add rank
Some checks failed
Deploy / deploy (build, debian, 22) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822) (push) Has been cancelled

This commit is contained in:
2026-03-30 05:56:52 -06:00
parent 35dbfda52c
commit 9ff2edeecf
3 changed files with 37 additions and 1 deletions

View File

@@ -176,6 +176,7 @@ export const Submission = {
username?: string username?: string
user_id?: number user_id?: number
flag?: string | null flag?: string | null
zone?: string
task_id?: number task_id?: number
task_type?: string task_type?: string
score_min?: number score_min?: number

View File

@@ -24,6 +24,17 @@
:options="flagFilterOptions" :options="flagFilterOptions"
@update:value="handleFlagSelect" @update:value="handleFlagSelect"
/> />
<n-select
v-model:value="query.zone"
style="width: 100px"
clearable
placeholder="分区"
:options="[
{ label: '夯', value: 'featured' },
{ label: 'NPC', value: 'pending' },
{ label: '拉', value: 'low' },
]"
/>
<n-input <n-input
style="width: 120px" style="width: 120px"
v-model:value="query.username" v-model:value="query.username"
@@ -90,7 +101,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, h, onMounted, onUnmounted, reactive, ref, watch } from "vue" 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 { Icon } from "@iconify/vue"
import { Submission } from "../api" import { Submission } from "../api"
import type { SubmissionOut, FlagType } from "../utils/type" import type { SubmissionOut, FlagType } from "../utils/type"
@@ -125,6 +136,7 @@ const query = reactive({
? "" ? ""
: (route.query.username ?? "")) as string, : (route.query.username ?? "")) as string,
flag: null as string | null, flag: null as string | null,
zone: null as string | null,
}) })
// 当前选中提交的代码 // 当前选中提交的代码
@@ -208,6 +220,21 @@ const columns: DataTableColumn<SubmissionOut>[] = [
"onUpdate:flag": (flag: FlagType) => updateFlag(row, flag), "onUpdate:flag": (flag: FlagType) => updateFlag(row, flag),
}), }),
}, },
{
title: "",
key: "zone",
width: 42,
render: (row) => {
const map: Record<string, { label: string; type: "success" | "default" | "warning" }> = {
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: "时间", title: "时间",
key: "created", key: "created",
@@ -348,6 +375,13 @@ watch(
init() init()
}, },
) )
watch(
() => query.zone,
() => {
query.page = 1
init()
},
)
onMounted(init) onMounted(init)
onUnmounted(() => { onUnmounted(() => {

View File

@@ -79,6 +79,7 @@ export interface SubmissionOut {
my_score: number my_score: number
conversation_id?: string conversation_id?: string
flag?: FlagType flag?: FlagType
zone?: "featured" | "low" | "pending" | null
submit_count: number submit_count: number
created: Date created: Date
modified: Date modified: Date