From 5d0f34c144dd0797ac7eb38e1018b857110ea3d4 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Sun, 15 Jan 2023 21:32:04 +0800 Subject: [PATCH] submission list. --- src/components.d.ts | 2 + src/oj/api.ts | 4 +- src/oj/problem/components/ProblemContent.vue | 1 - src/oj/problem/list.vue | 12 +- src/oj/status/list.vue | 127 +++++++++++++++---- src/shared/Pagination/index.vue | 1 + 6 files changed, 110 insertions(+), 37 deletions(-) diff --git a/src/components.d.ts b/src/components.d.ts index 40e13ad..327b05e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -24,6 +24,7 @@ declare module '@vue/runtime-core' { ElHeader: typeof import('element-plus/es')['ElHeader'] ElIcon: typeof import('element-plus/es')['ElIcon'] ElInput: typeof import('element-plus/es')['ElInput'] + ElLink: typeof import('element-plus/es')['ElLink'] ElMain: typeof import('element-plus/es')['ElMain'] ElMenu: typeof import('element-plus/es')['ElMenu'] ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] @@ -33,6 +34,7 @@ declare module '@vue/runtime-core' { ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] ElSelect: typeof import('element-plus/es')['ElSelect'] ElSpace: typeof import('element-plus/es')['ElSpace'] + ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] ElTabPane: typeof import('element-plus/es')['ElTabPane'] diff --git a/src/oj/api.ts b/src/oj/api.ts index 8515b81..6915b51 100644 --- a/src/oj/api.ts +++ b/src/oj/api.ts @@ -83,6 +83,6 @@ export function submitCode(data: SubmitCodePayload) { return http.post("submission", data) } -export function listSubmissions(params: SubmissionListPayload) { - return useAxios("submissions", { params }, http, { immediate: false }) +export function getSubmissions(params: SubmissionListPayload) { + return http.get("submissions", { params }) } diff --git a/src/oj/problem/components/ProblemContent.vue b/src/oj/problem/components/ProblemContent.vue index f224634..c31aef5 100644 --- a/src/oj/problem/components/ProblemContent.vue +++ b/src/oj/problem/components/ProblemContent.vue @@ -90,7 +90,6 @@ const type = (status: Sample["status"]) => :closable="false" center title="🎉 本 题 已 经 被 你 解 决 啦" - effect="dark" > diff --git a/src/oj/problem/list.vue b/src/oj/problem/list.vue index f346a8d..a940a09 100644 --- a/src/oj/problem/list.vue +++ b/src/oj/problem/list.vue @@ -47,16 +47,16 @@ async function listProblems() { problems.value = res.results } -function routePush() { +function routerPush() { router.push({ - path: "/", + path: route.path, query: filterEmptyValue(query), }) } function search() { query.page = 1 - routePush() + routerPush() } function clear() { @@ -64,7 +64,7 @@ function clear() { query.tag = "" query.difficulty = "" query.page = 1 - routePush() + routerPush() } async function getRandom() { @@ -76,13 +76,13 @@ function goProblem(row: any) { router.push("/problem/" + row._id) } -watch(() => query.page, routePush) +watch(() => query.page, routerPush) watch( () => [query.tag, query.difficulty, query.limit], () => { query.page = 1 - routePush() + routerPush() } ) diff --git a/src/oj/status/list.vue b/src/oj/status/list.vue index a0985df..ec6dff2 100644 --- a/src/oj/status/list.vue +++ b/src/oj/status/list.vue @@ -1,43 +1,102 @@ - - + + + + - + - - + + + + diff --git a/src/shared/Pagination/index.vue b/src/shared/Pagination/index.vue index f9c6e99..e5f7a1a 100644 --- a/src/shared/Pagination/index.vue +++ b/src/shared/Pagination/index.vue @@ -22,6 +22,7 @@ watch(page, () => emit("update:page", page))