From dab53c90983a323f12b48d44e123aa897d7ca20e Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Fri, 9 Oct 2026 13:10:54 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=A2=98=E7=9B=AE=E5=88=97=E8=A1=A8):=20?= =?UTF-8?q?=E7=AD=9B=E7=A9=BA=E4=BA=86=E5=8F=AA=E8=AF=B4=E3=80=8C=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E7=AC=A6=E5=90=88=E6=9D=A1=E4=BB=B6=E7=9A=84=E9=A2=98?= =?UTF-8?q?=E3=80=8D=EF=BC=8C=E7=82=B9=E3=80=8C=E6=B8=85=E7=A9=BA=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E3=80=8D=E8=BF=9E=E5=B7=A6=E8=BE=B9=E7=9A=84=E7=9F=A5?= =?UTF-8?q?=E8=AF=86=E7=82=B9=E4=B8=80=E8=B5=B7=E6=B8=85=E6=8E=89=E2=80=94?= =?UTF-8?q?=E2=80=94=E8=AF=B4=E6=B8=85=E6=A5=9A=E6=98=AF=E5=93=AA=E4=B8=AA?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=EF=BC=8C=E6=AF=8F=E4=B8=AA=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E6=8C=89=E9=92=AE=E5=8F=AA=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E5=AE=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 例如「『函数定义』里没有『画流程图』的题」+「看全部类型」;几个条件一起时每个条件各一个按钮 (看全部类型 / 看全部难度 / 看所有出题者 / 清掉搜索 / 关掉只看没做完)。 「你都做对了」只在「只看没做完」是唯一条件时才说,带着别的筛选空了不再误报。 Co-Authored-By: Claude Opus 5.5 --- apps/web/src/oj/problem/list.vue | 70 +++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 6 deletions(-) diff --git a/apps/web/src/oj/problem/list.vue b/apps/web/src/oj/problem/list.vue index 3c40c54..6eb8c47 100644 --- a/apps/web/src/oj/problem/list.vue +++ b/apps/web/src/oj/problem/list.vue @@ -56,7 +56,7 @@ const theme = useThemeVars() const tone = useTone() const { isDesktop, isMobile } = useBreakpoints() -const { query, clearQuery } = usePagination( +const { query } = usePagination( { keyword: useRouteQuery("keyword", "").value, difficulty: useRouteQuery("difficulty", "").value, @@ -299,7 +299,55 @@ const nextTag = computed(() => { } return best }) -const allDone = computed(() => loaded.value && undoneOn.value && total.value === 0 && !!mine.value) +// 只在「只看没做完」是唯一的条件时才说「你都做对了」:带着类型、难度这些筛选空了, +// 不能说成整个知识点都做对了 +const allDone = computed( + () => + loaded.value && undoneOn.value && total.value === 0 && !!mine.value && !hasExtraFilter.value, +) + +/** + * 筛空了:说清楚是哪些条件把题筛没了,每个条件一个按钮,只去掉那一个。 + * 原来只有一个「清空筛选」,点了连左栏的知识点一起清掉,人又得重新找回来 + */ +const emptyConditions = computed(() => { + const list: { label: string; action: string; clear: () => void }[] = [] + if (query.type) { + const label = PROBLEM_TYPE_LABEL[query.type as ProblemTypeFilter] + list.push({ label: `「${label}」的`, action: "看全部类型", clear: () => (query.type = "") }) + } + if (query.difficulty) { + const label = DIFFICULTIES.find((d) => d.value === query.difficulty)?.label ?? "" + list.push({ label, action: "看全部难度", clear: () => (query.difficulty = "") }) + } + if (query.author) + list.push({ + label: `${query.author} 出的`, + action: "看所有出题者", + clear: () => (query.author = ""), + }) + if (query.keyword) + list.push({ + label: `和「${query.keyword}」对得上的`, + action: "清掉搜索", + clear: () => (query.keyword = ""), + }) + if (undoneOn.value) + list.push({ + label: "没做完的", + action: "关掉只看没做完", + clear: () => (undoneOn.value = false), + }) + return list +}) + +const emptyText = computed(() => { + const where = query.tag ? `「${query.tag}」里` : "题库里" + const conds = emptyConditions.value + if (conds.length === 0) return `${where}还没有题` + if (conds.length === 1) return `${where}没有${conds[0]!.label}题` + return `${where}没有同时符合这些条件的题` +}) function knowledgeOf(row: ProblemRow) { return row.tags.filter((name) => tagByName.value.get(name)?.category === "knowledge").join(" · ") @@ -520,8 +568,12 @@ const gridColumns = computed(() =>
- 没有符合条件的题 - 清空筛选 + {{ emptyText }} +
+ + {{ c.action }} + +
@@ -637,8 +689,12 @@ const gridColumns = computed(() => 关掉只看没做完
- 没有符合条件的题 - 清空筛选 + {{ emptyText }} +
+ + {{ c.action }} + +
@@ -1107,6 +1163,8 @@ const gridColumns = computed(() => .empty-actions { display: flex; + flex-wrap: wrap; + justify-content: center; gap: 8px; margin-top: 6px; }