ChooseMedia() {//添加照片
let _that = this;
uni.chooseImage({
count: 8, //默认9
sizeType: ['original', 'compressed'],
success: (res) => {
//console.log(res)
//console.log(this.memIndex)
if (this.imgList.length != 0) {
this.imgList = this.imgList.concat(res.tempFiles);
this.imgPath = this.imgPath.concat(res.tempFilePaths)
} else {
//this.imgList = res.tempFilePaths;
this.imgList = res.tempFiles;
this.imgPath = res.tempFilePaths;
}
// #ifndef H5
var tempFilePaths = res.tempFilePaths;
var imgLen = tempFilePaths.length;
// imgxx = [];
// //console.log(res.tempFilePaths)
console.log(tempFilePaths)
for(let i=0;i<imgLen;i++){
console.log(i)
uni.saveFile({
tempFilePath: tempFilePaths[i],
success: function (res) {
//var savedFilePath = res.savedFilePath;
//imgxx.push(res.savedFilePath);
console.log(res)
},fail(e) {
console.log(e)
}
});
}
// #endif
}
});
},
nomo998 (作者)
还是不行的
2020-09-03 10:57
5***@qq.com
回复 nomo998: 我也碰到了这个问题请问解决了吗,我加了promise,还是有失败的
2020-09-09 09:37
nomo998 (作者)
回复 5***@qq.com: 没有呢,直接不用了,目前没有找到解决方法呢
2020-09-09 14:49
5***@qq.com
回复 nomo998: 我搞定了用递归,失败了就重新保存知道保存为止
2020-09-10 14:56
nomo998 (作者)
回复 5***@qq.com: 兄tie 加个扣 指导一下395534391 感恩
2020-09-11 21:04
DCloud_UNI_GSQ
回复 5***@qq.com: 使用promise的话,串行应该也可以避免
2020-10-10 17:11