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