| | |
| | | } |
| | | return Promise.reject('无效的会话,或者会话已过期,请重新登录。') |
| | | } else if (code === 500) { |
| | | ElMessage({ message: msg, type: 'error' }) |
| | | if(msg === 'Token已失效,请重新登录!' || msg === 'token非法无效!'){ |
| | | ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => { |
| | | isRelogin.show = false; |
| | | removeToken() |
| | | location.href = '/homePage'; |
| | | }).catch(() => { |
| | | }); |
| | | if(msg === '文件不存在'){ |
| | | |
| | | }else { |
| | | ElMessage({ message: msg, type: 'error' }) |
| | | if(msg === 'Token已失效,请重新登录!' || msg === 'token非法无效!'){ |
| | | ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => { |
| | | isRelogin.show = false; |
| | | removeToken() |
| | | location.href = '/homePage'; |
| | | }).catch(() => { |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | return Promise.reject(new Error(msg)) |
| | | } else if (code === 601) { |
| | |
| | | }, |
| | | error => { |
| | | console.log('err' + error) |
| | | if (error.response) { |
| | | // 请求已发出,但服务器响应的状态码不在 2xx 范围内 |
| | | console.log('responseresponseresponseresponseresponseresponse') |
| | | } else if (error.request) { |
| | | // 请求已发出,但没有收到响应 |
| | | console.log('requestrequestrequestrequestrequestrequestrequest') |
| | | } else { |
| | | // 发生了一些问题导致请求不能发送到服务器 |
| | | console.log('error33333333') |
| | | } |
| | | |
| | | let { message } = error; |
| | | if (message == "Network Error") { |
| | | message = "后端接口连接异常"; |