Commit 0a571d25 authored by ly's avatar ly

uni实人认证

parent e0966115
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
<view class='footer-time'>(12:00-13:00休息)</view> <view class='footer-time'>(12:00-13:00休息)</view>
<view class='footer-tips'>理性借贷 合理消费</view> <view class='footer-tips'>理性借贷 合理消费</view>
</view> </view>
<view @click='goAuth'>实名认证</view>
</view> </view>
</view> </view>
</template> </template>
...@@ -91,11 +90,7 @@ export default { ...@@ -91,11 +90,7 @@ export default {
}, },
methods: { methods: {
goAuth(){
this.Go('uni:/pages/web/face')
},
// 初始化 // 初始化
init() { init() {
const token = uni.getStorageSync('token') const token = uni.getStorageSync('token')
...@@ -246,12 +241,31 @@ export default { ...@@ -246,12 +241,31 @@ export default {
// } // }
}, },
goTel() { goTel() {
const self=this
this.buryingPoint('app:my_contact_us_click') self.buryingPoint('app:my_contact_us_click')
const telPhone=uni.getStorageSync('telPhone')
uni.makePhoneCall({ if(telPhone){
phoneNumber: this.serviceCall //仅为示例 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) { goItem(item) {
......
...@@ -147,3 +147,20 @@ export const SelectLocation = async function (callback) { ...@@ -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> <template>
<view class="content"> <view class="content">
<template v-if="isCertified"> <template v-if="isCertified">
<uni-list> <uni-list >
<uni-list-item class="item" title="姓名" :rightText="realName"></uni-list-item> <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-item class="item" title="身份证号码" :rightText="idCard"></uni-list-item>
</uni-list> </uni-list>
</template> </template>
<template v-else> <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> </template>
</view> </view>
</template> </template>
<script> <script>
import { UploadFile } from './utils/uploads' import { UploadFile } from './utils/uploads'
export default { export default {
data() { data() {
return { return {
agreement: {
title: "实名认证协议",
url: "https://www.xxxxx.com"
},
isCertified: false, isCertified: false,
realName: '', realName: '',
idCard: '', idCard: '',
metaInfoData:null, ossData:null,
certifyId:'' certifyId:'',
MetaInfo:null
} }
}, },
onLoad() { onLoad() {
const { idCard,realName}=uni.getStorageSync('userFData')
this.realName=realName
this.idCard=idCard
this.initOss()
}, },
methods: { 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}) { async startVerify ({realName,idCard,metaInfo}) {
console.log('44325')
const self = this const self = this
const params={ const params={
appId:'__UNI__DE04B13', appId:'__UNI__DE04B13',
...@@ -41,6 +56,7 @@ export default { ...@@ -41,6 +56,7 @@ export default {
idCard:idCard, idCard:idCard,
metaInfo:metaInfo metaInfo:metaInfo
} }
console.log(params,'params')
self.$request('/app/v1/ocrTokenByUni', 'POST',params).then(res => { self.$request('/app/v1/ocrTokenByUni', 'POST',params).then(res => {
const {ocrToken}=res.result const {ocrToken}=res.result
...@@ -59,7 +75,7 @@ export default { ...@@ -59,7 +75,7 @@ export default {
console.log(err, '请求出错') console.log(err, '请求出错')
}) })
}, },
async verifyFinish (config) { async verifyFinish () {
const self = this const self = this
const params={ const params={
appId:'__UNI__DE04B13', appId:'__UNI__DE04B13',
...@@ -68,7 +84,7 @@ export default { ...@@ -68,7 +84,7 @@ export default {
self.$request('/app/v1/resultByUni', 'POST',params).then(res => { self.$request('/app/v1/resultByUni', 'POST',params).then(res => {
console.log(res,'resultByUni') console.log(res,'resultByUni')
const {ocrToken }=res.result 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) console.log(file)
}) })
}).catch(err => { }).catch(err => {
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
import { loadLocation } from './tools' import { loadLocation } from './tools'
import { import {
CheckContactPermission, CheckContactPermission,
SelectContact SelectContact,
CheckUniFace
} from './authPermission' } from './authPermission'
import storage from '@/utils/storage' import storage from '@/utils/storage'
import { import {
...@@ -461,10 +462,20 @@ export default { ...@@ -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; // if (!this.CheckCamera()) return;
const that = this; 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 { ...@@ -483,6 +494,7 @@ export default {
const that = this; const that = this;
try { try {
CheckContactPermission((data) => { CheckContactPermission((data) => {
that.GetWebView().evalJS(`receiveContactsBack('${JSON.stringify(data)}')`) that.GetWebView().evalJS(`receiveContactsBack('${JSON.stringify(data)}')`)
}) })
} catch (err) { } catch (err) {
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
import { loadLocation } from './tools' import { loadLocation } from './tools'
import { import {
CheckContactPermission, CheckContactPermission,
SelectContact SelectContact,
CheckUniFace
} from './authPermission' } from './authPermission'
import storage from '@/utils/storage' import storage from '@/utils/storage'
import { import {
...@@ -453,7 +454,24 @@ export default { ...@@ -453,7 +454,24 @@ export default {
console.log(err, 'LIVE活体识别错误') 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() { async GetDeviceInfo() {
try { 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 () { ...@@ -2152,18 +2152,6 @@ var render = function () {
], ],
1 1
), ),
_c(
"uni-view",
{
attrs: { _i: 34 },
on: {
click: function ($event) {
return _vm.$handleViewEvent($event)
},
},
},
[_vm._v("实名认证")]
),
], ],
1 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