fix.
This commit is contained in:
@@ -20,15 +20,12 @@ type Sample = Problem["samples"][number] & {
|
||||
|
||||
const props = defineProps<Props>()
|
||||
const route = useRoute()
|
||||
const contestID = <string>route.params.contestID
|
||||
const theme = useThemeVars()
|
||||
const style = computed(() => "color: " + theme.value.primaryColor)
|
||||
const solved = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
if (contestID) {
|
||||
checkSubmisson()
|
||||
}
|
||||
if (route.params.contestID) checkSubmission()
|
||||
})
|
||||
|
||||
const samples = ref<Sample[]>(
|
||||
@@ -50,7 +47,7 @@ const disabled = computed(
|
||||
)
|
||||
)
|
||||
|
||||
async function checkSubmisson() {
|
||||
async function checkSubmission() {
|
||||
const res = await submissionExists(props.problem.id)
|
||||
solved.value = res.data
|
||||
}
|
||||
@@ -97,7 +94,7 @@ const type = (status: ProblemStatus) =>
|
||||
|
||||
<template>
|
||||
<n-alert
|
||||
v-if="problem.my_status === 0 || (contestID && solved)"
|
||||
v-if="problem.my_status === 0 || (route.params.contestID && solved)"
|
||||
type="success"
|
||||
title="🎉 本 题 已 经 被 你 解 决 啦"
|
||||
/>
|
||||
|
||||
@@ -166,7 +166,6 @@ function rowProps(row: ProblemFiltered) {
|
||||
class="select"
|
||||
v-model:value="query.tag"
|
||||
:options="tagOptions"
|
||||
clearable
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item label="搜索">
|
||||
|
||||
@@ -67,7 +67,7 @@ onMounted(init)
|
||||
</n-alert>
|
||||
<n-card embedded>
|
||||
<n-space justify="end">
|
||||
<n-button @click="handleCopy(submission!.code)">
|
||||
<n-button type="primary" @click="handleCopy(submission!.code)">
|
||||
{{ copied ? "已复制" : "复制代码" }}
|
||||
</n-button>
|
||||
</n-space>
|
||||
@@ -78,7 +78,11 @@ onMounted(init)
|
||||
show-line-numbers
|
||||
/>
|
||||
</n-card>
|
||||
<n-data-table :columns="columns" :data="submission.info.data" />
|
||||
<n-data-table
|
||||
v-if="submission.info"
|
||||
:columns="columns"
|
||||
:data="submission.info.data"
|
||||
/>
|
||||
</n-space>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -118,28 +118,33 @@ const columns = computed(() => {
|
||||
{
|
||||
title: "提交时间",
|
||||
key: "create_time",
|
||||
width: 180,
|
||||
width: 200,
|
||||
render: (row) =>
|
||||
parseTime(
|
||||
row.create_time,
|
||||
isDesktop ? "YYYY-M-D hh:mm:ss" : "M-D hh:mm"
|
||||
isDesktop ? "YYYY-MM-DD hh:mm:ss" : "M-D hh:mm"
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "编号",
|
||||
key: "id",
|
||||
render: (row) =>
|
||||
h(
|
||||
NButton,
|
||||
{
|
||||
text: true,
|
||||
type: "info",
|
||||
onClick: () => {
|
||||
if (row.show_link) router.push("/submission/" + row.id)
|
||||
render: (row) => {
|
||||
if (row.show_link) {
|
||||
return h(
|
||||
NButton,
|
||||
{
|
||||
text: true,
|
||||
type: "info",
|
||||
onClick: () => {
|
||||
router.push("/submission/" + row.id)
|
||||
},
|
||||
},
|
||||
},
|
||||
() => row.id.slice(0, 12)
|
||||
),
|
||||
() => row.id.slice(0, 12)
|
||||
)
|
||||
} else {
|
||||
return row.id.slice(0, 12)
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
@@ -157,7 +162,18 @@ const columns = computed(() => {
|
||||
{
|
||||
text: true,
|
||||
type: "info",
|
||||
onClick: () => router.push("/problem/" + row.problem),
|
||||
onClick: () => {
|
||||
if (route.name === "contest submissions") {
|
||||
router.push({
|
||||
name: "contest problem",
|
||||
params: {
|
||||
problemID: row.problem,
|
||||
},
|
||||
})
|
||||
} else {
|
||||
router.push("/problem/" + row.problem)
|
||||
}
|
||||
},
|
||||
},
|
||||
() => row.problem
|
||||
),
|
||||
@@ -215,7 +231,7 @@ const columns = computed(() => {
|
||||
v-model:value="query.username"
|
||||
@change="search"
|
||||
clearable
|
||||
placeholder="输入后回车或点击搜索"
|
||||
placeholder="输入用户后回车或点击搜索"
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item>
|
||||
|
||||
Reference in New Issue
Block a user