收藏
回答

微信OCR识别报错怎么办?

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'

      })

    })

  },



回答关注问题邀请回答
收藏
登录 后发表内容