|
|
@ -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实例
|
|
|
@ -40,7 +40,7 @@ service.interceptors.response.use( |
|
|
|
} else if (res.returnCode === 1) { |
|
|
|
return res.returnData |
|
|
|
} else if (res.code === 20001) { |
|
|
|
Message({ |
|
|
|
Notification({ |
|
|
|
showClose: true, |
|
|
|
message: res.message, |
|
|
|
type: 'error', |
|
|
@ -61,7 +61,7 @@ service.interceptors.response.use( |
|
|
|
} else { |
|
|
|
msg = res.returnMsg |
|
|
|
} |
|
|
|
Message({ |
|
|
|
Notification({ |
|
|
|
message: msg, |
|
|
|
type: 'error', |
|
|
|
duration: 3 * 1000 |
|
|
@ -71,9 +71,9 @@ service.interceptors.response.use( |
|
|
|
}, |
|
|
|
error => { |
|
|
|
hideLoading() |
|
|
|
console.error('err' + error)// for debug
|
|
|
|
Message({ |
|
|
|
message: error.message, |
|
|
|
console.error('error', error.response)// for debug
|
|
|
|
Notification({ |
|
|
|
message: error.response.data && error.response.data.message ? error.response.data.message : error.message, |
|
|
|
type: 'error', |
|
|
|
duration: 3 * 1000 |
|
|
|
}) |
|
|
|