chore: establish V1.1 recovery baseline
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* 注销账号页
|
||||
* 在线便捷渠道,不设置障碍
|
||||
*/
|
||||
const api = require('../../utils/api');
|
||||
|
||||
Page({
|
||||
data: {
|
||||
canWithdraw: false,
|
||||
blockers: [],
|
||||
reason: '',
|
||||
submitting: false,
|
||||
submitted: false
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.checkCanWithdraw();
|
||||
},
|
||||
|
||||
onReasonInput(e) {
|
||||
this.setData({ reason: e.detail.value });
|
||||
},
|
||||
|
||||
async checkCanWithdraw() {
|
||||
try {
|
||||
const token = wx.getStorageSync('accessToken');
|
||||
const res = await api.get('/account/can-withdraw', {}, { Authorization: `Bearer ${token}` });
|
||||
this.setData({
|
||||
canWithdraw: res.canWithdraw,
|
||||
blockers: Object.values(res.blockers || {})
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
},
|
||||
|
||||
async submitWithdraw() {
|
||||
if (!this.data.canWithdraw) return;
|
||||
this.setData({ submitting: true });
|
||||
try {
|
||||
const token = wx.getStorageSync('accessToken');
|
||||
await api.post('/account/close', { reason: this.data.reason.trim() }, {
|
||||
Authorization: `Bearer ${token}`
|
||||
});
|
||||
this.setData({ submitted: true });
|
||||
wx.setStorageSync('accessToken', '');
|
||||
wx.setStorageSync('userId', '');
|
||||
} catch (err) {
|
||||
wx.showToast({ title: err.message || '注销失败', icon: 'none' });
|
||||
this.setData({ submitting: false });
|
||||
}
|
||||
},
|
||||
|
||||
goBack() {
|
||||
if (this.data.submitted) {
|
||||
wx.reLaunch({ url: '/pages/login/login' });
|
||||
} else {
|
||||
wx.navigateBack();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "注销账号",
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<!-- 注销账号页 -->
|
||||
<view class="page" wx:if="{{!submitted}}">
|
||||
<view class="warning-banner">
|
||||
<text class="warning-icon">⚠</text>
|
||||
<text class="warning-title">注销账号</text>
|
||||
</view>
|
||||
|
||||
<view class="info-section">
|
||||
<text class="section-title">注销后将:</text>
|
||||
<view class="info-list">
|
||||
<view class="info-item">• 停止所有推荐</view>
|
||||
<view class="info-item">• 资料停止向他人展示</view>
|
||||
<view class="info-item">• 聊天停止</view>
|
||||
<view class="info-item">• 红娘服务结束</view>
|
||||
<view class="info-item">• 未开始的活动报名将取消</view>
|
||||
<view class="info-item">• 必要信息脱敏保留(符合法律要求)</view>
|
||||
<view class="info-item">• 所有数据不可恢复</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{!canWithdraw}}" class="blocker-section">
|
||||
<text class="blocker-title">无法注销:存在进行中的业务</text>
|
||||
<view class="blocker-item" wx:for="{{blockers}}" wx:key="index">{{item}}</view>
|
||||
</view>
|
||||
|
||||
<view class="section">
|
||||
<text class="section-title">注销原因(选填)</text>
|
||||
<view class="reason-options">
|
||||
<view class="reason-chip {{reason==='太少了'?'active':''}}" data-val="太少了" bindtap="setReason">太少了</view>
|
||||
<view class="reason-chip {{reason==='找不到合适的'?'active':''}}" data-val="找不到合适的" bindtap="setReason">找不到合适的</view>
|
||||
<view class="reason-chip {{reason==='暂时不需要'?'active':''}}" data-val="暂时不需要" bindtap="setReason">暂时不需要</view>
|
||||
<view class="reason-chip {{reason==='其他原因'?'active':''}}" data-val="其他原因" bindtap="setReason">其他原因</view>
|
||||
</view>
|
||||
<textarea class="other-reason" placeholder="或其他原因(选填)..." value="{{reason}}" bindinput="onReasonInput" maxlength="200" />
|
||||
</view>
|
||||
|
||||
<button class="btn-confirm" bindtap="submitWithdraw" loading="{{submitting}}" disabled="{{!canWithdraw}}">
|
||||
确认注销账号
|
||||
</button>
|
||||
<text class="hint">平台不会要求您打电话或邮寄身份证,全程在线完成</text>
|
||||
</view>
|
||||
|
||||
<!-- 注销成功 -->
|
||||
<view class="page submitted" wx:if="{{submitted}}">
|
||||
<view class="success-icon">✓</view>
|
||||
<text class="success-title">账号已注销</text>
|
||||
<text class="success-hint">感谢您的使用,期待您未来再次相遇。</text>
|
||||
<button class="btn-back" bindtap="goBack">返回登录页</button>
|
||||
</view>
|
||||
@@ -0,0 +1,141 @@
|
||||
.page {
|
||||
padding: 32rpx;
|
||||
background: #FFF8F7;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.warning-banner {
|
||||
background: #FFF3F2;
|
||||
border-radius: 20rpx;
|
||||
padding: 32rpx;
|
||||
text-align: center;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.warning-icon { font-size: 56rpx; display: block; }
|
||||
.warning-title { font-size: 32rpx; font-weight: bold; color: #E96B6B; display: block; margin-top: 12rpx; }
|
||||
|
||||
.info-section {
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
padding: 28rpx;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #1A1A1A;
|
||||
display: block;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.info-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.blocker-section {
|
||||
background: #FFF8E1;
|
||||
border-radius: 20rpx;
|
||||
padding: 28rpx;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.blocker-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: bold;
|
||||
color: #E59A32;
|
||||
display: block;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.blocker-item {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
display: block;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.reason-options {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16rpx;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.reason-chip {
|
||||
padding: 12rpx 24rpx;
|
||||
background: #F5F5F5;
|
||||
border-radius: 32rpx;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
border: 2rpx solid transparent;
|
||||
}
|
||||
|
||||
.reason-chip.active {
|
||||
background: #FFF3F2;
|
||||
border-color: #E96B6B;
|
||||
color: #E96B6B;
|
||||
}
|
||||
|
||||
.other-reason {
|
||||
width: 100%;
|
||||
min-height: 120rpx;
|
||||
font-size: 26rpx;
|
||||
background: #F9F9F9;
|
||||
border-radius: 16rpx;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.btn-confirm {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
background: #E96B6B;
|
||||
color: #fff;
|
||||
border-radius: 44rpx;
|
||||
font-size: 30rpx;
|
||||
margin-top: 32rpx;
|
||||
}
|
||||
|
||||
.btn-confirm[disabled] { background: #CCC; }
|
||||
|
||||
.hint {
|
||||
display: block;
|
||||
text-align: center;
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
margin-top: 16rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* 成功状态 */
|
||||
.submitted {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 120rpx 32rpx;
|
||||
}
|
||||
|
||||
.success-icon { font-size: 80rpx; color: #E96B6B; margin-bottom: 24rpx; }
|
||||
.success-title { font-size: 36rpx; font-weight: bold; color: #1A1A1A; margin-bottom: 16rpx; }
|
||||
.success-hint { font-size: 28rpx; color: #666; text-align: center; line-height: 1.6; margin-bottom: 48rpx; }
|
||||
.btn-back {
|
||||
width: 60%;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
background: #E96B6B;
|
||||
color: #fff;
|
||||
border-radius: 44rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user