diff --git a/package.json b/package.json index b4bdff3..42b548e 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ }, "devDependencies": { "@iconify-json/ep": "^1.1.8", + "@types/node": "^18.11.18", "@vitejs/plugin-vue": "^4.0.0", "monaco-editor": "^0.34.1", "prettier": "^2.8.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index abd8f06..09225b8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,7 @@ specifiers: '@element-plus/icons-vue': ^2.0.10 '@iconify-json/ep': ^1.1.8 '@monaco-editor/loader': ^1.3.2 + '@types/node': ^18.11.18 '@vitejs/plugin-vue': ^4.0.0 '@vueuse/core': ^9.10.0 '@vueuse/integrations': ^9.10.0 @@ -39,6 +40,7 @@ dependencies: devDependencies: '@iconify-json/ep': 1.1.8 + '@types/node': 18.11.18 '@vitejs/plugin-vue': 4.0.0_vite@4.0.4+vue@3.2.45 monaco-editor: 0.34.1 prettier: 2.8.2 @@ -46,7 +48,7 @@ devDependencies: unplugin-auto-import: 0.12.1_@vueuse+core@9.10.0 unplugin-icons: 0.15.1 unplugin-vue-components: 0.22.12_vue@3.2.45 - vite: 4.0.4 + vite: 4.0.4_@types+node@18.11.18 vite-plugin-vue-markdown: 0.22.2_vite@4.0.4 vue-tsc: 1.0.24_typescript@4.9.4 @@ -431,6 +433,10 @@ packages: resolution: {integrity: sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==} dev: true + /@types/node/18.11.18: + resolution: {integrity: sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==} + dev: true + /@types/web-bluetooth/0.0.16: resolution: {integrity: sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ==} @@ -441,7 +447,7 @@ packages: vite: ^4.0.0 vue: ^3.2.25 dependencies: - vite: 4.0.4 + vite: 4.0.4_@types+node@18.11.18 vue: 3.2.45 dev: true @@ -1515,12 +1521,12 @@ packages: '@rollup/pluginutils': 5.0.2 '@types/markdown-it': 12.2.3 markdown-it: 13.0.1 - vite: 4.0.4 + vite: 4.0.4_@types+node@18.11.18 transitivePeerDependencies: - rollup dev: true - /vite/4.0.4: + /vite/4.0.4_@types+node@18.11.18: resolution: {integrity: sha512-xevPU7M8FU0i/80DMR+YhgrzR5KS2ORy1B4xcX/cXLsvnUWvfHuqMmVU6N0YiJ4JWGRJJsLCgjEzKjG9/GKoSw==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -1545,6 +1551,7 @@ packages: terser: optional: true dependencies: + '@types/node': 18.11.18 esbuild: 0.16.16 postcss: 8.4.21 resolve: 1.22.1 diff --git a/public/C++.svg b/public/C++.svg new file mode 100644 index 0000000..867affe --- /dev/null +++ b/public/C++.svg @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/public/C.svg b/public/C.svg new file mode 100644 index 0000000..defcae4 --- /dev/null +++ b/public/C.svg @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/public/Golang.svg b/public/Golang.svg new file mode 100644 index 0000000..ba66888 --- /dev/null +++ b/public/Golang.svg @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/public/Java.svg b/public/Java.svg new file mode 100644 index 0000000..c78344a --- /dev/null +++ b/public/Java.svg @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/public/JavaScript.svg b/public/JavaScript.svg new file mode 100644 index 0000000..2fbc78e --- /dev/null +++ b/public/JavaScript.svg @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/public/Python2.svg b/public/Python2.svg new file mode 100644 index 0000000..aab7dc3 --- /dev/null +++ b/public/Python2.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/Python3.svg b/public/Python3.svg new file mode 100644 index 0000000..aab7dc3 --- /dev/null +++ b/public/Python3.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/dracula.json b/public/dracula.json new file mode 100644 index 0000000..5cfa272 --- /dev/null +++ b/public/dracula.json @@ -0,0 +1,208 @@ +{ + "base": "vs-dark", + "inherit": true, + "rules": [ + { + "background": "282a36", + "token": "" + }, + { + "foreground": "6272a4", + "token": "comment" + }, + { + "foreground": "f1fa8c", + "token": "string" + }, + { + "foreground": "bd93f9", + "token": "constant.numeric" + }, + { + "foreground": "bd93f9", + "token": "constant.language" + }, + { + "foreground": "bd93f9", + "token": "constant.character" + }, + { + "foreground": "bd93f9", + "token": "constant.other" + }, + { + "foreground": "ffb86c", + "token": "variable.other.readwrite.instance" + }, + { + "foreground": "ff79c6", + "token": "constant.character.escaped" + }, + { + "foreground": "ff79c6", + "token": "constant.character.escape" + }, + { + "foreground": "ff79c6", + "token": "string source" + }, + { + "foreground": "ff79c6", + "token": "string source.ruby" + }, + { + "foreground": "ff79c6", + "token": "keyword" + }, + { + "foreground": "ff79c6", + "token": "storage" + }, + { + "foreground": "8be9fd", + "fontStyle": "italic", + "token": "storage.type" + }, + { + "foreground": "50fa7b", + "fontStyle": "underline", + "token": "entity.name.class" + }, + { + "foreground": "50fa7b", + "fontStyle": "italic underline", + "token": "entity.other.inherited-class" + }, + { + "foreground": "50fa7b", + "token": "entity.name.function" + }, + { + "foreground": "ffb86c", + "fontStyle": "italic", + "token": "variable.parameter" + }, + { + "foreground": "ff79c6", + "token": "entity.name.tag" + }, + { + "foreground": "50fa7b", + "token": "entity.other.attribute-name" + }, + { + "foreground": "8be9fd", + "token": "support.function" + }, + { + "foreground": "6be5fd", + "token": "support.constant" + }, + { + "foreground": "66d9ef", + "fontStyle": " italic", + "token": "support.type" + }, + { + "foreground": "66d9ef", + "fontStyle": " italic", + "token": "support.class" + }, + { + "foreground": "f8f8f0", + "background": "ff79c6", + "token": "invalid" + }, + { + "foreground": "f8f8f0", + "background": "bd93f9", + "token": "invalid.deprecated" + }, + { + "foreground": "cfcfc2", + "token": "meta.structure.dictionary.json string.quoted.double.json" + }, + { + "foreground": "6272a4", + "token": "meta.diff" + }, + { + "foreground": "6272a4", + "token": "meta.diff.header" + }, + { + "foreground": "ff79c6", + "token": "markup.deleted" + }, + { + "foreground": "50fa7b", + "token": "markup.inserted" + }, + { + "foreground": "e6db74", + "token": "markup.changed" + }, + { + "foreground": "bd93f9", + "token": "constant.numeric.line-number.find-in-files - match" + }, + { + "foreground": "e6db74", + "token": "entity.name.filename" + }, + { + "foreground": "f83333", + "token": "message.error" + }, + { + "foreground": "eeeeee", + "token": "punctuation.definition.string.begin.json - meta.structure.dictionary.value.json" + }, + { + "foreground": "eeeeee", + "token": "punctuation.definition.string.end.json - meta.structure.dictionary.value.json" + }, + { + "foreground": "8be9fd", + "token": "meta.structure.dictionary.json string.quoted.double.json" + }, + { + "foreground": "f1fa8c", + "token": "meta.structure.dictionary.value.json string.quoted.double.json" + }, + { + "foreground": "50fa7b", + "token": "meta meta meta meta meta meta meta.structure.dictionary.value string" + }, + { + "foreground": "ffb86c", + "token": "meta meta meta meta meta meta.structure.dictionary.value string" + }, + { + "foreground": "ff79c6", + "token": "meta meta meta meta meta.structure.dictionary.value string" + }, + { + "foreground": "bd93f9", + "token": "meta meta meta meta.structure.dictionary.value string" + }, + { + "foreground": "50fa7b", + "token": "meta meta meta.structure.dictionary.value string" + }, + { + "foreground": "ffb86c", + "token": "meta meta.structure.dictionary.value string" + } + ], + "colors": { + "editor.foreground": "#f8f8f2", + "editor.background": "#282a36", + "editor.selectionBackground": "#44475a", + "editor.lineHighlightBackground": "#44475a", + "editorCursor.foreground": "#f8f8f0", + "editorWhitespace.foreground": "#3B3A32", + "editorIndentGuide.activeBackground": "#9D550FB0", + "editor.selectionHighlightBorder": "#222218" + } + } \ No newline at end of file diff --git a/src/components.d.ts b/src/components.d.ts index 0f15d8c..40e13ad 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -43,7 +43,6 @@ declare module '@vue/runtime-core' { IEpLoading: typeof import('~icons/ep/loading')['default'] IEpSelect: typeof import('~icons/ep/select')['default'] IEpSemiSelect: typeof import('~icons/ep/semi-select')['default'] - IEpVideoPlay: typeof import('~icons/ep/video-play')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] } diff --git a/src/main.ts b/src/main.ts index 9c83634..ede565b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,12 +3,13 @@ import { createPinia } from "pinia" import "normalize.css" import loader from "@monaco-editor/loader" +import storage from "utils/storage" +import { STORAGE_KEY } from "utils/constants" + +import { routes } from "./routes" import App from "./App.vue" -import storage from "./utils/storage" -import routes from "./routes" -import { STORAGE_KEY } from "./utils/constants" -import { useLoginStore } from "./shared/store/login" +import { useLoginStore } from "~/shared/store/login" const router = createRouter({ history: createWebHistory(), @@ -31,6 +32,11 @@ router.beforeEach((to, from, next) => { const pinia = createPinia() +Promise.all([loader.init(), fetch("/dracula.json")]).then(([monaco, dark]) => { + window.monaco = monaco + dark.json().then((data) => monaco.editor.defineTheme("dark", data)) +}) + loader.config({ paths: { vs: "https://cdn.staticfile.org/monaco-editor/0.34.1/min/vs" }, "vs/nls": { availableLanguages: { "*": "zh-cn" } }, diff --git a/src/oj/api.ts b/src/oj/api.ts index 6dd7772..1edba1d 100644 --- a/src/oj/api.ts +++ b/src/oj/api.ts @@ -1,8 +1,8 @@ import { useAxios } from "@vueuse/integrations/useAxios" -import http from "./../utils/http" -import { getACRate } from "./../utils/functions" -import { DIFFICULTY } from "./../utils/constants" -import { Problem, SubmitCodePayload, Submission } from "./../utils/types" +import http from "utils/http" +import { getACRate } from "utils/functions" +import { DIFFICULTY } from "utils/constants" +import { Problem, SubmitCodePayload, Submission } from "utils/types" function filterResult(result: Problem) { const newResult: any = { diff --git a/src/oj/problem/components/Editor.vue b/src/oj/problem/components/Editor.vue index 586546d..ec25009 100644 --- a/src/oj/problem/components/Editor.vue +++ b/src/oj/problem/components/Editor.vue @@ -1,11 +1,11 @@ + + diff --git a/src/oj/problem/components/SubmitPanel.vue b/src/oj/problem/components/SubmitPanel.vue index 85d9a59..092e023 100644 --- a/src/oj/problem/components/SubmitPanel.vue +++ b/src/oj/problem/components/SubmitPanel.vue @@ -1,20 +1,13 @@ + + + diff --git a/src/shared/Signup/index.vue b/src/shared/Signup/index.vue index ad874fa..0e131e2 100644 --- a/src/shared/Signup/index.vue +++ b/src/shared/Signup/index.vue @@ -1,5 +1,5 @@ diff --git a/src/shared/Split/index.vue b/src/shared/Split/index.vue index 3a2fb28..e3819b6 100644 --- a/src/shared/Split/index.vue +++ b/src/shared/Split/index.vue @@ -36,7 +36,6 @@ import Resizer from "./Resizer.vue" import Pane from "./Pane.vue" import { computed, ref } from "vue" -import { classNameToArray } from "element-plus/es/utils" interface Props { minPercent?: number diff --git a/src/shared/api.ts b/src/shared/api.ts index a9b2556..12d9d98 100644 --- a/src/shared/api.ts +++ b/src/shared/api.ts @@ -1,5 +1,5 @@ import { useAxios } from "@vueuse/integrations/useAxios" -import http from "../utils/http" +import http from "utils/http" export function login(data: { username: string; password: string }) { return useAxios("login", { method: "post", data }, http, { diff --git a/src/shared/layout/admin.vue b/src/shared/layout/admin.vue new file mode 100644 index 0000000..7caa234 --- /dev/null +++ b/src/shared/layout/admin.vue @@ -0,0 +1,11 @@ + + + + + diff --git a/src/oj/index.vue b/src/shared/layout/default.vue similarity index 67% rename from src/oj/index.vue rename to src/shared/layout/default.vue index 2a0b556..170ebaa 100644 --- a/src/oj/index.vue +++ b/src/shared/layout/default.vue @@ -1,24 +1,24 @@ - - - - - + + + + + diff --git a/src/shared/monaco/index.vue b/src/shared/monaco/index.vue index 4d63236..3bbe25c 100644 --- a/src/shared/monaco/index.vue +++ b/src/shared/monaco/index.vue @@ -1,9 +1,8 @@