orderdetails.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // subpackages/orderdetails/orderdetails.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. dingwei: '',
  8. fuzhi: '',
  9. yesbaoguo: '',
  10. },
  11. onLoad() {
  12. const fileIDs = [
  13. 'cloud://cloud1-6g98iw7i28b01747.636c-cloud1-6g98iw7i28b01747-1367995226/images/icon/dingwei.png',
  14. 'cloud://cloud1-6g98iw7i28b01747.636c-cloud1-6g98iw7i28b01747-1367995226/images/icon/fuzhi.png',
  15. 'cloud://cloud1-6g98iw7i28b01747.636c-cloud1-6g98iw7i28b01747-1367995226/images/icon/yesbaoguo.png'
  16. ];
  17. // 并发下载多个 fileID
  18. Promise.all(
  19. fileIDs.map(fileID => wx.cloud.downloadFile({ fileID }))
  20. ).then(results => {
  21. // 每个 result 对应一个下载结果
  22. const tempFilePaths = results.map(r => r.tempFilePath);
  23. console.log('全部下载成功:', tempFilePaths);
  24. this.setData({
  25. dingwei: tempFilePaths[0],
  26. fuzhi: tempFilePaths[1],
  27. yesbaoguo: tempFilePaths[2],
  28. });
  29. }).catch(err => {
  30. console.error('有文件下载失败:', err);
  31. });
  32. },
  33. })