feat: 祈福小助手万年历小程序第一期

This commit is contained in:
gouki
2026-08-06 08:47:09 +00:00
commit a3e6aa9c01
136 changed files with 16597 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
const { calculateDailyFortune } = require('../../utils/core/index.js');
Page({
data: {
hasBazi: false,
fortune: null,
scoreLevelText: ''
},
onShow() {
this.loadFortune();
},
onPullDownRefresh() {
this.loadFortune();
wx.stopPullDownRefresh();
},
loadFortune() {
const bazi = wx.getStorageSync('lunar-user-bazi');
if (!bazi) {
this.setData({ hasBazi: false, fortune: null });
return;
}
const today = new Date();
const fortune = calculateDailyFortune(bazi.eightChar, today);
const levelMap = {
great: '大吉',
good: '吉',
fair: '平',
poor: '凶',
bad: '大凶'
};
this.setData({
hasBazi: true,
fortune,
scoreLevelText: levelMap[fortune.scoreLevel] || '平'
});
},
goBazi() {
wx.switchTab({ url: '/pages/bazi/bazi' });
}
});