From a538e60e28a3e0fbb7f2ed9e6de0372c1212d253 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Mon, 28 Sep 2026 19:09:06 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=A2=98=E7=9B=AE):=20=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E4=B8=8A=E9=A1=B5=E7=AD=BE=E8=A1=8C=E7=9A=84=E3=80=8C=E2=8B=AF?= =?UTF-8?q?=E3=80=8D=E9=87=8C=E8=83=BD=E7=9B=B4=E6=8E=A5=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E3=80=81=E9=87=8D=E7=BD=AE=E4=BB=A3=E7=A0=81=E3=80=81=E5=8E=BB?= =?UTF-8?q?=E8=87=AA=E6=B5=8B=E7=8C=AB=EF=BC=8C=E4=B8=8D=E7=94=A8=E5=85=88?= =?UTF-8?q?=E5=88=87=E5=88=B0=E3=80=8C=E4=BB=A3=E7=A0=81=E3=80=8D=E9=A1=B5?= =?UTF-8?q?=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 「⋯」分两组:统计 / 点评 / 我的提交,分隔线,再是去自测猫 / 复制代码 / 重置代码 (老师还有课堂统计)。原来后几项在「代码」页签工具栏的「更多」里,代码页签那一行 现在只剩语言选择 - 菜单抽成 useEditorMenu,桌面工具栏的「更多」和手机的「⋯」共用一份;「课堂统计」弹窗 挂在页面上,两个入口开的是同一个 - 草稿键抽成 useDraftKey:编辑器存取草稿、「重置代码」删草稿用同一份算法。原来键在编辑器里拼、 当 prop 传给工具栏,挪出去之后再拼一份迟早对不上(题单入口还多了一种) Co-Authored-By: Claude Opus 5.5 --- .../oj/problem/components/EditorToolbar.vue | 140 +----------------- .../oj/problem/components/ProblemEditor.vue | 18 +-- .../oj/problem/components/StatisticsModal.vue | 31 ++++ .../src/oj/problem/composables/draftKey.ts | 25 ++++ .../src/oj/problem/composables/editorMenu.ts | 118 +++++++++++++++ apps/web/src/oj/problem/detail.vue | 31 +++- ...2026-09-28-problem-page-redesign-design.md | 2 +- 7 files changed, 211 insertions(+), 154 deletions(-) create mode 100644 apps/web/src/oj/problem/components/StatisticsModal.vue create mode 100644 apps/web/src/oj/problem/composables/draftKey.ts create mode 100644 apps/web/src/oj/problem/composables/editorMenu.ts diff --git a/apps/web/src/oj/problem/components/EditorToolbar.vue b/apps/web/src/oj/problem/components/EditorToolbar.vue index 94c8853..c45c21c 100644 --- a/apps/web/src/oj/problem/components/EditorToolbar.vue +++ b/apps/web/src/oj/problem/components/EditorToolbar.vue @@ -1,17 +1,10 @@ @@ -308,14 +191,14 @@ const goEdit = () => { 课堂统计 { {{ helpButtonText }} - - - - diff --git a/apps/web/src/oj/problem/components/ProblemEditor.vue b/apps/web/src/oj/problem/components/ProblemEditor.vue index 0bdea88..6c1622f 100644 --- a/apps/web/src/oj/problem/components/ProblemEditor.vue +++ b/apps/web/src/oj/problem/components/ProblemEditor.vue @@ -11,6 +11,7 @@ import type { LANGUAGE } from "utils/types" import { beginEditTrace, editTraceExtensions } from "oj/problem/utils/editTrace" import { errorMarkExtensions } from "oj/problem/utils/errorMark" import EditorToolbar from "./EditorToolbar.vue" +import { useDraftKey } from "../composables/draftKey" import CollabBar from "./CollabBar.vue" import { useFlowchartStore } from "oj/store/flowchart" @@ -86,20 +87,9 @@ const { isDesktop } = useBreakpoints() const editorExtensions = [...editTraceExtensions, ...errorMarkExtensions] const contestID = route.params.contestID || null -const problemSetId = route.params.problemSetId || null -/** - * 本地草稿的键。题单入口单独一份:原来题库和题单共用 `problem_题号_contest_null_语言`, - * 加入题单之前在题库里写对的代码,一进题单就摆在编辑器里(设计文档第 11 节 4)。 - * 键的最后一段必须是语言,changeLanguage 靠它判断草稿是不是这门语言的。 - */ -const storageKey = computed(() => - problemSetId - ? `problem_${problem.value!._id}_problemset_${problemSetId}_lang_${codeStore.code.language}` - : `problem_${problem.value!._id}_contest_${contestID}_lang_${codeStore.code.language}`, -) +// 草稿存在哪个键下(题单入口单独一份),和「重置代码」共用一份算法 +const storageKey = useDraftKey() -// 协作条 40px + 和工具栏之间的 12px 间距,要从编辑器里让出来,不然页面底下多出一截滚动条。 -// 手机上:顶栏两行 + 课堂条 + 页签 + 工具栏约 236px,底部还有「运行例子 / 提交」那条约 64px const editorHeight = computed(() => { const base = isDesktop.value ? 133 : 300 return `calc(100vh - ${base + (teacherCollab.value ? 52 : 0)}px)` @@ -171,7 +161,7 @@ provide("flowchartEditorRef", flowchartEditorRef)