|
|
@@ -7,6 +7,8 @@ import { tansParams, blobValidate } from "@/utils/ruoyi";
|
|
7
|
7
|
import { saveAs } from 'file-saver'
|
|
8
|
8
|
|
|
9
|
9
|
let downloadLoadingInstance;
|
|
|
10
|
+// 是否显示重新登录
|
|
|
11
|
+let isReloginShow;
|
|
10
|
12
|
|
|
11
|
13
|
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
|
12
|
14
|
// 创建axios实例
|
|
|
@@ -48,16 +50,25 @@ service.interceptors.response.use(res => {
|
|
48
|
50
|
return res.data
|
|
49
|
51
|
}
|
|
50
|
52
|
if (code === 401) {
|
|
51
|
|
- MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
|
|
|
53
|
+ if (!isReloginShow) {
|
|
|
54
|
+ isReloginShow = true;
|
|
|
55
|
+ MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
|
|
52
|
56
|
confirmButtonText: '重新登录',
|
|
53
|
57
|
cancelButtonText: '取消',
|
|
54
|
58
|
type: 'warning'
|
|
55
|
59
|
}
|
|
56
|
60
|
).then(() => {
|
|
|
61
|
+ isReloginShow = false;
|
|
57
|
62
|
store.dispatch('LogOut').then(() => {
|
|
58
|
|
- location.href = '/index';
|
|
|
63
|
+ // 如果是登录页面不需要重新加载
|
|
|
64
|
+ if (window.location.hash.indexOf("#/login") != 0) {
|
|
|
65
|
+ location.href = '/index';
|
|
|
66
|
+ }
|
|
59
|
67
|
})
|
|
60
|
|
- }).catch(() => {});
|
|
|
68
|
+ }).catch(() => {
|
|
|
69
|
+ isReloginShow = false;
|
|
|
70
|
+ });
|
|
|
71
|
+ }
|
|
61
|
72
|
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
|
62
|
73
|
} else if (code === 500) {
|
|
63
|
74
|
Message({
|