This commit is contained in:
2023-04-07 12:32:55 +08:00
parent 285459e129
commit efc9413ce6
6 changed files with 105 additions and 97 deletions

View File

@@ -129,7 +129,7 @@ export async function getContestProblems(contestID: string) {
export function getContestRank( export function getContestRank(
contestID: string, contestID: string,
query: { limit: number; offset: number } query: { limit: number; offset: number; force_refresh: "1" | "0" }
) { ) {
return http.get("contest_rank", { return http.get("contest_rank", {
params: { params: {

View File

@@ -29,7 +29,7 @@ const passwordFormVisible = computed(
</script> </script>
<template> <template>
<n-space vertical v-if="contestStore.contest"> <n-space vertical size="large" v-if="contestStore.contest">
<n-space align="center" justify="space-between"> <n-space align="center" justify="space-between">
<n-space align="center"> <n-space align="center">
<h2 class="contestTitle">{{ contestStore.contest.title }}</h2> <h2 class="contestTitle">{{ contestStore.contest.title }}</h2>

View File

@@ -119,6 +119,7 @@ function rowProps(row: Contest) {
} }
</script> </script>
<template> <template>
<n-space vertical size="large">
<n-space> <n-space>
<n-form :show-feedback="false" label-placement="left" inline> <n-form :show-feedback="false" label-placement="left" inline>
<n-form-item label="比赛状态"> <n-form-item label="比赛状态">
@@ -132,7 +133,7 @@ function rowProps(row: Contest) {
<n-input clearable @change="search" /> <n-input clearable @change="search" />
</n-form-item> </n-form-item>
</n-form> </n-form>
<n-form label-placement="left" inline> <n-form :show-feedback="false" label-placement="left" inline>
<n-form-item> <n-form-item>
<n-space> <n-space>
<n-button @click="search(query.keyword)">搜索</n-button> <n-button @click="search(query.keyword)">搜索</n-button>
@@ -141,7 +142,13 @@ function rowProps(row: Contest) {
</n-form-item> </n-form-item>
</n-form> </n-form>
</n-space> </n-space>
<n-data-table striped :columns="columns" :data="data" :row-props="rowProps" /> <n-data-table
striped
:columns="columns"
:data="data"
:row-props="rowProps"
/>
</n-space>
<Pagination <Pagination
v-model:limit="query.limit" v-model:limit="query.limit"
v-model:page="query.page" v-model:page="query.page"

View File

@@ -70,6 +70,7 @@ async function listRanks() {
const res = await getContestRank(props.contestID, { const res = await getContestRank(props.contestID, {
limit: query.limit, limit: query.limit,
offset: query.limit * (query.page - 1), offset: query.limit * (query.page - 1),
force_refresh: "0",
}) })
total.value = res.data.total total.value = res.data.total
data.value = res.data.results data.value = res.data.results
@@ -81,7 +82,7 @@ async function listRanks() {
async function addColumns() { async function addColumns() {
try { try {
problems.value = await getContestProblems(props.contestID) problems.value = await getContestProblems(props.contestID)
problems.value.map((problem, index) => { problems.value.map((problem) => {
columns.value.push({ columns.value.push({
align: "center", align: "center",
title: () => title: () =>
@@ -99,7 +100,7 @@ async function addColumns() {
}, },
}), }),
}, },
() => `${index + 1}` () => problem.title
), ),
render: (row) => { render: (row) => {
if (row.submission_info[problem.id]) { if (row.submission_info[problem.id]) {
@@ -138,6 +139,7 @@ async function addColumns() {
}, },
key: problem.id, key: problem.id,
width: 150, width: 150,
ellipsis: true,
}) })
}) })
} catch (err) { } catch (err) {

View File

@@ -168,6 +168,7 @@ function rowProps(row: ProblemFiltered) {
</script> </script>
<template> <template>
<n-space vertical size="large">
<n-space> <n-space>
<n-form :show-feedback="false" inline label-placement="left"> <n-form :show-feedback="false" inline label-placement="left">
<n-form-item label="难度"> <n-form-item label="难度">
@@ -181,7 +182,7 @@ function rowProps(row: ProblemFiltered) {
<n-input clearable @change="search" /> <n-input clearable @change="search" />
</n-form-item> </n-form-item>
</n-form> </n-form>
<n-form inline label-placement="left"> <n-form :show-feedback="false" inline label-placement="left">
<n-form-item> <n-form-item>
<n-space> <n-space>
<n-button @click="search(query.keyword)">搜索</n-button> <n-button @click="search(query.keyword)">搜索</n-button>
@@ -205,12 +206,12 @@ function rowProps(row: ProblemFiltered) {
</n-button> </n-button>
</n-space> </n-space>
<n-data-table <n-data-table
class="table"
striped striped
:data="problems" :data="problems"
:columns="columns" :columns="columns"
:row-props="rowProps" :row-props="rowProps"
/> />
</n-space>
<Pagination <Pagination
:total="total" :total="total"
v-model:limit="query.limit" v-model:limit="query.limit"
@@ -226,8 +227,4 @@ function rowProps(row: ProblemFiltered) {
.select { .select {
width: 120px; width: 120px;
} }
.table {
margin-top: 24px;
}
</style> </style>

View File

@@ -230,6 +230,7 @@ const columns = computed(() => {
}) })
</script> </script>
<template> <template>
<n-space vertical size="large">
<n-space> <n-space>
<n-form :show-feedback="false" inline label-placement="left"> <n-form :show-feedback="false" inline label-placement="left">
<n-form-item label="提交状态"> <n-form-item label="提交状态">
@@ -243,7 +244,7 @@ const columns = computed(() => {
<n-switch v-model:value="query.myself" /> <n-switch v-model:value="query.myself" />
</n-form-item> </n-form-item>
</n-form> </n-form>
<n-form inline label-placement="left"> <n-form :show-feedback="false" inline label-placement="left">
<n-form-item label="搜索用户"> <n-form-item label="搜索用户">
<n-input clearable @change="search" /> <n-input clearable @change="search" />
</n-form-item> </n-form-item>
@@ -256,6 +257,7 @@ const columns = computed(() => {
</n-form> </n-form>
</n-space> </n-space>
<n-data-table striped :columns="columns" :data="submissions" /> <n-data-table striped :columns="columns" :data="submissions" />
</n-space>
<Pagination <Pagination
:total="total" :total="total"
v-model:limit="query.limit" v-model:limit="query.limit"