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
+4
View File
@@ -3,6 +3,10 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="言逍导航 - 精选实用网址导航,收录常用网站、开发工具、学习资源等分类" />
<meta name="keywords" content="网址导航,实用工具,开发工具,言逍科技" />
<meta name="theme-color" content="#6366f1" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<title>言逍导航</title>
</head>
<body>
+4
View File
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<rect width="32" height="32" rx="6" fill="#6366f1"/>
<text x="16" y="23" font-size="20" font-weight="bold" fill="white" text-anchor="middle" font-family="sans-serif">Y</text>
</svg>

After

Width:  |  Height:  |  Size: 247 B

+13 -2
View File
@@ -1,5 +1,16 @@
<template>
<router-view />
<router-view v-slot="{ Component, route }">
<transition :name="route.meta?.transition || 'fade'" mode="out-in">
<component :is="Component" :key="route.path" />
</transition>
</router-view>
</template>
<script setup lang="ts"></script>
<style>
.fade-enter-active, .fade-leave-active { transition: opacity 0.25s ease; }
.fade-enter-from, .fade-leave-to { opacity: 0; }
.slide-enter-active, .slide-leave-active { transition: all 0.25s ease; }
.slide-enter-from { opacity: 0; transform: translateX(16px); }
.slide-leave-to { opacity: 0; transform: translateX(-16px); }
</style>
+9 -6
View File
@@ -1,5 +1,6 @@
import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '@/views/Home.vue'
import NotFound from '@/views/NotFound.vue'
import AdminLayout from '@/views/admin/AdminLayout.vue'
import AdminDashboard from '@/views/admin/Dashboard.vue'
import AdminLinks from '@/views/admin/Links.vue'
@@ -10,19 +11,21 @@ import AdminLogin from '@/views/admin/Login.vue'
const router = createRouter({
history: createWebHashHistory(),
routes: [
{ path: '/', name: 'home', component: Home },
{ path: '/admin/login', name: 'login', component: AdminLogin },
{ path: '/', name: 'home', component: Home, meta: { transition: 'fade' } },
{ path: '/admin/login', name: 'login', component: AdminLogin, meta: { transition: 'fade' } },
{
path: '/admin',
component: AdminLayout,
redirect: '/admin/dashboard',
meta: { transition: 'fade' },
children: [
{ path: 'dashboard', name: 'dashboard', component: AdminDashboard },
{ path: 'links', name: 'links', component: AdminLinks },
{ path: 'categories', name: 'categories', component: AdminCategories },
{ path: 'settings', name: 'settings', component: AdminSettings },
{ path: 'dashboard', name: 'dashboard', component: AdminDashboard, meta: { transition: 'slide' } },
{ path: 'links', name: 'links', component: AdminLinks, meta: { transition: 'slide' } },
{ path: 'categories', name: 'categories', component: AdminCategories, meta: { transition: 'slide' } },
{ path: 'settings', name: 'settings', component: AdminSettings, meta: { transition: 'slide' } },
],
},
{ path: '/:pathMatch(.*)*', name: 'not-found', component: NotFound },
],
})
+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>
+11 -1
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() {
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; }
+29 -3
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() {
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; }