- Phase 1: 添加纪念日合并人物创建流程(方案 B) - Phase 2: 农历提醒按 lunarMonth/Day 计算每年公历 - Phase 3: 人员数据同步到后端(新增 /api/person) - Phase 4: 新设备启动从云端恢复数据 - Phase 5: 工具函数收敛 utils/format.js - Phase 6: 同步失败入队 + 启动重试 - Phase 7: 闰月生日完整支持(含 isLeapMonth + UI 警示) - 修复 lunarInfo 数据表错位(替换为权威源 jjonline/calendar.js) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+6
-36
@@ -1,7 +1,7 @@
|
||||
// index.js
|
||||
const storage = require('../../utils/storage')
|
||||
const dateUtils = require('../../utils/date')
|
||||
const { TYPE_NAMES } = require('../../utils/constants')
|
||||
const fmt = require('../../utils/format')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@@ -45,10 +45,10 @@ Page({
|
||||
const next = upcoming[0]
|
||||
nextAnniversary = {
|
||||
type: next.type,
|
||||
typeName: this.getTypeName(next.type, next.customTypeName),
|
||||
typeName: fmt.getTypeName(next.type, next.customTypeName),
|
||||
dateText: dateUtils.formatDate(next.date, 'MM月DD日'),
|
||||
daysUntil: next.daysUntil,
|
||||
daysUntilText: this.formatDaysUntil(next.daysUntil)
|
||||
daysUntilText: fmt.formatDaysUntil(next.daysUntil)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,25 +77,6 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 格式化剩余天数
|
||||
*/
|
||||
formatDaysUntil(days) {
|
||||
if (days === 0) return '今天'
|
||||
if (days === 1) return '明天'
|
||||
if (days < 7) return `${days}天后`
|
||||
if (days < 30) return `还有${Math.floor(days / 7)}周`
|
||||
return `还有${Math.floor(days / 30)}个月`
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取类型名称
|
||||
*/
|
||||
getTypeName(type, customName) {
|
||||
if (type === 'other' && customName) return customName
|
||||
return TYPE_NAMES[type] || '纪念日'
|
||||
},
|
||||
|
||||
/**
|
||||
* 搜索输入
|
||||
*/
|
||||
@@ -178,22 +159,11 @@ Page({
|
||||
},
|
||||
|
||||
/**
|
||||
* 点击添加按钮
|
||||
* 点击添加按钮:直接进添加纪念日(方案 B:流程合并,姓名不存在自动建人)
|
||||
*/
|
||||
onAddTap() {
|
||||
wx.showActionSheet({
|
||||
itemList: ['添加人员', '添加纪念日'],
|
||||
success: (res) => {
|
||||
if (res.tapIndex === 0) {
|
||||
wx.navigateTo({
|
||||
url: '/pages/add-person/add-person'
|
||||
})
|
||||
} else if (res.tapIndex === 1) {
|
||||
wx.navigateTo({
|
||||
url: '/pages/add-anniversary/add-anniversary'
|
||||
})
|
||||
}
|
||||
}
|
||||
wx.navigateTo({
|
||||
url: '/pages/add-anniversary/add-anniversary'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user