use ojtest for test api.

This commit is contained in:
2023-01-08 10:04:41 +08:00
parent bb70ae2200
commit 7bea386dbc
4 changed files with 14 additions and 9 deletions

View File

@@ -7,7 +7,7 @@ import {
LANGUAGE_VALUE, LANGUAGE_VALUE,
SOURCES, SOURCES,
} from "../../../utils/constants" } from "../../../utils/constants"
import { isDesktop } from "../../../utils/breakpoints" import { isMobile } from "../../../utils/breakpoints"
const { problem } = defineProps<{ const { problem } = defineProps<{
problem: { problem: {
@@ -19,6 +19,7 @@ const { problem } = defineProps<{
const state = reactive({ const state = reactive({
values: ref({ ...SOURCES }), values: ref({ ...SOURCES }),
language: problem.languages[0] || "C", language: problem.languages[0] || "C",
isMobile,
}) })
const monacoEditorRef = ref() const monacoEditorRef = ref()
@@ -69,7 +70,7 @@ async function init() {
lineNumbersMinChars: 3, lineNumbersMinChars: 3,
automaticLayout: true, // 自适应布局 automaticLayout: true, // 自适应布局
tabSize: 4, tabSize: 4,
fontSize: 24, // 字体大小 fontSize: state.isMobile ? 16 : 24, // 字体大小
scrollBeyondLastLine: false, // 取消代码后面一大段空白 scrollBeyondLastLine: false, // 取消代码后面一大段空白
}) })
monaco.editor.getModels()[0].onDidChangeContent(() => { monaco.editor.getModels()[0].onDidChangeContent(() => {
@@ -97,7 +98,7 @@ async function init() {
</el-form> </el-form>
<div <div
ref="monacoEditorRef" ref="monacoEditorRef"
:class="isDesktop ? 'editor' : 'editorMobile'" :class="isMobile ? 'editorMobile' : 'editor'"
></div> ></div>
<el-tabs type="border-card"> <el-tabs type="border-card">
<el-tab-pane label="测试用例"> 1 </el-tab-pane> <el-tab-pane label="测试用例"> 1 </el-tab-pane>

View File

@@ -36,7 +36,7 @@ onMounted(() => {
<el-row v-if="problem._id"> <el-row v-if="problem._id">
<el-col :span="isDesktop ? 12 : 24"> <el-col :span="isDesktop ? 12 : 24">
<el-tabs type="border-card"> <el-tabs type="border-card">
<el-tab-pane label="题目描述" lazy> <el-tab-pane label="题目描述">
<el-scrollbar v-if="isDesktop" height="calc(100vh - 171px)" noresize> <el-scrollbar v-if="isDesktop" height="calc(100vh - 171px)" noresize>
<ProblemContent :problem="problem" /> <ProblemContent :problem="problem" />
</el-scrollbar> </el-scrollbar>
@@ -52,10 +52,14 @@ onMounted(() => {
<el-tab-pane label="提交情况">3</el-tab-pane> <el-tab-pane label="提交情况">3</el-tab-pane>
</el-tabs> </el-tabs>
</el-col> </el-col>
<el-col v-if="isDesktop" :span="12"> <el-col v-if="isDesktop" :span="12" class="editorWrapper">
<Editor :problem="problem" /> <Editor :problem="problem" />
</el-col> </el-col>
</el-row> </el-row>
</template> </template>
<style scoped></style> <style scoped>
.editorWrapper {
height: calc(100vh - 171px);
}
</style>

View File

@@ -63,10 +63,10 @@ function goSignup() {
label-position="right" label-position="right"
label-width="70px" label-width="70px"
> >
<el-form-item label="用户名" required prop="username"> <el-form-item label="用户名" required prop="username" name="username">
<el-input v-model="form.username"></el-input> <el-input v-model="form.username"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="密码" required prop="password"> <el-form-item label="密码" required prop="password" name="password">
<el-input <el-input
v-model="form.password" v-model="form.password"
type="password" type="password"

View File

@@ -6,7 +6,7 @@ import { ElementPlusResolver } from "unplugin-vue-components/resolvers"
import IconsResolver from "unplugin-icons/resolver" import IconsResolver from "unplugin-icons/resolver"
import Icons from "unplugin-icons/vite" import Icons from "unplugin-icons/vite"
const url = "https://oj.hyyz.izhai.net" const url = "https://ojtest.hyyz.izhai.net"
const proxyConfig = { const proxyConfig = {
target: url, target: url,
changeOrigin: true, changeOrigin: true,