更新首页列表

This commit is contained in:
2023-11-01 19:03:01 +08:00
parent 9cf73331ea
commit 710f4b5eb9
35 changed files with 261 additions and 241 deletions

View File

@@ -19,7 +19,7 @@ export async function getProblemList(
limit = 10,
keyword: string,
contestID?: string,
ruleType?: "ACM" | "OI"
ruleType?: "ACM" | "OI",
) {
const endpoint = !!contestID ? "admin/contest/problem" : "admin/problem"
const res = await http.get(endpoint, {
@@ -143,7 +143,7 @@ export function getContest(id: string) {
export function addProblemForContest(
contestID: string,
problemID: number,
displayID: string
displayID: string,
) {
return http.post("admin/contest/add_problem_from_public", {
contest_id: contestID,

View File

@@ -40,7 +40,7 @@ const columns: DataTableColumn<Contest>[] = [
h(
NTag,
{ type: CONTEST_STATUS[row.status]["type"], size: "small" },
() => CONTEST_STATUS[row.status]["name"]
() => CONTEST_STATUS[row.status]["name"],
),
},
{

View File

@@ -18,7 +18,7 @@ async function addProblem() {
await addProblemForContest(
props.contestID,
props.problemID,
displayID.value
displayID.value,
)
emit("added")
} catch (err: any) {

View File

@@ -47,7 +47,7 @@ async function getList() {
query.limit,
query.keyword,
"",
"ACM"
"ACM",
)
total.value = res.total
problems.value = res.results
@@ -56,7 +56,7 @@ watch(
() => props.show,
(value) => {
if (value) getList()
}
},
)
watch(query, getList, { deep: true })
</script>

View File

@@ -33,7 +33,7 @@ const title = computed(
"admin problem edit": "编辑题目",
"admin contest problem create": "新建比赛题目",
"admin contest problem edit": "编辑比赛题目",
}[<string>route.name])
})[<string>route.name],
)
const problem = reactive<BlankProblem>({
_id: "",
@@ -91,7 +91,7 @@ const languageOptions = [
]
const tagOptions = computed(() =>
existingTags.value.map((tag) => ({ label: tag.name, value: tag.name }))
existingTags.value.map((tag) => ({ label: tag.name, value: tag.name })),
)
async function getProblemDetail() {
@@ -233,7 +233,7 @@ function detectProblemCompletion() {
// 样例是空的
else if (
problem.samples.some(
(sample) => sample.output === "" || sample.input === ""
(sample) => sample.output === "" || sample.input === "",
)
) {
message.error("空样例没有删干净")

View File

@@ -20,10 +20,10 @@ const title = computed(
({
"admin problem list": "题目列表",
"admin contest problem list": "比赛题目列表",
}[<string>route.name])
})[<string>route.name],
)
const isContestProblemList = computed(
() => route.name === "admin contest problem list"
() => route.name === "admin contest problem list",
)
const [show, toggleShow] = useToggle()
@@ -77,7 +77,7 @@ async function listProblems() {
offset,
query.limit,
query.keyword,
props.contestID
props.contestID,
)
total.value = res.total
problems.value = res.results

View File

@@ -28,7 +28,7 @@ const testcaseColumns: DataTableColumn<Testcase>[] = [
h(
NButton,
{ size: "small", onClick: () => deleteTestcase(row.id) },
() => "删除"
() => "删除",
),
},
]
@@ -48,7 +48,7 @@ const serverColumns: DataTableColumn<Server>[] = [
h(
NTag,
{ type: statusMap[row.status].color, size: "small" },
() => statusMap[row.status].label
() => statusMap[row.status].label,
),
},
{
@@ -63,7 +63,7 @@ const serverColumns: DataTableColumn<Server>[] = [
disabled: row.status === "normal",
onClick: () => delJudgeServer(row.hostname),
},
() => "删除"
() => "删除",
),
},
{ title: "主机", key: "hostname", width: 130 },
@@ -94,7 +94,7 @@ const testcases = ref<Testcase[]>([])
const token = ref("")
const servers = ref<Server[]>([])
const abnormalServers = computed(() =>
servers.value.filter((item) => item.status === "abnormal")
servers.value.filter((item) => item.status === "abnormal"),
)
const websiteConfig = reactive({
@@ -144,7 +144,7 @@ async function delJudgeServer(hostname: string) {
async function deleteAbnormalServers() {
const dels = abnormalServers.value.map((item) =>
deleteJudgeServer(item.hostname)
deleteJudgeServer(item.hostname),
)
await Promise.all(dels)
message.success("删除成功")