| | |
| | | Promise.reject(error) |
| | | }) |
| | | |
| | | // 需要确认框的接口路径 |
| | | const confirmDialogUrls = [ |
| | | '/hosp/order/addtTransition', |
| | | '/hosp/customer/cusIdcard' |
| | | ]; |
| | | |
| | | // 响应拦截器 |
| | | service.interceptors.response.use(res => { |
| | | const code = res.data.code || 200; |
| | |
| | | } |
| | | return Promise.reject('无效的会话,或者会话已过期,请重新登录。') |
| | | } else if (code === 500) { |
| | | if (res.config.url === '/hosp/order/addtTransition') { |
| | | if (confirmDialogUrls.includes(res.config.url)) { |
| | | // 使用MessageBox和Message来替代this.$confirm和this.$message |
| | | MessageBox.confirm(res.data.msg, '提示', { |
| | | MessageBox.confirm(res.data.msg, { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | center: true |
| | | }).then(() => { |
| | | |
| | | }).catch(() => { |
| | | |
| | | type: 'error', |
| | | showCancelButton: false, |
| | | closeOnClickModal: false |
| | | }); |
| | | return Promise.reject('特定接口发生500错误'); |
| | | } |