|
@@ -59,25 +59,27 @@ service.interceptors.response.use(res => {
|
|
|
const code = res.data.code || 200;
|
|
|
// 获取错误信息
|
|
|
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
|
|
- if (code === 401) {
|
|
|
- MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
|
|
|
- confirmButtonText: '重新登录',
|
|
|
+ console.log('code: ', code);
|
|
|
+ if (code == 401) {
|
|
|
+ MessageBox.confirm('登录状态已过期,您可以关闭当前页面,刷新首页', '系统提示', {
|
|
|
+ confirmButtonText: '关闭当前页面',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
}
|
|
|
).then(() => {
|
|
|
- store.dispatch('LogOut').then(() => {
|
|
|
- this.$router.push({ path: '/login' })
|
|
|
- })
|
|
|
+ window.opener = null;
|
|
|
+ window.open("about:blank", "_top").close()
|
|
|
+ this.$router.push({path: "/home"});
|
|
|
+ location.reload()
|
|
|
}).catch(() => {});
|
|
|
- return Promise.reject()
|
|
|
+ // return Promise.reject()
|
|
|
} else if (code === 500) {
|
|
|
Message({
|
|
|
message: msg,
|
|
|
type: 'error'
|
|
|
})
|
|
|
return Promise.reject(new Error(msg))
|
|
|
- } else if (code !== 200 && code != 1) {
|
|
|
+ }else if (code !== 200 && code != 1) {
|
|
|
Notification.error({
|
|
|
title: msg
|
|
|
})
|