This commit is contained in:
2024-06-12 08:55:47 +08:00
parent 73db76e605
commit cc89920553

View File

@@ -41,6 +41,7 @@ const title = computed(
"admin contest problem edit": "编辑比赛题目", "admin contest problem edit": "编辑比赛题目",
})[<string>route.name], })[<string>route.name],
) )
const problem = useLocalStorage<BlankProblem>(STORAGE_KEY.ADMIN_PROBLEM, { const problem = useLocalStorage<BlankProblem>(STORAGE_KEY.ADMIN_PROBLEM, {
_id: "", _id: "",
title: "", title: "",
@@ -76,9 +77,6 @@ const problem = useLocalStorage<BlankProblem>(STORAGE_KEY.ADMIN_PROBLEM, {
}, },
}) })
const template = reactive(JSON.parse(JSON.stringify(CODE_TEMPLATES)))
const currentActiveTemplate = ref<LANGUAGE>("C")
// 从服务器来的tag列表 // 从服务器来的tag列表
const tagList = shallowRef<Tag[]>([]) const tagList = shallowRef<Tag[]>([])
@@ -86,13 +84,18 @@ interface Tags {
select: string[] select: string[]
upload: string[] upload: string[]
} }
// 选择的 和 新的 // 从 tagList 中选择的 和 新上传
const tags = useLocalStorage<Tags>(STORAGE_KEY.ADMIN_PROBLEM_TAGS, { const tags = useLocalStorage<Tags>(STORAGE_KEY.ADMIN_PROBLEM_TAGS, {
select: [], select: [],
upload: [], upload: [],
}) })
// 这三个用的少,就不缓存本地了
const [needTemplate, toggleNeedTemplate] = useToggle(false) const [needTemplate, toggleNeedTemplate] = useToggle(false)
const template = reactive(JSON.parse(JSON.stringify(CODE_TEMPLATES)))
const currentActiveTemplate = ref<LANGUAGE>("C")
// 给 TextEditor 用
const [ready, toggleReady] = useToggle(false) const [ready, toggleReady] = useToggle(false)
const difficultyOptions: SelectOption[] = [ const difficultyOptions: SelectOption[] = [
@@ -347,7 +350,7 @@ const showClear = computed(
function clear() { function clear() {
problem.value = null problem.value = null
tags.value = null tags.value = null
// TODO: 这里是 TextEditor 不更新,所以刷一下页面 // 为了给所有状态初始化,刷新页面
location.reload() location.reload()
} }