From cf9787fd50840c16e71e682e69cafd3b4275f6ed Mon Sep 17 00:00:00 2001 From: JiangQiming <291854119@qq.com> Date: Wed, 4 Jan 2023 09:55:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B5=8B=E8=AF=95=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.ts | 10 +++++----- src/router/menu.ts | 44 +++++++++++++++++++++++--------------------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/router/index.ts b/src/router/index.ts index 9d009ae6..cac0740a 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,7 +1,7 @@ import { createRouter, createWebHashHistory } from 'vue-router'; import menus, { LoginPath } from './menu' -import {LocalStore} from "@/utils/comm"; -import {TOKEN_KEY} from "@/utils/variable"; +import { LocalStore } from "@/utils/comm"; +import { TOKEN_KEY } from "@/utils/variable"; const router = createRouter({ history: createWebHashHistory(), @@ -10,14 +10,14 @@ const router = createRouter({ router.beforeEach((to, from, next) => { const token = LocalStore.get(TOKEN_KEY) - next() + next() // 测试用, 可删除 if (token) { next() } else { - if(to.path === LoginPath) { + if (to.path === LoginPath) { next() } else { - next({ path: LoginPath}) + next({ path: LoginPath }) } } }) diff --git a/src/router/menu.ts b/src/router/menu.ts index 411c6724..7b35793d 100644 --- a/src/router/menu.ts +++ b/src/router/menu.ts @@ -1,26 +1,28 @@ export const LoginPath = '/login' export default [ - // { - // path: '/', - // redirect: LoginPath - // }, - // { - // path: '/init', - // component: () => import('@/view/InitPage.vue') - // }, - // { - // path: LoginPath, - // name: 'login', - // component: () => import('@/view/Login/index.vue') - // }, - // { - // path: '/initsetting', - // component: () => import('@/view/Login/initSet.vue') - // } + // { + // path: '/', + // redirect: LoginPath + // }, + // { + // path: '/init', + // component: () => import('@/view/InitPage.vue') + // }, + // { + // path: LoginPath, + // name: 'login', + // component: () => import('@/view/Login/index.vue') + // }, + // { + // path: '/initsetting', + // component: () => import('@/view/Login/initSet.vue') + // } - { - path: '/demo', - component: () => import('@/views/demo/index.vue') - } + // start: 测试用, 可删除 + { + path: '/demo', + component: () => import('@/views/demo/index.vue') + } + // end: 测试用, 可删除 ] \ No newline at end of file