把自测猫搬进来了

This commit is contained in:
2024-07-04 20:17:44 +08:00
parent 6b457f5aae
commit 3a53ee0846
6 changed files with 171 additions and 30 deletions

View File

@@ -6,6 +6,7 @@ import { problem } from "../composables/problem"
import { ScreenMode } from "utils/constants"
const Editor = defineAsyncComponent(() => import("./components/Editor.vue"))
const EditorWithTest = defineAsyncComponent(() => import("./components/EditorWithTest.vue"))
const ProblemContent = defineAsyncComponent(
() => import("./components/ProblemContent.vue"),
)
@@ -30,18 +31,12 @@ const props = withDefaults(defineProps<Props>(), {
const errMsg = ref("无数据")
const onlyDetail = computed(
const bothAndProblem = computed(
() =>
screenMode.value === ScreenMode.both ||
screenMode.value === ScreenMode.problem,
)
const onlyCode = computed(
() =>
screenMode.value === ScreenMode.both ||
screenMode.value === ScreenMode.code,
)
async function init() {
try {
const res = await getProblem(props.problemID, props.contestID)
@@ -66,7 +61,7 @@ onBeforeUnmount(() => {
x-gap="16"
:cols="screenMode === ScreenMode.both ? 2 : 1"
>
<n-gi :span="isDesktop ? 1 : 2" v-show="onlyDetail">
<n-gi :span="isDesktop ? 1 : 2" v-if="bothAndProblem">
<n-scrollbar v-if="isDesktop" style="max-height: calc(100vh - 92px)">
<n-tabs default-value="content" type="segment">
<n-tab-pane name="content" tab="题目描述">
@@ -101,8 +96,11 @@ onBeforeUnmount(() => {
</n-tab-pane>
</n-tabs>
</n-gi>
<n-gi v-if="isDesktop" v-show="onlyCode">
<Editor />
<n-gi v-if="isDesktop && screenMode === ScreenMode.both">
<Editor/>
</n-gi>
<n-gi v-if="isDesktop && screenMode === ScreenMode.code">
<EditorWithTest />
</n-gi>
</n-grid>
<n-empty v-else :description="errMsg"></n-empty>