addresslist.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. Page({
  2. data: {
  3. addresses: [
  4. {
  5. address: '宁夏青铜峡市秦岭路846号'
  6. },
  7. {
  8. address: '浙江省永康市红旗桥湖滨大道124号'
  9. }
  10. ],
  11. souimg: '',
  12. shanchu: '',
  13. xiugaiimg: '',
  14. dingweiimg: '',
  15. },
  16. onLoad(options) {
  17. // const title = options.title ? decodeURIComponent(options.title) : '商品列表';
  18. // this.setData({ title });
  19. // wx.setNavigationBarTitle({ title });
  20. const fileIDs = [
  21. 'cloud://cloud1-6g98iw7i28b01747.636c-cloud1-6g98iw7i28b01747-1367995226/images/icon/sou.png',
  22. 'cloud://cloud1-6g98iw7i28b01747.636c-cloud1-6g98iw7i28b01747-1367995226/images/icon/shanchu.png',
  23. 'cloud://cloud1-6g98iw7i28b01747.636c-cloud1-6g98iw7i28b01747-1367995226/images/icon/xiugai.png',
  24. 'cloud://cloud1-6g98iw7i28b01747.636c-cloud1-6g98iw7i28b01747-1367995226/images/icon/dingwei.png'
  25. ];
  26. // 并发下载多个 fileID
  27. Promise.all(
  28. fileIDs.map(fileID => wx.cloud.downloadFile({ fileID }))
  29. ).then(results => {
  30. // 每个 result 对应一个下载结果
  31. const tempFilePaths = results.map(r => r.tempFilePath);
  32. console.log('全部下载成功:', tempFilePaths);
  33. this.setData({
  34. souimg: tempFilePaths[0],
  35. shanchu: tempFilePaths[1],
  36. xiugaiimg: tempFilePaths[2],
  37. dingweiimg: tempFilePaths[3],
  38. });
  39. }).catch(err => {
  40. console.error('有文件下载失败:', err);
  41. });
  42. },
  43. handleEdit(e) {
  44. const index = e.currentTarget.dataset.index;
  45. // 处理编辑逻辑
  46. },
  47. handleDelete(e) {
  48. const index = e.currentTarget.dataset.index;
  49. // 处理删除逻辑
  50. },
  51. handleAddAddress() {
  52. // 处理添加地址逻辑
  53. }
  54. });