feat(admin): 成就管理标题显示条数
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled

有下架的成就时一并显示下架条数——列表里只有"上架:否"那一列能看出来,
扫一眼容易漏。数据未加载完时退回纯标题,避免闪一下"0 条"。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-05 11:13:48 -06:00
parent 15d823aa20
commit b79dd6c721

View File

@@ -23,6 +23,15 @@ const RARITY_LABEL: Record<string, string> = {
platinum: "白金", platinum: "白金",
} }
// 下架的只在有的时候才提,全部上架时标题不啰嗦
const title = computed(() => {
if (!list.value.length) return "成就管理"
const offline = list.value.filter((a) => !a.visible).length
return offline
? `成就管理(${list.value.length} 条,${offline} 条下架)`
: `成就管理(${list.value.length} 条)`
})
async function load() { async function load() {
loading.value = true loading.value = true
try { try {
@@ -115,7 +124,7 @@ onMounted(load)
</script> </script>
<template> <template>
<n-card title="成就管理"> <n-card :title="title">
<template #header-extra> <template #header-extra>
<n-button type="primary" @click="create">新建成就</n-button> <n-button type="primary" @click="create">新建成就</n-button>
</template> </template>