fix
Some checks failed
Deploy / deploy (push) Has been cancelled

This commit is contained in:
2025-12-29 22:42:29 +08:00
parent 81e245b7b0
commit 2d3f94a8b8

View File

@@ -51,7 +51,8 @@ const { renderError, renderFlowchart } = useMermaid()
// 状态管理 // 状态管理
const rendering = ref(false) const rendering = ref(false)
const loading = ref(false) const loading = ref(false)
const rating = ref<Rating>({ score: 0, grade: "" }) const latestRating = ref<Rating>({ score: 0, grade: "" })
const modalRating = ref<Rating>({ score: 0, grade: "" })
const submissionCount = ref(0) const submissionCount = ref(0)
const myFlowchartZippedStr = ref("") const myFlowchartZippedStr = ref("")
const myMermaidCode = ref("") const myMermaidCode = ref("")
@@ -72,7 +73,7 @@ const handleWebSocketMessage = (data: FlowchartEvaluationUpdate) => {
if (data.type === "flowchart_evaluation_completed") { if (data.type === "flowchart_evaluation_completed") {
loading.value = false loading.value = false
rating.value = { latestRating.value = {
score: data.score || 0, score: data.score || 0,
grade: data.grade || "", grade: data.grade || "",
} }
@@ -114,7 +115,7 @@ async function submitFlowchartData(flowchartEditorRef: any) {
const compressed = utoa(JSON.stringify(flowchartData)) const compressed = utoa(JSON.stringify(flowchartData))
loading.value = true loading.value = true
rating.value = { score: 0, grade: "" } latestRating.value = { score: 0, grade: "" }
try { try {
const response = await submitFlowchart({ const response = await submitFlowchart({
@@ -152,7 +153,7 @@ async function getCurrentSubmission() {
if (!problem.value?.id) return if (!problem.value?.id) return
const { data } = await getCurrentProblemFlowchartSubmission(problem.value.id) const { data } = await getCurrentProblemFlowchartSubmission(problem.value.id)
submissionCount.value = data.count submissionCount.value = data.count
rating.value = { latestRating.value = {
score: data.score, score: data.score,
grade: data.grade, grade: data.grade,
} }
@@ -167,6 +168,10 @@ async function getSubmission(submissionPage = 0) {
const submission = data.submission const submission = data.submission
myFlowchartZippedStr.value = submission.flowchart_data.data myFlowchartZippedStr.value = submission.flowchart_data.data
myMermaidCode.value = submission.mermaid_code || "" myMermaidCode.value = submission.mermaid_code || ""
modalRating.value = {
score: submission.ai_score,
grade: submission.ai_grade,
}
evaluation.value = { evaluation.value = {
score: submission.ai_score, score: submission.ai_score,
grade: submission.ai_grade, grade: submission.ai_grade,
@@ -262,20 +267,25 @@ onUnmounted(() => {
<!-- 评分结果按钮 --> <!-- 评分结果按钮 -->
<n-button <n-button
secondary secondary
v-if="rating.grade" v-if="latestRating.grade"
@click="openDetailModal" @click="openDetailModal"
:type="getGradeType(rating.grade)" :type="getGradeType(latestRating.grade)"
> >
{{ rating.score }} {{ rating.grade }} {{ latestRating.score }} {{ latestRating.grade }}
</n-button> </n-button>
<!-- 流程图评分详情模态框 --> <!-- 流程图评分详情模态框 -->
<n-modal <n-modal
v-model:show="showDetailModal" v-model:show="showDetailModal"
preset="card" preset="card"
title="流程图 AI 评分详情"
style="width: 1000px" style="width: 1000px"
> >
<template #header>
<n-flex align="center">
<n-text>流程图评分详情</n-text>
<n-text :type="getGradeType(modalRating.grade)">{{ modalRating.score }} {{ modalRating.grade }}</n-text>
</n-flex>
</template>
<n-grid :cols="5" :x-gap="16"> <n-grid :cols="5" :x-gap="16">
<!-- 左侧流程图预览区域 --> <!-- 左侧流程图预览区域 -->
<n-gi :span="3"> <n-gi :span="3">