- 新增 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;已做负向注入验证判别力
52 lines
1.6 KiB
JavaScript
52 lines
1.6 KiB
JavaScript
/**
|
|
* UserCard 用户卡片(列表项 / Discover / 活动互选)
|
|
*
|
|
* 不携带任何操作按钮,纯展示;操作按钮由调用方 slot 注入。
|
|
* 用法:
|
|
* <ui-user-card user="{{user}}" bind:tap="onTap">
|
|
* <view slot="actions">…自定义按钮…</view>
|
|
* </ui-user-card>
|
|
*/
|
|
const { profileLabelOf } = require('../../constants')
|
|
|
|
Component({
|
|
options: { addGlobalClass: true, multipleSlots: true },
|
|
properties: {
|
|
user: { type: Object, value: null },
|
|
showReasons: { type: Boolean, value: false }, // 是否展示推荐理由
|
|
selectable: { type: Boolean, value: false }, // 是否显示选择框
|
|
selected: { type: Boolean, value: false },
|
|
},
|
|
data: {
|
|
// 由后端枚举码派生的中文展示值(界面不得出现英文码)
|
|
educationLabel: '',
|
|
occupationLabel: '',
|
|
maritalLabel: '',
|
|
},
|
|
observers: {
|
|
user(u) {
|
|
if (!u) {
|
|
this.setData({ educationLabel: '', occupationLabel: '', maritalLabel: '' })
|
|
return
|
|
}
|
|
this.setData({
|
|
educationLabel: profileLabelOf('educationCode', u.educationCode),
|
|
occupationLabel: profileLabelOf('occupationCode', u.occupationCode),
|
|
maritalLabel: profileLabelOf('maritalStatus', u.maritalStatus),
|
|
})
|
|
},
|
|
},
|
|
methods: {
|
|
onTap() {
|
|
if (!this.data.user) return;
|
|
this.triggerEvent('tap', { userId: this.data.user.userId });
|
|
},
|
|
onToggleSelect() {
|
|
this.triggerEvent('select', {
|
|
userId: this.data.user.userId,
|
|
selected: !this.data.selected,
|
|
});
|
|
},
|
|
},
|
|
});
|