fix.
This commit is contained in:
126
package-lock.json
generated
126
package-lock.json
generated
@@ -23,10 +23,10 @@
|
||||
"prettier": "^2.8.1",
|
||||
"typescript": "^4.9.4",
|
||||
"unplugin-auto-import": "^0.12.1",
|
||||
"unplugin-icons": "^0.15.0",
|
||||
"unplugin-icons": "^0.15.1",
|
||||
"unplugin-vue-components": "^0.22.12",
|
||||
"vite": "^4.0.4",
|
||||
"vue-tsc": "^1.0.20"
|
||||
"vue-tsc": "^1.0.22"
|
||||
}
|
||||
},
|
||||
"node_modules/@antfu/install-pkg": {
|
||||
@@ -584,41 +584,41 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@volar/language-core": {
|
||||
"version": "1.0.20",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/language-core/-/language-core-1.0.20.tgz",
|
||||
"integrity": "sha512-FU6TC+xQDLkBmp226NTeZ454MTb8VFLga6CIzWP+TsxuxGwB9Exvzof9TKpilIhTdF4IGVJJ4X1aCP6ycnLMbg==",
|
||||
"version": "1.0.22",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/language-core/-/language-core-1.0.22.tgz",
|
||||
"integrity": "sha512-hiJeCOqxNdtG/04FRGLGI9H9DVz2l6cTqPDBzwqplHXAWfMxjzUaGUrn9sfTG7YMFNZUgK4EYxJnRfhqdtbSFQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@volar/source-map": "1.0.20",
|
||||
"@volar/source-map": "1.0.22",
|
||||
"muggle-string": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@volar/source-map": {
|
||||
"version": "1.0.20",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/source-map/-/source-map-1.0.20.tgz",
|
||||
"integrity": "sha512-6wwrvAjuy7HepvHW7CqCw5b57YIFrj9mcfJvjic1WCX9TqjnXAcuHFqiUPid7EdZ4SCRKCYQbWmWreThYbHaZw==",
|
||||
"version": "1.0.22",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/source-map/-/source-map-1.0.22.tgz",
|
||||
"integrity": "sha512-cv4gypHSP4MWVR82ed/+1IpI6794qAl0Q0+KJ+VGMVF8rVugsiF9QbyMCgjel9wNRsssQsazzsf6txOR9vHQiw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"muggle-string": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@volar/typescript": {
|
||||
"version": "1.0.20",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/typescript/-/typescript-1.0.20.tgz",
|
||||
"integrity": "sha512-98D2+rC4igqPL7emqIf0NtIx3UYXZ8xqILiP/ihwP7G2T4oyoGr2vKEOwo49sUzvgUvQl2AI5p8ZQ71mFJfP7w==",
|
||||
"version": "1.0.22",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/typescript/-/typescript-1.0.22.tgz",
|
||||
"integrity": "sha512-VPyEicealSD4gqlE5/UQ1j3ietsO6Hfat40KtUEh/K+XEZ7h02b1KgFV64YEuBkBOaZ5hgvRW/WXKtQgXCl7Iw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@volar/language-core": "1.0.20"
|
||||
"@volar/language-core": "1.0.22"
|
||||
}
|
||||
},
|
||||
"node_modules/@volar/vue-language-core": {
|
||||
"version": "1.0.20",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/vue-language-core/-/vue-language-core-1.0.20.tgz",
|
||||
"integrity": "sha512-Zz6yuxtA6BG6YU8KPwV4qhO5kh3e2Et6+YOu0QC43SiDgjIw2Vzzi+qAqm8UYofg9UBn82OArO1L+VrZPCCK8A==",
|
||||
"version": "1.0.22",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/vue-language-core/-/vue-language-core-1.0.22.tgz",
|
||||
"integrity": "sha512-Ki0G/ZdBj2/GLw+/VVH3n9XR/JL6krMIth02EekFn6JV4PGN3mNxbvoh6lOPSDZLR6biOU5nJPnnjpKy8nuXhw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@volar/language-core": "1.0.20",
|
||||
"@volar/source-map": "1.0.20",
|
||||
"@volar/language-core": "1.0.22",
|
||||
"@volar/source-map": "1.0.22",
|
||||
"@vue/compiler-dom": "^3.2.45",
|
||||
"@vue/compiler-sfc": "^3.2.45",
|
||||
"@vue/reactivity": "^3.2.45",
|
||||
@@ -628,13 +628,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@volar/vue-typescript": {
|
||||
"version": "1.0.20",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/vue-typescript/-/vue-typescript-1.0.20.tgz",
|
||||
"integrity": "sha512-FxucnAIZc503CfkdEGmUSw8EQfT31gi0DST7YmCNBK3cWOqJTF7UaHaBDpejnYGbsB568KZQbWTLNSpid5S/lA==",
|
||||
"version": "1.0.22",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/vue-typescript/-/vue-typescript-1.0.22.tgz",
|
||||
"integrity": "sha512-2T1o5z86PAev31OMtVOv/qp4P3ZVl9ln/2KTmykQE8Fh4A5F+868MW4nf5J7XQ6RNyx7RH9LhzgjvbqJpAfiYw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@volar/typescript": "1.0.20",
|
||||
"@volar/vue-language-core": "1.0.20"
|
||||
"@volar/typescript": "1.0.22",
|
||||
"@volar/vue-language-core": "1.0.22"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/compiler-core": {
|
||||
@@ -1931,14 +1931,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/unplugin-icons": {
|
||||
"version": "0.15.0",
|
||||
"resolved": "https://registry.npmmirror.com/unplugin-icons/-/unplugin-icons-0.15.0.tgz",
|
||||
"integrity": "sha512-/BGtBL8y/2wjey4GLyb0w90mhc9d7XKlewWGMxBPROHS7mR84AV1Y0zDapYK0Q/cc/+u4WUcloreev5cABDa5w==",
|
||||
"version": "0.15.1",
|
||||
"resolved": "https://registry.npmmirror.com/unplugin-icons/-/unplugin-icons-0.15.1.tgz",
|
||||
"integrity": "sha512-d4Gc8A4qIJYIXKueltTwoHfR3Cxsdfnmz8lSN5dsITEyai5tdb0uWpbQkn3j9HUlLDSB1ybdQIf5CItxJT3UDw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@antfu/install-pkg": "^0.1.1",
|
||||
"@antfu/utils": "^0.7.2",
|
||||
"@iconify/utils": "^2.0.3",
|
||||
"@iconify/utils": "^2.0.9",
|
||||
"debug": "^4.3.4",
|
||||
"kolorist": "^1.6.0",
|
||||
"local-pkg": "^0.4.2",
|
||||
@@ -1946,7 +1946,7 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@svgr/core": ">=5.5.0",
|
||||
"@vue/compiler-sfc": "^3.0.2",
|
||||
"@vue/compiler-sfc": "^3.0.2 || ^2.7.0",
|
||||
"vue-template-compiler": "^2.6.12",
|
||||
"vue-template-es2015-compiler": "^1.9.0"
|
||||
},
|
||||
@@ -2090,13 +2090,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/vue-tsc": {
|
||||
"version": "1.0.20",
|
||||
"resolved": "https://registry.npmmirror.com/vue-tsc/-/vue-tsc-1.0.20.tgz",
|
||||
"integrity": "sha512-AApewYXozAD7v4Iz9I0QzQebSVgvlUvpfbGe2e9TwtBdcw5gBsGiX8Oj5BdxRRiGnOdDG3BHPK8msl7Qhmy/1A==",
|
||||
"version": "1.0.22",
|
||||
"resolved": "https://registry.npmmirror.com/vue-tsc/-/vue-tsc-1.0.22.tgz",
|
||||
"integrity": "sha512-xSxwgWR3czhv7sLKHWu6lzj9Xq6AtsCURVL45AY4TLGFszv2L2YlMgygXvqslyCM5bz9cyoIKSaZnzHqHTHjzA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@volar/vue-language-core": "1.0.20",
|
||||
"@volar/vue-typescript": "1.0.20"
|
||||
"@volar/vue-language-core": "1.0.22",
|
||||
"@volar/vue-typescript": "1.0.22"
|
||||
},
|
||||
"bin": {
|
||||
"vue-tsc": "bin/vue-tsc.js"
|
||||
@@ -2462,41 +2462,41 @@
|
||||
"requires": {}
|
||||
},
|
||||
"@volar/language-core": {
|
||||
"version": "1.0.20",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/language-core/-/language-core-1.0.20.tgz",
|
||||
"integrity": "sha512-FU6TC+xQDLkBmp226NTeZ454MTb8VFLga6CIzWP+TsxuxGwB9Exvzof9TKpilIhTdF4IGVJJ4X1aCP6ycnLMbg==",
|
||||
"version": "1.0.22",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/language-core/-/language-core-1.0.22.tgz",
|
||||
"integrity": "sha512-hiJeCOqxNdtG/04FRGLGI9H9DVz2l6cTqPDBzwqplHXAWfMxjzUaGUrn9sfTG7YMFNZUgK4EYxJnRfhqdtbSFQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@volar/source-map": "1.0.20",
|
||||
"@volar/source-map": "1.0.22",
|
||||
"muggle-string": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"@volar/source-map": {
|
||||
"version": "1.0.20",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/source-map/-/source-map-1.0.20.tgz",
|
||||
"integrity": "sha512-6wwrvAjuy7HepvHW7CqCw5b57YIFrj9mcfJvjic1WCX9TqjnXAcuHFqiUPid7EdZ4SCRKCYQbWmWreThYbHaZw==",
|
||||
"version": "1.0.22",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/source-map/-/source-map-1.0.22.tgz",
|
||||
"integrity": "sha512-cv4gypHSP4MWVR82ed/+1IpI6794qAl0Q0+KJ+VGMVF8rVugsiF9QbyMCgjel9wNRsssQsazzsf6txOR9vHQiw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"muggle-string": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"@volar/typescript": {
|
||||
"version": "1.0.20",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/typescript/-/typescript-1.0.20.tgz",
|
||||
"integrity": "sha512-98D2+rC4igqPL7emqIf0NtIx3UYXZ8xqILiP/ihwP7G2T4oyoGr2vKEOwo49sUzvgUvQl2AI5p8ZQ71mFJfP7w==",
|
||||
"version": "1.0.22",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/typescript/-/typescript-1.0.22.tgz",
|
||||
"integrity": "sha512-VPyEicealSD4gqlE5/UQ1j3ietsO6Hfat40KtUEh/K+XEZ7h02b1KgFV64YEuBkBOaZ5hgvRW/WXKtQgXCl7Iw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@volar/language-core": "1.0.20"
|
||||
"@volar/language-core": "1.0.22"
|
||||
}
|
||||
},
|
||||
"@volar/vue-language-core": {
|
||||
"version": "1.0.20",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/vue-language-core/-/vue-language-core-1.0.20.tgz",
|
||||
"integrity": "sha512-Zz6yuxtA6BG6YU8KPwV4qhO5kh3e2Et6+YOu0QC43SiDgjIw2Vzzi+qAqm8UYofg9UBn82OArO1L+VrZPCCK8A==",
|
||||
"version": "1.0.22",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/vue-language-core/-/vue-language-core-1.0.22.tgz",
|
||||
"integrity": "sha512-Ki0G/ZdBj2/GLw+/VVH3n9XR/JL6krMIth02EekFn6JV4PGN3mNxbvoh6lOPSDZLR6biOU5nJPnnjpKy8nuXhw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@volar/language-core": "1.0.20",
|
||||
"@volar/source-map": "1.0.20",
|
||||
"@volar/language-core": "1.0.22",
|
||||
"@volar/source-map": "1.0.22",
|
||||
"@vue/compiler-dom": "^3.2.45",
|
||||
"@vue/compiler-sfc": "^3.2.45",
|
||||
"@vue/reactivity": "^3.2.45",
|
||||
@@ -2506,13 +2506,13 @@
|
||||
}
|
||||
},
|
||||
"@volar/vue-typescript": {
|
||||
"version": "1.0.20",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/vue-typescript/-/vue-typescript-1.0.20.tgz",
|
||||
"integrity": "sha512-FxucnAIZc503CfkdEGmUSw8EQfT31gi0DST7YmCNBK3cWOqJTF7UaHaBDpejnYGbsB568KZQbWTLNSpid5S/lA==",
|
||||
"version": "1.0.22",
|
||||
"resolved": "https://registry.npmmirror.com/@volar/vue-typescript/-/vue-typescript-1.0.22.tgz",
|
||||
"integrity": "sha512-2T1o5z86PAev31OMtVOv/qp4P3ZVl9ln/2KTmykQE8Fh4A5F+868MW4nf5J7XQ6RNyx7RH9LhzgjvbqJpAfiYw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@volar/typescript": "1.0.20",
|
||||
"@volar/vue-language-core": "1.0.20"
|
||||
"@volar/typescript": "1.0.22",
|
||||
"@volar/vue-language-core": "1.0.22"
|
||||
}
|
||||
},
|
||||
"@vue/compiler-core": {
|
||||
@@ -3515,14 +3515,14 @@
|
||||
}
|
||||
},
|
||||
"unplugin-icons": {
|
||||
"version": "0.15.0",
|
||||
"resolved": "https://registry.npmmirror.com/unplugin-icons/-/unplugin-icons-0.15.0.tgz",
|
||||
"integrity": "sha512-/BGtBL8y/2wjey4GLyb0w90mhc9d7XKlewWGMxBPROHS7mR84AV1Y0zDapYK0Q/cc/+u4WUcloreev5cABDa5w==",
|
||||
"version": "0.15.1",
|
||||
"resolved": "https://registry.npmmirror.com/unplugin-icons/-/unplugin-icons-0.15.1.tgz",
|
||||
"integrity": "sha512-d4Gc8A4qIJYIXKueltTwoHfR3Cxsdfnmz8lSN5dsITEyai5tdb0uWpbQkn3j9HUlLDSB1ybdQIf5CItxJT3UDw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@antfu/install-pkg": "^0.1.1",
|
||||
"@antfu/utils": "^0.7.2",
|
||||
"@iconify/utils": "^2.0.3",
|
||||
"@iconify/utils": "^2.0.9",
|
||||
"debug": "^4.3.4",
|
||||
"kolorist": "^1.6.0",
|
||||
"local-pkg": "^0.4.2",
|
||||
@@ -3602,13 +3602,13 @@
|
||||
}
|
||||
},
|
||||
"vue-tsc": {
|
||||
"version": "1.0.20",
|
||||
"resolved": "https://registry.npmmirror.com/vue-tsc/-/vue-tsc-1.0.20.tgz",
|
||||
"integrity": "sha512-AApewYXozAD7v4Iz9I0QzQebSVgvlUvpfbGe2e9TwtBdcw5gBsGiX8Oj5BdxRRiGnOdDG3BHPK8msl7Qhmy/1A==",
|
||||
"version": "1.0.22",
|
||||
"resolved": "https://registry.npmmirror.com/vue-tsc/-/vue-tsc-1.0.22.tgz",
|
||||
"integrity": "sha512-xSxwgWR3czhv7sLKHWu6lzj9Xq6AtsCURVL45AY4TLGFszv2L2YlMgygXvqslyCM5bz9cyoIKSaZnzHqHTHjzA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@volar/vue-language-core": "1.0.20",
|
||||
"@volar/vue-typescript": "1.0.20"
|
||||
"@volar/vue-language-core": "1.0.22",
|
||||
"@volar/vue-typescript": "1.0.22"
|
||||
}
|
||||
},
|
||||
"webpack-sources": {
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
"prettier": "^2.8.1",
|
||||
"typescript": "^4.9.4",
|
||||
"unplugin-auto-import": "^0.12.1",
|
||||
"unplugin-icons": "^0.15.0",
|
||||
"unplugin-icons": "^0.15.1",
|
||||
"unplugin-vue-components": "^0.22.12",
|
||||
"vite": "^4.0.4",
|
||||
"vue-tsc": "^1.0.20"
|
||||
"vue-tsc": "^1.0.22"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
<script lang="ts" setup>
|
||||
import loader, { Monaco } from "@monaco-editor/loader"
|
||||
import { ref, onBeforeUnmount, onMounted, watch, reactive } from "vue"
|
||||
import { onBeforeRouteLeave, useRoute } from "vue-router"
|
||||
import {
|
||||
buildProblemCodeKey,
|
||||
LANGUAGE,
|
||||
languageLabel,
|
||||
languageValue,
|
||||
LANGUAGE_LABEL,
|
||||
LANGUAGE_VALUE,
|
||||
SOURCES,
|
||||
} from "../../../utils/constants"
|
||||
import storage from "../../../utils/storage"
|
||||
|
||||
const route = useRoute()
|
||||
const { languages, template } = defineProps<{
|
||||
const { problem } = defineProps<{
|
||||
problem: {
|
||||
languages: Array<LANGUAGE>
|
||||
template: { [key in LANGUAGE]?: string }
|
||||
}
|
||||
}>()
|
||||
|
||||
const state = reactive({
|
||||
value: "",
|
||||
language: languages[0] || "C",
|
||||
theme: "vs",
|
||||
values: ref({ ...SOURCES }),
|
||||
language: problem.languages[0] || "C",
|
||||
})
|
||||
|
||||
const monacoEditorRef = ref()
|
||||
@@ -27,78 +25,52 @@ const monacoEditorRef = ref()
|
||||
let monaco: Monaco
|
||||
|
||||
function reset() {
|
||||
state.values[state.language] =
|
||||
problem.template[state.language] || SOURCES[state.language]
|
||||
if (monaco && monaco.editor) {
|
||||
monaco.editor.getModels()[0].setValue(template[state.language] || "")
|
||||
monaco.editor.getModels()[0].setValue(state.values[state.language])
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
initValue()
|
||||
initEditor()
|
||||
init()
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
monaco.editor.getModels().forEach((model) => model.dispose())
|
||||
})
|
||||
|
||||
onBeforeRouteLeave(() => {
|
||||
const key = buildProblemCodeKey(
|
||||
route.params.problemID as string,
|
||||
route.params.contestID as string
|
||||
)
|
||||
storage.set(key, {
|
||||
code: state.value,
|
||||
language: state.language,
|
||||
theme: state.theme,
|
||||
})
|
||||
})
|
||||
|
||||
watch(
|
||||
() => state.language,
|
||||
() => {
|
||||
if (monaco && monaco.editor) {
|
||||
monaco.editor.setModelLanguage(
|
||||
monaco.editor.getModels()[0],
|
||||
languageValue[state.language]
|
||||
LANGUAGE_VALUE[state.language]
|
||||
)
|
||||
reset()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
function initValue() {
|
||||
const key = buildProblemCodeKey(
|
||||
route.params.problemID as string,
|
||||
route.params.contestID as string
|
||||
)
|
||||
const problemCode = storage.get(key)
|
||||
if (problemCode) {
|
||||
state.value = problemCode.code
|
||||
state.language = problemCode.language
|
||||
state.theme = problemCode.theme
|
||||
}
|
||||
if (!state.value && template[state.language]) {
|
||||
state.value = template[state.language] || ""
|
||||
}
|
||||
}
|
||||
async function init() {
|
||||
state.values[state.language] =
|
||||
problem.template[state.language] || SOURCES[state.language]
|
||||
|
||||
async function initEditor() {
|
||||
monaco = await loader.init()
|
||||
monaco.editor.create(monacoEditorRef.value, {
|
||||
value: state.value, // 编辑器初始显示文字
|
||||
language: languageValue[state.language],
|
||||
value: state.values[state.language], // 编辑器初始显示文字
|
||||
language: LANGUAGE_VALUE[state.language],
|
||||
automaticLayout: true, // 自适应布局
|
||||
theme: state.theme, // 官方自带三种主题vs, hc-black, or vs-dark
|
||||
theme: "vs", // 官方自带三种主题vs, hc-black, or vs-dark
|
||||
minimap: {
|
||||
enabled: false,
|
||||
},
|
||||
fontSize: 24, // 字体大小
|
||||
scrollBeyondLastLine: false, // 取消代码后面一大段空白
|
||||
overviewRulerBorder: false, // 不要滚动条的边框
|
||||
})
|
||||
// 监听值的变化
|
||||
monaco.editor.getModels()[0].onDidChangeContent(() => {
|
||||
console.log(1)
|
||||
state.value = monaco.editor.getModels()[0].getValue()
|
||||
state.values[state.language] = monaco.editor.getModels()[0].getValue()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@@ -108,10 +80,10 @@ async function initEditor() {
|
||||
<el-form-item label="语言" label-width="60">
|
||||
<el-select v-model="state.language" class="language">
|
||||
<el-option
|
||||
v-for="item in languages"
|
||||
v-for="item in problem.languages"
|
||||
:key="item"
|
||||
:value="item"
|
||||
:label="languageLabel[item]"
|
||||
:label="LANGUAGE_LABEL[item]"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
@@ -139,7 +111,7 @@ async function initEditor() {
|
||||
}
|
||||
|
||||
.editor {
|
||||
height: 500px;
|
||||
height: 70%;
|
||||
}
|
||||
.actions {
|
||||
margin-top: 16px;
|
||||
|
||||
@@ -11,7 +11,7 @@ const contestID = route.params.contestID as string
|
||||
const problemID = route.params.problemID as string
|
||||
|
||||
const problem = ref({
|
||||
_id: 0,
|
||||
_id: "",
|
||||
created_by: {},
|
||||
io_mode: {},
|
||||
languages: [],
|
||||
@@ -33,7 +33,7 @@ onMounted(() => {
|
||||
|
||||
<template>
|
||||
<el-row v-if="problem._id">
|
||||
<el-col :span="14">
|
||||
<el-col :span="12">
|
||||
<el-tabs type="border-card">
|
||||
<el-tab-pane label="题目描述">
|
||||
<ProblemContent :problem="problem" />
|
||||
@@ -45,8 +45,8 @@ onMounted(() => {
|
||||
<el-tab-pane label="提交情况">3</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<Editor :languages="problem.languages" :template="problem.template" />
|
||||
<el-col :span="12">
|
||||
<Editor :problem="problem" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
export const cSource =
|
||||
'#include<stdio.h>\r\n\r\nint main()\r\n{\r\n printf("黄岩一职");\r\n return 0;\r\n}'
|
||||
export const cppSource =
|
||||
'#include<iostream>\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n cout<<"黄岩一职"<<endl;\r\n return 0;\r\n}'
|
||||
export const pythonSource = 'print("黄岩一职")'
|
||||
export const javaSource =
|
||||
'public class Main {\r\n public static void main(String[] args) {\r\n System.out.println("黄岩一职");\r\n }\r\n}'
|
||||
|
||||
export const sources = {
|
||||
50: cSource,
|
||||
54: cppSource,
|
||||
62: javaSource,
|
||||
71: pythonSource,
|
||||
}
|
||||
|
||||
export const language = {
|
||||
50: "c",
|
||||
54: "cpp",
|
||||
62: "java",
|
||||
71: "python",
|
||||
}
|
||||
|
||||
export const deadResults = {
|
||||
50: {
|
||||
encoded:
|
||||
"I2luY2x1ZGU8c3RkaW8uaD4NCg0KaW50IG1haW4oKQ0Kew0KICAgIHByaW50Zigi6buE5bKp5LiA6IGMIik7DQogICAgcmV0dXJuIDA7DQp9",
|
||||
result: {
|
||||
status: 3,
|
||||
output: "黄岩一职",
|
||||
},
|
||||
},
|
||||
54: {
|
||||
encoded:
|
||||
"I2luY2x1ZGU8aW9zdHJlYW0+DQoNCnVzaW5nIG5hbWVzcGFjZSBzdGQ7DQoNCmludCBtYWluKCkNCnsNCiAgICBjb3V0PDwi6buE5bKp5LiA6IGMIjw8ZW5kbDsNCiAgICByZXR1cm4gMDsNCn0=",
|
||||
result: {
|
||||
status: 3,
|
||||
output: "黄岩一职",
|
||||
},
|
||||
},
|
||||
71: {
|
||||
encoded: "cHJpbnQoIum7hOWyqeS4gOiBjCIp",
|
||||
result: {
|
||||
status: 3,
|
||||
output: "黄岩一职",
|
||||
},
|
||||
},
|
||||
62: {
|
||||
encoded:
|
||||
"cHVibGljIGNsYXNzIE1haW4gew0KICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpIHsNCiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCLpu4TlsqnkuIDogYwiKTsNCiAgICB9DQp9",
|
||||
result: {
|
||||
status: 3,
|
||||
output: "黄岩一职",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -143,7 +143,69 @@ export function buildProblemCodeKey(problemID: string, contestID = "") {
|
||||
return `${STORAGE_KEY.PROBLEM_CODE}_NaN_${problemID}`
|
||||
}
|
||||
|
||||
export const languageLabel = {
|
||||
const cSource =
|
||||
'#include<stdio.h>\r\n\r\nint main()\r\n{\r\n printf("黄岩一职");\r\n return 0;\r\n}'
|
||||
const cppSource =
|
||||
'#include<iostream>\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n cout<<"黄岩一职"<<endl;\r\n return 0;\r\n}'
|
||||
const pythonSource = 'print("黄岩一职")'
|
||||
const javaSource =
|
||||
'public class Main {\r\n public static void main(String[] args) {\r\n System.out.println("黄岩一职");\r\n }\r\n}'
|
||||
|
||||
export const SOURCES = {
|
||||
C: cSource,
|
||||
"C++": cppSource,
|
||||
Java: javaSource,
|
||||
Python3: pythonSource,
|
||||
Python2: "",
|
||||
JavaScript: "",
|
||||
Golang: "",
|
||||
}
|
||||
|
||||
export const LANGUAGE_ID = {
|
||||
C: 50,
|
||||
"C++": 54,
|
||||
Java: 62,
|
||||
Python3: 71,
|
||||
Python2: 0,
|
||||
JavaScript: 0,
|
||||
Golang: 0,
|
||||
}
|
||||
|
||||
export const DEAD_RESULTS = {
|
||||
C: {
|
||||
encoded:
|
||||
"I2luY2x1ZGU8c3RkaW8uaD4NCg0KaW50IG1haW4oKQ0Kew0KICAgIHByaW50Zigi6buE5bKp5LiA6IGMIik7DQogICAgcmV0dXJuIDA7DQp9",
|
||||
result: {
|
||||
status: 3,
|
||||
output: "黄岩一职",
|
||||
},
|
||||
},
|
||||
"C++": {
|
||||
encoded:
|
||||
"I2luY2x1ZGU8aW9zdHJlYW0+DQoNCnVzaW5nIG5hbWVzcGFjZSBzdGQ7DQoNCmludCBtYWluKCkNCnsNCiAgICBjb3V0PDwi6buE5bKp5LiA6IGMIjw8ZW5kbDsNCiAgICByZXR1cm4gMDsNCn0=",
|
||||
result: {
|
||||
status: 3,
|
||||
output: "黄岩一职",
|
||||
},
|
||||
},
|
||||
Java: {
|
||||
encoded:
|
||||
"cHVibGljIGNsYXNzIE1haW4gew0KICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpIHsNCiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCLpu4TlsqnkuIDogYwiKTsNCiAgICB9DQp9",
|
||||
result: {
|
||||
status: 3,
|
||||
output: "黄岩一职",
|
||||
},
|
||||
},
|
||||
Python3: {
|
||||
encoded: "cHJpbnQoIum7hOWyqeS4gOiBjCIp",
|
||||
result: {
|
||||
status: 3,
|
||||
output: "黄岩一职",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export const LANGUAGE_LABEL = {
|
||||
C: "C",
|
||||
"C++": "C++",
|
||||
Java: "Java",
|
||||
@@ -153,9 +215,9 @@ export const languageLabel = {
|
||||
Golang: "Go",
|
||||
}
|
||||
|
||||
export type LANGUAGE = keyof typeof languageLabel
|
||||
export type LANGUAGE = keyof typeof LANGUAGE_LABEL
|
||||
|
||||
export const languageValue = {
|
||||
export const LANGUAGE_VALUE = {
|
||||
C: "c",
|
||||
"C++": "cpp",
|
||||
Java: "java",
|
||||
|
||||
Reference in New Issue
Block a user