diff --git a/src/utils/request.js b/src/utils/request.js index c2f999e37..3754efd68 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -6,7 +6,7 @@ import { MessageBox } from 'element-ui'; import { getToken } from '@/utils/auth'; import { getBaseUrl } from '@/utils/baseUrl'; import { EventBus } from '@/scripts/event-bus'; -import {interfaceErrorConfig} from '@/scripts/ConstConfig'; +import ConstConfig from '@/scripts/ConstConfig'; import Vue from 'vue'; const BASE_API = getBaseUrl(); @@ -64,13 +64,13 @@ service.interceptors.response.use( }); }); } else { - // console.log('==================='); - // const defaultError = { type: '服务异常:', message: '请您稍后重试!'}; - // Vue.prototype.$alert('' + (interfaceErrorConfig[res.code + ''] || defaultError).type + '' + (interfaceErrorConfig[res.code + ''] || defaultError).type.message + '', '请求结果', { - // confirmButtonText: '确定', - // dangerouslyUseHTMLString: true, - // closeOnClickModal: false - // }).then(() => {}); + const defaultError = { type: '服务异常:', message: '未知错误!'}; + const errorTip = ConstConfig.ConstSelect.interfaceErrorConfig[res.code + '']; + Vue.prototype.$alert('' + (errorTip || defaultError).type + '' + (errorTip || defaultError).message + '', '请求结果', { + confirmButtonText: '确定', + dangerouslyUseHTMLString: true, + closeOnClickModal: false + }).then(() => {}); return Promise.reject(res); } } else {