From a2af02c6f885221d774647d44fcb0f1a24eb0f38 Mon Sep 17 00:00:00 2001 From: liuminjian Date: Mon, 2 Aug 2021 12:38:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/permission.js | 12 ++++++++++-- src/utils/request.js | 1 - 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/permission.js b/src/permission.js index 6e10115a..7f070fe0 100644 --- a/src/permission.js +++ b/src/permission.js @@ -57,7 +57,13 @@ router.beforeEach((to, from, next) => { }).catch(err => { store.dispatch('LogOut').then(() => { // Message.error(err) - next({ path: '/' }) + if ('/authenticRight/index'.indexOf(to.path) !== -1) { + next({ path: '/authenticRight/login' }) + } else if ('/homestead/index'.indexOf(to.path) !== -1) { + next({ path: '/homestead/login' }) + } else { + next({ path: '/' }) + } }) }) } else { @@ -70,7 +76,9 @@ router.beforeEach((to, from, next) => { // 在免登录白名单,直接进入 next() } else { - if ('/homestead/index'.indexOf(to.path) !== -1) { + if ('/authenticRight/index'.indexOf(to.path) !== -1) { + next(`/authenticRight/login?redirect=${to.fullPath}`) + } else if ('/homestead/index'.indexOf(to.path) !== -1) { next(`/homestead/login?redirect=${to.fullPath}`) } else { next(`/login?redirect=${to.fullPath}`) diff --git a/src/utils/request.js b/src/utils/request.js index 30548865..57031da1 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -61,7 +61,6 @@ service.interceptors.response.use(res => { // 获取错误信息 const msg = errorCode[code] || res.data.msg || errorCode['default'] if (code === 401) { - console.log(this.$route.path) Dialog.confirm({ title: '系统提示',