|
|
@@ -9,7 +9,7 @@ import { saveAs } from 'file-saver'
|
|
9
|
9
|
|
|
10
|
10
|
let downloadLoadingInstance;
|
|
11
|
11
|
// 是否显示重新登录
|
|
12
|
|
-let isReloginShow;
|
|
|
12
|
+export let isRelogin = { show: false };
|
|
13
|
13
|
|
|
14
|
14
|
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
|
15
|
15
|
// 创建axios实例
|
|
|
@@ -76,23 +76,20 @@ service.interceptors.response.use(res => {
|
|
76
|
76
|
return res.data
|
|
77
|
77
|
}
|
|
78
|
78
|
if (code === 401) {
|
|
79
|
|
- if (!isReloginShow) {
|
|
80
|
|
- isReloginShow = true;
|
|
|
79
|
+ if (!isRelogin.show) {
|
|
|
80
|
+ isRelogin.show = true;
|
|
81
|
81
|
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
|
|
82
|
82
|
confirmButtonText: '重新登录',
|
|
83
|
83
|
cancelButtonText: '取消',
|
|
84
|
84
|
type: 'warning'
|
|
85
|
85
|
}
|
|
86
|
86
|
).then(() => {
|
|
87
|
|
- isReloginShow = false;
|
|
|
87
|
+ isRelogin.show = false;
|
|
88
|
88
|
store.dispatch('LogOut').then(() => {
|
|
89
|
|
- // 如果是登录页面不需要重新加载
|
|
90
|
|
- if (window.location.hash.indexOf("#/login") != 0) {
|
|
91
|
|
- location.href = '/index';
|
|
92
|
|
- }
|
|
|
89
|
+ location.href = '/index';
|
|
93
|
90
|
})
|
|
94
|
91
|
}).catch(() => {
|
|
95
|
|
- isReloginShow = false;
|
|
|
92
|
+ isRelogin.show = false;
|
|
96
|
93
|
});
|
|
97
|
94
|
}
|
|
98
|
95
|
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|