fix(题目): 恢复 AC 后弹出点评轮盘
Some checks failed
Deploy / deploy (push) Has been cancelled

ec27441 把触发逻辑整段删了,只留下 n-modal 和 ProblemReaction 本体,
commentPanel 从此没有任何一处置 true,弹窗成了死代码。库里的评价全部
停在删除当天,学生只能自己点进「题目点评」标签页才评得了。

按原样恢复:AC 后延迟 1500ms 拉一次 getReaction,mine === null(这题
还没评过)才弹。比赛不打扰;题单入口 1.5 秒后要跳回题单页,弹了也会
被路由冲掉,同样不弹。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sy3L9zJHiSNFyNC3ZbMwdj
This commit is contained in:
2026-09-03 20:05:44 -06:00
parent 8a88fe8d99
commit 37861800e0

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import { Icon } from "@iconify/vue"
import { storeToRefs } from "pinia"
import { formatCode, submitCode } from "oj/api"
import { formatCode, getReaction, submitCode } from "oj/api"
import { useCodeStore } from "oj/store/code"
import { useProblemStore } from "oj/store/problem"
import { useFireworks } from "oj/problem/composables/useFireworks"
@@ -68,6 +68,20 @@ const { start: startCooldown, isPending: isCooldown } = useTimeout(5000, {
immediate: false,
})
// ==================== AC 后弹出点评轮盘 ====================
// 只对已经能评价、且还没评过的人弹:后端要求先有 AC 才收评价,这里刚 AC 完正好;
// mine 非 null 说明早就评过了,别再打扰。
const { start: showCommentPanelDelayed } = useTimeoutFn(
async () => {
const res = await getReaction(problem.value!.id)
if (res.mine === null) {
commentPanel.value = true
}
},
1500,
{ immediate: false },
)
const { start: goToProblemSetDelayed } = useTimeoutFn(
() => {
router.push({
@@ -200,6 +214,11 @@ watch(
// 3. 放烟花
celebrate()
// 4. 弹出评价框。比赛里不打扰;题单里 1.5 秒后要跳回题单页,弹了也会被冲掉
if (!contestID && !problemSetId) {
showCommentPanelDelayed()
}
if (problemSetId) {
// 延迟回到题单页面
goToProblemSetDelayed()