修改后台目录和创建比赛的时间设置
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { Icon } from "@iconify/vue"
|
||||
import { CONTEST_STATUS } from "utils/constants"
|
||||
import { CONTEST_STATUS, ContestStatus } from "utils/constants"
|
||||
import { isDesktop } from "~/shared/composables/breakpoints"
|
||||
import { useContestStore } from "../store/contest"
|
||||
import ContestInfo from "./components/ContestInfo.vue"
|
||||
@@ -21,13 +21,20 @@ async function check() {
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => contestStore.contestStatus,
|
||||
(nv, ov) => {
|
||||
if (nv === ContestStatus.underway && ov == ContestStatus.not_started) {
|
||||
contestStore.init(props.contestID)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
contestStore.init(props.contestID)
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
contestStore.clear()
|
||||
})
|
||||
onBeforeUnmount(contestStore.clear)
|
||||
|
||||
const passwordFormVisible = computed(
|
||||
() =>
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
import { Icon } from "@iconify/vue"
|
||||
import { problem } from "oj/composables/problem"
|
||||
import { DIFFICULTY, JUDGE_STATUS } from "utils/constants"
|
||||
import { getACRate, getTagColor, parseTime } from "utils/functions"
|
||||
import { getACRateNumber, getTagColor, parseTime } from "utils/functions"
|
||||
import { Pie } from "vue-chartjs"
|
||||
import { getProblemBeatRate } from "~/oj/api"
|
||||
import { isDesktop } from "~/shared/composables/breakpoints"
|
||||
|
||||
const beatRate = ref("0%")
|
||||
const beatRate = ref("0")
|
||||
|
||||
const data = computed(() => {
|
||||
const status = problem.value!.statistic_info
|
||||
@@ -32,24 +32,28 @@ const numbers = computed(() => {
|
||||
icon: "streamline-emojis:scroll",
|
||||
title: problem.value?.submission_number ?? 0,
|
||||
content: "总提交",
|
||||
suffix: "",
|
||||
},
|
||||
{
|
||||
icon: "streamline-emojis:woman-raising-hand-2",
|
||||
title: problem.value?.accepted_number ?? 0,
|
||||
content: "通过数",
|
||||
suffix: "",
|
||||
},
|
||||
{
|
||||
icon: "emojione:chart-increasing",
|
||||
title: getACRate(
|
||||
title: getACRateNumber(
|
||||
problem.value?.accepted_number ?? 0,
|
||||
problem.value?.submission_number ?? 0,
|
||||
),
|
||||
content: "通过率",
|
||||
suffix: "%",
|
||||
},
|
||||
{
|
||||
icon: "streamline-emojis:sparkles",
|
||||
title: beatRate.value,
|
||||
title: Number(beatRate.value),
|
||||
content: "你击败的用户",
|
||||
suffix: "%",
|
||||
},
|
||||
]
|
||||
})
|
||||
@@ -98,12 +102,15 @@ onMounted(getBeatRate)
|
||||
</n-descriptions-item>
|
||||
</n-descriptions>
|
||||
<n-grid :cols="isDesktop ? 4 : 2" :x-gap="10" :y-gap="10" class="cards">
|
||||
<n-gi v-for="item in numbers" :key="item.title">
|
||||
<n-gi v-for="item in numbers" :key="item.content">
|
||||
<n-card hoverable>
|
||||
<n-flex align="center">
|
||||
<Icon :icon="item.icon" width="40" />
|
||||
<div>
|
||||
<n-h2 class="number">{{ item.title }}</n-h2>
|
||||
<n-h2 class="number">
|
||||
<n-number-animation :to="item.title" />
|
||||
<span v-if="item.suffix">{{ item.suffix }}</span>
|
||||
</n-h2>
|
||||
<n-h4 class="number-label">{{ item.content }}</n-h4>
|
||||
</div>
|
||||
</n-flex>
|
||||
|
||||
@@ -20,8 +20,9 @@ export const useContestStore = defineStore("contest", () => {
|
||||
let timer = 0
|
||||
|
||||
const contestStatus = computed<ContestStatus>(() => {
|
||||
const start = getTime(parseISO(contest.value!.start_time.toString()))
|
||||
const end = getTime(parseISO(contest.value!.end_time.toString()))
|
||||
if (!contest.value) return ContestStatus.initial
|
||||
const start = getTime(parseISO(contest.value.start_time.toString()))
|
||||
const end = getTime(parseISO(contest.value.end_time.toString()))
|
||||
if (start > now.value) {
|
||||
return ContestStatus.not_started
|
||||
} else if (end < now.value) {
|
||||
|
||||
@@ -79,11 +79,13 @@ const metrics = computed(() => {
|
||||
icon: "fluent-emoji:candy",
|
||||
title: profile.value?.accepted_number ?? 0,
|
||||
content: "已解决的题目数量",
|
||||
animate: true,
|
||||
},
|
||||
{
|
||||
icon: "fluent-emoji:thinking-face",
|
||||
title: profile.value?.submission_number ?? 0,
|
||||
content: "总提交数量",
|
||||
animate: true,
|
||||
},
|
||||
]
|
||||
})
|
||||
@@ -110,13 +112,16 @@ onMounted(init)
|
||||
:x-gap="10"
|
||||
:y-gap="10"
|
||||
>
|
||||
<n-gi v-for="item in metrics" :key="item.title">
|
||||
<n-gi v-for="item in metrics" :key="item.content">
|
||||
<n-card hoverable>
|
||||
<n-flex align="center">
|
||||
<Icon v-if="isDesktop" :icon="item.icon" width="50" />
|
||||
<div>
|
||||
<Component :is="isDesktop ? NH2 : NH3" class="number">
|
||||
{{ item.title }}
|
||||
<n-number-animation v-if="item.animate" :to="item.title" />
|
||||
<template v-else>
|
||||
{{ item.title }}
|
||||
</template>
|
||||
</Component>
|
||||
<n-h4 class="number-label">{{ item.content }}</n-h4>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user