This commit is contained in:
2023-02-10 12:32:46 +08:00
parent c106f4bb5f
commit a1d657fe8d
9 changed files with 1417 additions and 2081 deletions

View File

@@ -83,7 +83,6 @@ declare global {
const refThrottled: typeof import('@vueuse/core')['refThrottled']
const refWithControl: typeof import('@vueuse/core')['refWithControl']
const resolveComponent: typeof import('vue')['resolveComponent']
const resolveDirective: typeof import('vue')['resolveDirective']
const resolveRef: typeof import('@vueuse/core')['resolveRef']
const resolveUnref: typeof import('@vueuse/core')['resolveUnref']
const setActivePinia: typeof import('pinia')['setActivePinia']
@@ -214,6 +213,7 @@ declare global {
const usePreferredDark: typeof import('@vueuse/core')['usePreferredDark']
const usePreferredLanguages: typeof import('@vueuse/core')['usePreferredLanguages']
const usePreferredReducedMotion: typeof import('@vueuse/core')['usePreferredReducedMotion']
const usePrevious: typeof import('@vueuse/core')['usePrevious']
const useRafFn: typeof import('@vueuse/core')['useRafFn']
const useRefHistory: typeof import('@vueuse/core')['useRefHistory']
const useResizeObserver: typeof import('@vueuse/core')['useResizeObserver']
@@ -282,3 +282,8 @@ declare global {
const watchWithFilter: typeof import('@vueuse/core')['watchWithFilter']
const whenever: typeof import('@vueuse/core')['whenever']
}
// for type re-export
declare global {
// @ts-ignore
export type { Component,ComponentPublicInstance,ComputedRef,InjectionKey,PropType,Ref,VNode } from 'vue'
}

View File

@@ -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="🎉 本 题 已 经 被 你 解 决 啦"
/>

View File

@@ -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="搜索">

View File

@@ -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>

View File

@@ -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>

View File

@@ -63,7 +63,7 @@ function goSignup() {
v-model:value="form.username"
autofocus
clearable
name="username"
name="login username"
/>
</n-form-item>
<n-form-item label="密码" path="password">
@@ -71,7 +71,7 @@ function goSignup() {
v-model:value="form.password"
clearable
type="password"
name="password"
name="login password"
@change="submit"
/>
</n-form-item>

View File

@@ -36,14 +36,14 @@ function submit() {}
v-model:value="form.username"
autofocus
clearable
name="username"
name="signup username"
/>
</n-form-item>
<n-form-item label="邮箱" path="email">
<n-input
v-model:value="form.email"
clearable
name="email"
name="signup email"
@change="submit"
/>
</n-form-item>
@@ -52,7 +52,7 @@ function submit() {}
v-model:value="form.password"
clearable
type="password"
name="password"
name="signup password"
/>
</n-form-item>
<n-form-item label="确认密码" path="password">
@@ -60,7 +60,7 @@ function submit() {}
v-model:value="form.passwordAgain"
clearable
type="password"
name="passwordAgain"
name="signup password again"
/>
</n-form-item>
<n-alert v-if="msg" type="error" :show-icon="false"> {{ msg }}</n-alert>