Request initialize failed with message: The specified module could not be found. \\?\C:\Program Files (x86)\Tencent\微信webå¼åè å·¥å ·\code\package.nw\node_modules\node-float-pigment-css\float-pigment-css-for-nodejs.node
wx.serviceMarket.invokeService({
service: 'wx79ac3de8be320b71',
api: 'OcrAllInOne',
data: {
img_url: filePath,
data_type: 3,
ocr_type: 1,
},
}).then(res => {
console.log('微信OCR识别成功', res)
// 解析OCR结果
const ocrResult = res.data
if (ocrResult && ocrResult.type === 0) {
that.setData({
'formData.name': ocrResult.name.text || '',
'formData.idCard': ocrResult.id.text || '',
'formData.province': '',
'formData.city': '',
'formData.district': '',
'formData.detailAddress': ocrResult.address.text || ''
})
}
wx.hideLoading()
wx.showToast({
title: '识别成功',
icon: 'success'
})
}).catch(err => {
console.error('微信OCR识别失败', err)
wx.hideLoading()
wx.showToast({
title: '微信OCR识别失败',
icon: 'none'
})
})
},
