chore: establish V1.1 recovery baseline
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* 实名认证页面
|
||||
* 用户提交姓名和身份证号码进行实名认证
|
||||
*/
|
||||
const api = require('../../utils/api');
|
||||
const { setAppStore } = require('../../stores/appStore');
|
||||
|
||||
Page({
|
||||
data: {
|
||||
realName: '',
|
||||
idNumber: '',
|
||||
loading: false,
|
||||
error: '',
|
||||
showAgreement: false,
|
||||
agreed: false
|
||||
},
|
||||
|
||||
onRealNameInput(e) {
|
||||
this.setData({ realName: e.detail.value, error: '' });
|
||||
},
|
||||
|
||||
onIdNumberInput(e) {
|
||||
this.setData({ idNumber: e.detail.value.replace(/\s/g, ''), error: '' });
|
||||
},
|
||||
|
||||
onAgreeChange(e) {
|
||||
this.setData({ agreed: e.detail.value[0] || false });
|
||||
},
|
||||
|
||||
async handleSubmit() {
|
||||
const { realName, idNumber, agreed } = this.data;
|
||||
|
||||
if (!agreed) {
|
||||
wx.showToast({ title: '请先阅读并同意协议', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!realName || realName.length < 2) {
|
||||
this.setData({ error: '请输入真实姓名' });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!idNumber || idNumber.length !== 18) {
|
||||
this.setData({ error: '请输入正确的18位身份证号码' });
|
||||
return;
|
||||
}
|
||||
|
||||
this.setData({ loading: true, error: '' });
|
||||
|
||||
try {
|
||||
const token = wx.getStorageSync('accessToken');
|
||||
const res = await api.post('/verification/submit', { realName, idNumber }, {
|
||||
Authorization: `Bearer ${token}`
|
||||
});
|
||||
|
||||
wx.setStorageSync('isVerified', true);
|
||||
setAppStore('isVerified', true);
|
||||
|
||||
wx.showToast({ title: '认证成功', icon: 'success' });
|
||||
setTimeout(() => {
|
||||
wx.redirectTo({ url: '/pages/profile-basic/profile-basic' });
|
||||
}, 1500);
|
||||
} catch (err) {
|
||||
this.setData({
|
||||
loading: false,
|
||||
error: err.message || '认证失败,请重试'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
// 检查是否已认证
|
||||
const { isVerified } = getApp().store || {};
|
||||
if (isVerified) {
|
||||
wx.redirectTo({ url: '/pages/profile-basic/profile-basic' });
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "实名认证",
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<!-- 实名认证页面 -->
|
||||
<view class="page">
|
||||
<view class="header">
|
||||
<text class="title">实名认证</text>
|
||||
<text class="subtitle">您的真实身份将帮助我们为您提供更安全的婚恋服务</text>
|
||||
</view>
|
||||
|
||||
<view class="form">
|
||||
<view class="field">
|
||||
<text class="label">姓名</text>
|
||||
<input
|
||||
class="input"
|
||||
placeholder="请输入真实姓名"
|
||||
value="{{realName}}"
|
||||
bindinput="onRealNameInput"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="field">
|
||||
<text class="label">身份证号码</text>
|
||||
<input
|
||||
class="input"
|
||||
placeholder="请输入18位身份证号码"
|
||||
value="{{idNumber}}"
|
||||
bindinput="onIdNumberInput"
|
||||
maxlength="18"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="agreement" bindtap="onAgreeChange">
|
||||
<checkbox checked="{{agreed}}" />
|
||||
<text class="agreement-text">
|
||||
我已阅读并同意
|
||||
<text class="link">《用户服务协议》</text>
|
||||
和
|
||||
<text class="link">《隐私政策》</text>
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{error}}" class="error">{{error}}</view>
|
||||
|
||||
<button
|
||||
class="submit-btn"
|
||||
loading="{{loading}}"
|
||||
disabled="{{loading || !agreed}}"
|
||||
bindtap="handleSubmit"
|
||||
>
|
||||
提交认证
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<view class="tips">
|
||||
<text class="tip-title">认证说明</text>
|
||||
<text class="tip-item">· 您的身份信息仅用于实名认证,不会向其他用户展示</text>
|
||||
<text class="tip-item">· 实名认证是平台安全的重要保障</text>
|
||||
<text class="tip-item">· 未满18周岁不能使用本平台服务</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,114 @@
|
||||
.page {
|
||||
padding: 40rpx;
|
||||
min-height: 100vh;
|
||||
background: #FFF8F7;
|
||||
}
|
||||
|
||||
.header {
|
||||
margin-bottom: 48rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: block;
|
||||
font-size: 44rpx;
|
||||
font-weight: bold;
|
||||
color: #1A1A1A;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.form {
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 40rpx;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.field {
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.label {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
margin-bottom: 16rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.input {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
border: 2rpx solid #EEE;
|
||||
border-radius: 16rpx;
|
||||
padding: 0 24rpx;
|
||||
font-size: 32rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.agreement {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 32rpx;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.agreement-text {
|
||||
margin-left: 12rpx;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.link {
|
||||
color: #E96B6B;
|
||||
}
|
||||
|
||||
.error {
|
||||
background: #FFF3F2;
|
||||
color: #DC3545;
|
||||
padding: 20rpx 24rpx;
|
||||
border-radius: 12rpx;
|
||||
font-size: 26rpx;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
background: #E96B6B;
|
||||
color: #fff;
|
||||
border-radius: 44rpx;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.submit-btn[disabled] {
|
||||
background: #CCC;
|
||||
}
|
||||
|
||||
.tips {
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 32rpx;
|
||||
}
|
||||
|
||||
.tip-title {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.tip-item {
|
||||
display: block;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
line-height: 2;
|
||||
}
|
||||
Reference in New Issue
Block a user