Commit e948e710 authored by 李晓兵's avatar 李晓兵

'增加合格证识别'

parent 26563110
......@@ -9,8 +9,8 @@
</div>
<div class="down-content">
<span>请上传照片</span>
<div class="photo">
<!-- <img src=""> -->
<div class="photo" @click="ocrShow()">
<img v-if="vehicleImg" :src="vertifyImg" alt="">
</div>
<list-item :item-height="44">
<item>
......@@ -313,6 +313,7 @@ export default {
bp_id: '',
},
equip: [],
vehicleImg: '',
}
},
computed: {
......@@ -359,6 +360,76 @@ export default {
})
},
methods: {
// ocr识别入口
ocrShow () {
let vm = this
hlsPopup.showActionSheet({
titleText: '请选择照片',
buttonArray: ['拍照', '从相册取'],
callback: index => {
if (index === 0) {
vm.openCamera()
} else {
vm.takePicture()
}
},
})
},
openCamera () {
let vm = this
let cameraoptions = {
quality: 60,
width: 1843,
height: 1382,
}
let success = function (imgdata) {
if (!imgdata) {
hlsPopup.showLongCenter('请拍照')
} else {
vm.vehicleImg = imgdata
vm.vehicleIdentify(imgdata)
}
}
let error = function () {
hlsPopup.showLongCenter(error)
}
hlsUtil.openCamera(cameraoptions, success, error)
},
takePicture () {
let vm = this
var cameraoptions = {
quality: 70,
width: 1843,
height: 1382,
maxCount: 1,
}
let success = function (imgUrl) {
if (imgUrl.length === 0) {
hlsPopup.showLongCenter('请选择一张图片')
} else {
vm.vehicleImg = imgUrl[0]
vm.vehicleIdentify(imgUrl[0])
}
}
let error = function () {
hlsPopup.showLongCenter(error)
}
vm.hlsUtil.takePicture(cameraoptions, success, error)
},
// 合格证识别
vehicleIdentify (fileUrl) {
let vm = this
hlsPopup.showLoading('正在识别')
let url = process.env.ocrPath + '/baidu/ocr/vehicle_certificate'
hlsUtil.baiduOcr(fileUrl, url, function (res) {
hlsPopup.hideLoading()
let result = res.result.words_result
vm.frame_number = result.VinNo // 车架号
vm.engine = result.EngineNo // 发动机号
//vm.vehicle_model = result.VinNo // 车辆型号
vm.certificate_number = result.CertificationNo // 合格证编号
})
},
showTime (format) {
this.hlsPopup.showTime({
nowDate: `${this.carDate}`,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment