promiseTest=()=>{
Toast.loading("加载中");
//接口传参
constargsa={
idType:"1",
idCord:"1234",
};
constargsb={
idType:"1",
idCord:"1234",
};
constargsc={
idType:"1",
idCord:"1234",
};
constpromiseAll=[];
constrequestA=requestPost("接口编号",argsa);
constrequestB=requestPost("接口编号",argsb);
constrequestC=requestPost("接口编号",argsc);
promiseAll.push(requestA,requestB,requestC);
constpromiseAllDone=Promise.all(promiseAll);
promiseAllDone.then(res=>{
console.log("所有情况都返回成功!");
Toast.hide();
//所有接口返回值都在res中,res为数组
//可以先再判断一下接口返回是否正常
for(leti=0;i<res.length;i++){
if(res[i].success!==true){
Toast.fail("系统异常!");
return;
}
}
//获取各个接口返回的结果
constresA=res[0];
constresB=res[1];
constresC=res[2];
});
}