From a3c5eb59b5c6e493d9975769cc52365be157b247 Mon Sep 17 00:00:00 2001 From: zichen1019 <1510748736@qq.com> Date: Mon, 23 Aug 2021 08:37:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8Notification=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E5=8E=9FMessage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/apibjd.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 })