接口报错调整

This commit is contained in:
fan 2020-04-23 10:03:07 +08:00
parent 69574ccb0d
commit 97a9ae9f5c

View File

@ -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('<strong>' + (interfaceErrorConfig[res.code + ''] || defaultError).type + '<i style="color: red;">' + (interfaceErrorConfig[res.code + ''] || defaultError).type.message + '</i></strong>', '请求结果', {
// confirmButtonText: '确定',
// dangerouslyUseHTMLString: true,
// closeOnClickModal: false
// }).then(() => {});
const defaultError = { type: '服务异常:', message: '未知错误!'};
const errorTip = ConstConfig.ConstSelect.interfaceErrorConfig[res.code + ''];
Vue.prototype.$alert('<strong>' + (errorTip || defaultError).type + '<i style="color: red;">' + (errorTip || defaultError).message + '</i></strong>', '请求结果', {
confirmButtonText: '确定',
dangerouslyUseHTMLString: true,
closeOnClickModal: false
}).then(() => {});
return Promise.reject(res);
}
} else {