feat: 添加独立首页路由,优化登录后跳转逻辑

- 新增/home路由指向独立首页组件
- 将根路径重定向从/pages改为/home
- 更新登录成功后默认跳转路径为/home
- 设置首页路由为隐藏状态,不在菜单中显示
This commit is contained in:
Wei_佳 2025-11-17 18:15:02 +08:00
parent 2ce82f3401
commit bde761864b
3 changed files with 174 additions and 2 deletions

View File

@ -6,9 +6,18 @@ const Layout = () => import('@/layout/index.vue')
export const basicRoutes = [
{
path: '/',
redirect: '/pages', // 默认跳转到首页
redirect: '/home', // 默认跳转到首页
meta: { order: 0 },
},
{
name: 'Home',
path: '/home',
component: () => import('@/views/home/index.vue'),
isHidden: true,
meta: {
title: '首页',
},
},
{
name: t('views.workbench.label_workbench'),
path: '/workbench',

View File

@ -0,0 +1,163 @@
<template>
<div class="home-container">
<div class="header">
<div class="logo-section">
<img src="@/assets/images/logo.png" alt="logo" class="logo" />
<div class="user-center" @click="handleUserCenter">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="12" cy="8" r="4" stroke="currentColor" stroke-width="2"/>
<path d="M6 21C6 17.134 8.686 14 12 14C15.314 14 18 17.134 18 21" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
</svg>
<span>个人中心</span>
</div>
</div>
</div>
<div class="content">
<div class="title-section">
<h1 class="main-title">非遗IP价值评估系统</h1>
<p class="subtitle">基于深度学习算法的智能评估系统为您的知识产权和非物质文化遗产提供专业的价值评估服务</p>
</div>
<div class="action-section">
<n-button
type="primary"
size="large"
class="start-btn"
@click="handleStartEvaluation"
>
开始评估
</n-button>
</div>
</div>
</div>
</template>
<script setup>
const router = useRouter()
function handleStartEvaluation() {
router.push('/pages')
}
function handleUserCenter() {
// TODO:
$message.info('个人中心功能开发中')
}
</script>
<style scoped>
.home-container {
min-height: 100vh;
background: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%);
display: flex;
flex-direction: column;
}
.header {
padding: 20px 40px;
background: rgba(255, 255, 255, 0.9);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.logo-section {
display: flex;
align-items: center;
justify-content: space-between;
max-width: 1200px;
margin: 0 auto;
}
.logo {
height: 32px;
width: auto;
}
.user-center {
font-size: 16px;
color: #303133;
cursor: pointer;
display: flex;
align-items: center;
gap: 8px;
padding: 8px 16px;
border-radius: 8px;
transition: all 0.3s ease;
}
.user-center:hover {
background: rgba(136, 12, 34, 0.05);
color: #880C22;
}
.user-center svg {
color: currentColor;
}
.content {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 40px 20px;
}
.title-section {
text-align: center;
margin-bottom: 60px;
}
.main-title {
font-size: 48px;
font-weight: 600;
color: #303133;
line-height: 1.2;
margin: 0 0 20px 0;
}
.subtitle {
font-size: 16px;
color: #606266;
line-height: 1.6;
max-width: 700px;
margin: 0 auto;
}
.action-section {
display: flex;
justify-content: center;
}
.start-btn {
height: 50px;
padding: 0 60px;
font-size: 18px;
background: linear-gradient(93deg, #880C22 0%, #A30113 100%);
border: none;
border-radius: 8px;
cursor: pointer;
transition: all 0.3s ease;
}
.start-btn:hover {
transform: translateY(-2px);
box-shadow: 0 8px 16px rgba(136, 12, 34, 0.3);
}
@media (max-width: 768px) {
.main-title {
font-size: 32px;
}
.subtitle {
font-size: 14px;
}
.start-btn {
height: 44px;
padding: 0 40px;
font-size: 16px;
}
}
</style>

View File

@ -182,7 +182,7 @@ async function handleLogin() {
Reflect.deleteProperty(query, 'redirect')
router.push({ path, query })
} else {
router.push('/')
router.push('/home')
}
}
})