|
@@ -1,5 +1,5 @@
|
|
|
import axios from 'axios'
|
|
|
-import { MessageBox, Message } from 'element-ui'
|
|
|
+import { Message } from 'element-ui'
|
|
|
import store from '@/store'
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
|
@@ -50,31 +50,39 @@ service.interceptors.response.use(
|
|
|
if (location.href.indexOf('login') !== -1) {
|
|
|
location.reload() // 为了重新实例化vue-router对象 避免bug
|
|
|
} else {
|
|
|
- MessageBox.confirm(
|
|
|
- '登录状态已过期,您可以继续留在该页面,或者重新登录',
|
|
|
- '系统提示',
|
|
|
- {
|
|
|
- confirmButtonText: '重新登录',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }
|
|
|
- ).then(() => {
|
|
|
+ Message.error('登录状态已过期,请重新登录')
|
|
|
+ setTimeout(() => {
|
|
|
location.reload() // 为了重新实例化vue-router对象 避免bug
|
|
|
- })
|
|
|
+ }, 1500)
|
|
|
+ // MessageBox.confirm(
|
|
|
+ // '登录状态已过期,您可以继续留在该页面,或者重新登录',
|
|
|
+ // '系统提示',
|
|
|
+ // {
|
|
|
+ // confirmButtonText: '重新登录',
|
|
|
+ // cancelButtonText: '取消',
|
|
|
+ // type: 'warning'
|
|
|
+ // }
|
|
|
+ // ).then(() => {
|
|
|
+ // location.reload() // 为了重新实例化vue-router对象 避免bug
|
|
|
+ // })
|
|
|
}
|
|
|
} else if (code === 6401) {
|
|
|
store.dispatch('user/resetToken')
|
|
|
- MessageBox.confirm(
|
|
|
- '登录状态已过期,您可以继续留在该页面,或者重新登录',
|
|
|
- '系统提示',
|
|
|
- {
|
|
|
- confirmButtonText: '重新登录',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }
|
|
|
- ).then(() => {
|
|
|
+ Message.error('登录状态已过期,请重新登录')
|
|
|
+ setTimeout(() => {
|
|
|
location.reload() // 为了重新实例化vue-router对象 避免bug
|
|
|
- })
|
|
|
+ }, 1500)
|
|
|
+ // MessageBox.confirm(
|
|
|
+ // '登录状态已过期,您可以继续留在该页面,或者重新登录',
|
|
|
+ // '系统提示',
|
|
|
+ // {
|
|
|
+ // confirmButtonText: '重新登录',
|
|
|
+ // cancelButtonText: '取消',
|
|
|
+ // type: 'warning'
|
|
|
+ // }
|
|
|
+ // ).then(() => {
|
|
|
+ // location.reload() // 为了重新实例化vue-router对象 避免bug
|
|
|
+ // })
|
|
|
return false
|
|
|
} else if (code === 400 || code === 403 || code !== 200) {
|
|
|
Message({
|