fix submission.
This commit is contained in:
@@ -24,7 +24,7 @@ const editorHeight = computed(() =>
|
||||
<template>
|
||||
<Form :problem="props.problem" />
|
||||
<CodeEditor
|
||||
v-model:value="code.value"
|
||||
v-model="code.value"
|
||||
:language="code.language"
|
||||
:height="editorHeight"
|
||||
/>
|
||||
|
||||
@@ -63,6 +63,22 @@ async function test(sample: Sample, index: number) {
|
||||
return sample
|
||||
}
|
||||
})
|
||||
|
||||
const id = setTimeout(() => {
|
||||
clearTimeout(id)
|
||||
samples.value = samples.value.map((sample) => {
|
||||
if (sample.id === index) {
|
||||
return {
|
||||
...sample,
|
||||
msg: res.output,
|
||||
status: "not_test",
|
||||
loading: false,
|
||||
}
|
||||
} else {
|
||||
return sample
|
||||
}
|
||||
})
|
||||
}, 2000)
|
||||
}
|
||||
|
||||
function label(status: ProblemStatus, loading: boolean) {
|
||||
@@ -108,19 +124,14 @@ function 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-tooltip trigger="hover">
|
||||
<template #trigger>
|
||||
<n-button
|
||||
size="small"
|
||||
:type="type(sample.status)"
|
||||
:disabled="disabled"
|
||||
@click="test(sample, index)"
|
||||
>
|
||||
{{ label(sample.status, sample.loading) }}
|
||||
</n-button>
|
||||
</template>
|
||||
点击测试
|
||||
</n-tooltip>
|
||||
<n-button
|
||||
size="small"
|
||||
:type="type(sample.status)"
|
||||
:disabled="disabled"
|
||||
@click="test(sample, index)"
|
||||
>
|
||||
{{ label(sample.status, sample.loading) }}
|
||||
</n-button>
|
||||
</n-space>
|
||||
<n-descriptions
|
||||
bordered
|
||||
@@ -145,7 +156,7 @@ function type(status: ProblemStatus) {
|
||||
</template>
|
||||
<div class="testcase">{{ sample.output }}</div>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item label="运行结果" v-if="sample.status === 'failed'">
|
||||
<n-descriptions-item label="运行结果" v-if="sample.msg">
|
||||
<div class="testcase">{{ sample.msg }}</div>
|
||||
</n-descriptions-item>
|
||||
</n-descriptions>
|
||||
|
||||
@@ -13,9 +13,9 @@ import { Submission } from "utils/types"
|
||||
import { adminRejudge, getSubmissions } from "oj/api"
|
||||
import { isDesktop } from "~/shared/composables/breakpoints"
|
||||
import { useUserStore } from "~/shared/store/user"
|
||||
import { useConfigStore } from "~/shared/store/config"
|
||||
|
||||
interface Query {
|
||||
problem: string
|
||||
username: string
|
||||
result: string
|
||||
limit: number
|
||||
@@ -26,12 +26,12 @@ interface Query {
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore()
|
||||
const configStore = useConfigStore()
|
||||
const message = useMessage()
|
||||
|
||||
const submissions = ref([])
|
||||
const total = ref(0)
|
||||
const query = reactive<Query>({
|
||||
problem: <string>route.query.problem ?? "",
|
||||
result: <string>route.query.result ?? "",
|
||||
page: parseInt(<string>route.query.page) || 1,
|
||||
limit: parseInt(<string>route.query.limit) || 10,
|
||||
@@ -48,6 +48,7 @@ const options: SelectOption[] = [
|
||||
]
|
||||
|
||||
async function listSubmissions() {
|
||||
query.problem = <string>route.query.problem ?? ""
|
||||
query.result = <string>route.query.result ?? ""
|
||||
query.page = parseInt(<string>route.query.page) || 1
|
||||
query.limit = parseInt(<string>route.query.limit) || 10
|
||||
|
||||
Reference in New Issue
Block a user