百度AI要图片为base64编码的,我用filesystemmanager.ReadFile总是返回的是fail
也不报错
使用的是微信开发者工具,JS后台
wx.chooseImage({
sizeType: ['original', 'compressed'],
sourceType: [type],
success: function (res) {
var tempFilePaths = res.tempFilePaths
that.tempFilePath = tempFilePaths
//console.log(tempFilePaths)
//that.getkey(res.data)
wx.getFileSystemManager().readFile({
filePath:tempFilePaths,
encoding:'base64',
//decoding:"base64",
success:res=>{
console.log(res.data)
//that.getkey(res.data)
},
fail:res=>{
console.log('fail')
wx.hideLoading();
wx.showToast({
title: '拍照失败',
icon: "none"
})
}
})