Commit 250832c5 authored by 李晓兵's avatar 李晓兵

'人脸比对'

parent 899a5e6d
......@@ -375,31 +375,122 @@ export default {
content: `您确认${val}吗?`,
onConfirm: (data) => {
if (data) {
let vm = this
let url = process.env.basePath + 'do_confrim_bp'
let param = {
'master': {
confirm_id: vm.confirm_id,
confirm_status: status,
confirm_note: this.confirm_note,
},
}
vm.hlsPopup.showLoading('提交数据中!')
vm.hlsHttp.post(url, param).then(function (res) {
vm.hlsPopup.hideLoading()
if (res.result === 'S') {
vm.hlsPopup.showSuccess(`审批成功,已${val}`)
vm.$router.push({
name: 'ContractSigning',
})
} else {
vm.hlsPopup.showSuccess(res.message)
}
})
// 执行同意的逻辑,先打开相机自拍一张
this.takePhonto(status)
// this.confirmContractSign()
}
},
})
},
takePhonto (status) {
hlsPopup.showPopup({
title: '提示',
content: `请自拍一张`,
onConfirm: () => {
this.takePhontoOpenCamera(status)
},
})
},
// 打开相机自拍
takePhontoOpenCamera (status) {
let vm = this
let obj = {
'pkvalue': check_id,
'source_type': 'PRJ_CDD_ITEM_CHECK',
'picture': '',
'check_id': check_id,
'filePath': '',
'attachment_id': '',
'user_id': 1,
'fileName': '',
}
let cameraoptions = {
quality: 100,
cameraDirection: 1,
}
let success = function (imgdata) {
obj.filePath = imgdata
this.confirmContractSign(imgdata,status)
/* let list = []
list.push(obj)
// vm.upload_list.push(obj)
// 拍完一张立马执行保存图片逻辑
vm.save_picture(list) */
}
let error = function () {
hlsPopup.showLongCenter('请拍照')
}
hlsUtil.openCamera(cameraoptions, success, error)
},
// 执行同意的逻辑(查询对应的身份证正面图片->人脸识别->确认签约)
async confirmContractSign (faceImg,status) {
let idCardImgUrl = await this.idCardImgUrlGet()
this.faceIdentify(faceImg, idCardImgUrl,status)
},
// 获取身份证照片
async idCardImgUrlGet () {
let vm = this
let url = $config.basePath + ''
let param = {
}
hlsPopup.showLoading('请稍候')
let res = await vm.$post(url, param)
hlsPopup.hideLoading()
if (res.result === 'S') {
return res.url
} else {
hlsPopup.showLongCenter(res.info.msg)
return null
}
},
// 人脸比对
faceIdentify (faceImg, idCardImgUrl,status) {
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.success) {
let identifyScore = res.result.result.score.toFixed(0)
hlsPopup.showPopup({
title: '提示',
content: `识别分数为${identifyScore}`,
onConfirm: () => {
this.doConfirm(status)
},
})
}
})
},
// 确认签约逻辑
doConfirm (status) {
let vm = this
let url = process.env.basePath + 'do_confrim_bp'
let param = {
'master': {
confirm_id: vm.confirm_id,
confirm_status: status,
confirm_note: this.confirm_note,
},
}
vm.hlsPopup.showLoading('提交数据中!')
vm.hlsHttp.post(url, param).then(function (res) {
vm.hlsPopup.hideLoading()
if (res.result === 'S') {
vm.hlsPopup.showSuccess(`审批成功,已${val}`)
vm.$router.push({
name: 'ContractSigning',
})
} else {
vm.hlsPopup.showSuccess(res.message)
}
})
},
popProtocol () {
let modal = document.querySelector('.myModal')
let alpha = 0
......
......@@ -523,7 +523,6 @@ export default {
hlsPopup.showLoading('请稍候')
let res = await vm.$post(url, param)
hlsPopup.hideLoading()
debugger
if (res.info.code === 0) {
return res.info.data.authUrl
} else {
......
......@@ -276,7 +276,7 @@
</item>
</list-item>
</div>
<div v-if="cddItemList.length" class="userInfo">资产信息</div>
<div v-if="cddItemList.length" class="userInfo">附件信息</div>
<div v-for="(list, index) in cddItemList" :key="index" class="card">
<span>{{ list.description }}</span>
<div class="img-content">
......
......@@ -374,7 +374,7 @@
<!-- 资产信息 -->
<div v-if="cddItemList.length" :class="{martop: flag,types:!flag}" class="userInfo">资产信息</div>
<div v-if="cddItemList.length" :class="{martop: flag,types:!flag}" class="userInfo">附件信息</div>
<div v-for="(list, index) in cddItemList" :key="index" class="card2">
<span>{{ list.description }}</span>
<div class="img-content">
......
......@@ -278,6 +278,7 @@ export default {
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: window.localStorage.savePhoto || false,
correctOrientation: true,
cameraDirection: cameraoption.cameraDirection || 0
}
navigator.camera.getPicture(onSuccess, onFail, options)
} else {
......@@ -474,6 +475,39 @@ export default {
ft.upload(path, url, uploadSuccess, error, options)
},
/**
* 百度OCR人脸识别
* @param file
* @param url
* @param success
*/
baiduOcrFace: function (file, postUrl, success) {
let path = file.fileUrl
let name = path.substr(fileUrl.lastIndexOf('/') + 1)
let url = encodeURI(postUrl)
let options = new FileUploadOptions() // eslint-disable-line
options.headers = {
'Authorization': 'Bearer ' + window.localStorage.access_token,
}
options.fileKey = 'file'
options.fileName = name
options.mimeType = 'multipart/form-date'
options.params = {
'imagePath': file.idCardImgUrl,
}
let ft = new FileTransfer() // eslint-disable-line
function uploadSuccess (message) {
let res = JSON.parse(message.response)
success(res)
}
function error (e) {
this.hlsPopup.showLongCenter('识别失败')
}
ft.upload(path, url, uploadSuccess, error, options)
},
/**
*
* @param x 输入的数字
......
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