import request from '@/utils/request.js' import { headerEncrypt, paramEncrypt } from '@/utils/bridge.js' async function EncryptProcess(obj1, obj2) { let data = { 'param1': { 'param' : '' }, 'param2': { 'param' : '' } }; try { // 等待第一个异步操作完成 const responseData1 = await paramEncrypt(obj1); data.param1.param = responseData1; // 等待第二个异步操作完成 const responseData2 = await headerEncrypt(obj2); data.param2.param = responseData2; } catch (error) { console.error('An error occurred in either operation:', error); } // 两个异步操作都完成后,返回合并的结果 return data; } export async function vipInfo (data, obj) { const result = await EncryptProcess(data, obj); // 获取到result之后再执行请求 return request({ url: '/api/product', method: 'get', params: result.param1, headers: result.param2 }) }
标签:异步,const,请求,param,接口,error,data,result From: https://www.cnblogs.com/chicidol/p/18091166