初始化

This commit is contained in:
SunYF
2026-08-28 14:07:22 +08:00
parent a185247ab1
commit b34325a16f
971 changed files with 291 additions and 220360 deletions
@@ -1,31 +0,0 @@
import { createRouter, createWebHashHistory } from 'vue-router'
import { getToken } from '../utils/request'
// hash 路由:静态托管下刷新/深链稳定,不需要服务端兜底配置
const routes = [
{ path: '/', redirect: '/main' },
{
path: '/login',
name: 'Login',
component: () => import('../views/Login.vue')
},
{
path: '/main',
name: 'Main',
component: () => import('../views/Main.vue')
}
]
const router = createRouter({
history: createWebHashHistory(),
routes
})
router.beforeEach((to) => {
const hasToken = !!getToken()
if (!hasToken && to.path !== '/login') return '/login'
if (hasToken && to.path === '/login') return '/main'
return true
})
export default router