From 165455ea845de0dda56ab3ac708991c640aa86be Mon Sep 17 00:00:00 2001
From: zhangdaiscott <zhangdaiscott@163.com>
Date: Tue, 29 Sep 2020 11:49:42 +0800
Subject: [PATCH] 解决token失效 ,登录页面重复跳转登录页面问题

---
 ant-design-vue-jeecg/src/utils/request.js | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/ant-design-vue-jeecg/src/utils/request.js b/ant-design-vue-jeecg/src/utils/request.js
index d4bcb60..d3b7009 100644
--- a/ant-design-vue-jeecg/src/utils/request.js
+++ b/ant-design-vue-jeecg/src/utils/request.js
@@ -32,13 +32,9 @@ const err = (error) => {
         notification.error({ message: '系统提示', description: '拒绝访问',duration: 4})
         break
       case 500:
-        let path = window.location.href
         //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失效采用弹框模式,不直接跳转----
-          // store.dispatch('Logout').then(() => {
-          //     window.location.reload()
-          // })
           Modal.error({
             title: '登录已过期',
             content: '很抱歉,登录已过期,请重新登录',
@@ -48,7 +44,9 @@ const err = (error) => {
               store.dispatch('Logout').then(() => {
                 Vue.ls.remove(ACCESS_TOKEN)
                 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()
                   }
                 }catch (e) {
--
libgit2 0.22.2