diff --git a/src/utils/apibjd.js b/src/utils/apibjd.js index c12d0e5..e6ae09d 100644 --- a/src/utils/apibjd.js +++ b/src/utils/apibjd.js @@ -1,5 +1,5 @@ import axios from 'axios' -import { Message } from 'element-ui' +import { Notification } from 'element-ui' import store from '../store' import { showLoading, hideLoading } from './apiHelper' // 创建axios实例 @@ -36,7 +36,7 @@ service.interceptors.response.use( if (res.data.returnCode === 1) { return res.data.returnData } else if (res.data.returnCode === '20011') { - Message({ + Notification({ showClose: true, message: res.returnMsg, type: 'error', @@ -49,7 +49,7 @@ service.interceptors.response.use( }) return Promise.reject('未登录') } else { - Message({ + Notification({ message: res.data.returnMsg || '请求处理异常,请稍后再试', type: 'error', duration: 3 * 1000 @@ -64,7 +64,7 @@ service.interceptors.response.use( } if (res.returnCode === 1) { return res.returnData } else if (res.returnCode === '20011') { - Message({ + Notification({ showClose: true, message: res.returnMsg, type: 'error', @@ -88,7 +88,7 @@ service.interceptors.response.use( if (res.data && res.data.constructor === String) { msg = msg ? msg + ':' + res.data : res.data } - Message({ + Notification({ message: msg, type: 'error', duration: 3 * 1000 @@ -99,8 +99,8 @@ service.interceptors.response.use( error => { hideLoading() console.error('err' + error) // for debug - Message({ - message: error.response.data.msg, + Notification({ + message: error.response.data && error.response.data.message ? error.response.data.message : error.message, type: 'error', duration: 3 * 1000 })