修复节气计算/佛历倒计时/顶部固定高度+老黄历方框

- 节气改用精确查表(2000-2060天文算法生成),修复立秋等大偏差
- 佛历倒计时/节日速查以当前选中日期为基准,切换日期实时更新
- 大日历顶部节日区/佛历区固定高度,空着也占位不再跳动
- 大日期加老黄历式方框(双线边框,节假日红/工作日绿)
This commit is contained in:
gouki
2026-08-07 22:57:26 +00:00
parent bb9c19c99f
commit 2bd84eea88
5 changed files with 130 additions and 24 deletions
+5 -2
View File
@@ -82,6 +82,7 @@ Page({
const almanac = getAlmanacInfo(y, m, d);
this.setData({ dayInfo, almanac, currentYear: y, currentMonth: m });
this.refreshDerived();
this.loadUpcoming();
},
/** 计算派生数据(节假日/工作日/佛历/初一十五) */
@@ -92,12 +93,14 @@ Page({
const workday = isWorkday(y, m, d);
const termTime = dayInfo.solarTerm ? (SOLAR_TERM_TIMES[dayInfo.solarTerm] || '') : '';
const isFirstOrFifteen = highlightLunar && (dayInfo.lunarDay === 1 || dayInfo.lunarDay === 15);
const nextBuddhist = showBuddhist ? getNextBuddhistFestival() : null;
const nextBuddhist = showBuddhist ? getNextBuddhistFestival(y, m, d) : null;
this.setData({ legalHoliday, workday, termTime, isFirstOrFifteen, nextBuddhist });
},
loadUpcoming() {
this.setData({ upcoming: getUpcomingFestivals(5) });
const { dayInfo } = this.data;
const { solarYear: y, solarMonth: m, solarDay: d } = dayInfo;
this.setData({ upcoming: getUpcomingFestivals(5, y, m, d) });
},
prevDay() { this.shiftDay(-1); },
+9 -7
View File
@@ -27,10 +27,12 @@
</view>
</view>
<!-- 大日期 -->
<!-- 大日期(老黄历方框) -->
<view class="almanac-day-row" catchtap="noop">
<view class="day-arrow" catchtap="prevDay"></view>
<view class="almanac-day-num font-chinese {{legalHoliday ? 'num-holiday' : (workday ? 'num-workday' : 'num-weekend')}}">{{dayInfo.solarDay}}</view>
<view class="day-frame {{legalHoliday ? 'frame-holiday' : (workday ? 'frame-workday' : 'frame-weekend')}}">
<view class="almanac-day-num font-chinese {{legalHoliday ? 'num-holiday' : (workday ? 'num-workday' : 'num-weekend')}}">{{dayInfo.solarDay}}</view>
</view>
<view class="day-arrow" catchtap="nextDay"></view>
</view>
@@ -40,17 +42,17 @@
<text class="almanac-lunar-sub">{{dayInfo.lunarYearGanzhi}}年 {{dayInfo.lunarMonthGanzhi}}月 {{dayInfo.lunarDayGanzhi}}日 · 属{{dayInfo.zodiac}}</text>
</view>
<!-- 节日/节气/佛历 -->
<view class="almanac-fest" wx:if="{{legalHoliday || dayInfo.lunarFestival || dayInfo.solarFestival || dayInfo.solarTerm}}">
<!-- 节日/节气(固定高度,空着也占位) -->
<view class="almanac-fest">
<text class="badge badge-holiday" wx:if="{{legalHoliday}}">{{legalHoliday}}</text>
<text class="badge badge-festival" wx:if="{{dayInfo.lunarFestival && !legalHoliday}}">{{dayInfo.lunarFestival}}</text>
<text class="badge badge-festival" wx:if="{{dayInfo.solarFestival && !legalHoliday}}">{{dayInfo.solarFestival}}</text>
<text class="badge badge-term" wx:if="{{dayInfo.solarTerm}}">{{dayInfo.solarTerm}}{{termTime ? ' ' + termTime : ''}}</text>
</view>
<!-- 佛历提醒 -->
<view class="buddhist-tip" wx:if="{{showBuddhist && nextBuddhist}}" catchtap="noop">
<text class="buddhist-text">🪷 距 {{nextBuddhist.name}} 还有 {{nextBuddhist.daysLeft}} 天({{nextBuddhist.solarDate}}</text>
<!-- 佛历提醒(固定高度,空着也占位) -->
<view class="buddhist-tip">
<text class="buddhist-text" wx:if="{{showBuddhist && nextBuddhist}}" catchtap="noop">🪷 距 {{nextBuddhist.name}} 还有 {{nextBuddhist.daysLeft}} 天({{nextBuddhist.solarDate}}</text>
</view>
<!-- 工作日/节假日提示 -->
+26 -4
View File
@@ -128,13 +128,29 @@
}
.almanac-day-num {
font-size: 240rpx;
font-size: 200rpx;
font-weight: 700;
line-height: 1.05;
min-width: 400rpx;
text-align: center;
}
/* 老黄历方框 */
.day-frame {
min-width: 360rpx;
height: 300rpx;
display: flex;
align-items: center;
justify-content: center;
border: 6rpx solid;
border-radius: 16rpx;
background: #FFFDF8;
box-shadow: inset 0 0 0 4rpx #FFFDF8, inset 0 0 0 6rpx currentColor;
}
.frame-holiday { border-color: #C41E3A; color: #C41E3A; }
.frame-workday { border-color: #2E7D32; color: #2E7D32; }
.frame-weekend { border-color: #C41E3A; color: #C41E3A; }
.num-holiday { color: #C41E3A; }
.num-workday { color: #2E7D32; }
.num-weekend { color: #C41E3A; }
@@ -165,13 +181,15 @@
margin-top: 8rpx;
}
/* 节日 */
/* 节日(固定高度占位) */
.almanac-fest {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
gap: 12rpx;
margin-bottom: 12rpx;
min-height: 52rpx;
}
.badge-holiday {
@@ -191,11 +209,15 @@
color: #FFFFFF;
}
/* 佛历提醒 */
/* 佛历提醒(固定高度占位) */
.buddhist-tip {
text-align: center;
padding: 12rpx;
margin-bottom: 8rpx;
min-height: 50rpx;
display: flex;
align-items: center;
justify-content: center;
}
.buddhist-text {