Commit c2c52f98 authored by ly's avatar ly

uni活体检测

parent 0a571d25
<template>
<view class="content">
<template v-if="isCertified">
<!-- <template v-if="isCertified">
<uni-list >
<uni-list-item class="item" title="姓名1" :rightText="realName"></uni-list-item>
<uni-list-item class="item" title="身份证号码" :rightText="idCard"></uni-list-item>
</uni-list>
</template>
<template v-else>
<template v-else> -->
<uni-frv-external-realname ref="frv" @start="startVerify" @finish="verifyFinish"></uni-frv-external-realname>
</template>
<!-- </template> -->
</view>
</template>
......@@ -22,14 +22,18 @@ export default {
idCard: '',
ossData:null,
certifyId:'',
MetaInfo:null
MetaInfo:null,
eventChannel: null,
}
},
onLoad() {
this.eventChannel = this.getOpenerEventChannel()
this.MetaInfo=uni.getFacialRecognitionMetaInfo()
const { idCard,realName}=uni.getStorageSync('userFData')
this.realName=realName
this.idCard=idCard
this.initOss()
this.startVerifys()
},
methods: {
initOss(){
......@@ -40,21 +44,52 @@ export default {
fileType: FilePath,
}
self.$request('/app/v1/oss', 'GET',params).then(res => {
// console.log(res.result,'oss')
console.log(res.result,'oss')
self.ossData=res.result
}).catch(err => {
console.log(err, '请求出错')
})
},
async startVerify ({realName,idCard,metaInfo}) {
startVerifys () {
console.log('44325')
// {realName,idCard,metaInfo}
const self = this
const params={
appId:'__UNI__DE04B13',
realName:self.realName,
idCard:self.idCard,
metaInfo:self.MetaInfo
}
console.log(params,'params')
self.$request('/app/v1/ocrTokenByUni', 'POST',params).then(res => {
const {ocrToken}=res.result
console.log(res.result)
if(ocrToken.certifyId){
self.certifyId=ocrToken.certifyId
self.$refs.frv.startFacialRecognitionVerify(ocrToken.certifyId)
}else{
const {message}=ocrToken.error
uni.showToast({
title:message,
icon: "none",
})
}
}).catch(err => {
console.log(err, '请求出错')
})
},
async startVerify () {
console.log('44325')
// {realName,idCard,metaInfo}
const self = this
const params={
appId:'__UNI__DE04B13',
realName:realName,
idCard:idCard,
metaInfo:metaInfo
realName:self.realName,
idCard:self.idCard,
metaInfo:self.MetaInfo
}
console.log(params,'params')
self.$request('/app/v1/ocrTokenByUni', 'POST',params).then(res => {
......@@ -84,8 +119,11 @@ export default {
self.$request('/app/v1/resultByUni', 'POST',params).then(res => {
console.log(res,'resultByUni')
const {ocrToken }=res.result
UploadFile(self.ossData,`data:image/png;base64,${ocrToken.photo}`).then(file=>{
console.log(file)
UploadFile(self.ossData,`data:image/jpg;base64,${ocrToken.photo}`).then(file=>{
console.log(file.fileUrl)
uni.setStorageSync('fileUrlFace',file.fileUrl)
this.eventChannel.emit('send', JSON.stringify(file.fileUrl))
self.Back()
})
}).catch(err => {
console.log(err, '请求出错')
......
......@@ -470,7 +470,6 @@ export default {
const that = this;
try{
CheckUniFace((data)=>{
console.log(data,'uni_Face')
that.GetWebView().evalJS(`receiveUniFace('${JSON.stringify(data)}')`)
})
}catch(err){
......
......@@ -463,10 +463,8 @@ export default {
const that = this;
try{
CheckUniFace((data)=>{
console.log(data,'uni_Face')
that.GetWebView().evalJS(`receiveUniFace('${JSON.stringify(data)}')`)
})
}catch(err){
console.log(err, '获取人脸失败')
}
......
......@@ -10,7 +10,7 @@
<button type="primary" @click="_retry" v-else>返回</button>
<view class="dev-tip" v-if="isDev">请在控制台查看详细错误(此提示仅在开发环境展示)</view>
</template>
<template v-else>
<!-- <template v-else>
<text class="title">实名认证</text>
<uni-forms>
<uni-forms-item name="realName">
......@@ -35,7 +35,7 @@
</view>
</view>
<button type="primary" :disabled="!certifyIdNext" @click="_getCertifyId">确定</button>
</template>
</template> -->
</view>
</template>
......
This diff is collapsed.
This diff is collapsed.
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