|
@@ -12,8 +12,14 @@ const http = (url = '', date = {}, type = 'POST', header = {
|
|
|
//console.log(burl2 + url)
|
|
|
header={};
|
|
|
const logInData = uni.getStorageSync("logInData");
|
|
|
- header['token']=logInData.token;
|
|
|
- header['uid']=logInData.uid;
|
|
|
+ if(logInData){
|
|
|
+ header['token']=logInData.token;
|
|
|
+ header['uid']=logInData.uid;
|
|
|
+ }else{
|
|
|
+ header['token']='';
|
|
|
+ header['uid']='';
|
|
|
+ }
|
|
|
+
|
|
|
// header['token']='BA205B2ABFE4445EA5D111042E7BCE56';
|
|
|
// header['uid']='BE98A41B9E0C44C1B5EDCBCE39D550D0';
|
|
|
header['Content-Type']='application/x-www-form-urlencoded';
|
|
@@ -28,9 +34,9 @@ const http = (url = '', date = {}, type = 'POST', header = {
|
|
|
/* setTimeout(function() {
|
|
|
uni.hideLoading();
|
|
|
}, 200); */
|
|
|
- uni.hideLoading();
|
|
|
- let [error, res] = response;
|
|
|
|
|
|
+ let [error, res] = response;
|
|
|
+ uni.hideLoading();
|
|
|
if(res.data.code==1){
|
|
|
/* uni.showToast({
|
|
|
title: res.data.msg ? res.data.msg : '接口错误',
|
|
@@ -40,6 +46,7 @@ const http = (url = '', date = {}, type = 'POST', header = {
|
|
|
resolve(res.data);
|
|
|
}
|
|
|
else if(res.data.code==401){
|
|
|
+ uni.hideLoading();
|
|
|
uni.showToast({
|
|
|
title: res.data.msg,
|
|
|
icon:'none',
|
|
@@ -61,6 +68,7 @@ const http = (url = '', date = {}, type = 'POST', header = {
|
|
|
}
|
|
|
}else if(res.data.code==0){
|
|
|
// 正常
|
|
|
+ uni.hideLoading();
|
|
|
resolve(res.data);
|
|
|
}
|
|
|
|