What is the problem of js concurring multiple ajax in Synchronize's method?

async getData() {
      await this.Arr.forEach(async val => {
        let obj = {};
        let itemBody = {key:val}
        let data = await post(this.dataUrl, itemBody, this.header);
        console.log(data);
        if (data.result) {
          obj[val] = data.result.res;
          closeAry.push(obj);
        }
      });
      this.closeAry = closeAry;
      let setKey = this.getStorageKey()
      wx.setStorageSync(setKey.toString(), closeAry)
    }
The

Arr array corresponds to 15 interfaces. Synchronize was supposed to execute each ajax, but it was too slow. How to make the concurrent request data and the order of the returned results in closeAry correspond to the order of Arr?

Apr.01,2021

each request is put into promise, which forms an array of 15 promise, which is executed concurrently using Promise.all (promise array), and then then fetches the data.

the final effect picture looks like this, indicating that there may be bug

.
async getData() {
  let promises = [];
  this.Arr.forEach(val => {
      promises.push(new Promise(resolve, reject) {
        let obj = {};
        let itemBody = {key:val}
        post(this.dataUrl, itemBody, this.header)
          .then(data=>resolve({[val]:data.result.res}))
          .catch(reject);
      });
  });

  let closeAry = await Promise.all(promises);

  this.closeAry = closeAry;
  let setKey = this.getStorageKey();
  wx.setStorageSync(setKey.toString(), closeAry);
}
Menu