fix.
This commit is contained in:
@@ -14,7 +14,12 @@ const contestStore = useContestStore()
|
||||
:show-arrow="false"
|
||||
>
|
||||
<template #trigger>
|
||||
<n-button>比赛信息</n-button>
|
||||
<n-button>
|
||||
<template #icon>
|
||||
<i-ep-warning />
|
||||
</template>
|
||||
比赛信息
|
||||
</n-button>
|
||||
</template>
|
||||
<div v-html="contestStore.contest.description"></div>
|
||||
<n-descriptions bordered label-placement="left" :column="1">
|
||||
|
||||
@@ -24,12 +24,11 @@ function getCurrentType(name: string): "primary" | "default" {
|
||||
return "default"
|
||||
}
|
||||
|
||||
const options = computed<DropdownOption[]>(() => [
|
||||
const options: DropdownOption[] = [
|
||||
{ label: "比赛题目", key: "problems" },
|
||||
{ label: "提交信息", key: "submissions" },
|
||||
{ label: "比赛排名", key: "rank" },
|
||||
{ label: "管理员助手", key: "helper", show: contestStore.isContestAdmin },
|
||||
])
|
||||
]
|
||||
</script>
|
||||
<template>
|
||||
<div v-if="contestMenuVisible">
|
||||
@@ -46,13 +45,6 @@ const options = computed<DropdownOption[]>(() => [
|
||||
<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-else :options="options" trigger="click" @select="goto">
|
||||
<n-button>菜单</n-button>
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
<script lang="ts" setup>
|
||||
const columns: DataTableColumn[] = [
|
||||
{ title: "AC 时间", key: "ac_time" },
|
||||
{ title: "问题 ID", key: "problem_display_id" },
|
||||
{ title: "一血", key: "is_first_ac" },
|
||||
{ title: "用户名", key: "username" },
|
||||
{ title: "状态", key: "status" },
|
||||
{ title: "选项", key: "actions" },
|
||||
]
|
||||
</script>
|
||||
<template>
|
||||
<n-data-table :columns="columns"></n-data-table>
|
||||
</template>
|
||||
@@ -17,17 +17,19 @@ code.language = props.problem.languages[0] || "C"
|
||||
code.value = props.problem.template[code.language] || SOURCES[code.language]
|
||||
|
||||
const editorHeight = computed(() =>
|
||||
isDesktop.value ? "calc(100vh - 150px)" : "calc(100vh - 200px)"
|
||||
isDesktop.value ? "calc(100vh - 133px)" : "calc(100vh - 180px)"
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Form :problem="props.problem" />
|
||||
<CodeEditor
|
||||
v-model="code.value"
|
||||
:language="code.language"
|
||||
:height="editorHeight"
|
||||
/>
|
||||
<n-space vertical>
|
||||
<Form :problem="props.problem" />
|
||||
<CodeEditor
|
||||
v-model="code.value"
|
||||
:language="code.language"
|
||||
:height="editorHeight"
|
||||
/>
|
||||
</n-space>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
|
||||
@@ -39,6 +39,7 @@ function goEdit() {
|
||||
const menu: DropdownOption[] = [
|
||||
{ label: "重置", key: "reset" },
|
||||
{ label: "提交信息", key: "submissions" },
|
||||
{ label: "自测猫", key: "testcat" },
|
||||
]
|
||||
|
||||
const options: DropdownOption[] = props.problem.languages.map((it) => ({
|
||||
@@ -65,22 +66,21 @@ function select(key: string) {
|
||||
case "submissions":
|
||||
goSubmissions()
|
||||
break
|
||||
case "testcat":
|
||||
goTestCat()
|
||||
break
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<n-form inline label-placement="left">
|
||||
<n-form-item>
|
||||
<n-select
|
||||
class="language"
|
||||
v-model:value="code.language"
|
||||
:options="options"
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item>
|
||||
<Submit />
|
||||
</n-form-item>
|
||||
<n-space>
|
||||
<n-select
|
||||
class="language"
|
||||
v-model:value="code.language"
|
||||
:options="options"
|
||||
/>
|
||||
<Submit />
|
||||
<n-dropdown
|
||||
v-if="isMobile"
|
||||
trigger="click"
|
||||
@@ -95,17 +95,17 @@ function select(key: string) {
|
||||
</template>
|
||||
</n-button>
|
||||
</n-dropdown>
|
||||
<n-form-item v-if="isDesktop">
|
||||
<n-space>
|
||||
<n-button @click="reset">重置</n-button>
|
||||
<n-button @click="goSubmissions">提交信息</n-button>
|
||||
<n-button type="info" @click="goTestCat">自测猫</n-button>
|
||||
<n-button type="warning" v-if="userStore.isSuperAdmin" @click="goEdit">
|
||||
编辑
|
||||
</n-button>
|
||||
</n-space>
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
<n-button v-if="isDesktop" @click="reset">重置</n-button>
|
||||
<n-button v-if="isDesktop" @click="goSubmissions">提交信息</n-button>
|
||||
<n-button v-if="isDesktop" type="info" @click="goTestCat">自测猫</n-button>
|
||||
<n-button
|
||||
type="warning"
|
||||
v-if="isDesktop && userStore.isSuperAdmin"
|
||||
@click="goEdit"
|
||||
>
|
||||
编辑
|
||||
</n-button>
|
||||
</n-space>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -91,6 +91,7 @@ function type(status: ProblemStatus) {
|
||||
|
||||
<template>
|
||||
<n-alert
|
||||
class="success"
|
||||
v-if="problem.my_status === 0"
|
||||
type="success"
|
||||
title="🎉 本 题 已 经 被 你 解 决 啦"
|
||||
@@ -98,7 +99,7 @@ function type(status: ProblemStatus) {
|
||||
|
||||
<n-space align="center">
|
||||
<n-tag>{{ problem._id }}</n-tag>
|
||||
<h1>{{ problem.title }}</h1>
|
||||
<h1 class="problemTitle">{{ problem.title }}</h1>
|
||||
</n-space>
|
||||
<p class="title" :style="style">描述</p>
|
||||
<div class="content" v-html="problem.description"></div>
|
||||
@@ -161,9 +162,13 @@ function type(status: ProblemStatus) {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.problemTitle {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 20px;
|
||||
margin: 24px 0 16px 0;
|
||||
margin: 12px 0;
|
||||
}
|
||||
|
||||
.testcaseTitle {
|
||||
@@ -179,4 +184,8 @@ function type(status: ProblemStatus) {
|
||||
font-size: 14px;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.success {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
38
src/oj/rank/components/Index.vue
Normal file
38
src/oj/rank/components/Index.vue
Normal file
@@ -0,0 +1,38 @@
|
||||
<script lang="ts" setup>
|
||||
interface Props {
|
||||
page: number
|
||||
limit: number
|
||||
index: number
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
const index = computed(() => props.index + (props.page - 1) * props.limit + 1)
|
||||
const color = computed(() => {
|
||||
if (index.value === 1) return "#FFD700"
|
||||
if (index.value === 2) return "#C0C0C0"
|
||||
if (index.value === 3) return "rgb(191,173,111)"
|
||||
return ""
|
||||
})
|
||||
const tooltip = computed(() => {
|
||||
if (index.value === 1) return "🏅 金牌"
|
||||
if (index.value === 2) return "🥈 银牌"
|
||||
if (index.value === 3) return "🥉 铜牌"
|
||||
return ""
|
||||
})
|
||||
</script>
|
||||
<template>
|
||||
<span v-if="index > 3">{{ index }}</span>
|
||||
<n-tooltip v-else>
|
||||
<template #trigger>
|
||||
<n-icon class="icon" size="20">
|
||||
<i-ep-medal :color="color" />
|
||||
</n-icon>
|
||||
</template>
|
||||
{{ tooltip }}
|
||||
</n-tooltip>
|
||||
</template>
|
||||
<style scoped>
|
||||
.icon {
|
||||
transform: translateY(4px);
|
||||
}
|
||||
</style>
|
||||
@@ -5,6 +5,7 @@ import Pagination from "~/shared/Pagination.vue"
|
||||
import { Rank } from "utils/types"
|
||||
import { getRank } from "oj/api"
|
||||
import { getACRate } from "utils/functions"
|
||||
import Index from "./components/Index.vue"
|
||||
|
||||
const router = useRouter()
|
||||
const data = ref<Rank[]>([])
|
||||
@@ -29,9 +30,10 @@ const columns: DataTableColumn<Rank>[] = [
|
||||
{
|
||||
title: "排名",
|
||||
key: "index",
|
||||
width: 100,
|
||||
width: 80,
|
||||
align: "center",
|
||||
render: (_, index) =>
|
||||
h("span", {}, index + (query.page - 1) * query.limit + 1),
|
||||
h(Index, { index, page: query.page, limit: query.limit }),
|
||||
},
|
||||
{
|
||||
title: "用户",
|
||||
|
||||
Reference in New Issue
Block a user