判的是 `props.contest.rule_type === "ACM"`,而 rule_type 是阶段 0 砍掉 OI 模式时删掉的字段 —— 后端和契约里都不存在,`undefined === "ACM"` 恒为 false。路由、页面、接口都在(实测 acm-helper 返回 200),只有这个 入口按钮被自己判没了。 比赛只有 ACM 模式,条件直接去掉。 这条本来就在 vue-tsc 的既有错误里(TS2339: Property 'rule_type' does not exist),只是之前没人跑,所以没人看见。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
61 lines
1.3 KiB
Vue
61 lines
1.3 KiB
Vue
<script lang="ts" setup>
|
|
import type { Contest } from "utils/types"
|
|
import { cloneContest } from "../../api"
|
|
|
|
interface Props {
|
|
contest: Contest
|
|
}
|
|
const props = defineProps<Props>()
|
|
const router = useRouter()
|
|
const message = useMessage()
|
|
|
|
function goEdit() {
|
|
router.push({
|
|
name: "admin contest edit",
|
|
params: { contestID: props.contest.id },
|
|
})
|
|
}
|
|
|
|
function goEditProblems() {
|
|
router.push({
|
|
name: "admin contest problem list",
|
|
params: { contestID: props.contest.id },
|
|
})
|
|
}
|
|
|
|
function goACMHelper() {
|
|
router.push({
|
|
name: "admin contest helper",
|
|
params: { contestID: props.contest.id },
|
|
})
|
|
}
|
|
|
|
async function clone() {
|
|
try {
|
|
const res = await cloneContest(props.contest.id)
|
|
message.success("复制成功")
|
|
router.push({
|
|
name: "admin contest edit",
|
|
params: { contestID: res.data.id },
|
|
})
|
|
} catch {
|
|
message.error("复制失败")
|
|
}
|
|
}
|
|
</script>
|
|
<template>
|
|
<n-flex>
|
|
<n-button size="small" type="primary" secondary @click="goEditProblems">
|
|
题目
|
|
</n-button>
|
|
<n-button size="small" type="warning" secondary @click="goACMHelper">
|
|
审核
|
|
</n-button>
|
|
<n-button size="small" type="info" secondary @click="goEdit">
|
|
编辑
|
|
</n-button>
|
|
<n-button size="small" secondary @click="clone"> 复制 </n-button>
|
|
</n-flex>
|
|
</template>
|
|
<style scoped></style>
|