refactor(契约): 判题状态码收进契约唯一一份,并收紧 18 处 as any
- 状态码常量与 judgeStatusSchema 移到 packages/contract/src/judge-status.ts, 后端 judge/status.ts 只再导出;前端 SubmissionStatus 枚举加编译期断言对齐契约 (实测改坏一个码会当场类型检查失败) - 类型逃逸 22 处降到 4 处:collab/handler、pagination、configUpdate、 ExerciseManager、ProblemSubmission、pk.vue tooltip;剩下的是词云插件无类型、 生成的 .d.ts、skulpt 和 TextEditor Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,7 @@ import {
|
||||
Legend,
|
||||
Colors,
|
||||
Filler,
|
||||
type TooltipItem,
|
||||
} from "chart.js"
|
||||
|
||||
// 注册Chart.js组件
|
||||
@@ -673,9 +674,12 @@ const radarChartOptions = {
|
||||
},
|
||||
tooltip: {
|
||||
callbacks: {
|
||||
label: function (context: any) {
|
||||
const dataset = context.dataset as any
|
||||
const rawValue = dataset?.rawData?.[context.dataIndex]
|
||||
label: function (context: TooltipItem<"radar">) {
|
||||
// rawData 是我们自己塞进 dataset 的扩展字段,chart.js 的类型里没有
|
||||
const dataset = context.dataset as typeof context.dataset & {
|
||||
rawData?: (number | null)[]
|
||||
}
|
||||
const rawValue = dataset.rawData?.[context.dataIndex]
|
||||
const metric = context.label || ""
|
||||
const isRate = context.dataIndex >= 3
|
||||
if (rawValue === undefined || rawValue === null) {
|
||||
|
||||
@@ -298,7 +298,7 @@ watch(query, listSubmissions)
|
||||
<n-tag
|
||||
v-for="item in statusDistribution"
|
||||
:key="item.result"
|
||||
:type="item.type as any"
|
||||
:type="item.type"
|
||||
size="small"
|
||||
round
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user