| | |
| | | prop="idCard" |
| | | borderBottom |
| | | > |
| | | <u--input v-model="model.idCard" maxlength="18" border="none" placeholder="请输入"></u--input> |
| | | <view style="idth: 100%; position: relative;"> |
| | | <u--input v-model="model.idCard" maxlength="18" border="none" placeholder="请输入"></u--input> |
| | | <button style="position: absolute; top: 0; right: 0; font-size: 22rpx;" @click="test">识别身份证</button> |
| | | </view> |
| | | </u-form-item> |
| | | <u-form-item |
| | | label="派遣单位:" |
| | |
| | | this.getDispatchingUnit() |
| | | }, |
| | | methods: { |
| | | test() { |
| | | var that = this; |
| | | // 选择图片 |
| | | wx.chooseImage({ |
| | | count: 1, |
| | | success: async function(res) { |
| | | try { |
| | | uni.showLoading({ title: '识别中' }); |
| | | const invokeRes = await wx.serviceMarket.invokeService({ |
| | | service: 'wx79ac3de8be320b71', |
| | | api: 'OcrAllInOne', |
| | | data: { |
| | | // 用 CDN 方法标记要上传并转换成 HTTP URL 的文件 |
| | | img_url: new wx.serviceMarket.CDN({ |
| | | type: 'filePath', |
| | | filePath: res.tempFilePaths[0], |
| | | }), |
| | | data_type: 3, |
| | | ocr_type: 1 |
| | | }, |
| | | }) |
| | | that.model.idCard = invokeRes.data.idcard_res.id.text |
| | | that.model.name = invokeRes.data.idcard_res.name.text |
| | | uni.hideLoading(); |
| | | } catch (err) { |
| | | wx.showModal({ title: 'fail', content: err }) |
| | | uni.hideLoading(); |
| | | } |
| | | }, |
| | | fail: function(res) {}, |
| | | complete: function(res) {}, |
| | | }) |
| | | }, |
| | | // 派遣单位 |
| | | getDispatchingUnit() { |
| | | this.$u.api.findListByDTO({ |