|
@@ -114,14 +114,27 @@ service.interceptors.response.use(
|
|
|
},
|
|
|
error => {
|
|
|
loadingInstance && loadingInstance.close()
|
|
|
- const { msg } = error.response.data
|
|
|
- console.log('err' + error) // for debug
|
|
|
- // '后端异常:' +
|
|
|
- Message({
|
|
|
- message: msg,
|
|
|
- type: 'error',
|
|
|
- duration: 5 * 1000
|
|
|
- })
|
|
|
+ if (error.response.data instanceof ArrayBuffer) {
|
|
|
+ const textDecoder = new TextDecoder('utf-8')
|
|
|
+ const errorText = textDecoder.decode(error.response.data)
|
|
|
+
|
|
|
+ const errorJson = JSON.parse(errorText)
|
|
|
+
|
|
|
+ Message({
|
|
|
+ message: errorJson.msg || '文件下载失败',
|
|
|
+ type: 'error',
|
|
|
+ duration: 5 * 1000
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ const { msg } = error.response.data
|
|
|
+ console.log('err' + error) // for debug
|
|
|
+ // '后端异常:' +
|
|
|
+ Message({
|
|
|
+ message: msg,
|
|
|
+ type: 'error',
|
|
|
+ duration: 5 * 1000
|
|
|
+ })
|
|
|
+ }
|
|
|
resetLogin(error.response)
|
|
|
return Promise.reject(error)
|
|
|
}
|