refactor(题目): 提交状态挪进 store——手机上切页签、桌面切分栏,判题结果和点评不再丢
提交按钮那个组件(SubmitCode)在编辑器的工具栏里,而提交的全部状态和判完之后的 反应都长在它身上:手机上交完切到「描述」页签(Naive 的页签切走即卸载)、桌面切到 「题目 / 自测」模式,编辑器一卸载,判题结果、AI 提示、失败计数、通过后的点评、 题单里的回题单全丢了。 - oj/store/submission.ts:这次提交、判题跟踪、语法检查报错、结果面板开合、冷却、 AI 提示(useSubmissionHint) - SubmissionEffects.vue:挂在题目页这一层,失败计数、标成已解决、烟花、强制点评 (连同「先点评再换题」的导航拦截)、回题单 - SubmitCode 只剩按钮和结果面板 - WebSocket 通道和判题监控的收尾改成 onScopeDispose:onUnmounted 在 store 里挂不上 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a8b83ba762
commit
26e22e2542
8 files changed
+556
-419
No files matched your search
@@ -7,6 +7,9 @@ import { useProblemStore } from "oj/store/problem"
|
||||
import { useScreenModeStore } from "shared/store/screenMode"
|
||||
import { useMyFlowchartStore } from "shared/store/myFlowchart"
|
||||
import { useUserStore } from "shared/store/user"
|
||||
import { useSubmissionStore } from "oj/store/submission"
|
||||
// 判完之后该发生的事(烟花、点评、回题单)。静态引入:它得在第一次判完之前就挂好
|
||||
import SubmissionEffects from "./components/SubmissionEffects.vue"
|
||||
|
||||
// 抽成具名 loader,便于进页面时与接口并行预取编辑器 chunk。
|
||||
// 题库、比赛、题单三种入口用的是同一个编辑器:原来比赛和题单用的是另一个精简版,
|
||||
@@ -131,6 +134,9 @@ watch(
|
||||
},
|
||||
)
|
||||
onBeforeUnmount(() => {
|
||||
// 提交状态在 store 里、离开页面也不会自己没:不清的话回到题目页(哪怕换了一道题),
|
||||
// 结果面板里还是上一次的那条
|
||||
useSubmissionStore().reset()
|
||||
problem.value = null
|
||||
errMsg.value = "无数据"
|
||||
screenModeStore.resetScreenMode()
|
||||
@@ -154,6 +160,7 @@ watch(
|
||||
|
||||
<template>
|
||||
<template v-if="problem">
|
||||
<SubmissionEffects />
|
||||
<n-split
|
||||
v-if="isDesktop && screenModeStore.isBothMode"
|
||||
direction="horizontal"
|
||||
|
||||
Reference in new issue
Block a user