fix contest info.

This commit is contained in:
2023-02-10 10:45:36 +08:00
parent c80352b245
commit 951b4c768e
4 changed files with 326 additions and 324 deletions

View File

@@ -2,7 +2,6 @@
import { parseTime } from "utils/functions"
import { useContestStore } from "oj/store/contest"
import ContestTypeVue from "./ContestType.vue"
import { isDesktop } from "~/shared/composables/breakpoints"
const contestStore = useContestStore()
</script>
@@ -17,7 +16,8 @@ const contestStore = useContestStore()
<template #trigger>
<n-button>比赛信息</n-button>
</template>
<n-descriptions bordered :column="isDesktop ? 4 : 1">
<div v-html="contestStore.contest.description"></div>
<n-descriptions bordered label-placement="left" :column="1">
<n-descriptions-item label="开始时间">
{{
parseTime(contestStore.contest.start_time, "YYYY年M月D日 hh:mm:ss")

View File

@@ -14,7 +14,7 @@ const isPrivate = computed(
</script>
<template>
<n-tag :type="isPrivate ? 'error' : 'default'">
<n-tag :type="isPrivate ? 'error' : 'info'">
{{ isPrivate ? "需要密码" : "公开" }}
</n-tag>
</template>

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { CONTEST_STATUS, ContestType } from "utils/constants"
import { CONTEST_STATUS } from "utils/constants"
import { isDesktop, isMobile } from "~/shared/composables/breakpoints"
import { useContestStore } from "../store/contest"
import { DropdownOption } from "naive-ui"
@@ -17,7 +17,7 @@ onMounted(() => contestStore.init(props.contestID))
const contestMenuVisible = computed(() => {
if (contestStore.isContestAdmin) return true
if (contestStore.contest?.contest_type === ContestType.public) {
if (!contestStore.isPrivate) {
// TODO:这里没有完成
}
return contestStore.access
@@ -25,7 +25,7 @@ const contestMenuVisible = computed(() => {
const passwordFormVisible = computed(
() =>
contestStore.contest?.contest_type === ContestType.private &&
contestStore.isPrivate &&
!contestStore.access &&
!contestStore.isContestAdmin
)
@@ -49,56 +49,54 @@ const options = computed<DropdownOption[]>(() => [
<template>
<div v-if="contestStore.contest">
<n-space align="center" justify="space-between">
<n-space class="title" align="center" justify="space-between">
<n-space align="center">
<n-tag :type="CONTEST_STATUS[contestStore.contest.status]['type']">
{{ CONTEST_STATUS[contestStore.contest.status]["name"] }}
</n-tag>
<h2 class="contestTitle">{{ contestStore.contest.title }}</h2>
<n-icon
v-if="contestStore.contest.contest_type === ContestType.private"
class="lockIcon"
>
<n-icon v-if="contestStore.isPrivate" class="lockIcon">
<i-ep-lock />
</n-icon>
</n-space>
<n-space v-if="contestMenuVisible">
<n-space>
<ContestInfo />
<n-space v-if="isDesktop">
<n-button
:type="getCurrentType('problems')"
@click="goto('problems')"
<div v-if="contestMenuVisible">
<n-space v-if="isDesktop">
<n-button
:type="getCurrentType('problems')"
@click="goto('problems')"
>
比赛题目
</n-button>
<n-button
:type="getCurrentType('submissions')"
@click="goto('submissions')"
>
提交信息
</n-button>
<n-button :type="getCurrentType('rank')" @click="goto('rank')">
比赛排名
</n-button>
<n-button
v-if="contestStore.isContestAdmin"
:type="getCurrentType('helper')"
@click="goto('helper')"
>
管理员助手
</n-button>
</n-space>
<n-dropdown
v-if="isMobile"
:options="options"
trigger="click"
@select="goto"
>
比赛题目
</n-button>
<n-button
:type="getCurrentType('submissions')"
@click="goto('submissions')"
>
提交信息
</n-button>
<n-button :type="getCurrentType('rank')" @click="goto('rank')">
比赛排名
</n-button>
<n-button
v-if="contestStore.isContestAdmin"
:type="getCurrentType('helper')"
@click="goto('helper')"
>
管理员助手
</n-button>
</n-space>
<n-dropdown
v-if="isMobile"
:options="options"
trigger="click"
@select="goto"
>
<n-button>菜单</n-button>
</n-dropdown>
<n-button>菜单</n-button>
</n-dropdown>
</div>
</n-space>
</n-space>
<div v-html="contestStore.contest.description"></div>
<n-form
:inline="isDesktop"
label-placement="left"
@@ -125,6 +123,10 @@ const options = computed<DropdownOption[]>(() => [
</template>
<style scoped>
.title {
margin-bottom: 16px;
}
.contestTitle {
font-weight: 500;
margin: 0;