纪念日新增农历日期显示
部署到群晖 / deploy (push) Successful in 44s

- 人员详情页:日期下方显示完整农历「农历 YYYY年 X月X日」
- 日历页本月纪念日列表:日期下方显示农历月日「X月X日」
- 公历事件用 solarToLunar 算当年对应农历
- 农历事件按当年公历落点反算农历(与原始农历一致)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
yuming
2026-06-02 14:19:14 +08:00
parent f0835726de
commit e643512dfa
6 changed files with 44 additions and 5 deletions
+2
View File
@@ -122,12 +122,14 @@ Page({
.map(x => {
const person = persons.find(p => p.id === x.personId)
const date = new Date(currentYear, x._displayMonth - 1, x._displayDay)
const ld = lunar.solarToLunar(date)
return {
...x,
personName: person ? person.name : '未知',
typeIcon: this.getTypeIcon(x.type),
typeName: x.customTypeName || this.getTypeName(x.type),
dateText: dateUtils.formatDate(date, 'MM月DD日'),
lunarMD: ld.lunarText,
daysUntil: dateUtils.getDaysUntil(date)
}
})
+4 -1
View File
@@ -40,7 +40,10 @@
<view class="event-header">
<text class="event-icon">{{item.typeIcon}}</text>
<text class="event-title">{{item.personName}} - {{item.typeName}}</text>
<text class="event-date">{{item.dateText}}</text>
<view class="event-date-group">
<text class="event-date">{{item.dateText}}</text>
<text class="event-lunar">{{item.lunarMD}}</text>
</view>
</view>
<view class="event-info">
<text wx:if="{{item.isLunar}}" class="lunar-badge">农历</text>
+14 -2
View File
@@ -249,11 +249,23 @@
white-space: nowrap;
}
.event-date-group {
display: flex;
flex-direction: column;
align-items: flex-end;
flex-shrink: 0;
margin-left: 12rpx;
gap: 2rpx;
}
.event-date {
font-size: 24rpx;
color: #8A8278;
flex-shrink: 0;
margin-left: 12rpx;
}
.event-lunar {
font-size: 20rpx;
color: #A9A096;
}
.event-info {
+3
View File
@@ -1,6 +1,7 @@
// person-detail.js
const storage = require('../../utils/storage')
const dateUtils = require('../../utils/date')
const lunar = require('../../utils/lunar')
const fmt = require('../../utils/format')
Page({
@@ -52,11 +53,13 @@ Page({
const formatted = anniversaries.map(a => {
const date = new Date(a.solarYear, a.solarMonth - 1, a.solarDay)
const daysUntil = dateUtils.getDaysUntil(date)
const ld = lunar.solarToLunar(date)
return {
...a,
date,
dateText: dateUtils.formatDate(date, 'YYYY年MM月DD日'),
lunarText: `农历 ${ld.year}${ld.lunarText}`,
daysUntil,
daysUntilAbs: Math.abs(daysUntil),
typeIcon: fmt.getTypeIcon(a.type),
+5
View File
@@ -44,6 +44,11 @@
<text wx:if="{{item.isLunar}}" class="lunar-badge">农历</text>
</view>
<view class="anniversary-lunar">
<text class="lunar-icon">🌙</text>
<text class="lunar-text">{{item.lunarText}}</text>
</view>
<view wx:if="{{item.daysUntil !== undefined}}" class="days-info">
<text wx:if="{{item.daysUntil === 0}}" class="days-text urgent">今天</text>
<text wx:elif="{{item.daysUntil === 1}}" class="days-text warning">明天</text>
+15 -1
View File
@@ -193,11 +193,25 @@
}
.anniversary-date {
margin-bottom: 12rpx;
margin-bottom: 8rpx;
font-size: 24rpx;
color: #5A5247;
}
.anniversary-lunar {
display: flex;
align-items: center;
gap: 8rpx;
margin-bottom: 12rpx;
font-size: 22rpx;
color: #8A8278;
}
.lunar-icon {
font-size: 20rpx;
opacity: 0.7;
}
.date-label {
color: #8A8278;
}