fix axios.

This commit is contained in:
2023-01-21 10:15:22 +08:00
parent 0b2d9e3efd
commit f75ae1b00d
7 changed files with 134 additions and 92 deletions

46
package-lock.json generated
View File

@@ -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",

View File

@@ -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",

View File

@@ -27,7 +27,9 @@ hljs.registerLanguage("go", go)
:date-locale="dateZhCN"
:hljs="hljs"
>
<n-notification-provider>
<router-view></router-view>
</n-notification-provider>
</n-config-provider>
</template>

1
src/components.d.ts vendored
View File

@@ -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']

View File

@@ -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 },
})
}

View File

@@ -1,5 +1,11 @@
<script setup lang="ts"></script>
<script setup lang="ts">
import { DataTableColumn } from "naive-ui"
<template>rank list</template>
const columns: DataTableColumn[] = []
</script>
<template>
<n-data-table :columns="columns" />
</template>
<style scoped></style>

View File

@@ -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,13 +111,17 @@ watch(
}
)
const columns: DataTableColumn<Submission>[] = [
const columns = computed(() => {
const res: DataTableColumn<Submission>[] = [
{
title: "提交时间",
key: "create_time",
width: 180,
render: (row) =>
parseTime(row.create_time, isDesktop ? "YYYY-M-D hh:mm:ss" : "M-D hh:mm"),
parseTime(
row.create_time,
isDesktop ? "YYYY-M-D hh:mm:ss" : "M-D hh:mm"
),
},
{
title: "编号",
@@ -165,7 +178,21 @@ const columns: DataTableColumn<Submission>[] = [
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
})
</script>
<template>
<n-form :inline="isDesktop" label-placement="left">