update
Some checks failed
Deploy / deploy (push) Has been cancelled

This commit is contained in:
2025-10-12 15:57:59 +08:00
parent 4335ffb1e1
commit 87d2b828a1
9 changed files with 63 additions and 21 deletions

View File

@@ -30,10 +30,10 @@ watch(
(isAuthed) => {
if (!isAuthed) {
// 如果用户未登录禁用WebSocket功能
console.warn('用户未登录WebSocket配置更新功能已禁用')
console.warn("用户未登录WebSocket配置更新功能已禁用")
}
},
{ immediate: true }
{ immediate: true },
)
const testcaseColumns: DataTableColumn<Testcase>[] = [

View File

@@ -5,16 +5,25 @@ 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 { ICON_SET, 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"
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"
import SubmitCode from "./SubmitCode.vue"
const SubmitFlowchart = defineAsyncComponent(
() => import("./SubmitFlowchart.vue"),
)
interface Props {
storageKey: string
@@ -59,25 +68,23 @@ const menu = computed<DropdownOption[]>(() => [
{ label: "重置代码", key: "reset" },
])
const flowchartAndLanguages = computed(() => [
...(problem.value!.allow_flowchart ? ["Flowchart"] : []),
...problem.value!.languages,
])
const Options = {
Flowchart: "流程图",
...LANGUAGE_SHOW_VALUE,
}
const flowchartAndLanguages = computed(
() =>
[
...(problem.value!.allow_flowchart ? ["Flowchart"] : []),
...problem.value!.languages,
] as LANGUAGE[],
)
const languageOptions: DropdownOption[] = flowchartAndLanguages.value.map(
(it) => ({
label: () =>
h(NFlex, { align: "center" }, [
h(NFlex, { align: "center" }, () => [
h(Icon, {
icon: ICON_SET[it as keyof typeof ICON_SET],
icon: ICON_SET[it],
width: 16,
}),
Options[it as keyof typeof Options],
LANGUAGE_SHOW_VALUE[it],
]),
value: it,
}),
@@ -137,6 +144,12 @@ defineExpose({
syncEnabled.value = false
},
})
onMounted(() => {
if (!problem.value!.languages.includes(codeStore.code.language)) {
codeStore.code.language = "Python3"
}
})
</script>
<template>
@@ -149,7 +162,9 @@ defineExpose({
@update:value="changeLanguage"
/>
<Submit />
<SubmitFlowchart v-if="codeStore.code.language === 'Flowchart'" />
<SubmitCode v-else />
<n-button
v-if="!userStore.isSuperAdmin && userStore.showSubmissions"

View File

@@ -0,0 +1,20 @@
<script lang="ts" setup>
import { useBreakpoints } from "shared/composables/breakpoints"
const { isDesktop } = useBreakpoints()
const message = useMessage()
const submit = () => {
message.warning("暂未实现")
}
</script>
<template>
<n-button
:size="isDesktop ? 'medium' : 'small'"
type="primary"
@click="submit"
>
提交流程图
</n-button>
</template>

View File

@@ -23,7 +23,9 @@ function filterClass() {
</script>
<template>
<n-flex align="center">
<n-button text type="info" @click="$emit('click')"><slot></slot></n-button>
<n-button text type="info" @click="$emit('click')">
<slot></slot>
</n-button>
<n-tooltip>
<template #trigger>
<n-button text @click="$emit('search')">

View File

@@ -31,7 +31,7 @@ export function useConfigUpdate() {
disconnect()
}
},
{ immediate: true }
{ immediate: true },
)
return {

View File

@@ -34,7 +34,7 @@ export function useMaxKB() {
disconnect()
}
},
{ immediate: true }
{ immediate: true },
)
const loadMaxKBScript = () => {

View File

@@ -154,6 +154,7 @@ export const SOURCES = {
Python2: "",
JavaScript: "",
Golang: "",
Flowchart: "",
} as const
export const LANGUAGE_ID = {
@@ -164,6 +165,7 @@ export const LANGUAGE_ID = {
Python2: 0,
JavaScript: 0,
Golang: 0,
Flowchart: 0,
} as const
export const LANGUAGE_FORMAT_VALUE = {
@@ -174,9 +176,11 @@ export const LANGUAGE_FORMAT_VALUE = {
Python3: "python",
JavaScript: "javascript",
Golang: "go",
Flowchart: "flowchart",
} as const
export const LANGUAGE_SHOW_VALUE = {
Flowchart: "流程图",
C: "C语言",
"C++": "C++",
Java: "Java",
@@ -187,7 +191,7 @@ export const LANGUAGE_SHOW_VALUE = {
} as const
export const ICON_SET = {
Flowchart: "material-symbols:flowchart",
Flowchart: "streamline-freehand-color:programming-flowchart",
Python2: "devicon:python",
Python3: "devicon:python",
C: "devicon:c",

View File

@@ -59,6 +59,7 @@ export type LANGUAGE =
| "Java"
| "JavaScript"
| "Golang"
| "Flowchart"
export type LANGUAGE_SHOW_LABEL =
(typeof LANGUAGE_SHOW_VALUE)[keyof typeof LANGUAGE_SHOW_VALUE]