fix(miniapp): 小程序界面全量中文化,消除英文/非中文枚举码上屏
- 新增 miniapp/constants/profileLabels.js 作为「枚举码→中文简体」唯一字典 (婚姻/子女/学历/职业/吸烟饮酒/择偶子女/红娘状态),覆盖表单值与种子 实际值两套并集,保证详情页无论后端返回哪种码都显示中文 - 修复「择偶条件-子女」下拉英文选项(any/accept/reject→不限/可接受/不接受), 改用 value/label 数组 + range-key="label" - 修复 recommend-card / user-card / profile-detail / profile-confirm 直接渲染 后端枚举码(educationCode/maritalStatus/occupationCode…)的问题,改由 observers 派生中文 label 上屏 - 清理残留英文文案:Required 条件→必须符合的条件、喜欢TA/向Ta→喜欢对方/向对方、 U51 服务预约→服务预约、U64 公益服务记录→公益服务记录 - 修复 7 个英文窗口标题与 3 个英文占位页正文 - matchmaker 历史服务状态消除原始码兜底,统一走字典 - 加固 scripts/audit-miniapp-language.mjs(A 整行先剥离 mustache、B 排除 bind:action 处理器、F 窗口标题、JPG/PNG 入白名单) - 新增 ui-tests/miniapp-language-contracts.mjs 语种守卫(复用审计脚本,断言 0 命中), UI 契约门禁 MIN_GUARDS 21→22;已做负向注入验证判别力
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
const { userStore, appStore } = require('../../stores');
|
||||
const { profileService } = require('../../services');
|
||||
const { ROUTE, STORAGE_KEYS, PROFILE_REVIEW } = require('../../constants');
|
||||
const { ROUTE, STORAGE_KEYS, PROFILE_REVIEW, profileLabelOf } = require('../../constants');
|
||||
|
||||
// 审核状态 → StatusBadge kind 映射
|
||||
const REVIEW_BADGE = {
|
||||
@@ -23,28 +23,6 @@ const REVIEW_BADGE = {
|
||||
[PROFILE_REVIEW.REJECTED]: { label: '未通过', kind: 'danger' },
|
||||
};
|
||||
|
||||
// 婚姻状况字典(前端展示用,权威值仍由服务端 Profile.maritalStatus 给出)
|
||||
const MARITAL_LABEL = {
|
||||
single: '未婚',
|
||||
divorced: '离异',
|
||||
widowed: '丧偶',
|
||||
};
|
||||
|
||||
// 学历字典
|
||||
const EDUCATION_LABEL = {
|
||||
high_school: '高中/中专',
|
||||
college: '大专',
|
||||
bachelor: '本科',
|
||||
master: '硕士',
|
||||
doctor: '博士',
|
||||
};
|
||||
|
||||
// 子女情况字典
|
||||
const CHILDREN_LABEL = {
|
||||
none: '无子女',
|
||||
has: '有子女',
|
||||
};
|
||||
|
||||
/**
|
||||
* 计算资料完整度(客户端派生展示)
|
||||
*
|
||||
@@ -165,9 +143,9 @@ Page({
|
||||
resubmitAllowed,
|
||||
completion,
|
||||
reviewBadge: REVIEW_BADGE[reviewStatus] || REVIEW_BADGE[PROFILE_REVIEW.NOT_SUBMITTED],
|
||||
maritalLabel: MARITAL_LABEL[profile && profile.maritalStatus] || (profile && profile.maritalStatus) || '-',
|
||||
educationLabel: EDUCATION_LABEL[profile && profile.educationCode] || (profile && profile.educationCode) || '-',
|
||||
childrenLabel: CHILDREN_LABEL[profile && (profile.hasChildren ? 'has' : 'none')] || '-',
|
||||
maritalLabel: profileLabelOf('maritalStatus', profile && profile.maritalStatus) || '-',
|
||||
educationLabel: profileLabelOf('educationCode', profile && profile.educationCode) || '-',
|
||||
childrenLabel: profile && (profile.hasChildren ? '有子女' : '无子女'),
|
||||
});
|
||||
} catch (err) {
|
||||
appStore.toastError(err, '加载失败');
|
||||
|
||||
Reference in New Issue
Block a user