| | |
| | | (response) => { |
| | | if (response.status == 200) { |
| | | if (response.request.responseURL.indexOf('/FileDownload') > -1) { |
| | | return response.data; |
| | | return response.data |
| | | } |
| | | return response.data.data; |
| | | return response.data.data |
| | | } |
| | | }, |
| | | (error) => { |
| | | let msg = '请求发生错误'; |
| | | if (error.response && error.response.status == 401) { |
| | | localStorage.clear() |
| | | router.replace({ |
| | | path: '/login' |
| | | }) |
| | | let msg = '请求发生错误' |
| | | if ((error.response && error.response.status == 401) || error.code == 'ERR_NETWORK') { |
| | | localStorage.removeItem('token') |
| | | localStorage.removeItem('userInfo') |
| | | if (localStorage.getItem('loginCtx')) { |
| | | window.open(localStorage.getItem('loginCtx')) |
| | | } else { |
| | | router.replace({ |
| | | path: '/login' |
| | | }) |
| | | } |
| | | } else { |
| | | if (error.response && error.response.data) { |
| | | msg = error.response.data.msg |
| | | } |
| | | } |
| | | throw msg; |
| | | throw msg |
| | | } |
| | | ) |
| | | |