From 834574b39e659296ee031dd679545bb1b99cd63a Mon Sep 17 00:00:00 2001 From: Mplan Date: Thu, 23 Jul 2026 23:35:05 +0800 Subject: [PATCH] feat(admin): clarify dashboard priorities and content health --- src/views/admin/AdminView.vue | 205 ++++++++++++++++++++++++++++------ 1 file changed, 169 insertions(+), 36 deletions(-) diff --git a/src/views/admin/AdminView.vue b/src/views/admin/AdminView.vue index 4930802..1025511 100644 --- a/src/views/admin/AdminView.vue +++ b/src/views/admin/AdminView.vue @@ -108,6 +108,35 @@ const cloudTypeStats = computed(() => { .slice(0, 8) }) +const reviewedCount = computed(() => dashboardStats.value.approved + dashboardStats.value.rejected) +const approvalRate = computed(() => getPercentage(dashboardStats.value.approved, reviewedCount.value)) +const publicImageCount = computed(() => Math.max(0, dashboardStats.value.images - dashboardStats.value.hidden)) +const recentImages = computed(() => images.value.slice(0, 5)) +const cloudTypeMaxCount = computed(() => Math.max(1, ...cloudTypeStats.value.map(item => item.count))) +const reviewStatusStats = computed(() => [ + { + key: 'approved', + label: '已通过', + count: dashboardStats.value.approved, + bar: 'bg-emerald-500', + text: 'text-emerald-700', + }, + { + key: 'pending', + label: '待审核', + count: dashboardStats.value.pending, + bar: 'bg-amber-400', + text: 'text-amber-700', + }, + { + key: 'rejected', + label: '已拒绝', + count: dashboardStats.value.rejected, + bar: 'bg-rose-400', + text: 'text-rose-700', + }, +]) + const selectedReviewCount = computed(() => selectedReviewIds.value.size) function toAdminCloud(row: ApiCloud): AdminCloud { @@ -147,6 +176,11 @@ function formatCoordinate(value: number | null) { return value === null ? '未记录' : value.toFixed(2) } +function getPercentage(value: number, total: number) { + if (!total) return 0 + return Math.round(value / total * 100) +} + function getErrorMessage(error: unknown, fallback: string) { return error instanceof Error ? error.message : fallback } @@ -508,57 +542,124 @@ onMounted(loadAdminData)