diff --git a/components.d.ts b/components.d.ts index 193e614..742a9e2 100644 --- a/components.d.ts +++ b/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'] @@ -38,10 +39,14 @@ declare module '@vue/runtime-core' { ElTabPane: typeof import('element-plus/es')['ElTabPane'] ElTabs: typeof import('element-plus/es')['ElTabs'] ElTag: typeof import('element-plus/es')['ElTag'] + IEpBell: typeof import('~icons/ep/bell')['default'] + 'IEpCaret-': typeof import('~icons/ep/caret-')['default'] + IEpCaretRight: typeof import('~icons/ep/caret-right')['default'] + IEpLoading: typeof import('~icons/ep/loading')['default'] IEpSelect: typeof import('~icons/ep/select')['default'] IEpSemiSelect: typeof import('~icons/ep/semi-select')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] - UseNetwork: typeof import('@vueuse/components')['UseNetwork'] + UseNetwork: typeof import("@vueuse/components")["UseNetwork"] } } diff --git a/package-lock.json b/package-lock.json index e65b6a0..f589dcd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "axios": "^1.2.2", "element-plus": "^2.2.28", "normalize.css": "^8.0.1", + "party-js": "^2.2.0", "pinia": "^2.0.28", "vue": "^3.2.45", "vue-router": "^4.1.6" @@ -1618,6 +1619,11 @@ "node": ">=10" } }, + "node_modules/party-js": { + "version": "2.2.0", + "resolved": "https://registry.npmmirror.com/party-js/-/party-js-2.2.0.tgz", + "integrity": "sha512-50hGuALCpvDTrQLPQ1fgUgxKIWAH28ShVkmeK/3zhO0YJyCqkhrZhQEkWPxDYLvbFJ7YAXyROmFEu35gKpZLtQ==" + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmmirror.com/path-exists/-/path-exists-4.0.0.tgz", @@ -3324,6 +3330,11 @@ "p-limit": "^3.0.2" } }, + "party-js": { + "version": "2.2.0", + "resolved": "https://registry.npmmirror.com/party-js/-/party-js-2.2.0.tgz", + "integrity": "sha512-50hGuALCpvDTrQLPQ1fgUgxKIWAH28ShVkmeK/3zhO0YJyCqkhrZhQEkWPxDYLvbFJ7YAXyROmFEu35gKpZLtQ==" + }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmmirror.com/path-exists/-/path-exists-4.0.0.tgz", diff --git a/package.json b/package.json index 1bdb5fd..1d16ee9 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "axios": "^1.2.2", "element-plus": "^2.2.28", "normalize.css": "^8.0.1", + "party-js": "^2.2.0", "pinia": "^2.0.28", "vue": "^3.2.45", "vue-router": "^4.1.6" diff --git a/src/App.vue b/src/App.vue index 742bf3f..5651af3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,10 +1,9 @@ diff --git a/src/main.ts b/src/main.ts index c9833f2..f1b4340 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,58 +5,12 @@ import "normalize.css" import loader from "@monaco-editor/loader" import App from "./App.vue" -import Home from "./oj/index.vue" -import Problems from "./oj/problem/list.vue" import storage from "./utils/storage" +import routes from "./routes" import { STORAGE_KEY } from "./utils/constants" import { useLoginStore } from "./shared/stores/login" -const routes = [ - { - path: "/", - component: Home, - children: [ - { path: "", component: Problems }, - { - path: "problem/:problemID", - component: () => import("./oj/problem/detail.vue"), - props: true, - }, - { - path: "status", - component: () => import("./oj/status/list.vue"), - meta: { requiresAuth: true }, - }, - { - path: "status/:statusID", - component: () => import("./oj/status/detail.vue"), - props: true, - }, - { - path: "contest", - component: () => import("./oj/contest/list.vue"), - meta: { requiresAuth: true }, - }, - { - path: "contest/:contestID", - component: () => import("./oj/contest/detail.vue"), - props: true, - }, - { - path: "contest/:contestID/problem/:problemID", - component: () => import("./oj/problem/detail.vue"), - props: true, - }, - { - path: "rank", - component: () => import("./oj/rank/list.vue"), - }, - ], - }, - { path: "/admin", component: () => import("./admin/index.vue") }, -] - const router = createRouter({ history: createWebHistory(), routes, diff --git a/src/oj/api.ts b/src/oj/api.ts index 177cc95..4f40fc1 100644 --- a/src/oj/api.ts +++ b/src/oj/api.ts @@ -1,6 +1,6 @@ import { getACRate } from "./../utils/functions" import { DIFFICULTY } from "./../utils/constants" -import { Problem, SubmitCodePayload } from "./../utils/types" +import { Problem, SubmitCodePayload, Submission } from "./../utils/types" import http from "./../utils/http" import { useAxios } from "@vueuse/integrations/useAxios" @@ -60,11 +60,17 @@ export function getProblem(id: string) { } export function getSubmission(id: string) { - return http.get("submission", { + return http.get("submission", { params: { id }, }) } +export function submissionExists(problemID: number) { + return http.get("submission_exists", { + params: { problem_id: problemID }, + }) +} + export function submitCode(data: SubmitCodePayload) { return http.post("submission", data) } diff --git a/src/oj/components/submission-result-tag.vue b/src/oj/components/submission-result-tag.vue new file mode 100644 index 0000000..fda1f48 --- /dev/null +++ b/src/oj/components/submission-result-tag.vue @@ -0,0 +1,16 @@ + + + + + diff --git a/src/oj/contest/detail.vue b/src/oj/contest/detail.vue index e69de29..80b8d56 100644 --- a/src/oj/contest/detail.vue +++ b/src/oj/contest/detail.vue @@ -0,0 +1,5 @@ + + + + + diff --git a/src/oj/problem/components/editor-exec.vue b/src/oj/problem/components/editor-exec.vue new file mode 100644 index 0000000..e1bae57 --- /dev/null +++ b/src/oj/problem/components/editor-exec.vue @@ -0,0 +1,277 @@ + + + + + diff --git a/src/oj/problem/components/editor.vue b/src/oj/problem/components/editor.vue index 42ab14a..f3883cf 100644 --- a/src/oj/problem/components/editor.vue +++ b/src/oj/problem/components/editor.vue @@ -1,39 +1,28 @@ diff --git a/src/oj/problem/detail.vue b/src/oj/problem/detail.vue index 471bb2c..0435f5d 100644 --- a/src/oj/problem/detail.vue +++ b/src/oj/problem/detail.vue @@ -13,7 +13,7 @@ const { data: problem, isFinished } = getProblem(problemID) - + diff --git a/src/oj/problem/list.vue b/src/oj/problem/list.vue index 356cd33..880fcf6 100644 --- a/src/oj/problem/list.vue +++ b/src/oj/problem/list.vue @@ -100,7 +100,7 @@ onMounted(listProblems)