为比赛添加标签
This commit is contained in:
@@ -23,16 +23,12 @@ async function handleDelete() {
|
|||||||
emit("deleted")
|
emit("deleted")
|
||||||
}
|
}
|
||||||
|
|
||||||
function goDetail() {}
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<n-space>
|
<n-space>
|
||||||
<n-button size="small" type="success" secondary @click="goEdit">
|
<n-button size="small" type="success" secondary @click="goEdit">
|
||||||
编辑
|
编辑
|
||||||
</n-button>
|
</n-button>
|
||||||
<n-button size="small" type="info" secondary @click="goDetail">
|
|
||||||
查看
|
|
||||||
</n-button>
|
|
||||||
<n-popconfirm @positive-click="handleDelete">
|
<n-popconfirm @positive-click="handleDelete">
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<n-button size="small" type="error" secondary>删除</n-button>
|
<n-button size="small" type="error" secondary>删除</n-button>
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ async function init() {
|
|||||||
announcement.title = res.data.title
|
announcement.title = res.data.title
|
||||||
announcement.content = res.data.content
|
announcement.content = res.data.content
|
||||||
announcement.visible = res.data.visible
|
announcement.visible = res.data.visible
|
||||||
|
announcement.tag = res.data.tag
|
||||||
announcement.top = res.data.top
|
announcement.top = res.data.top
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,17 @@ const [ready, toggleReady] = useToggle()
|
|||||||
const startTime = ref(after10mins)
|
const startTime = ref(after10mins)
|
||||||
const endTime = ref(after70mins)
|
const endTime = ref(after70mins)
|
||||||
|
|
||||||
|
const tags: SelectOption[] = [
|
||||||
|
{ label: "练习", value: "练习" },
|
||||||
|
{ label: "期中", value: "期中" },
|
||||||
|
{ label: "期末", value: "期末" },
|
||||||
|
]
|
||||||
|
|
||||||
const contest = reactive<BlankContest & { id: number }>({
|
const contest = reactive<BlankContest & { id: number }>({
|
||||||
id: 0,
|
id: 0,
|
||||||
title: "",
|
title: "",
|
||||||
description: "",
|
description: "",
|
||||||
|
tag: "练习",
|
||||||
start_time: formatISO(after10mins),
|
start_time: formatISO(after10mins),
|
||||||
end_time: formatISO(after70mins),
|
end_time: formatISO(after70mins),
|
||||||
rule_type: "ACM",
|
rule_type: "ACM",
|
||||||
@@ -48,6 +55,7 @@ async function getContestDetail() {
|
|||||||
contest.id = data.id
|
contest.id = data.id
|
||||||
contest.title = data.title
|
contest.title = data.title
|
||||||
contest.description = data.description
|
contest.description = data.description
|
||||||
|
contest.tag = data.tag
|
||||||
contest.start_time = data.start_time
|
contest.start_time = data.start_time
|
||||||
contest.end_time = data.end_time
|
contest.end_time = data.end_time
|
||||||
contest.rule_type = "ACM"
|
contest.rule_type = "ACM"
|
||||||
@@ -93,6 +101,13 @@ onMounted(getContestDetail)
|
|||||||
<n-form-item label="标题">
|
<n-form-item label="标题">
|
||||||
<n-input class="contestTitle" v-model:value="contest.title" />
|
<n-input class="contestTitle" v-model:value="contest.title" />
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
<n-form-item label="标签">
|
||||||
|
<n-select
|
||||||
|
style="width: 100px"
|
||||||
|
:options="tags"
|
||||||
|
v-model:value="contest.tag"
|
||||||
|
/>
|
||||||
|
</n-form-item>
|
||||||
<n-form-item label="开始">
|
<n-form-item label="开始">
|
||||||
<n-date-picker v-model:value="startTime" type="datetime" />
|
<n-date-picker v-model:value="startTime" type="datetime" />
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ const columns: DataTableColumn<Contest>[] = [
|
|||||||
minWidth: 250,
|
minWidth: 250,
|
||||||
render: (row) => h(ContestTitle, { contest: row }),
|
render: (row) => h(ContestTitle, { contest: row }),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "标签",
|
||||||
|
key: "tag",
|
||||||
|
width: 80,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: "类型",
|
title: "类型",
|
||||||
key: "contest_type",
|
key: "contest_type",
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ export function getContestList(query: {
|
|||||||
limit: number
|
limit: number
|
||||||
keyword: string
|
keyword: string
|
||||||
status: string
|
status: string
|
||||||
|
tag: string
|
||||||
}) {
|
}) {
|
||||||
return http.get("contests", { params: query })
|
return http.get("contests", { params: query })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ const query = reactive({
|
|||||||
limit: parseInt(<string>route.query.limit) || 10,
|
limit: parseInt(<string>route.query.limit) || 10,
|
||||||
keyword: <string>route.query.keyword ?? "",
|
keyword: <string>route.query.keyword ?? "",
|
||||||
status: <string>route.query.status ?? "",
|
status: <string>route.query.status ?? "",
|
||||||
|
tag: <string>route.query.tag ?? "",
|
||||||
})
|
})
|
||||||
const data = ref<Contest[]>([])
|
const data = ref<Contest[]>([])
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
@@ -29,6 +30,13 @@ const options: SelectOption[] = [
|
|||||||
{ label: "已结束", value: "-1" },
|
{ label: "已结束", value: "-1" },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const tags: SelectOption[] = [
|
||||||
|
{ label: "全部", value: "" },
|
||||||
|
{ label: "练习", value: "练习" },
|
||||||
|
{ label: "期中", value: "期中" },
|
||||||
|
{ label: "期末", value: "期末" },
|
||||||
|
]
|
||||||
|
|
||||||
const columns: DataTableColumn<Contest>[] = [
|
const columns: DataTableColumn<Contest>[] = [
|
||||||
{
|
{
|
||||||
title: renderTableTitle("状态", "streamline-emojis:collision"),
|
title: renderTableTitle("状态", "streamline-emojis:collision"),
|
||||||
@@ -47,6 +55,12 @@ const columns: DataTableColumn<Contest>[] = [
|
|||||||
minWidth: 360,
|
minWidth: 360,
|
||||||
render: (row) => h(ContestTitle, { contest: row }),
|
render: (row) => h(ContestTitle, { contest: row }),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: renderTableTitle("标签", "fluent-emoji-flat:keycap-hashtag"),
|
||||||
|
key: "tag",
|
||||||
|
width: 100,
|
||||||
|
render: (row) => h(NTag, () => row.tag),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: renderTableTitle("开始时间", "fluent-emoji-flat:eleven-thirty"),
|
title: renderTableTitle("开始时间", "fluent-emoji-flat:eleven-thirty"),
|
||||||
key: "start_time",
|
key: "start_time",
|
||||||
@@ -68,6 +82,7 @@ async function listContests() {
|
|||||||
limit: query.limit,
|
limit: query.limit,
|
||||||
keyword: query.keyword,
|
keyword: query.keyword,
|
||||||
status: query.status,
|
status: query.status,
|
||||||
|
tag: query.tag,
|
||||||
})
|
})
|
||||||
data.value = res.data.results
|
data.value = res.data.results
|
||||||
total.value = res.data.total
|
total.value = res.data.total
|
||||||
@@ -87,12 +102,13 @@ function search(value: string) {
|
|||||||
function clear() {
|
function clear() {
|
||||||
query.keyword = ""
|
query.keyword = ""
|
||||||
query.status = ""
|
query.status = ""
|
||||||
|
query.tag = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(listContests)
|
onMounted(listContests)
|
||||||
watch(() => query.page, routerPush)
|
watch(() => query.page, routerPush)
|
||||||
watch(
|
watch(
|
||||||
() => [query.limit, query.status],
|
() => [query.limit, query.status, query.tag],
|
||||||
() => {
|
() => {
|
||||||
query.page = 1
|
query.page = 1
|
||||||
routerPush()
|
routerPush()
|
||||||
@@ -137,6 +153,9 @@ function rowProps(row: Contest) {
|
|||||||
v-model:value="query.status"
|
v-model:value="query.status"
|
||||||
/>
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
<n-form-item label="标签">
|
||||||
|
<n-select class="select" :options="tags" v-model:value="query.tag" />
|
||||||
|
</n-form-item>
|
||||||
<n-form-item>
|
<n-form-item>
|
||||||
<n-input
|
<n-input
|
||||||
clearable
|
clearable
|
||||||
|
|||||||
@@ -279,6 +279,7 @@ export interface Contest extends BlankContest {
|
|||||||
export interface BlankContest {
|
export interface BlankContest {
|
||||||
title: string
|
title: string
|
||||||
description: string
|
description: string
|
||||||
|
tag: string
|
||||||
start_time: string
|
start_time: string
|
||||||
end_time: string
|
end_time: string
|
||||||
rule_type: "ACM" | "OI"
|
rule_type: "ACM" | "OI"
|
||||||
|
|||||||
Reference in New Issue
Block a user