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

ios代码备份

parent 49b0a08c
......@@ -178,15 +178,18 @@
</tab-button>
<tab-button class="approve" @click.native="isConfirm">确定</tab-button>
</bottom-tab>
<!--活体检测-->
<body-check ref="body" :check_id="$route.params.check_id" :confirm_id="confirm_id" />
</h-view>
</template>
<script>
import Tab from '@/pages/carConfirm/tab'
import bodyCheck from './body-check'
export default {
components: {
Tab,
// bodyCheck,
bodyCheck,
},
filters: {
lengthCheck: function (value) {
......@@ -391,42 +394,126 @@ export default {
getTabNum (i) {
this.tabNum = i
},
async takePhonto () {
takePhonto () {
let vm = this
let flag = await this.signCheck()
if (flag) {
vm.hlsPopup.showLongCenter('已经验证过!')
return
hlsPopup.showConfirm({
title: '提示',
content: '请自拍一张',
onConfirm: function (index) {
if (index === 1) {
vm.takePhontoOpenCamera()
// vm.goElectronicSign()
}
},
})
},
// 图片上传
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',
}
let url = process.env.basePath + 'bp_query'
let param = {
bp_id: window.localStorage.bp_id,
let cameraoptions = {
quality: 100,
cameraDirection: 1,
}
hlsPopup.showLoading('请稍候')
vm.hlsHttp.post(url, param).then(res => {
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()
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)
})
if (res.success && res.result.result.score) {
vm.save_picture(vm.faceListUpload)
let identifyScore = res.result.result.score.toFixed(0)
if (identifyScore > 50) {
hlsPopup.showPopup({
title: '提示',
content: `识别分数为${identifyScore},请进行活体检测`,
onConfirm: () => {
// 进入活体检测页面
vm.goBodyCheck()
},
})
} else {
hlsPopup.showLongCenter('比对失败,请保证和绑定时是同一个人')
}
} else {
vm.hlsPopup.showLongCenter(res.message)
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) {
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