From 76d0a11ffd8f9362a72693e86f06297dab88a35c Mon Sep 17 00:00:00 2001 From: aixianling Date: Sun, 29 Jan 2023 13:58:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=BB=98=E8=AE=A4=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/utils/router.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/src/utils/router.js b/web/src/utils/router.js index 74f1336..11286e3 100644 --- a/web/src/utils/router.js +++ b/web/src/utils/router.js @@ -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 -}) \ No newline at end of file +})