This commit is contained in:
邓晓坤
2019-10-22 10:15:07 +08:00
parent 1dd8fab904
commit ef8ad69acb
4 changed files with 176 additions and 40 deletions

View File

@@ -70,6 +70,14 @@ export function uploadImg(data) {
data
})
}
// 人脸识别
export function recognition(data) {
return request({
url: getUrl('/customer/recognition', 1),
method: 'post',
data
})
}
// 139.9.27.13:7002/updown/uploadImage
// 核保接口

View File

@@ -0,0 +1,67 @@
<template>
<div>
<van-uploader
name="fileListIdFront"
capture="camera"
:preview-image="false"
v-model="fileListIdFront"
upload-text="上传图片"
:after-read="afterRead"
class="mt10 ml20"
:max-count="1"
>
<van-button type="primary">人脸识别</van-button>
</van-uploader>
</div>
</template>
<script>
import { Uploader, button } from 'vant'
import { uploadImg } from '@/api/ebiz/sale/sale'
export default {
name: 'UploadImageFile',
data() {
return {
file: '',
imgName: '',
fileListIdFront: []
}
},
components: {
[button.name]: button,
[Uploader.name]: Uploader
},
methods: {
afterRead(file) {
let that = this
// console.log(type)
// 此时可以自行将文件上传至服务器
that.file = file.content
that.imgName = Math.floor(Math.random() * 100).toString() + new Date().getTime() + file.file.name //为图片名加随机数 与时间戳
that.uploadImg()
},
dataURLtoFile(dataurl, filename) {
var arr = dataurl.split(','),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length,
u8arr = new Uint8Array(n)
while (n--) {
u8arr[n] = bstr.charCodeAt(n)
}
return new File([u8arr], filename, { type: mime })
},
uploadImg() {
let that = this
let formdata = new FormData()
console.log('file-----------------', that.file)
console.log('name-----------------', that.imgName)
formdata.append('imgPath', that.dataURLtoFile(that.file, that.imgName))
uploadImg(formdata).then(res => {
that.$emit('sendimage', that.file)
that.$forceUpdate()
})
}
}
}
</script>

View File

@@ -43,20 +43,21 @@
<p class="start" v-if="airSign != '1'">点击开始按钮进行相关操作</p>
<div v-if="!isInvalid" class="flex justify-content-a mt20">
<!-- <van-button
<van-button
v-if="isShow"
type="danger"
size="normal"
style="width: 157px;"
class="w160"
plain
v-no-more-click="1000"
:disabled="appntSign.signStatus == '1'"
@click="share(insured.length == '0' ? '2' : '0')"
>分享</van-button> -->
>分享</van-button
>
<van-button
type="danger"
size="normal"
style="width: 157px;"
class="w160"
plain
:disabled="appntSign.signStatus == '1'"
v-no-more-click="1000"
@@ -92,7 +93,7 @@
</p>
<p class="start" v-if="airSign != '1'">点击开始按钮进行相关操作</p>
<div v-if="!isInvalid" class="flex justify-content-a mt20">
<!-- <van-button
<van-button
v-if="isShow"
type="danger"
size="normal"
@@ -101,7 +102,8 @@
@click="share('1')"
plain
v-no-more-click="1000"
>分享</van-button> -->
>分享</van-button
>
<van-button
type="danger"
size="normal"
@@ -188,8 +190,8 @@
<span class="text">{{ insuredSign.tipsSignDocumentName }}</span>
<img :src="src" v-if="insuredSign.tipsSignStatus == '1'" />
</p> -->
<!-- 新加的 需要改++++++++++++++++++++++++= -->
<p>需签111</p>
<p>需签署</p>
<p class="mb20">
<span class="text">{{ insuredSign.signDocumentName }}</span>
<img :src="src" v-if="insuredSign.signStatus == '1'" />
@@ -214,15 +216,15 @@
:disabled="insuredSign.signStatus == '1'"
@click="start_ocr('1')"
v-no-more-click="1000"
>开始</van-button
>开始 微信</van-button
>
<UploadImageFile @sendimage="sendimage"></UploadImageFile>
</div>
<div class="text" v-else>操作时间已失效请联系销售人员</div>
</van-collapse-item>
</van-collapse>
</div>
</div>
<!-- <p class="mb20">尊敬的<span class="text">陈伟</span>先生/女士您好</p>
<p class="mb20">
感谢您于<span class="text">2019-08-03</span>在鼎诚人寿保险有限责任公司为陈伟投保保费合计<span class="text">7128</span>销售人员为1009368孙岚
@@ -245,6 +247,7 @@
<script>
import { Cell, CellGroup, Collapse, CollapseItem, Dialog } from 'vant'
import UploadImageFile from '@/components/ebiz/sale/UploadImageFile'
import { underWrite, getOrderDetail, getToken, getSignInvalid, checkSignInvalid } from '@/api/ebiz/sale/sale'
import { weixinShare } from '@/assets/js/utils/wxShare.js'
// import axios from 'axios'
@@ -406,13 +409,14 @@ export default {
idcardName: JSON.parse(this.$route.query.saleInsuredInfo).name,
idcardNumber: JSON.parse(this.$route.query.saleInsuredInfo).idNo
}
getToken(data).then(res => {
if (res.result == '0') {
window.location.href = `https://api.megvii.com/faceid/lite/do?token=${res.content.token}`
} else {
this.$toast(res.resultMessage)
}
})
// getToken(data).then(res => {
// if (res.result == '0') {
// window.location.href = `https://api.megvii.com/faceid/lite/do?token=${res.content.token}`
// } else {
// this.$toast(res.resultMessage)
// }
// })
}
} else {
window.localStorage.setItem('sign-val', val)
@@ -432,13 +436,13 @@ export default {
idcardName: JSON.parse(this.$route.query.saleInsuredPersonInfo).name,
idcardNumber: JSON.parse(this.$route.query.saleInsuredPersonInfo).idNo
}
getToken(data).then(res => {
if (res.result == '0') {
window.location.href = `https://api.megvii.com/faceid/lite/do?token=${res.content.token}`
} else {
this.$toast(res.resultMessage)
}
})
// getToken(data).then(res => {
// if (res.result == '0') {
// window.location.href = `https://api.megvii.com/faceid/lite/do?token=${res.content.token}`
// } else {
// this.$toast(res.resultMessage)
// }
// })
}
}
} else {
@@ -457,14 +461,14 @@ export default {
})
} else {
// 原人脸识别
// EWebBridge.webCallAppInJs('face_auth', {
// number: that.saleInsuredInfo.idNo, //身份证号码
// name: that.saleInsuredInfo.name //姓名
// })
// 跳过人脸识别
new Promise(resolve => {
console.log('--跳过人脸识别--返回识别成功')
resolve(JSON.stringify({ state: '1' }))
EWebBridge.webCallAppInJs('face_auth', {
number: that.saleInsuredInfo.idNo, //身份证号码
name: that.saleInsuredInfo.name //姓名
// })
// // 跳过人脸识别
// new Promise(resolve => {
// console.log('--跳过人脸识别--返回识别成功')
// resolve(JSON.stringify({ state: '1' }))
}).then(data => {
if (JSON.parse(data).state == '1') {
if (that.appntSign.readStatus == '0') {
@@ -519,13 +523,13 @@ export default {
})
} else {
// 跳过人脸识别
// EWebBridge.webCallAppInJs('face_auth', {
// number: that.saleInsuredInfo.idNo, //身份证号码
// name: that.saleInsuredInfo.name //姓名
// })
new Promise(resolve => {
console.log('--跳过人脸识别--返回识别成功')
resolve(JSON.stringify({ state: '1' }))
EWebBridge.webCallAppInJs('face_auth', {
number: that.saleInsuredInfo.idNo, //身份证号码
name: that.saleInsuredInfo.name //姓名
// })
// new Promise(resolve => { 你 你
// console.log('--跳过人脸识别--返回识别成功')
// resolve(JSON.stringify({ state: '1' }))
}).then(data => {
if (JSON.parse(data).state == '1') {
if (that.insuredSign.readStatus == '0') {
@@ -567,6 +571,13 @@ export default {
}
}
},
//调用微信人脸识别
wxtoface(imgData) {
let data = { imgData: imgData, realName: this.name, idno: this.telnum }
recognition(data).then(res => {
this.value = res
})
},
toTest() {},
// 微信分享
share(code) {
@@ -830,6 +841,7 @@ export default {
[Cell.name]: Cell,
[CellGroup.name]: CellGroup,
[Collapse.name]: Collapse,
UploadImageFile: UploadImageFile,
[CollapseItem.name]: CollapseItem,
[Dialog.name]: Dialog
},

View File

@@ -16,23 +16,68 @@
<br />
<div @click="bankAuto">bank 银行卡</div>
<br />
<input type="text" v-model="name" placeholder="人脸识别姓名" class="w350 mt12 p6" />
<input type="text" v-model="telnum" placeholder="人脸识别身份证" class="w350 mt12 p6" />
<!-- <div @click="facetoface" class="p8">人脸识别点击开始</div> -->
<van-button icon="photo" @click="facetoface" class="mt12" type="primary">人脸识别</van-button>
<br />
<!-- <UploadImageFile @sendimage="sendimage"></UploadImageFile> -->
<div>
{{ value }}
</div>
<br />
<br />
<br />
<br />
<br />
<UploadImageFile @sendimage="sendimage"></UploadImageFile>
<!-- <van-button icon="photo" @click="wxtoface" class="mt12" type="primary">H5拍照识别人脸识别</van-button> -->
</div>
</template>
<script>
import { Uploader, button } from 'vant'
import { uploadImg, recognition } from '@/api/ebiz/sale/sale'
import UploadImageFile from '@/components/ebiz/sale/UploadImageFile'
import { test } from '@/api/ebiz/sale/sale'
import Pdfh5 from 'pdfh5'
export default {
data() {
return {
name: '',
telnum: '',
imgData: '',
base64: '',
value: ''
value: '',
file: '',
imgName: '',
fileListIdFront: []
}
},
components: {
[button.name]: button,
UploadImageFile: UploadImageFile,
[Uploader.name]: Uploader
},
methods: {
wxtoface(imgData) {
let data = { imgData: imgData, realName: this.name, idno: this.telnum }
recognition(data).then(res => {
this.value = res
})
},
facetoface() {
let that = this
EWebBridge.webCallAppInJs('face_auth', {
number: this.telnum,
name: this.name
}).then(data => {
that.value = data
console.log(JSON.parse(data))
})
},
reload() {
window.location.reload()
setTimeout(() => {
@@ -97,6 +142,10 @@ export default {
}).then(data => {
_this.value = data
})
},
sendimage(v) {
// console.log(v)
this.wxtoface(v)
}
// start_ocr(val) {
// let that = this