From 9ff2edeecfb7249acbd1931ac8246d8e8d697357 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Mon, 30 Mar 2026 05:56:52 -0600 Subject: [PATCH] add rank --- src/api.ts | 1 + src/pages/Submissions.vue | 36 +++++++++++++++++++++++++++++++++++- src/utils/type.ts | 1 + 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/api.ts b/src/api.ts index a447f28..612d4e4 100644 --- a/src/api.ts +++ b/src/api.ts @@ -176,6 +176,7 @@ export const Submission = { username?: string user_id?: number flag?: string | null + zone?: string task_id?: number task_type?: string score_min?: number diff --git a/src/pages/Submissions.vue b/src/pages/Submissions.vue index 5fdd05f..af3a419 100644 --- a/src/pages/Submissions.vue +++ b/src/pages/Submissions.vue @@ -24,6 +24,17 @@ :options="flagFilterOptions" @update:value="handleFlagSelect" /> + import { computed, h, onMounted, onUnmounted, reactive, ref, watch } from "vue" -import { NButton, NDataTable, type DataTableColumn } from "naive-ui" +import { NButton, NDataTable, NTag, type DataTableColumn } from "naive-ui" import { Icon } from "@iconify/vue" import { Submission } from "../api" import type { SubmissionOut, FlagType } from "../utils/type" @@ -125,6 +136,7 @@ const query = reactive({ ? "" : (route.query.username ?? "")) as string, flag: null as string | null, + zone: null as string | null, }) // 当前选中提交的代码 @@ -208,6 +220,21 @@ const columns: DataTableColumn[] = [ "onUpdate:flag": (flag: FlagType) => updateFlag(row, flag), }), }, + { + title: "", + key: "zone", + width: 42, + render: (row) => { + const map: Record = { + featured: { label: "精", type: "success" }, + pending: { label: "评", type: "default" }, + low: { label: "改", type: "warning" }, + } + if (!row.zone || !map[row.zone]) return null + const { label, type } = map[row.zone] + return h(NTag, { size: "small", round: true, type }, () => label) + }, + }, { title: "时间", key: "created", @@ -348,6 +375,13 @@ watch( init() }, ) +watch( + () => query.zone, + () => { + query.page = 1 + init() + }, +) onMounted(init) onUnmounted(() => { diff --git a/src/utils/type.ts b/src/utils/type.ts index e585153..1adb629 100644 --- a/src/utils/type.ts +++ b/src/utils/type.ts @@ -79,6 +79,7 @@ export interface SubmissionOut { my_score: number conversation_id?: string flag?: FlagType + zone?: "featured" | "low" | "pending" | null submit_count: number created: Date modified: Date