[FIX]【更换人脸识别厂商】取消调用UploadImageFile组件;签名页分享到微信url修改,减少url长度,页面初始化所需参数从请求后端接口并调用intLocalStorage方法后的localStorage中取

This commit is contained in:
yuweiqi
2020-05-07 16:47:59 +08:00
parent 2fe9df9a44
commit b8348f4559

View File

@@ -227,20 +227,29 @@
}}</van-button>
</van-cell-group>
</van-dialog>
<UploadImageFile
<!-- <UploadImageFile
:typeface="idcardData.typeface && faceAuthCount.weixin < smsAuthNum"
:realName="idcardData.idcardName"
:idno="idcardData.idcardNumber"
@sendimage="sendimage"
>
</UploadImageFile>
</UploadImageFile> -->
</div>
</template>
<script>
import UploadImageFile from '@/components/ebiz/sale/UploadImageFile'
// import UploadImageFile from '@/components/ebiz/sale/UploadImageFile'
import { Field, Cell, CellGroup, Collapse, CollapseItem, Dialog } from 'vant'
import { underWrite, getOrderDetail, getSignInvalid, checkSignInvalid, getAuthCode, autchCodeCheck } from '@/api/ebiz/sale/sale'
import {
underWrite,
getOrderDetail,
getSignInvalid,
checkSignInvalid,
getAuthCode,
autchCodeCheck,
getRecognitionUrl,
getRecognitionResult
} from '@/api/ebiz/sale/sale'
import { checkPhone } from '@/api/ebiz/customer/customer'
import { weixinShare } from '@/assets/js/utils/wxShare.js'
import IndexBar from '@/components/ebiz/sale/IndexBar'
@@ -308,14 +317,23 @@ export default {
// 空签时顶部姓名
tipsName: '',
idcardData: {
typeface: false,
idcardName: '',
idcardNumber: ''
realName: '',
idno: '',
redirectUrl: window.location.href
},
// idcardData: {
// typeface: false,
// idcardName: '',
// idcardNumber: ''
// },
appntSignStatus: '', //投保人电子签名状态
insuredSignStatus: '', //被保险人电子签名状态
changeCard: localStorage.changeCard,
salePageFlag: '-10'
salePageFlag: '-10',
bizToken: '', //微信端-人脸识别相关参数-获取人脸识别URL时返回
requestId: '', //微信端-人脸识别相关参数-获取人脸识别URL时返回
recognizeResult: '', //微信端-人脸识别结果
recognizeMessage: '' //微信端-人脸识别失败原因
}
},
methods: {
@@ -355,12 +373,12 @@ export default {
if (this.$route.query.airSign) {
sessionStorage.setItem('airSign', this.$route.query.airSign)
}
window.localStorage.setItem('saleInsuredInfo', this.$route.query.saleInsuredInfo)
window.localStorage.setItem('saleInsuredPersonInfo', this.$route.query.saleInsuredPersonInfo)
// window.localStorage.setItem('saleInsuredInfo', this.$route.query.saleInsuredInfo)
// window.localStorage.setItem('saleInsuredPersonInfo', this.$route.query.saleInsuredPersonInfo)
window.localStorage.setItem('token', this.$route.query.token)
window.localStorage.setItem('orderNo', this.$route.query.orderNo)
window.localStorage.setItem('relationToAppnt', this.$route.query.relationToAppnt)
window.localStorage.setItem('productCode', this.$route.query.productCode)
// window.localStorage.setItem('relationToAppnt', this.$route.query.relationToAppnt)
// window.localStorage.setItem('productCode', this.$route.query.productCode)
if (this.$route.query.changeCard == '0') {
localStorage.setItem('changeCard', true)
} else {
@@ -549,13 +567,16 @@ export default {
if (val == '0' || val == '2') {
//idtype不为身份证跳过人脸识别
// if (JSON.parse(this.$route.query.saleInsuredInfo).idType != '1' || JSON.parse(this.$route.query.saleInsuredInfo).age < '18') {
if (JSON.parse(this.$route.query.saleInsuredInfo).idType != '1') {
if (JSON.parse(localStorage.saleInsuredInfo).idType != '1') {
that.goUrl()
} else {
if (this.faceAuthCount.appnt < this.smsAuthNum) {
this.idcardData.typeface = !this.idcardData.typeface
this.idcardData.idcardName = JSON.parse(this.$route.query.saleInsuredInfo).name
this.idcardData.idcardNumber = JSON.parse(this.$route.query.saleInsuredInfo).idNo
// this.idcardData.typeface = !this.idcardData.typeface
// this.idcardData.idcardName = JSON.parse(this.$route.query.saleInsuredInfo).name
// this.idcardData.idcardNumber = JSON.parse(this.$route.query.saleInsuredInfo).idNo
this.idcardData.realName = JSON.parse(localStorage.saleInsuredInfo).name
this.idcardData.idno = JSON.parse(localStorage.saleInsuredInfo).idNo
this.recognition()
} else {
this.operaFlag = 'appnt'
this.realPeopelCheck()
@@ -564,14 +585,17 @@ export default {
} else {
window.localStorage.setItem('sign-val', val)
window.localStorage.setItem('sign-insured', JSON.stringify(that.insuredSign))
if (JSON.parse(this.$route.query.saleInsuredPersonInfo).idType != '1' || JSON.parse(this.$route.query.saleInsuredPersonInfo).age < '18') {
if (JSON.parse(localStorage.saleInsuredPersonInfo).idType != '1' || JSON.parse(localStorage.saleInsuredPersonInfo).age < '18') {
// if (JSON.parse(this.$route.query.saleInsuredPersonInfo).idType != '1') {
that.insuredUrl()
} else {
if (this.faceAuthCount.insured < this.smsAuthNum) {
this.idcardData.typeface = !this.idcardData.typeface
this.idcardData.idcardName = JSON.parse(this.$route.query.saleInsuredPersonInfo).name
this.idcardData.idcardNumber = JSON.parse(this.$route.query.saleInsuredPersonInfo).idNo
// this.idcardData.typeface = !this.idcardData.typeface
// this.idcardData.idcardName = JSON.parse(this.$route.query.saleInsuredPersonInfo).name
// this.idcardData.idcardNumber = JSON.parse(this.$route.query.saleInsuredPersonInfo).idNo
this.idcardData.realName = JSON.parse(localStorage.saleInsuredPersonInfo).name
this.idcardData.idno = JSON.parse(localStorage.saleInsuredPersonInfo).idNo
this.recognition()
} else {
this.operaFlag = 'insured'
this.realPeopelCheck()
@@ -745,10 +769,10 @@ export default {
localStorage.orderNo +
'&token=' +
localStorage.token +
'&saleInsuredInfo=' +
encodeURI(localStorage.saleInsuredInfo) +
'&saleInsuredPersonInfo=' +
encodeURI(localStorage.saleInsuredPersonInfo) +
// '&saleInsuredInfo=' +
// encodeURI(localStorage.saleInsuredInfo) +
// '&saleInsuredPersonInfo=' +
// encodeURI(localStorage.saleInsuredPersonInfo) +
'&relationToAppnt=' +
JSON.parse(window.localStorage.getItem('saleInsuredPersonInfo')).relationToAppnt +
'&shareCode=' +
@@ -773,10 +797,10 @@ export default {
localStorage.orderNo +
'&token=' +
localStorage.token +
'&saleInsuredInfo=' +
encodeURI(localStorage.saleInsuredInfo) +
'&saleInsuredPersonInfo=' +
encodeURI(localStorage.saleInsuredPersonInfo) +
// '&saleInsuredInfo=' +
// encodeURI(localStorage.saleInsuredInfo) +
// '&saleInsuredPersonInfo=' +
// encodeURI(localStorage.saleInsuredPersonInfo) +
'&relationToAppnt=' +
JSON.parse(window.localStorage.getItem('saleInsuredPersonInfo')).relationToAppnt +
'&shareCode=' +
@@ -934,19 +958,19 @@ export default {
) {
// const message = res.orderDTO.productDTO.special.content
// Dialog({ message })
let content = res.orderDTO.productDTO.special.content
// {
// title: '标题',
// message: '内容',
// confirmButtonText: '确认',
// messageAlign: 'left'
// }
// title 需要标题则配置,不需要则不要配置
// message 内容,\n换行
// confirmButtonText确认按钮的文字
// messageAlign 对齐方式,固定左对齐,为'left'
let content = res.orderDTO.productDTO.special.content
// {
// title: '标题',
// message: '内容',
// confirmButtonText: '确认',
// messageAlign: 'left'
// }
// title 需要标题则配置,不需要则不要配置
// message 内容,\n换行
// confirmButtonText确认按钮的文字
// messageAlign 对齐方式,固定左对齐,为'left'
try {
const config = JSON.parse(content);
const config = JSON.parse(content)
config.message = '&emsp;&emsp;' + config.message
config.message = config.message.split('\\n').join('\n&emsp;&emsp;')
// {
@@ -970,7 +994,6 @@ export default {
// confirmButtonText: '本人已阅读并同意上述特别约定内容',
// messageAlign: 'left'
// })
}
/* if (isShowDialog) {
//记录每次弹框的订单号。再次进入页面,订单号改变才会弹窗。
@@ -1129,7 +1152,7 @@ export default {
// 微信人脸验证后 返回值 操作
sendimage(e) {
// let that = this
if (e) {
if (!e) {
// this.$toast.clear()
// this.$toast('人脸检测成功')
// 1 为被保险人
@@ -1149,6 +1172,58 @@ export default {
this.realPeopelCheck()
}
}
},
async recognition() {
console.log(11)
await this.getRecognitionUrl()
if (this.requestId && this.bizToken) {
await this.getRecognitionResult(this.requestId, this.bizToken)
} else {
return
}
this.sendimage(this.recognizeResult)
},
getRecognitionUrl() {
return new Promise((resolve, reject) => {
let data = { realName: this.idcardData.realName, idno: this.idcardData.idno, redirectUrl: '/sale/' }
// let data = { realName: this.idcardData.realName, idno: this.idcardData.idno, redirectUrl: this.idcardData.redirectUrl }
console.log('获取URL请求参数', data)
getRecognitionUrl(data).then(
res => {
console.log('getRecognitionUrl', res)
if (res.result == '0') {
this.requestId = res.content.requestId
this.bizToken = res.content.bizToken
window.location.href = res.content.url
} else {
this.$toast(res.resultMessage)
}
},
error => {
console.log(error)
}
)
})
},
getRecognitionResult(requestId, bizToken) {
return new Promise((resolve, reject) => {
getRecognitionResult({ requestId, bizToken }).then(
res => {
console.log('getRecognitionResult', res)
if (res.result == '0') {
this.recognizeResult = res.content.result
this.recognizeMessage = res.content.result == '1' ? res.content.resultMessage : ''
this.isSuccess = true
} else {
this.$toast(res.resultMessage)
}
},
error => {
console.log(error)
}
)
})
}
},
created() {
@@ -1187,7 +1262,7 @@ export default {
[Cell.name]: Cell,
[CellGroup.name]: CellGroup,
[Collapse.name]: Collapse,
UploadImageFile: UploadImageFile,
// UploadImageFile: UploadImageFile,
[CollapseItem.name]: CollapseItem,
[Dialog.name]: Dialog,
[Field.name]: Field,