// subpackages/dahome/dahome.js Page({ data: { // levelOptions: ['初级', '中级', '高级'], // selectedLevelIndex: 0, typeOptions: ['1段', '2段', '3段'], selectedTypeIndex: 0, items: [ { image: 'https://img1.baidu.com/it/u=2052658756,3021621759&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500', title: '全脑智能开发答案', subtitle: '初级1', downloadCount: 128 }, { image: 'https://img1.baidu.com/it/u=2052658756,3021621759&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500', title: '全脑智能开发答案', subtitle: '初级1', downloadCount: 128 }, { image: 'https://img1.baidu.com/it/u=2052658756,3021621759&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500', title: '全脑智能开发答案', subtitle: '初级1', downloadCount: 128 },{ image: 'https://img1.baidu.com/it/u=2052658756,3021621759&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500', title: '全脑智能开发答案', subtitle: '初级1', downloadCount: 128 },{ image: 'https://img1.baidu.com/it/u=2052658756,3021621759&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500', title: '全脑智能开发答案', subtitle: '初级1', downloadCount: 128 },{ image: 'https://img1.baidu.com/it/u=2052658756,3021621759&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500', title: '全脑智能开发答案', subtitle: '初级1', downloadCount: 128 }, ], souimg: '', xialaimg: '', goods_9: '', }, onLoad() { const fileIDs = [ 'cloud://cloud1-6g98iw7i28b01747.636c-cloud1-6g98iw7i28b01747-1367995226/images/icon/sou.png', 'cloud://cloud1-6g98iw7i28b01747.636c-cloud1-6g98iw7i28b01747-1367995226/images/icon/xiala.png', 'cloud://cloud1-6g98iw7i28b01747.636c-cloud1-6g98iw7i28b01747-1367995226/images/goods/goods_9.jpg' ]; // 并发下载多个 fileID Promise.all( fileIDs.map(fileID => wx.cloud.downloadFile({ fileID })) ).then(results => { // 每个 result 对应一个下载结果 const tempFilePaths = results.map(r => r.tempFilePath); console.log('全部下载成功:', tempFilePaths); this.setData({ souimg: tempFilePaths[0], xialaimg: tempFilePaths[1], goods_9: tempFilePaths[2], }); }).catch(err => { console.error('有文件下载失败:', err); }); }, // handleLevelChange(e) { // this.setData({ // selectedLevelIndex: e.detail.value // }); // }, handleTypeChange(e) { this.setData({ selectedTypeIndex: e.detail.value }); } })