diff --git a/package-lock.json b/package-lock.json
index c0b38f4..3bcecf6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,7 +12,7 @@
"@monaco-editor/loader": "^1.3.2",
"@vueuse/core": "^9.11.0",
"@vueuse/integrations": "^9.11.0",
- "axios": "^1.2.3",
+ "axios": "1.2.2",
"copy-text-to-clipboard": "^3.0.1",
"highlight.js": "^11.7.0",
"naive-ui": "^2.34.3",
@@ -1026,9 +1026,9 @@
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/axios": {
- "version": "1.2.3",
- "resolved": "https://registry.npmmirror.com/axios/-/axios-1.2.3.tgz",
- "integrity": "sha512-pdDkMYJeuXLZ6Xj/Q5J3Phpe+jbGdsSzlQaFVkMQzRUL05+6+tetX8TV3p4HrU4kzuO9bt+io/yGQxuyxA/xcw==",
+ "version": "1.2.2",
+ "resolved": "https://registry.npmmirror.com/axios/-/axios-1.2.2.tgz",
+ "integrity": "sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==",
"dependencies": {
"follow-redirects": "^1.15.0",
"form-data": "^4.0.0",
@@ -1585,9 +1585,9 @@
}
},
"node_modules/local-pkg": {
- "version": "0.4.2",
- "resolved": "https://registry.npmmirror.com/local-pkg/-/local-pkg-0.4.2.tgz",
- "integrity": "sha512-mlERgSPrbxU3BP4qBqAvvwlgW4MTg78iwJdGGnv7kibKjWcJksrG3t6LB5lXI93wXRDvG4NpUgJFmTG4T6rdrg==",
+ "version": "0.4.3",
+ "resolved": "https://registry.npmmirror.com/local-pkg/-/local-pkg-0.4.3.tgz",
+ "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==",
"dev": true,
"engines": {
"node": ">=14"
@@ -2221,17 +2221,17 @@
"dev": true
},
"node_modules/unimport": {
- "version": "1.2.0",
- "resolved": "https://registry.npmmirror.com/unimport/-/unimport-1.2.0.tgz",
- "integrity": "sha512-yMok/ubppurBE7Png1QH70Om96AxIoWCcfdxW3J/pziozShMc1UGpPgWpSckfo9ndAO5M74yNnRDdLAZy/gWQg==",
+ "version": "1.3.0",
+ "resolved": "https://registry.npmmirror.com/unimport/-/unimport-1.3.0.tgz",
+ "integrity": "sha512-fOkrdxglsHd428yegH0wPH/6IfaSdDeMXtdRGn6en/ccyzc2aaoxiUTMrJyc6Bu+xoa18RJRPMfLUHEzjz8atw==",
"dev": true,
"dependencies": {
"@rollup/pluginutils": "^5.0.2",
"escape-string-regexp": "^5.0.0",
"fast-glob": "^3.2.12",
- "local-pkg": "^0.4.2",
+ "local-pkg": "^0.4.3",
"magic-string": "^0.27.0",
- "mlly": "^1.0.0",
+ "mlly": "^1.1.0",
"pathe": "^1.0.0",
"pkg-types": "^1.0.1",
"scule": "^1.0.0",
@@ -3191,9 +3191,9 @@
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"axios": {
- "version": "1.2.3",
- "resolved": "https://registry.npmmirror.com/axios/-/axios-1.2.3.tgz",
- "integrity": "sha512-pdDkMYJeuXLZ6Xj/Q5J3Phpe+jbGdsSzlQaFVkMQzRUL05+6+tetX8TV3p4HrU4kzuO9bt+io/yGQxuyxA/xcw==",
+ "version": "1.2.2",
+ "resolved": "https://registry.npmmirror.com/axios/-/axios-1.2.2.tgz",
+ "integrity": "sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==",
"requires": {
"follow-redirects": "^1.15.0",
"form-data": "^4.0.0",
@@ -3616,9 +3616,9 @@
}
},
"local-pkg": {
- "version": "0.4.2",
- "resolved": "https://registry.npmmirror.com/local-pkg/-/local-pkg-0.4.2.tgz",
- "integrity": "sha512-mlERgSPrbxU3BP4qBqAvvwlgW4MTg78iwJdGGnv7kibKjWcJksrG3t6LB5lXI93wXRDvG4NpUgJFmTG4T6rdrg==",
+ "version": "0.4.3",
+ "resolved": "https://registry.npmmirror.com/local-pkg/-/local-pkg-0.4.3.tgz",
+ "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==",
"dev": true
},
"locate-path": {
@@ -4103,17 +4103,17 @@
"dev": true
},
"unimport": {
- "version": "1.2.0",
- "resolved": "https://registry.npmmirror.com/unimport/-/unimport-1.2.0.tgz",
- "integrity": "sha512-yMok/ubppurBE7Png1QH70Om96AxIoWCcfdxW3J/pziozShMc1UGpPgWpSckfo9ndAO5M74yNnRDdLAZy/gWQg==",
+ "version": "1.3.0",
+ "resolved": "https://registry.npmmirror.com/unimport/-/unimport-1.3.0.tgz",
+ "integrity": "sha512-fOkrdxglsHd428yegH0wPH/6IfaSdDeMXtdRGn6en/ccyzc2aaoxiUTMrJyc6Bu+xoa18RJRPMfLUHEzjz8atw==",
"dev": true,
"requires": {
"@rollup/pluginutils": "^5.0.2",
"escape-string-regexp": "^5.0.0",
"fast-glob": "^3.2.12",
- "local-pkg": "^0.4.2",
+ "local-pkg": "^0.4.3",
"magic-string": "^0.27.0",
- "mlly": "^1.0.0",
+ "mlly": "^1.1.0",
"pathe": "^1.0.0",
"pkg-types": "^1.0.1",
"scule": "^1.0.0",
diff --git a/package.json b/package.json
index 3dd2732..43331a3 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,7 @@
"@monaco-editor/loader": "^1.3.2",
"@vueuse/core": "^9.11.0",
"@vueuse/integrations": "^9.11.0",
- "axios": "^1.2.3",
+ "axios": "1.2.2",
"copy-text-to-clipboard": "^3.0.1",
"highlight.js": "^11.7.0",
"naive-ui": "^2.34.3",
diff --git a/src/App.vue b/src/App.vue
index bcd5702..636b06c 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -27,7 +27,9 @@ hljs.registerLanguage("go", go)
:date-locale="dateZhCN"
:hljs="hljs"
>
-
+
+
+
diff --git a/src/components.d.ts b/src/components.d.ts
index a2002ca..97da2da 100644
--- a/src/components.d.ts
+++ b/src/components.d.ts
@@ -30,6 +30,7 @@ declare module '@vue/runtime-core' {
NLayoutHeader: typeof import('naive-ui')['NLayoutHeader']
NMenu: typeof import('naive-ui')['NMenu']
NModal: typeof import('naive-ui')['NModal']
+ NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
NPagination: typeof import('naive-ui')['NPagination']
NScrollbar: typeof import('naive-ui')['NScrollbar']
NSelect: typeof import('naive-ui')['NSelect']
diff --git a/src/oj/api.ts b/src/oj/api.ts
index 6915b51..7546dac 100644
--- a/src/oj/api.ts
+++ b/src/oj/api.ts
@@ -86,3 +86,9 @@ export function submitCode(data: SubmitCodePayload) {
export function getSubmissions(params: SubmissionListPayload) {
return http.get("submissions", { params })
}
+
+export function adminRejudge(id: string) {
+ return http.get("admin/submission/rejudge", {
+ params: { id },
+ })
+}
diff --git a/src/oj/rank/list.vue b/src/oj/rank/list.vue
index 0872d64..df04077 100644
--- a/src/oj/rank/list.vue
+++ b/src/oj/rank/list.vue
@@ -1,5 +1,11 @@
-
+
+
+
+
+
diff --git a/src/oj/submission/list.vue b/src/oj/submission/list.vue
index 824bfda..8bd84e3 100644
--- a/src/oj/submission/list.vue
+++ b/src/oj/submission/list.vue
@@ -10,8 +10,9 @@ import {
filterEmptyValue,
} from "utils/functions"
import { Submission } from "utils/types"
-import { getSubmissions } from "oj/api"
+import { adminRejudge, getSubmissions } from "oj/api"
import { isDesktop } from "~/shared/composables/breakpoints"
+import { useUserStore } from "~/shared/store/user"
interface Query {
username: string
@@ -23,6 +24,8 @@ interface Query {
const route = useRoute()
const router = useRouter()
+const userStore = useUserStore()
+const notification = useNotification()
const submissions = ref([])
const total = ref(0)
@@ -85,6 +88,12 @@ function clear() {
query.result = ""
}
+async function rejudge(submissionID: string) {
+ await adminRejudge(submissionID)
+ notification.success({ title: "重新判分成功", duration: 2000 })
+ listSubmissions()
+}
+
watch(() => query.page, routerPush)
watch(
@@ -102,70 +111,88 @@ watch(
}
)
-const columns: DataTableColumn[] = [
- {
- title: "提交时间",
- key: "create_time",
- width: 180,
- render: (row) =>
- parseTime(row.create_time, isDesktop ? "YYYY-M-D hh:mm:ss" : "M-D hh:mm"),
- },
- {
- title: "编号",
- key: "id",
- render: (row) =>
- h(
- NButton,
- {
- text: true,
- type: "info",
- onClick: () => router.push("/submission/" + row.id),
- },
- () => row.id.slice(0, 12)
- ),
- },
- {
- title: "状态",
- key: "status",
- width: 120,
- render: (row) => h(SubmissionResultTag, { result: row.result }),
- },
- {
- title: "题目",
- key: "problem",
- width: 100,
- render: (row) =>
- h(
- NButton,
- {
- text: true,
- type: "info",
- onClick: () => router.push("/problem/" + row.problem),
- },
- () => row.problem
- ),
- },
- {
- title: "执行耗时",
- key: "time",
- width: 100,
- render: (row) => submissionTimeFormat(row.statistic_info.time_cost),
- },
- {
- title: "占用内存",
- key: "memory",
- width: 100,
- render: (row) => submissionMemoryFormat(row.statistic_info.memory_cost),
- },
- { title: "语言", key: "language", width: 100 },
- {
- title: "提交者",
- key: "username",
- minWidth: 120,
- render: (row) =>
- h(NButton, { text: true, type: "info" }, () => row.username),
- },
-]
+const columns = computed(() => {
+ const res: DataTableColumn[] = [
+ {
+ title: "提交时间",
+ key: "create_time",
+ width: 180,
+ render: (row) =>
+ parseTime(
+ row.create_time,
+ isDesktop ? "YYYY-M-D hh:mm:ss" : "M-D hh:mm"
+ ),
+ },
+ {
+ title: "编号",
+ key: "id",
+ render: (row) =>
+ h(
+ NButton,
+ {
+ text: true,
+ type: "info",
+ onClick: () => router.push("/submission/" + row.id),
+ },
+ () => row.id.slice(0, 12)
+ ),
+ },
+ {
+ title: "状态",
+ key: "status",
+ width: 120,
+ render: (row) => h(SubmissionResultTag, { result: row.result }),
+ },
+ {
+ title: "题目",
+ key: "problem",
+ width: 100,
+ render: (row) =>
+ h(
+ NButton,
+ {
+ text: true,
+ type: "info",
+ onClick: () => router.push("/problem/" + row.problem),
+ },
+ () => row.problem
+ ),
+ },
+ {
+ title: "执行耗时",
+ key: "time",
+ width: 100,
+ render: (row) => submissionTimeFormat(row.statistic_info.time_cost),
+ },
+ {
+ title: "占用内存",
+ key: "memory",
+ width: 100,
+ render: (row) => submissionMemoryFormat(row.statistic_info.memory_cost),
+ },
+ { title: "语言", key: "language", width: 100 },
+ {
+ title: "提交者",
+ key: "username",
+ minWidth: 120,
+ render: (row) =>
+ h(NButton, { text: true, type: "info" }, () => row.username),
+ },
+ ]
+ if (!route.params.contestID && userStore.isSuperAdmin) {
+ res.push({
+ title: "选项",
+ key: "rejudge",
+ render: (row) =>
+ h(
+ NButton,
+ { size: "small", onClick: () => rejudge(row.id) },
+ () => "重新评分"
+ ),
+ })
+ }
+ return res
+})