private onDealWithData = (fileUris: string[]) => {
    console.log('appLog:fileUris:', JSON.stringify(fileUris));
    this.showChooseImage = fileUris
    this.onUploadImageFileList = []
    const promises = fileUris.map(async item => await this.onPromiseTask(item));
    Promise.all(promises)
      .then(() => {
        console.log("All tasks completed. Proceed to the next step.");
        if (this.onUploadImageFileList.length > 0) {
          this.onUploadFile(this.onUploadImageFileList);
        } else {
          console.log('onUploadImageFileList的长度为0')
        }
        // 在这里执行下一步操作
      })
      .catch(error => {
        console.error("Error occurred:", error);
      });
  }
  private onPromiseTask = (v) => {
    return new Promise((resolve, reject) => {
      fs.open(v, fs.OpenMode.READ_ONLY).then((file) => { // READ_ONLY READ_WRITE
        const dateStr = (new Date().getTime()).toString()
        let newPath = context.cacheDir + `/${dateStr}.png`;
        fs.copyFile(file.fd, newPath).then(() => {
          console.info("applog:copy file succeed");
          let realUri = "internal://cache/"+newPath.split("cache/")[1];
          const obj = {
            filename: `${dateStr}.png`,
            name: "files",
            uri: realUri,
            type: "png"
          }
          this.onUploadImageFileList.push(obj);
          resolve(true)
        }).catch((err) => {
          console.info("applog:copy file failed with error message: " + err.message + ", error code: " + err.code);
        });
      }).catch((err) => {
        console.info("applog:open file failed with error message: " + err.message + ", error code: " + err.code);
      });
    })
  }
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.