feat: Dashboard骨架屏+robots.txt
- Dashboard 加载骨架屏 - 添加 robots.txt - 优化前端加载体验
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
# 言逍导航
|
||||||
|
User-agent: *
|
||||||
|
Allow: /
|
||||||
|
Sitemap: https://110.42.189.169:9110/sitemap.xml
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dashboard">
|
<div class="dashboard">
|
||||||
|
<div v-if="loading" class="dashboard-loading">
|
||||||
|
<el-skeleton :rows="2" animated />
|
||||||
|
<el-skeleton style="margin-top:24px" :rows="2" animated />
|
||||||
|
<el-skeleton style="margin-top:24px" :rows="6" animated />
|
||||||
|
</div>
|
||||||
|
<template v-else>
|
||||||
<el-row :gutter="[16, 16]" class="stat-cards">
|
<el-row :gutter="[16, 16]" class="stat-cards">
|
||||||
<el-col :xs="12" :sm="6">
|
<el-col :xs="12" :sm="6">
|
||||||
<el-card shadow="hover">
|
<el-card shadow="hover">
|
||||||
@@ -73,6 +79,7 @@
|
|||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
@@ -82,8 +89,10 @@ import { adminApi } from '@/api'
|
|||||||
const stats = ref({ linkCount: 0, catCount: 0, totalViews: 0 })
|
const stats = ref({ linkCount: 0, catCount: 0, totalViews: 0 })
|
||||||
const settings = ref({})
|
const settings = ref({})
|
||||||
const categories = ref([])
|
const categories = ref([])
|
||||||
|
const loading = ref(true)
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
const [statsRes, setRes] = await Promise.all([
|
const [statsRes, setRes] = await Promise.all([
|
||||||
adminApi.getStats(),
|
adminApi.getStats(),
|
||||||
adminApi.getSettings()
|
adminApi.getSettings()
|
||||||
@@ -92,6 +101,9 @@ onMounted(async () => {
|
|||||||
stats.value = { linkCount: d.linkCount, catCount: d.categories.length, totalViews: d.totalViews }
|
stats.value = { linkCount: d.linkCount, catCount: d.categories.length, totalViews: d.totalViews }
|
||||||
categories.value = d.categories
|
categories.value = d.categories
|
||||||
settings.value = setRes.result.data
|
settings.value = setRes.result.data
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user