|
|
<template> <view class="pageBg"> <!-- <topNavbar :title="title"></topNavbar> --> <view class="pad"> <view class="card"> <view class="row"> <view class="lab">证件类型</view> <view class="rightCon"> <view class="val" @click="showType=true"> <input v-model="form.typeName" placeholder="请选择" class="input1" style="pointer-events: none;" disabled/></input> </view> <view class="icon"> <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon> </view> </view> </view> <view class="row" v-if="form.value==1"> <view class="lab">实名认证</view> <view class="rightCon"> <view class="val" v-if="vuex_userInfo.applyStep>1" style="color: #1989FA;">已认证</view> <view class="val" v-else>待认证</view> </view> </view> <view class="" v-else> <!-- <view class="row" v-if="form.value==7"> <view class="lab">国籍</view> <view class="rightCon"> <view class="val"> <input v-model="form.nationality" placeholder="请选择" @click="showType=true" disabled/></input> </view> <view class="icon"> <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon> </view> </view> </view> --> <view class="row"> <view class="lab">证件号码</view> <view class="rightCon"> <view class="val"> <input v-model="form.idcard" placeholder="请输入" /></input> </view> </view> </view> <view class="row"> <view class="lab">真实姓名</view> <view class="rightCon"> <view class="val"> <input v-model="form.name" placeholder="请输入" /></input> </view> </view> </view> <view class="row"> <view class="lab">性别</view> <view class="rightCon"> <u-radio-group v-model="form.sex" :labelDisabled="false"> <u-radio shape="circle" label="男" name="1" :labelDisabled="false">男</u-radio> <view class="" style="width: 50rpx;"></view> <u-radio shape="circle" label="女" name="2" :labelDisabled="false">女</u-radio> </u-radio-group> </view> </view> <view class="row"> <view class="lab">户籍地址</view> <view class="rightCon"> <view class="val"> <input v-model="form.address" placeholder="请输入" /></input> </view> </view> </view> </view> </view> <view class="footerBtn pad"> <view class="btnBg" @click="goNext">下一步</view> </view> </view> <u-picker :show="showType" :columns="typeArr" keyName="label" @confirm="confirmType" @cancel="showType=false"></u-picker> </view> </template>
<script> import { getpersonface, GetDetectInfoEnhanced, getCardType,getInitFaceVerify,GetDescribeFaceVerify } from '@/config/api.js' import { website } from '@/config/site.config.js' export default { data() { return { form: { value: 1, nationality: '中国', idcard: '', name: '', sex: '1', address: '', typeName: '身份证', }, formToast: { idcard: '请输入证件号码', name: '请输入真实姓名', sex: '请选择性别', address: '请输入户籍地址', }, showType: false, typeArr: [], title: '学员报名' } // 报名进度(0:待报名,1:已选驾校,2:已实名制,3:已填写报名信息,4:已签署合同,5:待支付,6:已支付)
}, onLoad(options) { if(options.tit) { this.title = options.tit } this.getCardTypeFn() const version = plus.os.version; console.log('iOS系统版本号:', version); }, methods: { // 获取证件类型
async getCardTypeFn() { const {data: res} = await getCardType() this.typeArr = [res] await this.$store.dispatch('getUserInfo') if(this.vuex_userInfo.applyStep>1) { res.forEach(item=>{ if(item.value==this.vuex_userInfo.cardType ){ this.form.typeName = item.label } }) } console.log(res) }, confirmType(val) { let item = val.value[0] console.log(item) this.form.value = item.value this.form.typeName = item.label this.showType = false }, async getpersonfaceFn() { const {data: res} = await getpersonface({MerchantId: '0NSJ2312271333064407'}) let obj = JSON.parse(res) // this.link = obj.Url
// this.$store.commit('updateBizToken', obj.BizToken)
this.EidToken = obj.EidToken return obj.EidToken // #ifdef H5
window.open(this.link, '_blank') // #endif
// var regex = /\[.*?\]/;
// alert(obj.BizToken)
// #ifdef MP-WEIXIN
this.$store.commit('updateWebVeiwUrl', this.link) uni.navigateTo({ url: '/pages/indexEntry/enroll/realName/webView' }) // #endif
console.log(obj) }, async goNext() { this.getInitFaceVerifyFn() return // if(!this.form.value) return this.$u.toast('请选择证件类型')
// this.$goPage('/pages/indexEntry/enroll/signContract/signContract?schoolId='+this.vuex_userInfo.schoolId)
// return
// 去签约
// if(this.vuex_userInfo.applyStep==3) {
// return this.$goPage('/pages/indexEntry/enroll/signContract/signContract')
// }
// return this.$goPage('/pages/indexEntry/enroll/registInfo/registInfo')
// 去填表
if(this.vuex_userInfo.applyStep==2) { if(this.title=='学员信息') { // 非平台学员
return this.$goPage('/pages/indexEntry/NonPlatformStudentInfo/NonPlatformStudentInfo') } return this.$goPage('/pages/indexEntry/enroll/registInfo/registInfo') } // 去支付
// if(this.vuex_userInfo.applyStep==4||this.vuex_userInfo.applyStep==5) {
// return this.$goPage('/pages/indexEntry/enroll/payment/payment')
// }
if(this.vuex_userInfo.applyStep>1&&this.vuex_userInfo.applyStep<5) { return this.$goPage('/pages/indexEntry/enroll/registInfo/registInfo') } // 不是身份证
if(this.form.value!=1) { for(let key in this.formToast) { if(!this.form[key]) { return this.$u.toast(this.formToast[key]) } } this.vuex_userInfo.address = this.form.address this.vuex_userInfo.name = this.form.name this.vuex_userInfo.sex = this.form.sex this.vuex_userInfo.idcard = this.form.idcard this.vuex_userInfo.nationality = (this.form.value==7||this.form.value==2)?'外国':'中国' this.vuex_userInfo.cardType = this.form.value return this.$goPage('/pages/indexEntry/enroll/uploadAvatar/uploadAvatar') } // 去实名
if(!this.vuex_userInfo.applyStep||this.vuex_userInfo.applyStep<2) { this.getInitFaceVerifyFn() } // this.$goPage('/pages/indexEntry/enroll/signContract/signContract')
// this.$goPage('/pages/indexEntry/enroll/uploadAvatar/uploadAvatar')
}, async getInitFaceVerifyFn() { const verifyPlugin = uni.requireNativePlugin('AP-FaceDetectModule'); var metaInfo = verifyPlugin.getMetaInfo() let p = uni.getSystemInfoSync().platform; if (p === "ios") { console.log(metaInfo) metaInfo = JSON.stringify(metaInfo); } console.log('metaInfo') console.log(JSON.parse(metaInfo)) const res = await getInitFaceVerify({metaInfo, accountId: this.vuex_userInfo.accountId}) let certifyId = res.data.body.resultObject.certifyId console.log(certifyId) // return
console.log(res) let _this = this verifyPlugin.verify({ certifyId, }, function(response){ console.log('ios没来这里') console.log(response) if(response.retCode==1000) { uni.showLoading({ title: '正在加载中……' }) GetDescribeFaceVerify({certifyId, accountId: _this.vuex_userInfo.accountId}).then((useRes)=>{ console.log(useRes) let userInfo1 = JSON.parse(useRes.data.body.resultObject.materialInfo) console.log(userInfo1) if(useRes.code==0) { let materialInfo = JSON.parse(useRes.data.body.resultObject.materialInfo) let userInfo = materialInfo.ocrIdCardInfo let obj = { address: userInfo.address, name: userInfo.certName, idcard: userInfo.certNo, nationality: userInfo.nationality, cardType: '1', sex: userInfo.sex=='女'?'2': '1' } let info = Object.assign(_this.$store.state.user.vuex_userInfo, obj) _this.$store.commit('update_vuex_userInfo', info) console.log('请求结果来了') console.log(_this.$store.state.user.vuex_userInfo) _this.$goPage('/pages/indexEntry/enroll/registInfo/registInfo') uni.hideLoading() } }) setTimeout(()=>{ uni.hideLoading() },6000) }else if(response.code==2006) { this.$u.toast('认证失败!请确定是本人后再重试') } }); },
} } </script>
<style> .input1::placeholder { color: red !important; } </style> <style lang="scss" scoped> .card { padding: 10rpx 46rpx 10rpx 32rpx; margin-bottom: 20rpx; .row { height: 100rpx; display: flex; align-items: center; .lab { width: 152rpx; } .rightCon { flex: 1; width: 0; display: flex; .val { flex: 1; width: 0; input { font-size: 28rpx; } } .icon { width: 30rpx; height: 30rpx; u-icon { color: #fff; } } } } } .footerBtn { position: fixed; left: 0; width: 100%; bottom: 30rpx; } .btnBg { width: 100%; height: 88rpx; text-align: center; } </style>
|