Files
OJ2/apps/web/src/oj/submission/components/FlowchartState.vue
T
xuyueandClaude Opus 5.5 309ca0ece2
Deploy / deploy (push) Canceled after 0s
refactor(前端): 全站共用的班级下拉、胶囊配色挪出提交列表目录,编辑器不再偷读题目页的 store
- classLabel / groupClassOptions / classSelectOptions 挪到 utils/classes.ts,useTone 挪到
  shared/composables/tone.ts:原来放在 oj/submission/ 下,被前台、后台、shared 引了 50 多处
- 流程图编辑器的草稿键改由题目页传进来(键名不变,学生存着的草稿照样读得到)。原来编辑器
  自己读题目页的 store 和路由拼,后台出题页也用这个组件,那边 store 是空的
- SQL 表名补全改由题目页传表进来。原来补全直接读题目页的 store,自学页的 SQL 代码块会
  补出上一道看过的题的表名

实跑:提交列表、题目页、排名、后台题目页、SQL 题、流程图题打开无报错;SQL 题输入 stu
补出 students;流程图加一步,草稿照旧存在 flowchart-v2-problem-<题号>。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 14:59:55 +08:00

57 lines
1.6 KiB
Vue

<script setup lang="ts">
import { FlowchartSubmissionStatus } from "utils/types"
import { useTone, type Tone } from "shared/composables/tone"
/**
* 流程图提交在列表里的那个胶囊:评完的直接是「A 级」,没评完的是
* 排队中 / 评分中 / 评分失败。原来等级、分数、状态分三列,老师要横着对。
*/
const props = defineProps<{
status: number
grade: string | null
}>()
const tone = useTone()
const GRADE_TONE: Record<string, Tone> = { S: "success", A: "info", B: "warning", C: "error" }
const view = computed(() => {
if (props.status === FlowchartSubmissionStatus.COMPLETED && props.grade) {
return { tone: GRADE_TONE[props.grade] ?? "default", grade: props.grade, text: "" }
}
if (props.status === FlowchartSubmissionStatus.FAILED) {
return { tone: "error" as const, grade: "", text: "评分失败" }
}
if (props.status === FlowchartSubmissionStatus.PROCESSING) {
return { tone: "info" as const, grade: "", text: "评分中" }
}
return { tone: "default" as const, grade: "", text: "排队中" }
})
const colors = computed(() => tone(view.value.tone))
</script>
<template>
<span class="pill" :style="{ color: colors.color, background: colors.background }">
<template v-if="view.grade">
<b>{{ view.grade }} 级</b>
</template>
<template v-else>{{ view.text }}</template>
</span>
</template>
<style scoped>
.pill {
display: inline-flex;
align-items: center;
gap: 5px;
height: 24px;
padding: 0 9px;
border-radius: 12px;
font-size: 13px;
font-weight: 600;
white-space: nowrap;
flex: none;
}
</style>