|
@@ -45,13 +45,15 @@ export const $http = (url, method, data, json, loadingBool = false) => {
|
|
|
return {}
|
|
|
}
|
|
|
|
|
|
- uni.showToast({
|
|
|
- title: res.message || ('Error_'+res.code),
|
|
|
- icon: 'none',
|
|
|
- duration: 1500
|
|
|
- })
|
|
|
+ if (res.message || res.code) {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.message || 'Error',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 1500
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
- return Promise.reject(new Error(res.message || ('Error_'+res.code)))
|
|
|
+ return Promise.reject(new Error(res.message || 'Error'))
|
|
|
} else {
|
|
|
return res
|
|
|
}
|
|
@@ -164,15 +166,19 @@ export const axios = function(obj = {}) {
|
|
|
if (whiteCodes.indexOf(res.code) < 0) {
|
|
|
if (res.code === 1001) {
|
|
|
goLoginPage()
|
|
|
- reject(new Error(res.message || ('Error_'+res.code)));
|
|
|
+ reject(new Error(res.message || 'Error'));
|
|
|
return {}
|
|
|
}
|
|
|
- uni.showToast({
|
|
|
- title: res.message || ('Error_'+res.code),
|
|
|
- icon: 'none',
|
|
|
- duration: 1500
|
|
|
- })
|
|
|
- reject(new Error(res.message || ('Error_'+res.code)));
|
|
|
+
|
|
|
+ if (res.message || res.code) {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.message || 'Error',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 1500
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ reject(new Error(res.message || 'Error'));
|
|
|
} else {
|
|
|
resolve(res)
|
|
|
}
|