Commit 0a571d25 authored by ly's avatar ly

uni实人认证

parent e0966115
......@@ -50,7 +50,6 @@
<view class='footer-time'>(12:00-13:00休息)</view>
<view class='footer-tips'>理性借贷 合理消费</view>
</view>
<view @click='goAuth'>实名认证</view>
</view>
</view>
</template>
......@@ -91,11 +90,7 @@ export default {
},
methods: {
goAuth(){
this.Go('uni:/pages/web/face')
},
// 初始化
init() {
const token = uni.getStorageSync('token')
......@@ -246,12 +241,31 @@ export default {
// }
},
goTel() {
this.buryingPoint('app:my_contact_us_click')
uni.makePhoneCall({
phoneNumber: this.serviceCall //仅为示例
});
const self=this
self.buryingPoint('app:my_contact_us_click')
const telPhone=uni.getStorageSync('telPhone')
if(telPhone){
self.goPhone()
}else{
uni.showModal({
title: '提示',
content: '该“联系我们”功能需要获取您的电话拨号等权限,以便于您通过拨打电话的方式向我们反映问题!',
showCancel: false,//没有取消按钮的弹框
confirmText: '确定',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
self.goPhone()
}
}
})
}
},
goPhone(){
uni.setStorageSync('telPhone','1')
uni.makePhoneCall({
phoneNumber: this.serviceCall //仅为示例
});
},
goItem(item) {
......
......@@ -147,3 +147,20 @@ export const SelectLocation = async function (callback) {
}
}
}
//实名认证
export const CheckUniFace=async function(callback){
uni.navigateTo({
url: '/pages/web/face',
events: {
send(data) {
try {
const result = JSON.parse(data)
console.log(result,'resultuniface')
callback && callback(result)
} catch (err) {
console.log('处理通讯录选择的内容报错')
}
},
},
})
}
\ No newline at end of file
<template>
<view class="content">
<template v-if="isCertified">
<uni-list>
<uni-list-item class="item" title="姓名" :rightText="realName"></uni-list-item>
<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>
<uni-frv-external-realname ref="frv" :agreement="agreement" @start="startVerify" @finish="verifyFinish"></uni-frv-external-realname>
<uni-frv-external-realname ref="frv" @start="startVerify" @finish="verifyFinish"></uni-frv-external-realname>
</template>
</view>
</template>
<script>
import { UploadFile } from './utils/uploads'
import { UploadFile } from './utils/uploads'
export default {
data() {
return {
agreement: {
title: "实名认证协议",
url: "https://www.xxxxx.com"
},
isCertified: false,
realName: '',
idCard: '',
metaInfoData:null,
certifyId:''
ossData:null,
certifyId:'',
MetaInfo:null
}
},
onLoad() {
const { idCard,realName}=uni.getStorageSync('userFData')
this.realName=realName
this.idCard=idCard
this.initOss()
},
methods: {
initOss(){
const self=this
const FilePath = "DDH/face";
const params={
fileName: 'jpg', //图片名
fileType: FilePath,
}
self.$request('/app/v1/oss', 'GET',params).then(res => {
// console.log(res.result,'oss')
self.ossData=res.result
}).catch(err => {
console.log(err, '请求出错')
})
},
async startVerify ({realName,idCard,metaInfo}) {
console.log('44325')
const self = this
const params={
appId:'__UNI__DE04B13',
......@@ -41,6 +56,7 @@ export default {
idCard:idCard,
metaInfo:metaInfo
}
console.log(params,'params')
self.$request('/app/v1/ocrTokenByUni', 'POST',params).then(res => {
const {ocrToken}=res.result
......@@ -59,7 +75,7 @@ export default {
console.log(err, '请求出错')
})
},
async verifyFinish (config) {
async verifyFinish () {
const self = this
const params={
appId:'__UNI__DE04B13',
......@@ -68,7 +84,7 @@ export default {
self.$request('/app/v1/resultByUni', 'POST',params).then(res => {
console.log(res,'resultByUni')
const {ocrToken }=res.result
UploadFile(config,`data:image/png;base64,${ocrToken.photo}`).then(file=>{
UploadFile(self.ossData,`data:image/png;base64,${ocrToken.photo}`).then(file=>{
console.log(file)
})
}).catch(err => {
......
......@@ -8,7 +8,8 @@
import { loadLocation } from './tools'
import {
CheckContactPermission,
SelectContact
SelectContact,
CheckUniFace
} from './authPermission'
import storage from '@/utils/storage'
import {
......@@ -461,10 +462,20 @@ export default {
}
},
// 活体认证
async uni_Face(config) {
async uniFace(config) {
console.log(config,'config')
uni.setStorageSync('userFData',config)
// 检查相机权限
// if (!this.CheckCamera()) return;
const that = this;
try{
CheckUniFace((data)=>{
console.log(data,'uni_Face')
that.GetWebView().evalJS(`receiveUniFace('${JSON.stringify(data)}')`)
})
}catch(err){
console.log(err, '获取人脸失败')
}
},
// 获取设备信息
......@@ -483,6 +494,7 @@ export default {
const that = this;
try {
CheckContactPermission((data) => {
that.GetWebView().evalJS(`receiveContactsBack('${JSON.stringify(data)}')`)
})
} catch (err) {
......
......@@ -8,7 +8,8 @@
import { loadLocation } from './tools'
import {
CheckContactPermission,
SelectContact
SelectContact,
CheckUniFace
} from './authPermission'
import storage from '@/utils/storage'
import {
......@@ -453,7 +454,24 @@ export default {
console.log(err, 'LIVE活体识别错误')
}
},
// 活体认证
async uniFace(config) {
console.log(config,'config')
uni.setStorageSync('userFData',config)
// 检查相机权限
// if (!this.CheckCamera()) return;
const that = this;
try{
CheckUniFace((data)=>{
console.log(data,'uni_Face')
that.GetWebView().evalJS(`receiveUniFace('${JSON.stringify(data)}')`)
})
}catch(err){
console.log(err, '获取人脸失败')
}
},
// 获取设备信息
async GetDeviceInfo() {
try {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2152,18 +2152,6 @@ var render = function () {
],
1
),
_c(
"uni-view",
{
attrs: { _i: 34 },
on: {
click: function ($event) {
return _vm.$handleViewEvent($event)
},
},
},
[_vm._v("实名认证")]
),
],
1
),
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