| | |
| | | //#region ====================== 后端 res.err_code ====================== |
| | | export const enum ErrorCode { |
| | | /** @description 权限验证失败 */ |
| | | Message = 'MESSAGE', |
| | | /** @description 内部错误 */ |
| | | Exception = 'EXCEPTION', |
| | | /** @description 无权使用 */ |
| | | Auth = 'AUTH', |
| | | } |
| | | //#endregion |
| | |
| | | handleNoAuth(); |
| | | throw '权限验证失败'; |
| | | } |
| | | break; |
| | | case ErrorCode.Exception: |
| | | ElMessage.error('内部错误!'); |
| | | throw '内部错误'; |
| | | } |
| | | // const msg = serveData.json_msg ?? ''; |
| | | |
| | | // const error = serveData?.err_code ? `${msg ? `【${serveData.err_code}】` : serveData.err_code}` : ''; |
| | | // const tip = error + msg || '请求失败'; |
| | | // ElMessage.error(tip); |
| | | // const url = res.request.responseURL; |
| | | // throw new Error(url + '\n' + tip); |
| | | |
| | | } |
| | | return res.data; |
| | | }, |