云函数的security.imgSecCheck的图片检测图片大小限制1M?
云函数的security.imgSecCheck的图片检测图片大小限制1M根本就无法上传图片,而且上传图片的时候还要使用wx.getFileSystemManager()这个api,导致用户的体验很差
Promise.all(self.imgarr.map((tempFilePath, index) => {
return new Promise(function (resolve, reject) {
uni.showLoading({
title: '图片安全检测中'
});
wx.getFileSystemManager()
.readFile({
filePath: tempFilePath,
success: r => {
console.log("readSuccess:", r);
wx.cloud.callFunction({
name: "imgcheck",
data: {
img: r.data
},
success: result => {
console.log(result)
if(result.result.errCode==87014){
reject()
}
if(result.result.errCode==0 || result.result.errCode==404010){
resolve(1);
}else{
reject()
}
},
fail: err => {
reject()
uni.showToast({
title: '图片超出1M',
duration: 2000,
icon: 'none'
});
console.log("readFail:", err);
}
})
},
fail: err => {
console.log("readFail:", err);
}
});
});
})).then((res) => {
uni.showToast({
title: '检测通过',
duration: 2000
});
self.submit()
console.log('全部通过')
}).catch(function (err) {
uni.showToast({
title: '检测不通过',
duration: 2000,
icon: 'none'
});
})