From f4db7dc81cec4d1984bcb7f7a8cc5f403ea98f6b Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Mon, 28 Sep 2026 14:21:57 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=A2=98=E7=9B=AE):=20=E5=88=A4=E9=A2=98?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E4=BB=8E=E6=8F=90=E4=BA=A4=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E6=B5=AE=E5=B1=82=E6=8C=AA=E5=88=B0=E5=B7=A6?= =?UTF-8?q?=E6=A0=8F=E3=80=8C=E7=BB=93=E6=9E=9C=E3=80=8D=E9=A1=B5=E7=AD=BE?= =?UTF-8?q?=E2=80=94=E2=80=94=E6=94=B9=E4=BB=A3=E7=A0=81=E6=97=B6=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E5=B0=B1=E6=91=86=E5=9C=A8=E6=97=81=E8=BE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原来结果是提交按钮下面的 n-popover:点一下外面就收起、最高 600px、盖住编辑器, 学生没法一边看「正确输出 / 你的输出」一边改代码,还得靠「上次结果」按钮找回来。 - 左栏新增「结果」页签(手机上排在「代码」后面),交上去或者语法检查没过就自动切过去; 页签标题带状态图标(✕ / ✓ / ! / 判题中转圈),不只靠颜色 - 页签用 show:lazy:切走不卸载,编辑器里的错误标记、AI 提示都留着 - 「题目描述」改叫「题目」;去掉浮层和「上次结果」按钮 Co-Authored-By: Claude Opus 5.5 --- .../src/oj/problem/components/ResultPane.vue | 43 +++++++++++++ .../oj/problem/components/ResultTabLabel.vue | 60 ++++++++++++++++++ .../problem/components/SubmissionEffects.vue | 5 +- .../src/oj/problem/components/SubmitCode.vue | 63 ++++--------------- apps/web/src/oj/problem/detail.vue | 34 ++++++++-- apps/web/src/oj/store/submission.ts | 22 ++++--- 6 files changed, 160 insertions(+), 67 deletions(-) create mode 100644 apps/web/src/oj/problem/components/ResultPane.vue create mode 100644 apps/web/src/oj/problem/components/ResultTabLabel.vue diff --git a/apps/web/src/oj/problem/components/ResultPane.vue b/apps/web/src/oj/problem/components/ResultPane.vue new file mode 100644 index 0000000..978f896 --- /dev/null +++ b/apps/web/src/oj/problem/components/ResultPane.vue @@ -0,0 +1,43 @@ + + + + + diff --git a/apps/web/src/oj/problem/components/ResultTabLabel.vue b/apps/web/src/oj/problem/components/ResultTabLabel.vue new file mode 100644 index 0000000..478121b --- /dev/null +++ b/apps/web/src/oj/problem/components/ResultTabLabel.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/apps/web/src/oj/problem/components/SubmissionEffects.vue b/apps/web/src/oj/problem/components/SubmissionEffects.vue index 6114280..717b5ea 100644 --- a/apps/web/src/oj/problem/components/SubmissionEffects.vue +++ b/apps/web/src/oj/problem/components/SubmissionEffects.vue @@ -73,9 +73,8 @@ function settleReview() { function closeCommentPanel() { commentPanel.value = false - // 点评价弹窗时,结果面板会当成「点了外面」收起来 —— 而「下一题」就在面板里 - // (LessonNext),评价完得把它重新打开 - submissionStore.showResult = true + // 「下一题」在结果页签里(LessonNext),评价完回到那里 —— 学生点评之前可能切去看了题目 + submissionStore.revealResult() settleReview() } diff --git a/apps/web/src/oj/problem/components/SubmitCode.vue b/apps/web/src/oj/problem/components/SubmitCode.vue index b00338d..f7b98cb 100644 --- a/apps/web/src/oj/problem/components/SubmitCode.vue +++ b/apps/web/src/oj/problem/components/SubmitCode.vue @@ -1,6 +1,5 @@ diff --git a/apps/web/src/oj/problem/detail.vue b/apps/web/src/oj/problem/detail.vue index 7e5092e..68cb644 100644 --- a/apps/web/src/oj/problem/detail.vue +++ b/apps/web/src/oj/problem/detail.vue @@ -11,6 +11,7 @@ import { useSubmissionStore } from "oj/store/submission" import { useFlowchartStore } from "oj/store/flowchart" // 判完之后该发生的事(烟花、点评、回题单)。静态引入:它得在第一次判完之前就挂好 import SubmissionEffects from "./components/SubmissionEffects.vue" +import ResultTabLabel from "./components/ResultTabLabel.vue" // 抽成具名 loader,便于进页面时与接口并行预取编辑器 chunk。 // 题库、比赛、题单三种入口用的是同一个编辑器:原来比赛和题单用的是另一个精简版, @@ -25,6 +26,7 @@ const ProblemSubmission = defineAsyncComponent(() => import("./components/Proble const ProblemReaction = defineAsyncComponent(() => import("./components/ProblemReaction.vue")) const ProblemFlowchart = defineAsyncComponent(() => import("./components/ProblemFlowchart.vue")) const MyFlowchartTab = defineAsyncComponent(() => import("./components/MyFlowchartTab.vue")) +const ResultPane = defineAsyncComponent(() => import("./components/ResultPane.vue")) interface Props { problemID: string @@ -55,13 +57,15 @@ const canShowFlowchart = computed( ) const tabOptions = computed(() => { + // 桌面上「结果」紧跟在「题目」后面;手机上编辑器也是一个页签,「结果」排在「代码」后面 const options: string[] = ["content"] + if (!isMobile.value) options.push("result") if (canShowFlowchart.value) { options.push("flowchart") } if (isMobile.value) { - options.push("editor") + options.push("editor", "result") } options.push("info") if (!contestID) { @@ -93,6 +97,18 @@ watch(currentTab, (tab) => { }) }) +// 交上去、或者语法检查没过:切到「结果」。提交按钮在编辑器那边,页签归这一页管 +const submissionStore = useSubmissionStore() +watch( + () => submissionStore.resultSeq, + () => { + currentTab.value = "result" + }, +) + +// 结果页签的标题带状态图标(ResultTabLabel),n-tab-pane 的 tab 接受渲染函数 +const resultTab = () => h(ResultTabLabel) + watch( () => myFlowchartStore.showing, (showing) => { @@ -175,9 +191,13 @@ watch(