diff --git a/frontend/src/views/admin/Categories.vue b/frontend/src/views/admin/Categories.vue index e092ea8..50ebbd6 100644 --- a/frontend/src/views/admin/Categories.vue +++ b/frontend/src/views/admin/Categories.vue @@ -8,10 +8,7 @@ -
- -
-
+
@@ -53,19 +50,13 @@ import { ElMessage, ElMessageBox } from 'element-plus' import { adminApi } from '@/api' const categories = ref([]) -const loading = ref(true) const dialogVisible = ref(false) const editId = ref(null) const form = ref({ icon: '🔗', name: '', sort: 0 }) const dialogWidth = computed(() => window.innerWidth < 500 ? '92%' : '420px') async function load() { - loading.value = true - try { - categories.value = (await adminApi.getCategories()).result.data - } finally { - loading.value = false - } + categories.value = (await adminApi.getCategories()).result.data } function openDialog(row?: any) { @@ -100,7 +91,6 @@ onMounted(load) .page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; } .page-header h2 { font-size: 20px; font-weight: 600; } .table-wrap { overflow-x: auto; } -.loading-wrap { padding: 20px; } @media (max-width: 767px) { .page-header h2 { font-size: 18px; } diff --git a/frontend/src/views/admin/Dashboard.vue b/frontend/src/views/admin/Dashboard.vue index 399db9f..a1940e0 100644 --- a/frontend/src/views/admin/Dashboard.vue +++ b/frontend/src/views/admin/Dashboard.vue @@ -1,95 +1,88 @@ @@ -101,7 +94,6 @@ import { adminApi } from '@/api' const stats = ref({ linkCount: 0, catCount: 0, totalViews: 0 }) const settings = ref({}) const categories = ref([]) -const loading = ref(true) const viewTrend = ref<{date:string,count:number}[]>([]) const maxViews = computed(() => Math.max(1, ...viewTrend.value.map(d => d.count))) @@ -117,18 +109,14 @@ function generateTrend() { } onMounted(async () => { - try { - const [statsRes, setRes] = await Promise.all([ - adminApi.getStats(), - adminApi.getSettings() - ]) - const d = statsRes.result.data - stats.value = { linkCount: d.linkCount, catCount: d.categories.length, totalViews: d.totalViews } - categories.value = d.categories - settings.value = setRes.result.data - } finally { - loading.value = false - } + const [statsRes, setRes] = await Promise.all([ + adminApi.getStats(), + adminApi.getSettings() + ]) + const d = statsRes.result.data + stats.value = { linkCount: d.linkCount, catCount: d.categories.length, totalViews: d.totalViews } + categories.value = d.categories + settings.value = setRes.result.data generateTrend() }) @@ -141,35 +129,10 @@ onMounted(async () => { .action-btn { width: 100%; } .action-btn-link { display: block; text-decoration: none; } .table-wrap { overflow-x: auto; } -.dashboard-loading { padding: 20px; } -.chart-container { - display: flex; - align-items: flex-end; - gap: 12px; - height: 160px; - padding: 0 8px; -} -.chart-bar-wrap { - flex: 1; - display: flex; - flex-direction: column; - align-items: center; - gap: 4px; - height: 100%; - justify-content: flex-end; -} -.chart-bar { - width: 100%; - max-width: 40px; - background: linear-gradient(to top, #6366f1, #818cf8); - border-radius: 4px 4px 0 0; - transition: height 0.5s ease; - min-height: 4px; -} +.chart-container { display: flex; align-items: flex-end; gap: 12px; height: 160px; padding: 0 8px; } +.chart-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; } +.chart-bar { width: 100%; max-width: 40px; background: linear-gradient(to top, #6366f1, #818cf8); border-radius: 4px 4px 0 0; transition: height 0.5s ease; min-height: 4px; } .chart-label { font-size: 11px; color: #888; white-space: nowrap; } html.dark .chart-label { color: var(--text-secondary); } - -@media (max-width: 767px) { - .stat-item .num { font-size: 28px; } -} +@media (max-width: 767px) { .stat-item .num { font-size: 28px; } } \ No newline at end of file diff --git a/frontend/src/views/admin/Links.vue b/frontend/src/views/admin/Links.vue index 2cd4bd0..4258a93 100644 --- a/frontend/src/views/admin/Links.vue +++ b/frontend/src/views/admin/Links.vue @@ -188,7 +188,7 @@ async function deleteLink(row: any) { await loadLinks() } -onMounted(async () => { await loadLinks(); await loadCats() }) +onMounted(async () => { await Promise.all([loadLinks(), loadCats()]) })