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
@@ -1,4 +1,4 @@
|
||||
import { ref, computed, onUnmounted } from "vue"
|
||||
import { ref, computed, getCurrentScope, onScopeDispose } from "vue"
|
||||
import { useIntervalFn, useTimeoutFn } from "@vueuse/core"
|
||||
import { getSubmission } from "oj/api"
|
||||
import { SubmissionStatus } from "utils/constants"
|
||||
@@ -153,9 +153,9 @@ export function useSubmissionMonitor() {
|
||||
})
|
||||
|
||||
// ==================== 清理 ====================
|
||||
onUnmounted(() => {
|
||||
pausePolling()
|
||||
})
|
||||
// 现在由 submission store 持有(见 oj/store/submission.ts),store 不销毁就一直在;
|
||||
// 用 onScopeDispose 是为了在组件里调用时照样能收尾
|
||||
if (getCurrentScope()) onScopeDispose(pausePolling)
|
||||
|
||||
return {
|
||||
// 状态
|
||||
|
||||
Reference in new issue
Block a user