remove contest helper.
This commit is contained in:
54
src/oj/contest/components/ContestMenu.vue
Normal file
54
src/oj/contest/components/ContestMenu.vue
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { DropdownOption } from "naive-ui"
|
||||||
|
import { useContestStore } from "oj/store/contest"
|
||||||
|
import { isDesktop } from "~/shared/composables/breakpoints"
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
const router = useRouter()
|
||||||
|
const contestStore = useContestStore()
|
||||||
|
|
||||||
|
const contestMenuVisible = computed(() => {
|
||||||
|
if (contestStore.isContestAdmin) return true
|
||||||
|
if (!contestStore.isPrivate) {
|
||||||
|
// TODO:这里没有完成
|
||||||
|
}
|
||||||
|
return contestStore.access
|
||||||
|
})
|
||||||
|
|
||||||
|
function goto(name: string) {
|
||||||
|
router.push({ name: "contest " + name })
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCurrentType(name: string): "primary" | "default" {
|
||||||
|
if (route.name === "contest " + name) return "primary"
|
||||||
|
return "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
const options: DropdownOption[] = [
|
||||||
|
{ label: "比赛题目", key: "problems" },
|
||||||
|
{ label: "提交信息", key: "submissions" },
|
||||||
|
{ label: "比赛排名", key: "rank" },
|
||||||
|
]
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<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-space>
|
||||||
|
<n-dropdown v-else :options="options" trigger="click" @select="goto">
|
||||||
|
<n-button>菜单</n-button>
|
||||||
|
</n-dropdown>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<style scoped></style>
|
||||||
@@ -1,50 +1,25 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { CONTEST_STATUS } from "utils/constants"
|
import { CONTEST_STATUS } from "utils/constants"
|
||||||
import { isDesktop, isMobile } from "~/shared/composables/breakpoints"
|
import { isDesktop } from "~/shared/composables/breakpoints"
|
||||||
import { useContestStore } from "../store/contest"
|
import { useContestStore } from "../store/contest"
|
||||||
import { DropdownOption } from "naive-ui"
|
|
||||||
import ContestInfo from "./components/ContestInfo.vue"
|
import ContestInfo from "./components/ContestInfo.vue"
|
||||||
|
import ContestMenu from "./components/ContestMenu.vue"
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
contestID: string
|
contestID: string
|
||||||
}>()
|
}>()
|
||||||
const contestStore = useContestStore()
|
const contestStore = useContestStore()
|
||||||
const route = useRoute()
|
|
||||||
const router = useRouter()
|
|
||||||
const password = ref("")
|
const password = ref("")
|
||||||
|
|
||||||
onMounted(() => contestStore.init(props.contestID))
|
onMounted(() => contestStore.init(props.contestID))
|
||||||
|
|
||||||
const contestMenuVisible = computed(() => {
|
|
||||||
if (contestStore.isContestAdmin) return true
|
|
||||||
if (!contestStore.isPrivate) {
|
|
||||||
// TODO:这里没有完成
|
|
||||||
}
|
|
||||||
return contestStore.access
|
|
||||||
})
|
|
||||||
|
|
||||||
const passwordFormVisible = computed(
|
const passwordFormVisible = computed(
|
||||||
() =>
|
() =>
|
||||||
contestStore.isPrivate &&
|
contestStore.isPrivate &&
|
||||||
!contestStore.access &&
|
!contestStore.access &&
|
||||||
!contestStore.isContestAdmin
|
!contestStore.isContestAdmin
|
||||||
)
|
)
|
||||||
|
|
||||||
function goto(name: string) {
|
|
||||||
router.push({ name: "contest " + name })
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCurrentType(name: string): "primary" | "default" {
|
|
||||||
if (route.name === "contest " + name) return "primary"
|
|
||||||
return "default"
|
|
||||||
}
|
|
||||||
|
|
||||||
const options = computed<DropdownOption[]>(() => [
|
|
||||||
{ label: "比赛题目", key: "problems" },
|
|
||||||
{ label: "提交信息", key: "submissions" },
|
|
||||||
{ label: "比赛排名", key: "rank" },
|
|
||||||
{ label: "管理员助手", key: "helper", show: contestStore.isContestAdmin },
|
|
||||||
])
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -61,40 +36,7 @@ const options = computed<DropdownOption[]>(() => [
|
|||||||
</n-space>
|
</n-space>
|
||||||
<n-space>
|
<n-space>
|
||||||
<ContestInfo />
|
<ContestInfo />
|
||||||
<div v-if="contestMenuVisible">
|
<ContestMenu />
|
||||||
<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>
|
|
||||||
</n-dropdown>
|
|
||||||
</div>
|
|
||||||
</n-space>
|
</n-space>
|
||||||
</n-space>
|
</n-space>
|
||||||
<n-form
|
<n-form
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
<script setup lang="ts"></script>
|
|
||||||
|
|
||||||
<template></template>
|
|
||||||
|
|
||||||
<style scoped></style>
|
|
||||||
@@ -56,13 +56,6 @@ export const routes: RouteRecordRaw[] = [
|
|||||||
meta: { requiresAuth: true },
|
meta: { requiresAuth: true },
|
||||||
name: "contest rank",
|
name: "contest rank",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: "helper",
|
|
||||||
component: () => import("oj/contest/pages/helper.vue"),
|
|
||||||
props: true,
|
|
||||||
meta: { requiresAuth: true },
|
|
||||||
name: "contest helper",
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user