chore: establish V1.1 recovery baseline
This commit is contained in:
@@ -0,0 +1,187 @@
|
||||
/**
|
||||
* 审核未通过页 U17 / H11(Phase 05 P05-T17)
|
||||
*
|
||||
* 重构要点(遵循 AGENTS.md 不变量):
|
||||
* - 数据:userStore.fetchReviewStatus(取 items[] 逐项驳回原因)
|
||||
* - 展示:每项明确 itemType → 中文标签 + reasonText + "立即修改"跳转对应资料页
|
||||
* - 路由守卫:onShow 检查 userState,若状态变为 approved → reLaunch 首页;
|
||||
* 若变为 pending → redirectTo 审核中页
|
||||
* - AGENTS 第 9 条:DB 是 Source of Truth——审核结果以服务端 items 为准,
|
||||
* 本地不缓存驳回原因;每次进入页面重新拉取
|
||||
* - AGENTS 第 2 条:Required 不可自动放宽——本页仅引导修改,不修改任何择偶条件
|
||||
*/
|
||||
const { userStore, appStore, getReviewRedirectPath } = require('../../stores');
|
||||
const { ROUTE, PROFILE_REVIEW } = require('../../constants');
|
||||
|
||||
// itemType → 中文标签 + 对应资料编辑页路由
|
||||
// 路由跳转目标用 ONBOARDING.* 系列(与 profile-confirm 一致)
|
||||
const ITEM_TYPE_MAP = {
|
||||
avatar: { label: '头像', route: ROUTE.ONBOARDING.PROFILE_PHOTOS },
|
||||
photos: { label: '生活照', route: ROUTE.ONBOARDING.PROFILE_PHOTOS },
|
||||
self_intro: { label: '个人介绍', route: ROUTE.ONBOARDING.PROFILE_INTRO },
|
||||
basic: { label: '基础资料', route: ROUTE.ONBOARDING.PROFILE_BASIC },
|
||||
region: { label: '居住区域', route: ROUTE.ONBOARDING.PROFILE_BASIC },
|
||||
height: { label: '身高', route: ROUTE.ONBOARDING.PROFILE_BASIC },
|
||||
marital: { label: '婚姻状况', route: ROUTE.ONBOARDING.PROFILE_BASIC },
|
||||
children: { label: '子女情况', route: ROUTE.ONBOARDING.PROFILE_BASIC },
|
||||
education: { label: '学历', route: ROUTE.ONBOARDING.PROFILE_BASIC },
|
||||
occupation: { label: '职业', route: ROUTE.ONBOARDING.PROFILE_BASIC },
|
||||
lifestyle: { label: '生活方式', route: ROUTE.ONBOARDING.PROFILE_LIFESTYLE },
|
||||
smoking: { label: '吸烟情况', route: ROUTE.ONBOARDING.PROFILE_LIFESTYLE },
|
||||
drinking: { label: '饮酒情况', route: ROUTE.ONBOARDING.PROFILE_LIFESTYLE },
|
||||
settlement: { label: '定居意向', route: ROUTE.ONBOARDING.PROFILE_LIFESTYLE },
|
||||
intent: { label: '婚恋意愿', route: ROUTE.ONBOARDING.PROFILE_INTENT },
|
||||
relationship_goal: { label: '婚恋目标', route: ROUTE.ONBOARDING.PROFILE_INTENT },
|
||||
marriage_plan: { label: '结婚计划', route: ROUTE.ONBOARDING.PROFILE_INTENT },
|
||||
preference: { label: '择偶条件', route: ROUTE.ONBOARDING.PROFILE_PREFERENCE },
|
||||
interests: { label: '兴趣标签', route: ROUTE.ONBOARDING.PROFILE_INTERESTS },
|
||||
};
|
||||
|
||||
// 项状态 → 中文标签 + StatusBadge kind
|
||||
const ITEM_STATUS_MAP = {
|
||||
pending: { label: '审核中', kind: 'warning' },
|
||||
approved: { label: '已通过', kind: 'success' },
|
||||
need_edit: { label: '需修改', kind: 'warning' },
|
||||
rejected: { label: '未通过', kind: 'danger' },
|
||||
};
|
||||
|
||||
Page({
|
||||
data: {
|
||||
statusBarHeight: 20,
|
||||
navBarHeight: 44,
|
||||
loading: true,
|
||||
reviewStatus: PROFILE_REVIEW.NEED_EDIT,
|
||||
reviewStatusLabel: '需要修改',
|
||||
issueItems: [], // need_edit/rejected 项(待修改)
|
||||
otherItems: [], // approved/pending 项(其他审核结果)
|
||||
hasIssues: false,
|
||||
hasOtherItems: false,
|
||||
showAllItems: false,
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this._initSystemInfo();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 路由守卫:状态变化时引导至合适页面
|
||||
const redirect = getReviewRedirectPath();
|
||||
if (redirect === ROUTE.REVIEW.PENDING) {
|
||||
// 状态变为 pending(用户重新提交了审核)
|
||||
wx.redirectTo({ url: redirect });
|
||||
return;
|
||||
}
|
||||
if (!redirect) {
|
||||
// 状态变为 approved
|
||||
wx.reLaunch({ url: ROUTE.TAB.HOME });
|
||||
return;
|
||||
}
|
||||
// 仍为 need_edit/rejected,正常加载
|
||||
this.loadReviewResult();
|
||||
},
|
||||
|
||||
_initSystemInfo() {
|
||||
try {
|
||||
const sysInfo = wx.getSystemInfoSync();
|
||||
this.setData({
|
||||
statusBarHeight: sysInfo.statusBarHeight || 20,
|
||||
navBarHeight: 44,
|
||||
});
|
||||
} catch (e) { /* 使用默认值 */ }
|
||||
},
|
||||
|
||||
// ============ 数据加载 ============
|
||||
async loadReviewResult() {
|
||||
this.setData({ loading: true });
|
||||
try {
|
||||
const review = await userStore.fetchReviewStatus();
|
||||
const reviewStatus = (review && review.status) || PROFILE_REVIEW.NEED_EDIT;
|
||||
|
||||
// 取到最新状态后重新校验是否需要跳转
|
||||
if (reviewStatus === PROFILE_REVIEW.APPROVED) {
|
||||
wx.reLaunch({ url: ROUTE.TAB.HOME });
|
||||
return;
|
||||
}
|
||||
if (reviewStatus === PROFILE_REVIEW.PENDING) {
|
||||
wx.redirectTo({ url: ROUTE.REVIEW.PENDING });
|
||||
return;
|
||||
}
|
||||
if (reviewStatus === PROFILE_REVIEW.NOT_SUBMITTED) {
|
||||
wx.redirectTo({ url: ROUTE.ONBOARDING.PROFILE_CONFIRM });
|
||||
return;
|
||||
}
|
||||
|
||||
const rawItems = (review && review.items) || [];
|
||||
|
||||
// 派生展示项,并按 isIssue 拆分为两组(避免 WXML wx:for+wx:if 同元素)
|
||||
const issueItems = [];
|
||||
const otherItems = [];
|
||||
rawItems.forEach((raw) => {
|
||||
const typeMeta = ITEM_TYPE_MAP[raw.itemType] || { label: raw.itemType, route: ROUTE.ONBOARDING.PROFILE_BASIC };
|
||||
const statusMeta = ITEM_STATUS_MAP[raw.status] || { label: raw.status, kind: 'disabled' };
|
||||
const item = {
|
||||
itemType: raw.itemType,
|
||||
label: typeMeta.label,
|
||||
statusLabel: statusMeta.label,
|
||||
kind: statusMeta.kind,
|
||||
reasonText: raw.reasonText || '',
|
||||
reasonCode: raw.reasonCode || '',
|
||||
route: typeMeta.route,
|
||||
};
|
||||
if (raw.status === 'need_edit' || raw.status === 'rejected') {
|
||||
issueItems.push(item);
|
||||
} else {
|
||||
otherItems.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
const hasIssues = issueItems.length > 0;
|
||||
const hasOtherItems = otherItems.length > 0;
|
||||
const reviewStatusLabelMap = {
|
||||
need_edit: '需要修改',
|
||||
rejected: '审核未通过',
|
||||
};
|
||||
|
||||
this.setData({
|
||||
loading: false,
|
||||
reviewStatus,
|
||||
reviewStatusLabel: reviewStatusLabelMap[reviewStatus] || '需要修改',
|
||||
issueItems,
|
||||
otherItems,
|
||||
hasIssues,
|
||||
hasOtherItems,
|
||||
});
|
||||
} catch (err) {
|
||||
this.setData({ loading: false });
|
||||
appStore.toastError(err, '加载失败');
|
||||
}
|
||||
},
|
||||
|
||||
// ============ 展开/收起其他审核结果 ============
|
||||
onToggleItems() {
|
||||
this.setData({ showAllItems: !this.data.showAllItems });
|
||||
},
|
||||
|
||||
// ============ 跳转修改 ============
|
||||
/**
|
||||
* 跳转对应资料页修改
|
||||
* AGENTS 第 2 条:仅引导跳转,不放宽任何 Required 约束
|
||||
*/
|
||||
onEditItem(e) {
|
||||
const route = e.currentTarget.dataset.route;
|
||||
if (route) {
|
||||
wx.navigateTo({ url: route });
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 全部修改完后重新提交审核
|
||||
*/
|
||||
onResubmit() {
|
||||
wx.redirectTo({ url: ROUTE.ONBOARDING.PROFILE_CONFIRM });
|
||||
},
|
||||
|
||||
onBack() {
|
||||
wx.navigateBack();
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"navigationBarTitleText": "资料需修改",
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": false,
|
||||
"usingComponents": {
|
||||
"ui-nav-bar": "/components/nav-bar/index",
|
||||
"ui-section-header": "/components/section-header/index",
|
||||
"ui-status-badge": "/components/status-badge/index",
|
||||
"ui-button": "/components/button/index",
|
||||
"ui-empty": "/components/empty/index",
|
||||
"ui-loading": "/components/loading/index"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<!-- 审核未通过页 U17 / H11 -->
|
||||
<view class="rr-page">
|
||||
<ui-nav-bar
|
||||
title="资料需修改"
|
||||
status-bar-height="{{statusBarHeight}}"
|
||||
nav-bar-height="{{navBarHeight}}"
|
||||
bind:back="onBack"
|
||||
/>
|
||||
|
||||
<!-- 加载态 -->
|
||||
<view class="rr-loading" wx:if="{{loading}}">
|
||||
<ui-loading text="加载中…" />
|
||||
</view>
|
||||
|
||||
<view class="rr-body" wx:elif="{{issueItems.length || otherItems.length}}">
|
||||
<!-- 顶部提示卡 -->
|
||||
<view class="rr-hero card-base">
|
||||
<view class="rr-hero__icon">!</view>
|
||||
<text class="rr-hero__title">{{reviewStatusLabel}}</text>
|
||||
<text class="rr-hero__desc">
|
||||
请根据以下问题修改对应资料,修改完成后可重新提交审核。
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<!-- 需修改项列表 -->
|
||||
<view class="rr-section card-base">
|
||||
<ui-section-header title="需要修改的项" />
|
||||
<view class="rr-issue-list">
|
||||
<view
|
||||
wx:for="{{issueItems}}"
|
||||
wx:key="itemType"
|
||||
class="rr-issue"
|
||||
>
|
||||
<view class="rr-issue__head">
|
||||
<text class="rr-issue__title">{{item.label}}</text>
|
||||
<ui-status-badge kind="{{item.kind}}" label="{{item.statusLabel}}" icon="{{true}}" />
|
||||
</view>
|
||||
<view class="rr-issue__reason" wx:if="{{item.reasonText}}">
|
||||
<text class="rr-issue__reason-label">原因</text>
|
||||
<text class="rr-issue__reason-text">{{item.reasonText}}</text>
|
||||
</view>
|
||||
<view class="rr-issue__action">
|
||||
<text class="rr-issue__edit-link" bindtap="onEditItem" data-route="{{item.route}}">
|
||||
立即修改 ›
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 其他审核结果(默认折叠) -->
|
||||
<view class="rr-section card-base" wx:if="{{hasOtherItems}}">
|
||||
<view class="rr-toggle" bindtap="onToggleItems">
|
||||
<text class="rr-toggle__text">查看其他审核结果</text>
|
||||
<text class="rr-toggle__arrow">{{showAllItems ? '收起 ▲' : '展开 ▼'}}</text>
|
||||
</view>
|
||||
<view class="rr-other-list" wx:if="{{showAllItems}}">
|
||||
<view
|
||||
wx:for="{{otherItems}}"
|
||||
wx:key="itemType"
|
||||
class="rr-other-row"
|
||||
>
|
||||
<text class="rr-other-row__label">{{item.label}}</text>
|
||||
<ui-status-badge kind="{{item.kind}}" label="{{item.statusLabel}}" icon="{{true}}" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="rr-actions">
|
||||
<ui-button variant="primary" size="lg" block bind:tap="onResubmit">
|
||||
修改完成,重新提交审核
|
||||
</ui-button>
|
||||
</view>
|
||||
|
||||
<!-- 帮助提示 -->
|
||||
<view class="rr-help">
|
||||
<text class="rr-help__text">
|
||||
如对审核结果有疑问,可联系平台工作人员协助处理。
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 空态:未拉取到 items -->
|
||||
<view class="rr-empty" wx:else>
|
||||
<ui-empty title="暂无审核反馈" />
|
||||
<view class="rr-actions">
|
||||
<ui-button variant="secondary" size="md" block bind:tap="onResubmit">
|
||||
返回资料确认
|
||||
</ui-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,176 @@
|
||||
/**
|
||||
* 审核未通过页 U17 / H11
|
||||
*/
|
||||
|
||||
.rr-page {
|
||||
min-height: 100vh;
|
||||
background: var(--color-bg-page);
|
||||
padding-bottom: calc(160rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.rr-loading,
|
||||
.rr-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 60vh;
|
||||
gap: var(--spacing-4);
|
||||
}
|
||||
|
||||
.rr-body {
|
||||
padding: var(--spacing-2) var(--spacing-page-x);
|
||||
}
|
||||
|
||||
/* ============ 顶部提示卡 ============ */
|
||||
.rr-hero {
|
||||
margin-bottom: var(--spacing-3);
|
||||
padding: var(--spacing-5) var(--spacing-4);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.rr-hero__icon {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
margin: 0 auto var(--spacing-3);
|
||||
border-radius: var(--radius-full);
|
||||
background: var(--color-warning-light);
|
||||
color: var(--color-warning);
|
||||
font-size: 56rpx;
|
||||
line-height: 96rpx;
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.rr-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);
|
||||
}
|
||||
|
||||
.rr-hero__desc {
|
||||
display: block;
|
||||
font-size: var(--font-size-md);
|
||||
color: var(--color-text-secondary);
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
/* ============ 通用 section ============ */
|
||||
.rr-section {
|
||||
margin-bottom: var(--spacing-3);
|
||||
padding: var(--spacing-3) var(--spacing-4);
|
||||
}
|
||||
|
||||
/* ============ 需修改项列表 ============ */
|
||||
.rr-issue {
|
||||
padding: var(--spacing-3) 0;
|
||||
border-bottom: var(--border-width) solid var(--color-divider);
|
||||
}
|
||||
|
||||
.rr-issue:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.rr-issue__head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--spacing-3);
|
||||
margin-bottom: var(--spacing-2);
|
||||
}
|
||||
|
||||
.rr-issue__title {
|
||||
font-size: var(--font-size-md);
|
||||
color: var(--color-text-primary);
|
||||
font-weight: var(--font-weight-medium);
|
||||
}
|
||||
|
||||
.rr-issue__reason {
|
||||
padding: var(--spacing-2) var(--spacing-3);
|
||||
background: var(--color-warning-light);
|
||||
border-radius: var(--radius-md);
|
||||
margin-bottom: var(--spacing-2);
|
||||
}
|
||||
|
||||
.rr-issue__reason-label {
|
||||
display: block;
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--color-warning);
|
||||
font-weight: var(--font-weight-medium);
|
||||
margin-bottom: var(--spacing-1);
|
||||
}
|
||||
|
||||
.rr-issue__reason-text {
|
||||
display: block;
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--color-text-primary);
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.rr-issue__action {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.rr-issue__edit-link {
|
||||
font-size: var(--font-size-md);
|
||||
color: var(--color-primary);
|
||||
font-weight: var(--font-weight-medium);
|
||||
padding: var(--spacing-1) var(--spacing-2);
|
||||
}
|
||||
|
||||
/* ============ 其他审核结果 ============ */
|
||||
.rr-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: var(--spacing-2) 0;
|
||||
}
|
||||
|
||||
.rr-toggle__text {
|
||||
font-size: var(--font-size-md);
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
.rr-toggle__arrow {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
.rr-other-list {
|
||||
margin-top: var(--spacing-2);
|
||||
padding-top: var(--spacing-2);
|
||||
border-top: var(--border-width) solid var(--color-divider);
|
||||
}
|
||||
|
||||
.rr-other-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--spacing-3);
|
||||
padding: var(--spacing-2) 0;
|
||||
}
|
||||
|
||||
.rr-other-row__label {
|
||||
font-size: var(--font-size-md);
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
/* ============ 操作按钮 ============ */
|
||||
.rr-actions {
|
||||
margin: var(--spacing-4) 0;
|
||||
}
|
||||
|
||||
/* ============ 帮助提示 ============ */
|
||||
.rr-help {
|
||||
text-align: center;
|
||||
padding: var(--spacing-3) 0;
|
||||
}
|
||||
|
||||
.rr-help__text {
|
||||
display: block;
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--color-text-tertiary);
|
||||
line-height: 1.6;
|
||||
}
|
||||
Reference in New Issue
Block a user