- 流程图题的工具栏最左边是「写代码 / 画流程图」。原来流程图藏在语言下拉里,叫一个名叫 Flowchart 的「语言」;画完一道题之后它还被记成语言偏好,下一道能画的题一打开就是画布 - 「交给 AI 点评」交完切到「结果」页签:评的时候写着「AI 正在看你的图」、画布照样能改; 评完是分数、评语、改进建议、四项得分,顶上一排历次分数,点哪次看哪次。 原来是提交按钮旁一个 1000px 的弹框,盖住画布,翻历次评分要一页一页点 - 画到 A / S:给「照着它写代码 →」,题单里 1.5 秒后回题单(和代码通过一样), 课堂条当场标成做完;只在这一页上刚评完的那次才算,进页面读到以前的 A 不跳 - 「把这一版载回画布」只在画布和那一版不一样时出现;载回、进页面读回草稿后都缩放到装下整张图 - 题单入口能画流程图了(原来只有题库入口能画),题单里的代码草稿、流程图草稿各存一份, 加入题单之前写的、画的不会一进题单就摆在编辑器里 - 手机上不给「画流程图」(节点库是拖放,手机上拖不动),题面里以前画好的那张照样看得到 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
79 lines
2.5 KiB
Vue
79 lines
2.5 KiB
Vue
<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 { useCodeStore } from "oj/store/code"
|
|
import { isFlowchartPass, useFlowchartStore } from "oj/store/flowchart"
|
|
import { SubmissionStatus } from "utils/constants"
|
|
|
|
/**
|
|
* 「结果」页签的标题:带上这一次的状态。用图标而不是一个彩色小圆点 ——
|
|
* 机房投影、色弱的学生只靠颜色分不出对错。
|
|
*/
|
|
|
|
const theme = useThemeVars()
|
|
const { submission, syntaxErrorInfo, judging, pending, submitting } =
|
|
storeToRefs(useSubmissionStore())
|
|
|
|
const codeStore = useCodeStore()
|
|
const flowchart = storeToRefs(useFlowchartStore())
|
|
|
|
/** 画流程图时:评中转圈,A/S 打勾,B/C 是「还没过关」的 !,评失败是 ✕ */
|
|
const flowchartStatus = computed(() => {
|
|
const phase = flowchart.phase.value
|
|
if (phase === "evaluating")
|
|
return { icon: "ph:circle-notch-bold", color: theme.value.infoColor, spin: true }
|
|
if (phase === "failed") return { icon: "ph:x-bold", color: theme.value.errorColor }
|
|
if (phase !== "done") return null
|
|
return isFlowchartPass(flowchart.latestRating.value.grade)
|
|
? { icon: "ph:check-bold", color: theme.value.successColor }
|
|
: { icon: "ph:warning-bold", color: theme.value.warningColor }
|
|
})
|
|
|
|
const status = computed(() => {
|
|
if (codeStore.code.language === "Flowchart") return flowchartStatus.value
|
|
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>
|