batch update.
This commit is contained in:
@@ -2,17 +2,17 @@
|
||||
import { SOURCES } from "utils/constants"
|
||||
import { Problem } from "utils/types"
|
||||
import Monaco from "~/shared/Monaco.vue"
|
||||
import Submit from "./Submit.vue"
|
||||
import { code } from "oj/composables/code"
|
||||
import { isDesktop, isMobile } from "~/shared/composables/breakpoints"
|
||||
import { DropdownOption } from "naive-ui"
|
||||
|
||||
const Submit = defineAsyncComponent(() => import("./Submit.vue"))
|
||||
|
||||
interface Props {
|
||||
problem: Problem
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
code.language = props.problem.languages[0] || "C"
|
||||
@@ -27,8 +27,10 @@ function reset() {
|
||||
function change(value: string) {
|
||||
code.value = value
|
||||
}
|
||||
|
||||
function goSubmissions() {
|
||||
router.push(`/submission?problem=${props.problem._id}`)
|
||||
const name = !!route.params.contestID ? "contest submissions" : "submissions"
|
||||
router.push({ name, query: { problem: props.problem._id } })
|
||||
}
|
||||
const options: DropdownOption[] = props.problem.languages.map((it) => ({
|
||||
label: () => [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { Flag, CloseBold, Select } from "@element-plus/icons-vue"
|
||||
import { Promotion, CloseBold, Select } from "@element-plus/icons-vue"
|
||||
import Copy from "~/shared/Copy.vue"
|
||||
import { code } from "oj/composables/code"
|
||||
import { SOURCES } from "utils/constants"
|
||||
@@ -83,13 +83,13 @@ async function test(sample: Sample, index: number) {
|
||||
|
||||
const icon = (status: ProblemStatus) =>
|
||||
({
|
||||
not_test: Flag,
|
||||
not_test: Promotion,
|
||||
failed: CloseBold,
|
||||
passed: Select,
|
||||
}[status])
|
||||
const type = (status: ProblemStatus) =>
|
||||
({
|
||||
not_test: "warning",
|
||||
not_test: "",
|
||||
failed: "error",
|
||||
passed: "success",
|
||||
}[status] as "warning" | "error" | "success")
|
||||
@@ -120,17 +120,22 @@ const type = (status: ProblemStatus) =>
|
||||
<div v-for="(sample, index) of samples" :key="index">
|
||||
<n-space align="center">
|
||||
<p class="title testcaseTitle" :style="style">测试用例 {{ index + 1 }}</p>
|
||||
<n-button
|
||||
:type="type(sample.status)"
|
||||
:disabled="disabled"
|
||||
:loading="sample.loading"
|
||||
circle
|
||||
@click="test(sample, index)"
|
||||
>
|
||||
<template #icon>
|
||||
<component :is="icon(sample.status)"></component>
|
||||
<n-tooltip trigger="hover">
|
||||
<template #trigger>
|
||||
<n-button
|
||||
:type="type(sample.status)"
|
||||
:disabled="disabled"
|
||||
:loading="sample.loading"
|
||||
circle
|
||||
@click="test(sample, index)"
|
||||
>
|
||||
<template #icon>
|
||||
<component :is="icon(sample.status)"></component>
|
||||
</template>
|
||||
</n-button>
|
||||
</template>
|
||||
</n-button>
|
||||
点击测试
|
||||
</n-tooltip>
|
||||
</n-space>
|
||||
<n-descriptions
|
||||
bordered
|
||||
|
||||
@@ -22,7 +22,7 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
const problem = ref<Problem>()
|
||||
|
||||
async function init() {
|
||||
const res = await getProblem(props.problemID)
|
||||
const res = await getProblem(props.problemID, props.contestID)
|
||||
problem.value = res.data
|
||||
}
|
||||
onMounted(init)
|
||||
@@ -42,11 +42,6 @@ provide("problem", readonly(problem))
|
||||
<n-tab-pane v-if="isMobile" name="editor" tab="代码编辑">
|
||||
<Editor :problem="problem" />
|
||||
</n-tab-pane>
|
||||
<n-tab-pane
|
||||
name="contest"
|
||||
tab="比赛信息"
|
||||
v-if="props.contestID"
|
||||
></n-tab-pane>
|
||||
<n-tab-pane name="info" tab="题目信息">
|
||||
<ProblemInfo :problem="problem" />
|
||||
</n-tab-pane>
|
||||
|
||||
Reference in New Issue
Block a user