实名认证0.5

This commit is contained in:
WindowBird 2025-09-09 14:03:07 +08:00
parent 6540646b69
commit af9d199509
5 changed files with 259 additions and 163 deletions

View File

@ -21,3 +21,9 @@ export function putRealName(data) {
throw error throw error
}) })
} }
export function refreshRealName() {
return request({
url: '/app/realName/refreshRealName',
})
}

View File

@ -0,0 +1,29 @@
<template>
<view class="pages">
<web-view ref="webview" :src="https" @message="handleGetMessage"></web-view>
</view>
</template>
<script>
export default {
data() {
return {
https: '',
}
},
onLoad(option) {
this.https = decodeURIComponent(option.https)
console.log(option)
},
methods: {
handleGetMessage: function (e) {
console.log(e)
if (e.detail.data[0].result == 'success') {
uni.navigateBack()
}
},
},
}
</script>
<style lang="scss" scoped></style>

View File

@ -149,6 +149,20 @@
"navigationBarTitleText": "添加设备", "navigationBarTitleText": "添加设备",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
},
{
"path" : "facialRecognition/facialRecognition",
"style" :
{
"navigationBarTitleText" : ""
}
},
{
"path" : "web-view/web-view",
"style" :
{
"navigationBarTitleText" : ""
}
} }
] ]
} }

View File

@ -364,7 +364,7 @@ export default {
return return
} }
uni.navigateTo({ uni.navigateTo({
url: '/pages/realNameAuthentication/realNameAuthentication', url: '/pages/realNameAuthentication/realNameAuthentication?isReal=' + this.userInfo.isReal,
}) })
}, },
goToIncomeExpense() { goToIncomeExpense() {

View File

@ -1,195 +1,242 @@
<template> <template>
<view class="real-name-page"> <view class="page">
<!-- 头部区域 -->
<custom-nav-bar :fill="false" :show-back="true" background-color="transparent" title="" /> <custom-nav-bar :fill="false" :show-back="true" background-color="transparent" title="" />
<view class="header"> <image class="bj" mode="" src="https://api.ccttiot.com/image-1757389708427.png"></image>
<image :src="realName" class="agent-background" mode="widthFix"></image> <view v-if="isReal === false" class="sfxx">
<view class="main-content"> <view class="tit"> 请输入您的有效身份信息</view>
<!-- 表单卡片 --> <view class="name"> 姓名 <input v-model="name" placeholder="请填写姓名" type="text" /></view>
<view class="form-card"> <view class="name">
<view class="form-title">请输入您的有效身份信息</view> 身份证号 <input v-model="zfzh" placeholder="请填写身份证号" type="text" />
</view>
<view class="form-row"> <view class="" style="width: 100%; text-align: center; margin-top: 20rpx; color: #ccc">
<view class="row-label">姓名</view> 您当前还未完成实名认证
<input
:value="form.realName"
class="row-input"
confirm-type="done"
placeholder="请填写姓名"
placeholder-class="input-placeholder"
type="text"
@input="e => (form.realName = e.detail.value)"
/>
</view>
<view class="form-row">
<view class="row-label">身份证号</view>
<input
:value="form.idCard"
class="row-input"
confirm-type="done"
placeholder="请填写身份证号"
placeholder-class="input-placeholder"
type="idcard"
@input="e => (form.idCard = e.detail.value)"
/>
</view>
</view>
</view> </view>
</view> </view>
<view v-else class="sfxx">
<!-- 底部提交按钮 --> <view class="tit"> 请输入您的有效身份信息</view>
<view class="footer"> <view class="name">
<button class="submit-btn" @click="handleSubmit">提交</button> 姓名 <input v-model="name" :disabled="true" placeholder="请填写姓名" type="text" />
</view>
<view class="name">
身份证号 <input v-model="zfzh" :disabled="true" placeholder="请填写身份证号" type="text" />
</view>
<view class="" style="width: 100%; text-align: center; margin-top: 20rpx; color: #ccc">
您当前已完成实名认证
</view>
</view>
<view v-if="isReal === false" class="anniu" @click="btnshiming">
<!-- <text>进入人脸识别</text> -->
<text>提交</text>
</view> </view>
<!-- 主要内容区域 -->
</view> </view>
</template> </template>
<script> <script>
import { onShareAppMessage } from '@dcloudio/uni-app' import {
putRealName,
onShareAppMessage(e => { refreshRealName,
return {} } from '../../api/realNameAuthentication/realNameAuthentication'
})
export default { export default {
name: 'AgentsPage',
data() { data() {
return { return {
realName: 'https://api.ccttiot.com/image-1757311888771.png', bgc: {
form: { backgroundColor: '',
realName: '',
idCard: '',
}, },
name: '',
zfzh: '',
isReal: false,
backData: null,
smflag: true,
} }
}, },
computed: {}, onLoad(option) {
onLoad() {}, if (option.isReal) {
console.log('用户实名', option.isReal)
this.isReal = option.isReal
}
},
onShow() {
// if (this.backData === true) {
// console.log(':', this.backData);
// this.getshuaxin();
// this.backData = null; //
// }
},
methods: { methods: {
// · 2-20 //
validateName(value) { getshuaxin() {
const nameReg = /^[\u4e00-\u9fa5·]{2,20}$/ refreshRealName().then(res => {
return nameReg.test((value || '').trim()) if (res.code === 200) {
if (res.data.pass === true) {
let realNameType = res.data.realNameType
let infoId = res.data.infoId
uni.showModal({
title: '温馨提示',
content: `人脸认证成功`,
showCancel: false,
success: function (res) {
uni.navigateBack()
},
})
} else {
uni.showModal({
title: '温馨提示',
content: `人脸认证失败`,
showCancel: false,
success: function (res) {
uni.navigateBack()
},
})
}
} else {
uni.showModal({
title: '温馨提示',
content: `人脸认证失败`,
showCancel: false,
success: function (res) {
uni.navigateBack()
},
})
}
})
}, },
// 18 X/x //
validateIdCard(value) { btnfh() {
const idReg = /^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/ uni.navigateBack()
return idReg.test((value || '').trim())
}, },
//
btnshiming() {
if (this.smflag === true) {
this.smflag = false
let data = {
userName: this.name,
idCard: this.zfzh,
}
putRealName(data).then(res => {
if (res.code === 200) {
// page_user/facialRecognition/facialRecognition
let https = encodeURIComponent(res.data.jumpUrl)
this.backData = true
uni.navigateTo({
url: ' page_user/facialRecognition/facialRecognition?https=' + https,
})
} else if (res.code === 500 && res.msg === null) {
uni.showToast({
title: '已提交,请等待系统反馈',
icon: 'none',
duration: 2000,
})
this.smflag = true
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000,
})
this.smflag = true
}
})
}
// // this.$u.put(`/app/realName/realName`,data).then(res =>{ //
handleSubmit() { // if(res.code === 200){
if (!this.validateName(this.form.realName)) { // let https = encodeURIComponent(res.data.jumpUrl)
return uni.showToast({ title: '请输入正确的姓名', icon: 'none' }) // this.backData = true
} // uni.navigateTo({
if (!this.validateIdCard(this.form.idCard)) { // url:'/page_fenbao/renlian?https=' + https
return uni.showToast({ title: '请输入正确的身份证号', icon: 'none' }) // })
} // }else{
// TODO: // uni.showToast({
uni.showToast({ title: '提交成功', icon: 'success' }) // title: res.msg,
// icon: 'none',
// duration: 2000
// })
// }
// })
}, },
}, },
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss">
.real-name-page { .anniu {
position: relative; width: 750rpx;
height: 174rpx;
min-height: 100vh; background: #ffffff;
} box-shadow: 0rpx 8rpx 20rpx 0rpx rgba(0, 0, 0, 0.3);
border-radius: 0rpx 0rpx 0rpx 0rpx;
// line-height: 174rpx;
.header { text-align: center;
position: relative;
.agent-background {
position: relative;
width: 750rpx;
}
.main-content {
position: relative;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: stretch;
top: -240rpx;
background: #ffffff;
border-radius: 40rpx;
margin: 0 30rpx;
.form-card {
background: #f7f7f7;
border-radius: 24rpx;
padding: 24rpx;
.form-title {
background: #efefef;
border-radius: 16rpx;
color: #333333;
font-size: 28rpx;
padding: 24rpx;
margin-bottom: 20rpx;
text-align: left;
}
.form-row {
display: flex;
align-items: center;
background: #ffffff;
border-radius: 50rpx;
padding: 0 24rpx;
height: 88rpx;
margin: 20rpx 12rpx;
.row-label {
width: 150rpx;
color: #666666;
font-size: 26rpx;
}
.row-input {
flex: 1;
height: 100%;
line-height: 88rpx;
font-size: 28rpx;
color: #333333;
}
.input-placeholder {
color: #bdbdbd;
font-size: 26rpx;
}
}
}
}
}
.footer {
position: fixed; position: fixed;
left: 0; left: 0;
right: 0; bottom: 0;
bottom: 40rpx;
padding: 0 30rpx;
.submit-btn { text {
height: 88rpx; display: inline-block;
line-height: 88rpx; width: 682rpx;
border-radius: 100rpx; height: 84rpx;
background: #3a8dff; background: #f15a04;
color: #ffffff; border-radius: 42rpx 42rpx 42rpx 42rpx;
font-size: 30rpx; text-align: center;
} line-height: 84rpx;
font-weight: 600;
.submit-btn.disabled { font-size: 36rpx;
background: #c7d7ff;
color: #ffffff; color: #ffffff;
} }
} }
// .sfxx {
width: 676rpx;
height: 480rpx;
background: #ffffff;
border-radius: 20rpx 20rpx 20rpx 20rpx;
margin: auto;
margin-top: 460rpx;
border-radius: 30rpx;
.name {
width: 624rpx;
height: 92rpx;
margin: auto;
background: #efefef;
border-radius: 46rpx 46rpx 46rpx 46rpx;
margin-top: 46rpx;
display: flex;
align-items: center;
font-size: 32rpx;
color: #3d3d3d;
padding-left: 40rpx;
box-sizing: border-box;
justify-content: space-between;
input {
width: 430rpx;
padding-right: 20rpx;
box-sizing: border-box;
}
}
.tit {
width: 676rpx;
height: 118rpx;
background: #efefef;
font-weight: 600;
font-size: 36rpx;
color: #3d3d3d;
line-height: 118rpx;
padding-left: 38rpx;
box-sizing: border-box;
border-radius: 30rpx 30rpx 0 0;
}
}
.bj {
width: 750rpx;
height: 696rpx;
position: fixed;
top: 0;
left: 0;
z-index: -1;
}
</style> </style>