Deploy / deploy (push) Canceled after 0s
- 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>
66 lines
1.8 KiB
Vue
66 lines
1.8 KiB
Vue
<script setup lang="ts">
|
|
import { isExamTag } from "@oj2/contract"
|
|
import { useThemeVars } from "naive-ui"
|
|
import { useTone } from "shared/composables/tone"
|
|
import { CONTEST_STATUS, ContestStatus } from "utils/constants"
|
|
|
|
/**
|
|
* 比赛的两个小标:状态(进行中 / 未开始 / 已结束)和类型(练习 / 期中 / 期末)。
|
|
* 进行中绿、未开始琥珀、已结束灰;期中期末用浅红底 —— 学生一眼知道「这场是考试,排名考完才有」
|
|
*/
|
|
const props = defineProps<{ status?: ContestStatus; tag?: string }>()
|
|
|
|
const theme = useThemeVars()
|
|
const tone = useTone()
|
|
|
|
const style = computed(() => {
|
|
if (props.status !== undefined) {
|
|
const kind =
|
|
props.status === ContestStatus.underway
|
|
? "success"
|
|
: props.status === ContestStatus.not_started
|
|
? "warning"
|
|
: "default"
|
|
const t = tone(kind)
|
|
return { color: t.color, background: t.background, border: "1px solid transparent" }
|
|
}
|
|
if (props.tag && isExamTag(props.tag)) {
|
|
const t = tone("error")
|
|
return { color: t.color, background: t.background, border: "1px solid transparent" }
|
|
}
|
|
return {
|
|
color: theme.value.textColor3,
|
|
background: "transparent",
|
|
border: `1px solid ${theme.value.borderColor}`,
|
|
}
|
|
})
|
|
|
|
const text = computed(() =>
|
|
props.status !== undefined ? CONTEST_STATUS[props.status]?.name : props.tag,
|
|
)
|
|
</script>
|
|
|
|
<template>
|
|
<span class="badge" :class="{ strong: status === ContestStatus.underway }" :style="style">{{
|
|
text
|
|
}}</span>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.badge {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
height: 22px;
|
|
padding: 0 8px;
|
|
box-sizing: border-box;
|
|
border-radius: 3px;
|
|
font-size: 12px;
|
|
white-space: nowrap;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.strong {
|
|
font-weight: 600;
|
|
}
|
|
</style>
|