Some checks failed
Deploy / deploy (push) Has been cancelled
后台题单接口下发的是扁平结构(displayId / title / isRequired),前端却按前台 题单页的嵌套结构取值,naive-ui 的 key 也不解析点号路径,于是「题目ID」「题目 标题」两列永远是空的。同一处还连累了另外几个操作: - 编辑题目弹窗读 problem.problem.title,点「编辑」直接抛错; - 添加题目发 problem_id / is_required,api 层取 problemId,出站是 undefined, 被后端按参数错误 400 掉; - 编辑题目发 is_required,「必做」怎么改都不生效; - 新建/编辑奖章发 condition_type,toBadgeBody 读 conditionType,同样 400。 根因是 admin/api.ts 把这批后台接口的返回值标成了 oj 侧的 ProblemSet / ProblemSetBadge / ProblemSetProblem,加上 detail.vue 四个 handler 用 data: any 接弹窗数据,字段拼错编译器一句都不吭。现在返回值全部换成 Admin* 契约类型, handler 换成 AddProblemToSetRequest / UpdateProblemInSetRequest 和一个本地 BadgeFormData(条件类型是「完成所有题目」时不带 conditionValue,后端补 0), 两个奖章弹窗里的 const data: any 也一并拆掉。 验证:dev 栈实跑,列表两列有值、编辑弹窗正常打开、加题 / 改必做 / 建奖章 / 改奖章四条链路走完界面都成功落库;bun run type-check 通过。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011WmMi9tPrnSAwwAy2i4WAa
71 lines
2.0 KiB
Vue
71 lines
2.0 KiB
Vue
<script setup lang="ts">
|
|
import { parseTime } from "utils/functions"
|
|
import type { AdminProblemSet } from "utils/types"
|
|
|
|
interface Props {
|
|
problemSet: AdminProblemSet
|
|
}
|
|
|
|
defineProps<Props>()
|
|
</script>
|
|
|
|
<template>
|
|
<n-card title="题单信息" style="margin-bottom: 16px">
|
|
<n-descriptions :column="4" bordered>
|
|
<n-descriptions-item label="描述">
|
|
{{ problemSet.description }}
|
|
</n-descriptions-item>
|
|
<n-descriptions-item label="创建者">
|
|
{{ problemSet.createdBy.username }}
|
|
</n-descriptions-item>
|
|
<n-descriptions-item label="难度">
|
|
<n-tag
|
|
:type="
|
|
problemSet.difficulty === 'Easy'
|
|
? 'success'
|
|
: problemSet.difficulty === 'Medium'
|
|
? 'warning'
|
|
: 'error'
|
|
"
|
|
>
|
|
{{
|
|
problemSet.difficulty === "Easy"
|
|
? "简单"
|
|
: problemSet.difficulty === "Medium"
|
|
? "中等"
|
|
: "困难"
|
|
}}
|
|
</n-tag>
|
|
</n-descriptions-item>
|
|
<n-descriptions-item label="状态">
|
|
<n-tag
|
|
:type="
|
|
problemSet.status === 'active'
|
|
? 'success'
|
|
: problemSet.status === 'archived'
|
|
? 'default'
|
|
: 'info'
|
|
"
|
|
>
|
|
{{
|
|
problemSet.status === "active"
|
|
? "活跃"
|
|
: problemSet.status === "archived"
|
|
? "已归档"
|
|
: "草稿"
|
|
}}
|
|
</n-tag>
|
|
</n-descriptions-item>
|
|
<n-descriptions-item label="可见">
|
|
{{ problemSet.visible ? "是" : "否" }}
|
|
</n-descriptions-item>
|
|
<n-descriptions-item label="题目数量">
|
|
{{ problemSet.problemsCount }}
|
|
</n-descriptions-item>
|
|
<n-descriptions-item label="创建时间">
|
|
{{ parseTime(problemSet.createTime, "YYYY-MM-DD HH:mm:ss") }}
|
|
</n-descriptions-item>
|
|
</n-descriptions>
|
|
</n-card>
|
|
</template>
|