From d5d6491d6d77e4c65aad17a449eb3e29ef66860b Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Tue, 31 Jan 2023 15:38:29 +0800 Subject: [PATCH] add contest problem. --- src/App.vue | 4 +- src/components.d.ts | 1 + src/oj/api.ts | 7 +- src/oj/contest/detail.vue | 89 +++++++++++---------- src/oj/contest/list.vue | 24 +++--- src/oj/contest/pages/helper.vue | 5 ++ src/oj/contest/pages/problems.vue | 47 +++++++++++ src/oj/contest/pages/rank.vue | 5 ++ src/oj/contest/pages/submissions.vue | 5 ++ src/oj/problem/components/ProblemInfo.vue | 7 +- src/oj/problem/components/ProblemStatus.vue | 28 +++++++ src/oj/problem/list.vue | 29 ++----- src/oj/submission/detail.vue | 1 - src/oj/submission/list.vue | 6 +- src/routes.ts | 31 +++++++ src/utils/types.ts | 10 +++ 16 files changed, 210 insertions(+), 89 deletions(-) create mode 100644 src/oj/contest/pages/helper.vue create mode 100644 src/oj/contest/pages/problems.vue create mode 100644 src/oj/contest/pages/rank.vue create mode 100644 src/oj/contest/pages/submissions.vue create mode 100644 src/oj/problem/components/ProblemStatus.vue diff --git a/src/App.vue b/src/App.vue index 636b06c..3b0aa83 100644 --- a/src/App.vue +++ b/src/App.vue @@ -27,9 +27,9 @@ hljs.registerLanguage("go", go) :date-locale="dateZhCN" :hljs="hljs" > - + - + diff --git a/src/components.d.ts b/src/components.d.ts index d49b76c..0fbb508 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -32,6 +32,7 @@ declare module '@vue/runtime-core' { NLayoutContent: typeof import('naive-ui')['NLayoutContent'] NLayoutHeader: typeof import('naive-ui')['NLayoutHeader'] NMenu: typeof import('naive-ui')['NMenu'] + NMessageProvider: typeof import('naive-ui')['NMessageProvider'] NModal: typeof import('naive-ui')['NModal'] NNotificationProvider: typeof import('naive-ui')['NNotificationProvider'] NPagination: typeof import('naive-ui')['NPagination'] diff --git a/src/oj/api.ts b/src/oj/api.ts index 69f3602..c459318 100644 --- a/src/oj/api.ts +++ b/src/oj/api.ts @@ -117,6 +117,9 @@ export function checkContestPassword(contestID: string, password: string) { }) } -export function getContestProblem(contestID: string) { - return http.get("contest/problem", { params: { contest_id: contestID } }) +export async function getContestProblem(contestID: string) { + const res = await http.get("contest/problem", { + params: { contest_id: contestID }, + }) + return res.data.map(filterResult) } diff --git a/src/oj/contest/detail.vue b/src/oj/contest/detail.vue index f642c83..0072462 100644 --- a/src/oj/contest/detail.vue +++ b/src/oj/contest/detail.vue @@ -1,7 +1,7 @@ @@ -104,27 +102,42 @@ function rowProps(row: Problem) {
- + 确认 - + - 比赛题目 - 提交信息 - 比赛排名 - 管理员助手 + + 比赛题目 + + + 提交信息 + + + 比赛排名 + + + 管理员助手 + - + + - diff --git a/src/oj/contest/list.vue b/src/oj/contest/list.vue index 35f37aa..e8b869a 100644 --- a/src/oj/contest/list.vue +++ b/src/oj/contest/list.vue @@ -30,6 +30,17 @@ const options: SelectOption[] = [ ] const columns: DataTableColumn[] = [ + { + title: "状态", + key: "status", + width: 100, + render: (row) => + h( + NTag, + { type: CONTEST_STATUS[row.status]["type"] }, + () => CONTEST_STATUS[row.status]["name"] + ), + }, { title: "比赛", key: "title", @@ -48,17 +59,6 @@ const columns: DataTableColumn[] = [ width: 180, render: (row) => duration(row.start_time, row.end_time), }, - { - title: "状态", - key: "status", - width: 100, - render: (row) => - h( - NTag, - { type: CONTEST_STATUS[row.status]["type"] }, - () => CONTEST_STATUS[row.status]["name"] - ), - }, ] async function listContests() { @@ -129,7 +129,7 @@ function rowProps(row: Contest) { diff --git a/src/oj/contest/pages/helper.vue b/src/oj/contest/pages/helper.vue new file mode 100644 index 0000000..b0b0c66 --- /dev/null +++ b/src/oj/contest/pages/helper.vue @@ -0,0 +1,5 @@ + + + + + diff --git a/src/oj/contest/pages/problems.vue b/src/oj/contest/pages/problems.vue new file mode 100644 index 0000000..ecc6192 --- /dev/null +++ b/src/oj/contest/pages/problems.vue @@ -0,0 +1,47 @@ + + + + + diff --git a/src/oj/contest/pages/rank.vue b/src/oj/contest/pages/rank.vue new file mode 100644 index 0000000..b0b0c66 --- /dev/null +++ b/src/oj/contest/pages/rank.vue @@ -0,0 +1,5 @@ + + + + + diff --git a/src/oj/contest/pages/submissions.vue b/src/oj/contest/pages/submissions.vue new file mode 100644 index 0000000..b0b0c66 --- /dev/null +++ b/src/oj/contest/pages/submissions.vue @@ -0,0 +1,5 @@ + + + + + diff --git a/src/oj/problem/components/ProblemInfo.vue b/src/oj/problem/components/ProblemInfo.vue index fddf8ee..ffadbb4 100644 --- a/src/oj/problem/components/ProblemInfo.vue +++ b/src/oj/problem/components/ProblemInfo.vue @@ -14,11 +14,10 @@ const data = computed(() => { const status = props.problem.statistic_info const labels = [] for (let i in status) { - if (status[i] === 0) { - delete status[i] + if (status[i] !== 0) { + // @ts-ignore + labels.push(JUDGE_STATUS[i]["name"]) } - // @ts-ignore - labels.push(JUDGE_STATUS[i]["name"]) } return { labels, diff --git a/src/oj/problem/components/ProblemStatus.vue b/src/oj/problem/components/ProblemStatus.vue new file mode 100644 index 0000000..8fabf0a --- /dev/null +++ b/src/oj/problem/components/ProblemStatus.vue @@ -0,0 +1,28 @@ + + + + + diff --git a/src/oj/problem/list.vue b/src/oj/problem/list.vue index cd710f8..ba29a8a 100644 --- a/src/oj/problem/list.vue +++ b/src/oj/problem/list.vue @@ -1,12 +1,13 @@