feat: 项目优化

- 添加 SVG favicon 品牌图标 + SEO meta 标签
- 添加 404 错误页面 + 路由兜底
- 添加页面切换动画过渡
- Links/Categories 管理页添加加载骨架屏
- Links 列表添加图标预览列
- 优化前端 index.html 元数据
This commit is contained in:
Agent
2026-07-14 21:22:08 +08:00
parent 5f9bbf408d
commit 454e05e82d
7 changed files with 105 additions and 16 deletions
+31
View File
@@ -0,0 +1,31 @@
<template>
<div class="not-found">
<div class="nf-card">
<h1>404</h1>
<p>页面未找到</p>
<el-button type="primary" @click="$router.push('/')">返回首页</el-button>
</div>
</div>
</template>
<style scoped>
.not-found {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: #f5f7fa;
}
.nf-card {
text-align: center;
}
.nf-card h1 {
font-size: 80px;
font-weight: 800;
background: linear-gradient(135deg, #6366f1, #818cf8);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-bottom: 8px;
}
.nf-card p { color: #888; font-size: 18px; margin-bottom: 24px; }
</style>
+12 -2
View File
@@ -8,7 +8,10 @@
</div>
<el-card>
<div class="table-wrap">
<div v-if="loading" class="loading-wrap">
<el-skeleton :rows="6" animated />
</div>
<div v-else class="table-wrap">
<el-table :data="categories">
<el-table-column prop="icon" label="图标" width="70" align="center" />
<el-table-column prop="name" label="名称" min-width="120" />
@@ -50,13 +53,19 @@ 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() {
categories.value = (await adminApi.getCategories()).result.data
loading.value = true
try {
categories.value = (await adminApi.getCategories()).result.data
} finally {
loading.value = false
}
}
function openDialog(row?: any) {
@@ -91,6 +100,7 @@ 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; }
+30 -4
View File
@@ -19,12 +19,20 @@
</el-col>
</el-row>
<div class="table-wrap">
<div v-if="loading" class="loading-wrap">
<el-skeleton :rows="5" animated />
</div>
<div v-else class="table-wrap">
<el-table :data="links">
<el-table-column label="图标" width="60" align="center">
<template #default="scope">
<span class="link-icon-preview">{{ scope.row.iconUrl ? '🖼' : scope.row.title[0] }}</span>
</template>
</el-table-column>
<el-table-column prop="title" label="标题" min-width="120" />
<el-table-column prop="categoryName" label="分类" width="100" />
<el-table-column prop="url" label="网址" min-width="180" />
<el-table-column prop="isShow" label="显示" width="70" align="center">
<el-table-column prop="url" label="网址" min-width="180" show-overflow-tooltip />
<el-table-column label="显示" width="70" align="center">
<template #default="scope">
<el-tag :type="scope.row.isShow ? 'success' : 'info'" size="small">
{{ scope.row.isShow ? '是' : '否' }}
@@ -82,6 +90,7 @@ import { Plus } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { adminApi } from '@/api'
const loading = ref(true)
const links = ref([])
const categories = ref([])
const keyword = ref('')
@@ -92,7 +101,12 @@ const form = ref({ title: '', url: '', categoryId: '', description: '', iconUrl:
const dialogWidth = computed(() => window.innerWidth < 500 ? '92%' : '500px')
async function loadLinks() {
links.value = (await adminApi.getLinks({ keyword: keyword.value || undefined, categoryId: catFilter.value || undefined })).result.data
loading.value = true
try {
links.value = (await adminApi.getLinks({ keyword: keyword.value || undefined, categoryId: catFilter.value || undefined })).result.data
} finally {
loading.value = false
}
}
async function loadCats() {
categories.value = (await adminApi.getCategories()).result.data
@@ -130,6 +144,18 @@ onMounted(async () => { await loadLinks(); await loadCats() })
.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; }
.link-icon-preview {
display: inline-flex;
width: 32px;
height: 32px;
border-radius: 6px;
align-items: center;
justify-content: center;
background: #f0f0f0;
font-weight: 600;
font-size: 14px;
}
@media (max-width: 767px) {
.page-header h2 { font-size: 18px; }