新增:管理后台前端页面,以及openspec内容。

This commit is contained in:
2025-12-24 20:15:28 +08:00
parent 6d7ed38105
commit 845f1c6618
64 changed files with 9017 additions and 6 deletions

View File

@@ -0,0 +1,59 @@
import { createRouter, createWebHistory } from 'vue-router'
import { useAuthStore } from '../store/auth'
// 定义路由
const routes = [
{
path: '/login',
name: 'Login',
component: () => import('../views/Login.vue'),
meta: { requiresAuth: false }
},
{
path: '/',
name: 'Layout',
component: () => import('../components/Layout/Layout.vue'),
meta: { requiresAuth: true },
children: [
{
path: '',
name: 'Home',
component: () => import('../views/Home.vue')
},
{
path: '/conversations',
name: 'ConversationList',
component: () => import('../views/ConversationList.vue')
},
{
path: '/users',
name: 'UserList',
component: () => import('../views/UserList.vue')
}
]
},
{
path: '/:pathMatch(.*)*',
redirect: '/'
}
]
// 创建路由实例
const router = createRouter({
history: createWebHistory(),
routes
})
// 路由守卫
router.beforeEach((to, from, next) => {
const authStore = useAuthStore()
if (to.meta.requiresAuth && !authStore.isLoggedIn) {
// 未登录用户访问受保护页面,重定向到登录页
next('/login')
} else {
next()
}
})
export default router