提交 416c8df7 编写于 作者: JEECG低代码平台's avatar JEECG低代码平台

解决token失效 ,登录页面重复跳转登录页面问题

上级 b13a4b01
...@@ -32,13 +32,9 @@ const err = (error) => { ...@@ -32,13 +32,9 @@ const err = (error) => {
notification.error({ message: '系统提示', description: '拒绝访问',duration: 4}) notification.error({ message: '系统提示', description: '拒绝访问',duration: 4})
break break
case 500: case 500:
let path = window.location.href
//notification.error({ message: '系统提示', description:'Token失效,请重新登录!',duration: 4}) //notification.error({ message: '系统提示', description:'Token失效,请重新登录!',duration: 4})
if(token && data.message.includes("Token失效") && path.indexOf('/user/login') < 0){ if(token && data.message.includes("Token失效")){
// update-begin- --- author:scott ------ date:20190225 ---- for:Token失效采用弹框模式,不直接跳转---- // update-begin- --- author:scott ------ date:20190225 ---- for:Token失效采用弹框模式,不直接跳转----
// store.dispatch('Logout').then(() => {
// window.location.reload()
// })
Modal.error({ Modal.error({
title: '登录已过期', title: '登录已过期',
content: '很抱歉,登录已过期,请重新登录', content: '很抱歉,登录已过期,请重新登录',
...@@ -48,7 +44,9 @@ const err = (error) => { ...@@ -48,7 +44,9 @@ const err = (error) => {
store.dispatch('Logout').then(() => { store.dispatch('Logout').then(() => {
Vue.ls.remove(ACCESS_TOKEN) Vue.ls.remove(ACCESS_TOKEN)
try { try {
if(path.indexOf('/user/login')==-1){ let path = window.document.location.pathname
console.log("location pathname -> "+path)
if(path!="/" && path.indexOf('/user/login')==-1){
window.location.reload() window.location.reload()
} }
}catch (e) { }catch (e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册