From 64fd41ce327458c510acbbd0002c71ed4ef64447 Mon Sep 17 00:00:00 2001 From: fanfan Date: Fri, 19 Apr 2024 14:08:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/permission.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/permission.js b/src/permission.js index 597910a..f5c2dcd 100644 --- a/src/permission.js +++ b/src/permission.js @@ -14,7 +14,7 @@ NProgress.configure({ showSpinner: false }) // NProgress Configuration const whiteList = ['/user/login'] // 默认的主页 -const defaultRoutePath = '/store/index' +const defaultRoutePath = '/goods/index' router.beforeEach((to, from, next) => { NProgress.start() // start progress bar @@ -31,6 +31,7 @@ router.beforeEach((to, from, next) => { store .dispatch('GetInfo') .then(data => { + console.log() const roles = data.roles store.dispatch('GenerateRoutes', { roles }).then(() => { // 根据roles权限生成可访问的路由表 @@ -53,7 +54,7 @@ router.beforeEach((to, from, next) => { description: '请求用户信息失败,请重试' }) store.dispatch('Logout').then(() => { - next({ path: '/user/login', query: { redirect: to.fullPath } }) + next({ path: '/user/login',}) }) }) } @@ -64,7 +65,7 @@ router.beforeEach((to, from, next) => { // 在免登录白名单,直接进入 next() } else { - next({ path: '/user/login', query: { redirect: to.fullPath } }) + next({ path: '/user/login',}) NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it } }