diff --git a/src/permission.js b/src/permission.js index 4cb9d47d..1aa8b84d 100644 --- a/src/permission.js +++ b/src/permission.js @@ -27,7 +27,6 @@ const whiteList = [ '/policyDetail', '/attestationDetail', '/noticeDetail', - '/homestead/index', '/homestead/login', @@ -69,7 +68,13 @@ router.beforeEach((to, from, next) => { // 在免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 + if ('/homestead/index'.indexOf(to.path) !== -1) { + next(`/homestead/login?redirect=${to.fullPath}`) + } else { + next(`/login?redirect=${to.fullPath}`) + } + + // // 否则全部重定向到登录页 //next('/index'); NProgress.done() } diff --git a/src/utils/request.js b/src/utils/request.js index 57031da1..a582b88f 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -61,18 +61,19 @@ 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: '系统提示', - message: '登录状态已过期,您可以继续留在该页面,或者重新登录', - confirmButtonText: '重新登录', - cancelButtonText: '取消' - }) - .then(() => { - store.dispatch('LogOut').then(() => { - location.href = '/index'; - }) - }) + // Dialog.confirm({ + // title: '系统提示', + // message: '登录状态已过期,您可以继续留在该页面,或者重新登录', + // confirmButtonText: '重新登录', + // cancelButtonText: '取消' + // }) + // .then(() => { + // store.dispatch('LogOut').then(() => { + // location.href = '/index'; + // }) + // }) } else if (code === 500) { Dialog.alert({ type: 'warning', message: msg }); return Promise.reject(new Error(msg))