feat(题目): 判题结果从提交按钮下的浮层挪到左栏「结果」页签——改代码时结果就摆在旁边
原来结果是提交按钮下面的 n-popover:点一下外面就收起、最高 600px、盖住编辑器, 学生没法一边看「正确输出 / 你的输出」一边改代码,还得靠「上次结果」按钮找回来。 - 左栏新增「结果」页签(手机上排在「代码」后面),交上去或者语法检查没过就自动切过去; 页签标题带状态图标(✕ / ✓ / ! / 判题中转圈),不只靠颜色 - 页签用 show:lazy:切走不卸载,编辑器里的错误标记、AI 提示都留着 - 「题目描述」改叫「题目」;去掉浮层和「上次结果」按钮 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5cb7cfa924
commit
f4db7dc81c
6 files changed
+160
-67
No files matched your search
@@ -0,0 +1,60 @@
|
||||
<script setup lang="ts">
|
||||
import { Icon } from "@iconify/vue"
|
||||
import { useThemeVars } from "naive-ui"
|
||||
import { storeToRefs } from "pinia"
|
||||
import { useSubmissionStore } from "oj/store/submission"
|
||||
import { SubmissionStatus } from "utils/constants"
|
||||
|
||||
/**
|
||||
* 「结果」页签的标题:带上这一次的状态。用图标而不是一个彩色小圆点 ——
|
||||
* 机房投影、色弱的学生只靠颜色分不出对错。
|
||||
*/
|
||||
|
||||
const theme = useThemeVars()
|
||||
const { submission, syntaxErrorInfo, judging, pending, submitting } =
|
||||
storeToRefs(useSubmissionStore())
|
||||
|
||||
const status = computed(() => {
|
||||
if (syntaxErrorInfo.value) return { icon: "ph:warning-bold", color: theme.value.warningColor }
|
||||
if (!submission.value) return null
|
||||
if (judging.value || pending.value || submitting.value)
|
||||
return { icon: "ph:circle-notch-bold", color: theme.value.infoColor, spin: true }
|
||||
const result = submission.value.result
|
||||
if (result === SubmissionStatus.accepted)
|
||||
return { icon: "ph:check-bold", color: theme.value.successColor }
|
||||
if (result === SubmissionStatus.ast_check_failed)
|
||||
return { icon: "ph:warning-bold", color: theme.value.warningColor }
|
||||
return { icon: "ph:x-bold", color: theme.value.errorColor }
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span class="label">
|
||||
结果
|
||||
<Icon
|
||||
v-if="status"
|
||||
:icon="status.icon"
|
||||
:color="status.color"
|
||||
:class="{ spin: status.spin }"
|
||||
width="14"
|
||||
/>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.spin {
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user