页面调用
let urlImage = []
if(this.imgList.length > 0){
console.log("图片入口")
urlImage = this.Common.getUploadFile(this.imgList)
console.log("图片处理完成",urlImage)
}
上传相关
//组装上传到云存储
getUploadFile(lists){
console.log("进入图片数组处理")
let arr = []
Promise.all(lists.map(async (item)=>{
await this.uploadFile(item).then(res =>{
console.log("图片上传完成")
arr.push(res.fileID)
})} ))
return arr
},
async uploadFile(Image){
return new Promise((resolve, reject) => {
let cloudPath = new Date().getTime();
uniCloud.uploadFile({
cloudPath:cloudPath,
filePath:Image
}).then(res =>{
console.log("图片上传成功")
resolve(res)
}).catch(err =>{
reject(err)
})
})
},