const request=(url, method, data, the header)=& gt; {
Wx. ShowLoading ({
Title: '
});
The return of new Promise ((resolve, reject)=& gt; {
Wx. Request ({
Url: API_BASE_URL + url,
Method: method,
Data: data,
Header: header,
Success (request) {
Resolve (request. Data)
},
Fail (error) {
Reject (error)
},
Complete (aaa) {
//loaded
Var timerName=setTimeout (wx. HideLoading, 500);
}
})
})
};
/* *
* encapsulated FMS reques method
*/
Const frequest=(url, method, data, the header)=& gt; {
Wx. ShowLoading ({
Title: '
});
The return of new Promise ((resolve, reject)=& gt; {
Wx. Request ({
Url: FMS_BASE_URL + url,
Method: method,
Data: data,
Header: {
The content-type: "application/json; Charset=utf-8,
""KeyId" : "3 hrzcnowfolh3wsaaaaubglubhhaz2lsbglvbi5jb20uy24bagmebqyh
"},
Success (request) {
Resolve (request. Data)
},
Fail (error) {
Reject (error)
The console. The log (error);
},
Complete (aaa) {
//loaded
Var timerName=setTimeout (wx. HideLoading, 500);
}
})
})
};
CodePudding user response:
Remove the two functions show hidden in
Wx. ShowLoading ({
Title: '
});
Promise. All ([request, frequest]), then (res=& gt; {
Wx. HideLoading
});
Have a try
CodePudding user response: