- 调用cloud.openapi.ocr.bankcard 一直报错?errCode: 41005
// 调用js 代码 [代码]b[代码][代码]ankOCR() {[代码] [代码] [代码][代码]const that = [代码][代码]this[代码][代码] [代码][代码]wx.chooseImage({[代码][代码] [代码][代码]count: 1,[代码][代码] [代码][代码]sizeType: [[代码][代码]'compressed'[代码][代码]], [代码][代码] [代码][代码]sourceType: [[代码][代码]'album'[代码][代码], [代码][代码]'camera'[代码][代码]], [代码][代码] [代码][代码]success: [代码][代码]function[代码][代码](res) {[代码][代码] [代码][代码]var[代码] [代码]tempFilePaths = res.tempFilePaths[0][代码] [代码] [代码][代码]let buffer = wx.getFileSystemManager().readFileSync(tempFilePaths)[代码][代码] [代码][代码]wx.cloud.callFunction({[代码][代码] [代码][代码]name: [代码][代码]'bank_ocr'[代码][代码],[代码][代码] [代码][代码]data: { buffer:buffer }[代码][代码] [代码][代码]}).then([代码][代码] [代码][代码]r => {[代码][代码] [代码][代码]console.log(r)[代码][代码] [代码][代码]}[代码][代码] [代码][代码]).[代码][代码]catch[代码][代码](res=>{[代码][代码] [代码][代码]console.log(res)[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码] // 云函数入口文件 [代码]// 云函数入口文件[代码][代码]const cloud = require([代码][代码]'wx-server-sdk'[代码][代码])[代码] [代码]cloud.init()[代码] [代码]// 云函数入口函数[代码][代码]exports.main = async(event, context) => {[代码] [代码] [代码][代码]let result = await cloud.openapi.ocr.bankcard({[代码][代码] [代码][代码]type: [代码][代码]'photo'[代码][代码],[代码][代码] [代码][代码]// imgUrl: encodeURIComponent('https://static.shop.58victory.com/test/WechatIMG1327.jpeg')[代码][代码] [代码][代码]img : {[代码][代码] [代码][代码]contentType: [代码][代码]'image/jpeg'[代码][代码],[代码][代码] [代码][代码]value: Buffer.from(event.buffer)[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}).then(res => {[代码][代码] [代码][代码]console.log(res)[代码][代码] [代码][代码]return[代码] [代码]res.number[代码][代码] [代码][代码]}).[代码][代码]catch[代码][代码](res => {[代码][代码] [代码][代码]console.log(res)[代码][代码] [代码][代码]return[代码] [代码]res[代码][代码] [代码][代码]})[代码][代码] [代码][代码]return[代码] [代码]result[代码][代码]}[代码]报错 :Error: errCode: 41005 | errMsg: openapi.ocr.bankcard:fail media data missing hint: 请官方大大支持下。 通过imgUrl的方式是可以识别的,但是通过img的方式就一直报错。fail media data missing
2019-09-30 - 关于navigationStyle建议
navigationStyle一旦设置成自定义的,全部页面都没有导航栏了,其实我们只是希望个别页面自定义,而不是全局,希望能在子页面json能配置
2018-01-25