修复默认登录问题
This commit is contained in:
@@ -3,7 +3,7 @@ import {getToken} from './tools'
|
||||
|
||||
|
||||
let home = {name: "工作台", path: "/v", component: () => import('../views/home')},
|
||||
routes = [{name: "登录", path: "/login", component: () => import('../views/login')}]
|
||||
routes = [{name: "登录", path: "/login", component: () => import('../views/login')}]
|
||||
const loadApps = () => {
|
||||
const files = import.meta.glob('../apps/App*.vue'), apps = []
|
||||
return Promise.all(Object.keys(files).map(path => {
|
||||
@@ -34,11 +34,11 @@ export default loadApps().then(() => createRouter({
|
||||
if (to.name == "工作台") {
|
||||
next()
|
||||
} else if (getToken()) {
|
||||
if (to.name == '登录') next({name: "工作台"})
|
||||
if (/登录/.test(to.name) || to.path == "/") next({name: "工作台"})
|
||||
else next()
|
||||
} else if (to.name != '登录') {
|
||||
next({name: "登录"})
|
||||
} else next()
|
||||
})
|
||||
return router
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user