From 4335ffb1e11ef8787f1213a3028a605f487a75e2 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Sun, 12 Oct 2025 15:18:47 +0800 Subject: [PATCH] update --- public/C++.svg | 12 ------------ public/C.svg | 8 -------- public/Golang.svg | 4 ---- public/Java.svg | 12 ------------ public/JavaScript.svg | 5 ----- public/Python2.svg | 16 ---------------- public/Python3.svg | 16 ---------------- src/oj/problem/components/Form.vue | 27 +++++++++++++++++++-------- src/utils/constants.ts | 13 ++++++++++++- 9 files changed, 31 insertions(+), 82 deletions(-) delete mode 100644 public/C++.svg delete mode 100644 public/C.svg delete mode 100644 public/Golang.svg delete mode 100644 public/Java.svg delete mode 100644 public/JavaScript.svg delete mode 100644 public/Python2.svg delete mode 100644 public/Python3.svg diff --git a/public/C++.svg b/public/C++.svg deleted file mode 100644 index 867affe..0000000 --- a/public/C++.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/public/C.svg b/public/C.svg deleted file mode 100644 index defcae4..0000000 --- a/public/C.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/public/Golang.svg b/public/Golang.svg deleted file mode 100644 index ba66888..0000000 --- a/public/Golang.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - \ No newline at end of file diff --git a/public/Java.svg b/public/Java.svg deleted file mode 100644 index c78344a..0000000 --- a/public/Java.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/public/JavaScript.svg b/public/JavaScript.svg deleted file mode 100644 index 2fbc78e..0000000 --- a/public/JavaScript.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/public/Python2.svg b/public/Python2.svg deleted file mode 100644 index aab7dc3..0000000 --- a/public/Python2.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/public/Python3.svg b/public/Python3.svg deleted file mode 100644 index aab7dc3..0000000 --- a/public/Python3.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/oj/problem/components/Form.vue b/src/oj/problem/components/Form.vue index 4e7efd0..bda8b26 100644 --- a/src/oj/problem/components/Form.vue +++ b/src/oj/problem/components/Form.vue @@ -5,7 +5,7 @@ import { useCodeStore } from "oj/store/code" import { useProblemStore } from "oj/store/problem" import { injectSyncStatus } from "oj/composables/syncStatus" import { SYNC_MESSAGES } from "shared/composables/sync" -import { LANGUAGE_SHOW_VALUE, SOURCES, STORAGE_KEY } from "utils/constants" +import { ICON_SET, LANGUAGE_SHOW_VALUE, SOURCES, STORAGE_KEY } from "utils/constants" import { useBreakpoints } from "shared/composables/breakpoints" import { useUserStore } from "shared/store/user" import storage from "utils/storage" @@ -13,6 +13,8 @@ import { LANGUAGE } from "utils/types" import Submit from "./Submit.vue" import StatisticsPanel from "shared/components/StatisticsPanel.vue" import IconButton from "shared/components/IconButton.vue" +import { Icon } from "@iconify/vue" +import { NFlex } from "naive-ui" interface Props { storageKey: string @@ -37,7 +39,6 @@ const router = useRouter() const userStore = useUserStore() const codeStore = useCodeStore() const problemStore = useProblemStore() -const { code } = storeToRefs(codeStore) const { problem } = storeToRefs(problemStore) const { isMobile, isDesktop } = useBreakpoints() @@ -58,15 +59,25 @@ const menu = computed(() => [ { label: "重置代码", key: "reset" }, ]) -const languageOptions: DropdownOption[] = problem.value!.languages.map( +const flowchartAndLanguages = computed(() => [ + ...(problem.value!.allow_flowchart ? ["Flowchart"] : []), + ...problem.value!.languages, +]) + +const Options = { + Flowchart: "流程图", + ...LANGUAGE_SHOW_VALUE, +} + +const languageOptions: DropdownOption[] = flowchartAndLanguages.value.map( (it) => ({ label: () => - h("div", { style: "display: flex; align-items: center;" }, [ - h("img", { - src: `/${it}.svg`, - style: { width: "16px", height: "16px", marginRight: "8px" }, + h(NFlex, { align: "center" }, [ + h(Icon, { + icon: ICON_SET[it as keyof typeof ICON_SET], + width: 16, }), - LANGUAGE_SHOW_VALUE[it], + Options[it as keyof typeof Options], ]), value: it, }), diff --git a/src/utils/constants.ts b/src/utils/constants.ts index ba657fa..2b9673b 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -177,7 +177,7 @@ export const LANGUAGE_FORMAT_VALUE = { } as const export const LANGUAGE_SHOW_VALUE = { - C: "C", + C: "C语言", "C++": "C++", Java: "Java", Python2: "Python", @@ -186,6 +186,17 @@ export const LANGUAGE_SHOW_VALUE = { Golang: "Go", } as const +export const ICON_SET = { + Flowchart: "material-symbols:flowchart", + Python2: "devicon:python", + Python3: "devicon:python", + C: "devicon:c", + "C++": "devicon:cplusplus", + Java: "devicon:java", + JavaScript: "devicon:javascript", + Golang: "devicon:go", +} as const + const cTemplate = `//TEMPLATE BEGIN #include