|
@ -81,10 +81,11 @@ service.interceptors.response.use( |
|
|
}, |
|
|
}, |
|
|
error => { |
|
|
error => { |
|
|
closeLoading() |
|
|
closeLoading() |
|
|
|
|
|
switch (error.response.status) { |
|
|
|
|
|
case 500: |
|
|
ElMessageBox.confirm(`
|
|
|
ElMessageBox.confirm(`
|
|
|
<p>检测到接口错误${error}</p> |
|
|
<p>检测到接口错误${error}</p> |
|
|
<p>错误码500:此类错误内容常见于后台panic,如果影响您正常使用可强制登出清理缓存</p> |
|
|
|
|
|
<p>错误码404:此类错误多为接口未注册(或未重启)或者请求路径(方法)与api路径(方法)不符</p> |
|
|
|
|
|
|
|
|
<p>错误码<span style="color:red"> 500 </span>:此类错误内容常见于后台panic,请先查看后台日志,如果影响您正常使用可强制登出清理缓存</p> |
|
|
`, '接口报错', {
|
|
|
`, '接口报错', {
|
|
|
dangerouslyUseHTMLString: true, |
|
|
dangerouslyUseHTMLString: true, |
|
|
distinguishCancelAndClose: true, |
|
|
distinguishCancelAndClose: true, |
|
@ -94,6 +95,20 @@ service.interceptors.response.use( |
|
|
.then(() => { |
|
|
.then(() => { |
|
|
store.commit('user/LoginOut') |
|
|
store.commit('user/LoginOut') |
|
|
}) |
|
|
}) |
|
|
|
|
|
break |
|
|
|
|
|
case 404: |
|
|
|
|
|
ElMessageBox.confirm(`
|
|
|
|
|
|
<p>检测到接口错误${error}</p> |
|
|
|
|
|
<p>错误码<span style="color:red"> 404 </span>:此类错误多为接口未注册(或未重启)或者请求路径(方法)与api路径(方法)不符--如果为自动化代码请检查是否存在空格</p> |
|
|
|
|
|
`, '接口报错', {
|
|
|
|
|
|
dangerouslyUseHTMLString: true, |
|
|
|
|
|
distinguishCancelAndClose: true, |
|
|
|
|
|
confirmButtonText: '我知道了', |
|
|
|
|
|
cancelButtonText: '取消' |
|
|
|
|
|
}) |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return error |
|
|
return error |
|
|
} |
|
|
} |
|
|
) |
|
|
) |
|
|