多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
``` let temArr = \[\]; for (var i = 0; i < this.data.images.length; i++) { temArr.push(new Promise((resolve, resject) => { let item = that.data.images\[0\] let suffix = /\\.\\w+$/.exec(item)\[0\] //后缀名 wx.cloud.uploadFile({ cloudPath: new Date().getTime() + suffix, filePath: item, // 文件路径 }).then(res => { that.setData({ fileIds: that.data.fileIds.concat(res.fileID) }) // get resource ID console.log(99999) console.log(res.fileID) resolve() }).catch(error => { // handle error resject() }) })) } Promise.all(temArr).then(res => { db.collection('comment').add({ data: { content: this.data.commentValue, score: this.data.rateScore, movieid: this.data.movieid, fileIds: this.data.fileIds } }).then(res => { wx.hideLoading() wx.showToast({ title: '评价成功!', }) }).catch(err => { wx.hideLoading() wx.showToast({ title: '评价失败!', }) }) }).catch(err => { }); ```