From 97a9ae9f5caf1bb72ab030804fac079cacd41181 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Thu, 23 Apr 2020 10:03:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8A=A5=E9=94=99=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/request.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 {