后台出题人

This commit is contained in:
2025-10-03 14:30:08 +08:00
parent df72936d9f
commit e462bd0864
6 changed files with 82 additions and 53 deletions

View File

@@ -0,0 +1,35 @@
<template>
<n-select
style="width: 140px"
v-model:value="author"
remote
@update:show="getAuthorOptions"
:options="authorOptions"
/>
</template>
<script setup lang="ts">
import { getAuthors } from "~/oj/api"
interface Props {
all?: boolean
}
const { all = false } = defineProps<Props>()
const author = defineModel<string>("value")
const authorOptions = ref([{ label: "全部", value: "" }])
async function getAuthorOptions() {
authorOptions.value = [{ label: "全部", value: "" }]
const res = await getAuthors(all)
const remotes = res.data.map(
(item: { username: string; problem_count: number }) => ({
label: `${item.username} (${item.problem_count})`,
value: item.username,
}),
)
authorOptions.value = [...authorOptions.value, ...remotes]
}
</script>