From ba90fe893ebc6b0de401aecb59aa7e248c6d8b4b Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Mon, 19 Oct 2026 22:03:16 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=B5=81=E7=A8=8B=E5=9B=BE):=20=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E5=85=88=E8=AF=B4=E3=80=8C=E8=BF=98=E6=B2=A1=E7=94=BB?= =?UTF-8?q?=E5=AF=B9=20/=20=E7=94=BB=E5=AF=B9=E4=BA=86=E3=80=8D=E5=92=8C?= =?UTF-8?q?=E5=93=AA=E9=87=8C=E9=94=99=E3=80=81=E6=80=8E=E4=B9=88=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E9=80=90=E7=BB=84=E6=95=B0=E6=8D=AE=E6=94=B6=E6=88=90?= =?UTF-8?q?=E4=B8=80=E8=A1=8C=E7=82=B9=E5=BC=80=E6=89=8D=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 学生不关心过了几组数据。标题不再写「6 组走对 3 组」;点评做主体(AI 没写出来时 拿程序找到的第一处现象顶上);画布上只把要改的框标红、旁边写「要改这个框」, 别的框不再变淡,点开某一组才亮它走过的路;画对了直接给「照着它写代码」。 提交列表右栏老师看到的和学生一样,逐组数据也收着。 Co-Authored-By: Claude Opus 5.5 --- .../oj/problem/components/FlowchartResult.vue | 116 ++++++------- .../submission/components/FlowchartPane.vue | 61 +++---- .../components/FlowchartEditor/index.vue | 27 ++++ .../components/FlowchartEditor/model.ts | 2 + .../src/shared/components/FlowchartNote.vue | 153 ++++++++++++++++++ 5 files changed, 251 insertions(+), 108 deletions(-) create mode 100644 apps/web/src/shared/components/FlowchartNote.vue diff --git a/apps/web/src/oj/problem/components/FlowchartResult.vue b/apps/web/src/oj/problem/components/FlowchartResult.vue index 00b1218..df712dc 100644 --- a/apps/web/src/oj/problem/components/FlowchartResult.vue +++ b/apps/web/src/oj/problem/components/FlowchartResult.vue @@ -8,9 +8,8 @@ import { useUserStore } from "shared/store/user" import { sortFlowchartCriteria } from "utils/constants" import { parseTime } from "utils/functions" import { mermaidOrder, signature } from "shared/components/FlowchartEditor/model" -import FlowchartCases from "shared/components/FlowchartCases.vue" -import { caseHeadline, caseReport } from "utils/flowchart" -import { useTone } from "shared/composables/tone" +import FlowchartNote from "shared/components/FlowchartNote.vue" +import { caseReport } from "utils/flowchart" /** * 「结果」页签里流程图作业的那一块:AI 在评 / 评完了几分 / 历次分数 / 评语和改进建议。 @@ -40,7 +39,6 @@ watch( ) const message = useMessage() const theme = useThemeVars() -const tone = useTone() // 暗色主题的成功色是浅薄荷绿,上面的白字看不清 const isDark = useDark() const passText = computed(() => (isDark.value ? "rgba(0, 0, 0, 0.85)" : "#fff")) @@ -136,37 +134,47 @@ function loadToCanvas() { /** 2026-10 起的评法:逐组走一遍。老提交是 null,照旧显示四项分 */ const report = computed(() => caseReport(detail.value?.aiCriteriaDetails)) -/** 点开的是哪一组;换一次提交就默认点开第一组没走对的(设计稿 FlowResFail) */ +/** + * 逐组数据默认收着、一组也不点开(设计稿 FlowNoteFail:学生不关心过了几组,先看哪里错、怎么改)。 + * 换一次提交就收回去 + */ const selectedCase = ref(null) +const casesOpen = ref(false) watch( - () => [current.value?.id, report.value] as const, - ([, next]) => { - const firstWrong = next?.cases.findIndex((row) => !row.ok) ?? -1 - selectedCase.value = firstWrong >= 0 ? firstWrong : null + () => current.value?.id, + () => { + selectedCase.value = null + casesOpen.value = false }, - { immediate: true }, ) /** - * 点开的那一组在画布上走过的路。AI 报的是 Mermaid 的框号(n3),按交上去那一版的结构对回 + * 画布上标什么。没点开哪一组:只把要改的那个框标红、旁边写「要改这个框」,别的框照常; + * 点开了一组:亮出它走过的路。AI 报的是 Mermaid 的框号(n3),按交上去那一版的结构对回 * 画布上的框 —— 所以只在画布还是那一版时亮,改过了就不亮(载回画布之后又能亮) */ watch( () => [selectedCase.value, report.value, canvasSame.value, editor.value] as const, ([index, next, same, instance]) => { if (!instance) return - const row = index === null ? undefined : next?.cases[index] - if (!row || !same || !versionDoc.value) { + if (!next || !same || !versionDoc.value) { instance.setHighlight(null) return } const order = mermaidOrder(versionDoc.value) - const toStep = (id: string) => order[Number(id.slice(1))] - // 没走对的组标红 AI 指出的要改的框(错的根子),没有才退回程序找到的出结果的那个框 - const bad = row.ok ? null : (next?.focus ?? row.wrongAt) + const toStep = (id: string | null) => (id ? (order[Number(id.slice(1))] ?? null) : null) + // 要改的框:AI 对着答案指出的(错的根子),没有才退回程序找到的第一处出错的框 + const focus = next.focus ?? next.cases.find((row) => !row.ok)?.wrongAt ?? null + const row = index === null ? undefined : next.cases[index] + if (!row) { + const bad = toStep(focus) + instance.setHighlight(bad ? { order: [], bad, label: "要改这个框" } : null) + return + } + const bad = row.ok ? null : toStep(focus) instance.setHighlight({ order: row.path.map(toStep).filter((id): id is string => !!id), - bad: bad ? (toStep(bad) ?? null) : null, + bad, }) }, // 切回「结果」页签时组件重新挂载,这些值早就齐了,不会再变一次 @@ -244,7 +252,9 @@ function goCode() {
{{ current.grade }} 级 - {{ caseHeadline(report) }} + {{ + report.passed === report.total ? "画对了" : "还没画对" + }} 这道题算做完了
@@ -262,25 +272,23 @@ function goCode() { +