Commit 587b725c authored by Jennie Shi's avatar Jennie Shi

ios代码备份

parent 49b0a08c
...@@ -178,15 +178,18 @@ ...@@ -178,15 +178,18 @@
</tab-button> </tab-button>
<tab-button class="approve" @click.native="isConfirm">确定</tab-button> <tab-button class="approve" @click.native="isConfirm">确定</tab-button>
</bottom-tab> </bottom-tab>
<!--活体检测-->
<body-check ref="body" :check_id="$route.params.check_id" :confirm_id="confirm_id" />
</h-view> </h-view>
</template> </template>
<script> <script>
import Tab from '@/pages/carConfirm/tab' import Tab from '@/pages/carConfirm/tab'
import bodyCheck from './body-check'
export default { export default {
components: { components: {
Tab, Tab,
// bodyCheck, bodyCheck,
}, },
filters: { filters: {
lengthCheck: function (value) { lengthCheck: function (value) {
...@@ -391,42 +394,126 @@ export default { ...@@ -391,42 +394,126 @@ export default {
getTabNum (i) { getTabNum (i) {
this.tabNum = i this.tabNum = i
}, },
async takePhonto () { takePhonto () {
let vm = this let vm = this
let flag = await this.signCheck() hlsPopup.showConfirm({
if (flag) { title: '提示',
vm.hlsPopup.showLongCenter('已经验证过!') content: '请自拍一张',
return onConfirm: function (index) {
if (index === 1) {
vm.takePhontoOpenCamera()
// vm.goElectronicSign()
} }
let url = process.env.basePath + 'bp_query' },
let param = { })
bp_id: window.localStorage.bp_id, },
// 图片上传
takePhontoOpenCamera () {
let vm = this
vm.faceListUpload = []
let obj = {
pkvalue: vm.check_id,
source_type: 'PRJ_CDD_ITEM_CHECK',
picture: '',
filePath: '',
attachment_id: '',
user_id: 1,
fileName: 'face',
} }
hlsPopup.showLoading('请稍候') let cameraoptions = {
vm.hlsHttp.post(url, param).then(res => { quality: 100,
cameraDirection: 1,
}
let success = function (imgdata) {
obj.filePath = imgdata
vm.confirmContractSign(imgdata)
vm.faceListUpload.push(obj)
}
let error = function () {
hlsPopup.showLongCenter('请拍照')
}
hlsUtil.openCamera(cameraoptions, success, error)
},
// 执行同意的逻辑(查询对应的身份证正面图片->人脸识别->活体检测)
async confirmContractSign (faceImg) {
let idCardImgUrl = await this.idCardImgUrlGet()
if (idCardImgUrl) {
this.faceIdentify(faceImg, idCardImgUrl)
}
},
// 人脸比对
faceIdentify (faceImg, idCardImgUrl) {
let vm = this
let obj = {
fileUrl: faceImg,
idCardImgUrl: idCardImgUrl,
}
hlsPopup.showLoading('正在比对')
let url = process.env.ocrPath + '/baidu/ocr/face'
hlsUtil.baiduOcrFace(obj, url, function (res) {
hlsPopup.hideLoading() hlsPopup.hideLoading()
if (res.result === 'S') { if (res.success && res.result.result.score) {
let data = res.lists[0] vm.save_picture(vm.faceListUpload)
cordova.plugins.IdCardPlugin.faceContrast({'idNum': data.id_card_no, 'idName': data.bp_name}, function (suc) { let identifyScore = res.result.result.score.toFixed(0)
let success = JSON.parse(suc) if (identifyScore > 50) {
if (success.code === 1) { hlsPopup.showPopup({
let filePath = JSON.stringify(success.message, '\\', null) title: '提示',
filePath = 'file:\/\/' + filePath.replace('\"', '') content: `识别分数为${identifyScore},请进行活体检测`,
filePath = filePath.substr(0, filePath.length - 1) onConfirm: () => {
console.log('filePath ==== ' + filePath) // 进入活体检测页面
// 回调成功上传图片 vm.goBodyCheck()
vm.uploadImg(filePath) },
vm.goElectronicSign()
}
}, function (reason) {
let error = JSON.parse(reason)
vm.hlsPopup.showLongCenter('认证失败: ' + error.message)
}) })
} else { } else {
vm.hlsPopup.showLongCenter(res.message) hlsPopup.showLongCenter('比对失败,请保证和绑定时是同一个人')
}
} else {
hlsPopup.showLongCenter('比对失败,请保证和绑定时是同一个人')
} }
}) })
}, },
goBodyCheck () {
// 活体检测
this.$refs.body.show()
},
// 新插件版本
// async takePhonto () {
// let vm = this
// let flag = await this.signCheck()
// if (flag) {
// vm.hlsPopup.showLongCenter('已经验证过!')
// return
// }
// let url = process.env.basePath + 'bp_query'
// let param = {
// bp_id: window.localStorage.bp_id,
// }
// hlsPopup.showLoading('请稍候')
// vm.hlsHttp.post(url, param).then(res => {
// hlsPopup.hideLoading()
// if (res.result === 'S') {
// let data = res.lists[0]
// cordova.plugins.IdCardPlugin.faceContrast({'idNum': data.id_card_no, 'idName': data.bp_name}, function (suc) {
// let success = JSON.parse(suc)
// if (success.code === 1) {
// let filePath = JSON.stringify(success.message, '\\', null)
// filePath = 'file:\/\/' + filePath.replace('\"', '')
// filePath = filePath.substr(0, filePath.length - 1)
// console.log('filePath ==== ' + filePath)
// // 回调成功上传图片
// vm.uploadImg(filePath)
// vm.goElectronicSign()
// }
// }, function (reason) {
// let error = JSON.parse(reason)
// vm.hlsPopup.showLongCenter('认证失败: ' + error.message)
// })
// } else {
// vm.hlsPopup.showLongCenter(res.message)
// }
// })
// },
// 查看大图 // 查看大图
showBigPicture (pic) { showBigPicture (pic) {
let vm = this let vm = this
......
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