app.js
Promise: function(promise){
let APIURL = 'https://xxx.xxxx.com/';
return new Promise(function (resolve, reject){
wx.request({
url: APIURL + promise.url,
data: promise.data,
method: promise.method,
success(res) {
//跟服务器通信是否正常
if (res.statusCode === 200) {
//接口返回数据的状态码判断
if (res.data.code === 1000){
//返回接口的正常数据
resolve(res.data);
}else{
//显示接口返回的错误信息
wx.showToast({title: res.data.msg,icon: 'none',duration: 1500});
resolve();
}
}else{
wx.showToast({title: "网络异常",ic