简化纪念日类型:去掉"农历生日"类型,公历/农历改由 isLunar 字段决定
部署到群晖 / deploy (push) Successful in 44s

- typeList 从 5 项简化到 4 项:生日 / 结婚纪念日 / 订婚纪念日 / 其他纪念日
- TYPE_NAMES / TYPE_ICONS 中 lunar_birthday 保留兼容映射(也映射到「生日」+ 🎂),
  让线上历史数据自然回显,无需数据库迁移(方案 A)
- getTypeIndex('lunar_birthday') = 0,老数据编辑时正确回显「生日」
- index.js 列表筛选和 wxml 图标判断本来已含 lunar_birthday 兼容,无需改

老数据自然淘汰:用户重新保存时新数据写 type='birthday',老数据 type 保留
直到下次编辑保存才升级。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
yuming
2026-06-02 07:30:37 +08:00
parent 59ed635dcf
commit 756d57d818
4 changed files with 17 additions and 13 deletions
+9 -8
View File
@@ -10,7 +10,7 @@ Page({
personId: null,
personList: [],
inputName: '',
typeList: ['公历生日', '农历生日', '结婚纪念日', '订婚纪念日', '其他纪念日'],
typeList: ['生日', '结婚纪念日', '订婚纪念日', '其他纪念日'],
typeIndex: 0,
showCustomType: false,
dateValue: '',
@@ -101,14 +101,15 @@ Page({
/**
* 获取类型索引
* 注:lunar_birthday 是老数据兼容,新 UI 没有这一项,统一映射到「生日」(0)
*/
getTypeIndex(type) {
const indexMap = {
birthday: 0,
lunar_birthday: 1,
wedding: 2,
engagement: 3,
other: 4
lunar_birthday: 0,
wedding: 1,
engagement: 2,
other: 3
}
return indexMap[type] || 0
},
@@ -139,9 +140,9 @@ Page({
*/
onTypeChange(e) {
const index = parseInt(e.detail.value)
const types = ['birthday', 'lunar_birthday', 'wedding', 'engagement', 'other']
const isOther = index === 4
const types = ['birthday', 'wedding', 'engagement', 'other']
const isOther = index === 3
this.setData({
typeIndex: index,
showCustomType: isOther,