chore: establish V1.1 recovery baseline

This commit is contained in:
2026-09-09 22:05:00 +08:00
commit b46b48eb33
947 changed files with 155471 additions and 0 deletions
@@ -0,0 +1,181 @@
/**
* 审核中页 U16 / H10(Phase 05 P05-T16)
*
* 重构要点(遵循 AGENTS.md 不变量):
* - 数据:userStore.fetchReviewStatus + verificationService.getStatus(并行)
* - 状态自检:onShow 读取 userStore.state.userState.profileReviewStatus,
* 若已 approved → reLaunch 首页;若 need_edit/rejected → redirectTo 审核驳回页
* (AGENTS 第 9 条:DB 是 Source of Truth,状态以服务端为准)
* - 路由:仅读 userState,不放宽 Required;只读展示,无修改入口
* - 帮助:底部提示联系平台工作人员
*/
const { userStore, appStore, getReviewRedirectPath } = require('../../stores');
const { verificationService } = require('../../services');
const { ROUTE, PROFILE_REVIEW } = require('../../constants');
// 审核步骤:1 已提交 → 2 审核中 → 3 审核完成
const REVIEW_STEPS = [
{ key: 'submitted', label: '提交资料', icon: '✓' },
{ key: 'reviewing', label: '人工审核', icon: '◉' },
{ key: 'done', label: '审核完成', icon: '○' },
];
Page({
data: {
statusBarHeight: 20,
navBarHeight: 44,
loading: true,
refreshing: false,
// 实名认证状态
verificationStatus: 'pending',
verificationLabel: '认证中',
verificationKind: 'warning',
// 资料审核状态
profileReviewStatus: PROFILE_REVIEW.PENDING,
profileReviewLabel: '审核中',
profileReviewKind: 'warning',
submittedAt: null,
reviewedAt: null,
// 步骤
steps: REVIEW_STEPS,
currentStepIndex: 1,
},
onLoad() {
this._initSystemInfo();
},
onShow() {
// 路由守卫:若审核状态已变化,引导至合适页面
// (用户可能在别的页面停留时被审核通过/驳回)
const redirect = getReviewRedirectPath();
if (redirect && redirect !== ROUTE.REVIEW.PENDING) {
// 状态变为 need_edit/rejected → 跳驳回页
wx.redirectTo({ url: redirect });
return;
}
if (!redirect) {
// 状态变为 approved → 跳首页
wx.reLaunch({ url: ROUTE.TAB.HOME });
return;
}
// 仍为 pending,正常展示
this.loadStatus();
},
_initSystemInfo() {
try {
const sysInfo = wx.getSystemInfoSync();
this.setData({
statusBarHeight: sysInfo.statusBarHeight || 20,
navBarHeight: 44,
});
} catch (e) { /* 使用默认值 */ }
},
// ============ 数据加载 ============
async loadStatus() {
this.setData({ loading: true });
try {
// 并行拉取资料审核态 + 实名认证态;任一失败不阻塞另一个
const [review, verification] = await Promise.all([
userStore.fetchReviewStatus().catch(() => null),
verificationService.getStatus().catch(() => null),
]);
const profileReviewStatus = (review && review.status) || PROFILE_REVIEW.PENDING;
// 取到最新状态后重新校验是否需要跳转(状态可能在审核中变为 approved/need_edit)
if (profileReviewStatus === PROFILE_REVIEW.APPROVED) {
wx.reLaunch({ url: ROUTE.TAB.HOME });
return;
}
if (profileReviewStatus === PROFILE_REVIEW.NEED_EDIT || profileReviewStatus === PROFILE_REVIEW.REJECTED) {
wx.redirectTo({ url: ROUTE.REVIEW.REJECTED });
return;
}
const submittedAt = (review && review.submittedAt) || null;
const reviewedAt = (review && review.reviewedAt) || null;
const verificationStatus = (verification && verification.status) || 'pending';
const verificationLabelMap = {
not_submitted: '未提交',
pending: '认证中',
approved: '已完成',
rejected: '未通过',
};
const verificationKindMap = {
not_submitted: 'disabled',
pending: 'warning',
approved: 'success',
rejected: 'danger',
};
const profileReviewLabelMap = {
not_submitted: '未提交',
pending: '审核中',
approved: '已通过',
need_edit: '需修改',
rejected: '未通过',
};
const profileReviewKindMap = {
not_submitted: 'disabled',
pending: 'warning',
approved: 'success',
need_edit: 'warning',
rejected: 'danger',
};
// 步骤索引:approved → 2(完成),pending → 1(审核中),其他 → 0
let currentStepIndex = 1;
if (profileReviewStatus === PROFILE_REVIEW.APPROVED) currentStepIndex = 2;
else if (profileReviewStatus === PROFILE_REVIEW.NOT_SUBMITTED) currentStepIndex = 0;
this.setData({
loading: false,
verificationStatus,
verificationLabel: verificationLabelMap[verificationStatus] || '认证中',
verificationKind: verificationKindMap[verificationStatus] || 'warning',
profileReviewStatus,
profileReviewLabel: profileReviewLabelMap[profileReviewStatus] || '审核中',
profileReviewKind: profileReviewKindMap[profileReviewStatus] || 'warning',
submittedAt,
reviewedAt,
currentStepIndex,
});
} catch (err) {
this.setData({ loading: false });
appStore.toastError(err, '加载失败');
}
},
// ============ 下拉刷新 ============
async onPullDownRefresh() {
// 先刷新 userState(确保 getReviewRedirectPath 读到最新状态)
try {
await userStore.fetchStatus();
} catch (e) { /* 不阻塞 */ }
await this.loadStatus();
wx.stopPullDownRefresh();
},
onRefresh() {
this.loadStatus();
},
// ============ 导航 ============
/**
* 查看我的资料:跳转"我的"Tab
* 不直接跳 profile-confirm,避免审核中再触发"提交审核"
*/
onViewProfile() {
wx.switchTab({ url: ROUTE.TAB.MINE });
},
/**
* 联系工作人员:跳转帮助中心
*/
onContactHelp() {
wx.navigateTo({ url: ROUTE.SETTINGS.HELP_CENTER });
},
});
@@ -0,0 +1,11 @@
{
"navigationBarTitleText": "资料审核中",
"navigationStyle": "custom",
"enablePullDownRefresh": true,
"usingComponents": {
"ui-nav-bar": "/components/nav-bar/index",
"ui-status-badge": "/components/status-badge/index",
"ui-button": "/components/button/index",
"ui-loading": "/components/loading/index"
}
}
@@ -0,0 +1,82 @@
<!-- 审核中页 U16 / H10 -->
<view class="rp-page">
<ui-nav-bar
title="资料审核中"
status-bar-height="{{statusBarHeight}}"
nav-bar-height="{{navBarHeight}}"
show-back="{{false}}"
/>
<!-- 加载态 -->
<view class="rp-loading" wx:if="{{loading}}">
<ui-loading text="加载中…" />
</view>
<view class="rp-body" wx:else>
<!-- 顶部状态卡 -->
<view class="rp-hero card-base">
<view class="rp-hero__icon">○</view>
<text class="rp-hero__title">资料审核中</text>
<text class="rp-hero__desc">
工作人员正在核验头像、个人资料和婚恋信息。
</text>
<text class="rp-hero__hint">
你的资料审核通过后,即可开始使用匹配功能。
</text>
</view>
<!-- 双状态展示 -->
<view class="rp-section card-base">
<view class="rp-status-row">
<text class="rp-status-row__label">实名认证</text>
<ui-status-badge
kind="{{verificationKind}}"
label="{{verificationLabel}}"
icon="{{true}}"
/>
</view>
<view class="rp-status-row">
<text class="rp-status-row__label">资料审核</text>
<ui-status-badge
kind="{{profileReviewKind}}"
label="{{profileReviewLabel}}"
icon="{{true}}"
/>
</view>
<view class="rp-status-meta" wx:if="{{submittedAt}}">
<text class="rp-status-meta__text">提交时间:{{submittedAt}}</text>
</view>
</view>
<!-- 审核步骤 -->
<view class="rp-section card-base">
<view class="rp-steps">
<view
wx:for="{{steps}}"
wx:key="key"
class="rp-step {{index <= currentStepIndex ? 'rp-step--active' : ''}}"
>
<view class="rp-step__icon">{{item.icon}}</view>
<text class="rp-step__label">{{item.label}}</text>
</view>
</view>
</view>
<!-- 操作按钮 -->
<view class="rp-actions">
<ui-button variant="secondary" size="lg" block bind:tap="onViewProfile">
查看我的资料
</ui-button>
<view class="rp-actions__gap"></view>
<ui-button variant="ghost" size="md" block bind:tap="onRefresh">
刷新状态
</ui-button>
</view>
<!-- 帮助提示 -->
<view class="rp-help">
<text class="rp-help__text">如需帮助,请联系平台工作人员。</text>
<text class="rp-help__link" bindtap="onContactHelp">前往帮助中心</text>
</view>
</view>
</view>
@@ -0,0 +1,186 @@
/**
* 审核中页 U16 / H10
*/
.rp-page {
min-height: 100vh;
background: var(--color-bg-page);
padding-bottom: calc(var(--spacing-page-x) + env(safe-area-inset-bottom));
}
.rp-loading {
display: flex;
align-items: center;
justify-content: center;
min-height: 60vh;
}
.rp-body {
padding: var(--spacing-2) var(--spacing-page-x);
}
/* ============ 顶部状态卡 ============ */
.rp-hero {
margin-bottom: var(--spacing-3);
padding: var(--spacing-5) var(--spacing-4);
text-align: center;
}
.rp-hero__icon {
width: 96rpx;
height: 96rpx;
margin: 0 auto var(--spacing-3);
border-radius: var(--radius-full);
background: var(--color-primary-light);
color: var(--color-primary);
font-size: 56rpx;
line-height: 96rpx;
font-weight: var(--font-weight-bold);
}
.rp-hero__title {
display: block;
font-size: var(--font-size-xl);
color: var(--color-text-primary);
font-weight: var(--font-weight-semibold);
margin-bottom: var(--spacing-2);
}
.rp-hero__desc {
display: block;
font-size: var(--font-size-md);
color: var(--color-text-secondary);
line-height: 1.7;
margin-bottom: var(--spacing-2);
}
.rp-hero__hint {
display: block;
font-size: var(--font-size-sm);
color: var(--color-text-tertiary);
line-height: 1.6;
}
/* ============ 通用 section ============ */
.rp-section {
margin-bottom: var(--spacing-3);
padding: var(--spacing-3) var(--spacing-4);
}
/* ============ 双状态展示 ============ */
.rp-status-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--spacing-3);
padding: var(--spacing-3) 0;
border-bottom: var(--border-width) solid var(--color-divider);
}
.rp-status-row:last-child {
border-bottom: none;
}
.rp-status-row__label {
font-size: var(--font-size-md);
color: var(--color-text-primary);
font-weight: var(--font-weight-medium);
}
.rp-status-meta {
padding-top: var(--spacing-2);
border-top: var(--border-width) solid var(--color-divider);
margin-top: var(--spacing-2);
}
.rp-status-meta__text {
font-size: var(--font-size-sm);
color: var(--color-text-tertiary);
}
/* ============ 审核步骤 ============ */
.rp-steps {
display: flex;
align-items: center;
justify-content: space-between;
padding: var(--spacing-2) 0;
}
.rp-step {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
gap: var(--spacing-2);
position: relative;
}
.rp-step:not(:last-child)::after {
content: '';
position: absolute;
top: 28rpx;
right: -50%;
width: 100%;
height: 2rpx;
background: var(--color-divider);
}
.rp-step--active:not(:last-child)::after {
background: var(--color-primary);
}
.rp-step__icon {
width: 56rpx;
height: 56rpx;
border-radius: var(--radius-full);
background: var(--color-bg-disabled);
color: var(--color-text-tertiary);
font-size: 32rpx;
line-height: 56rpx;
text-align: center;
font-weight: var(--font-weight-medium);
}
.rp-step--active .rp-step__icon {
background: var(--color-primary);
color: var(--color-text-inverse);
}
.rp-step__label {
font-size: var(--font-size-sm);
color: var(--color-text-tertiary);
}
.rp-step--active .rp-step__label {
color: var(--color-text-primary);
font-weight: var(--font-weight-medium);
}
/* ============ 操作按钮 ============ */
.rp-actions {
margin: var(--spacing-4) 0;
}
.rp-actions__gap {
height: var(--spacing-2);
}
/* ============ 帮助提示 ============ */
.rp-help {
text-align: center;
padding: var(--spacing-3) 0;
}
.rp-help__text {
display: block;
font-size: var(--font-size-sm);
color: var(--color-text-tertiary);
margin-bottom: var(--spacing-1);
}
.rp-help__link {
display: inline-block;
font-size: var(--font-size-sm);
color: var(--color-primary);
text-decoration: underline;
}