后台题单接口下发的是扁平结构(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
This commit is contained in:
1 parent
1729b9db4d
commit
b130d805be
11 files changed
+89
-80
No files matched your search
@@ -2,13 +2,13 @@
|
||||
import Pagination from "shared/components/Pagination.vue"
|
||||
import { usePagination } from "shared/composables/pagination"
|
||||
import { parseTime } from "utils/functions"
|
||||
import type { ProblemSet } from "utils/types"
|
||||
import type { AdminProblemSet } from "utils/types"
|
||||
import { getProblemSetList, toggleProblemSetVisible } from "../api"
|
||||
import Actions from "./components/Actions.vue"
|
||||
import { NTag, NSwitch } from "naive-ui"
|
||||
|
||||
const total = ref(0)
|
||||
const problemSets = ref<ProblemSet[]>([])
|
||||
const problemSets = ref<AdminProblemSet[]>([])
|
||||
|
||||
interface ProblemSetQuery {
|
||||
keyword: string
|
||||
@@ -37,7 +37,7 @@ const statusOptions = [
|
||||
{ label: "草稿", value: "draft" },
|
||||
]
|
||||
|
||||
const columns: DataTableColumn<ProblemSet>[] = [
|
||||
const columns: DataTableColumn<AdminProblemSet>[] = [
|
||||
{ title: "ID", key: "id", width: 80 },
|
||||
{ title: "标题", key: "title", minWidth: 200 },
|
||||
{ title: "描述", key: "description", minWidth: 300, ellipsis: true },
|
||||
|
||||
Reference in new issue
Block a user