function sleep(time){ return new Promise((resolve,reject)=>{ setTimeout(()=>{ console.log(time) if(time==3000){ reject('3000登录报错') } if(time==5000){ reject('5000登录报错') } },time) }) } async function test(){ try{ await Promise.all([sleep(3000),sleep(5000)]) console.log('登录成功') }catch(error){ console.log(error,11111) } } test()