printText(){
let globalData= wx.getStorageSync("globalData")
wx.chooseMedia({
count:1,
mediaType: ['image'],
sourceType:['album'],
camera: 'back',
success: function(res:any) {
console.log(res);
var filePath =res.tempFiles[0].tempFilePath
console.log('filePath',filePath)
wx.request({
url: 'https://api.weixin.qq.com/cgi-bin/token',
method: 'GET',
data: {
grant_type: 'client_credential',
appid: globalData.appid,
secret: globalData.secret
},
success: function(res:any) {
var access_token = res.data.access_token;
wx.request({
url: 'https://api.weixin.qq.com/cv/ocr/comm?access_token=' + access_token,
method: 'POST',
data: {
img: 'https://tse2-mm.cn.bing.net/th/id/OIP-C.eWsWHlunRn7q296JL4jmbwHaJ4?pid=ImgDet&rs=1',
},
success: function(res) {
console.log('返回结果',res.data);
},
fail: function(err) {
console.error(err);
}
})
},
fail: function(err) {
console.error(err);
}
})
}
})},
已经告诉你缺少的数据啦