feat: 祈福小助手万年历小程序第一期
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
const { getTodayInfo, getAlmanacInfo } = require('../../utils/core/index.js');
|
||||
|
||||
Page({
|
||||
data: {
|
||||
dayInfo: {},
|
||||
almanac: {}
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.loadData();
|
||||
},
|
||||
|
||||
onPullDownRefresh() {
|
||||
this.loadData();
|
||||
wx.stopPullDownRefresh();
|
||||
},
|
||||
|
||||
loadData() {
|
||||
const dayInfo = getTodayInfo();
|
||||
const almanac = getAlmanacInfo(dayInfo.solarYear, dayInfo.solarMonth, dayInfo.solarDay);
|
||||
this.setData({ dayInfo, almanac });
|
||||
},
|
||||
|
||||
navTo(e) {
|
||||
const url = e.currentTarget.dataset.url;
|
||||
wx.navigateTo({ url });
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"navigationBarTitleText": "万年历",
|
||||
"enablePullDownRefresh": true,
|
||||
"backgroundTextStyle": "dark"
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
<view class="container">
|
||||
<!-- 顶部日期卡片 -->
|
||||
<view class="card date-card">
|
||||
<view class="flex justify-between items-center">
|
||||
<view>
|
||||
<text class="text-3xl font-bold">{{dayInfo.solarDay}}</text>
|
||||
<text class="text-lg text-muted ml-2">{{dayInfo.solarMonth}}月{{dayInfo.solarYear}}年</text>
|
||||
</view>
|
||||
<view class="text-right">
|
||||
<text class="text-base">{{dayInfo.weekDay}}</text>
|
||||
<text class="text-sm text-muted block">{{dayInfo.constellation}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mt-2 flex items-center gap-2">
|
||||
<text class="badge badge-festival" wx:if="{{dayInfo.lunarFestival}}">{{dayInfo.lunarFestival}}</text>
|
||||
<text class="badge badge-festival" wx:if="{{dayInfo.solarFestival}}">{{dayInfo.solarFestival}}</text>
|
||||
<text class="badge badge-outline" wx:if="{{dayInfo.solarTerm}}">{{dayInfo.solarTerm}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 农历信息 -->
|
||||
<view class="card">
|
||||
<view class="flex justify-between items-center">
|
||||
<view>
|
||||
<text class="text-2xl font-bold font-chinese">{{dayInfo.lunarMonthName}}{{dayInfo.lunarDayName}}</text>
|
||||
<text class="text-sm text-muted block mt-1">{{dayInfo.lunarYearGanzhi}}年 {{dayInfo.lunarMonthGanzhi}}月 {{dayInfo.lunarDayGanzhi}}日</text>
|
||||
</view>
|
||||
<view class="text-right">
|
||||
<text class="text-lg font-medium">{{dayInfo.zodiac}}年</text>
|
||||
<text class="text-sm text-muted block">{{dayInfo.moonPhase}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 宜忌 -->
|
||||
<view class="card">
|
||||
<view class="flex gap-2 mb-2">
|
||||
<view class="flex-1">
|
||||
<text class="text-lucky font-bold text-lg">宜</text>
|
||||
<view class="flex flex-wrap gap-1 mt-1">
|
||||
<text class="badge badge-lucky" wx:for="{{almanac.recommends}}" wx:key="*this">{{item}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-1">
|
||||
<text class="text-unlucky font-bold text-lg">忌</text>
|
||||
<view class="flex flex-wrap gap-1 mt-1">
|
||||
<text class="badge badge-unlucky" wx:for="{{almanac.avoids}}" wx:key="*this">{{item}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 黄历详情 -->
|
||||
<view class="card">
|
||||
<view class="grid grid-cols-2 gap-2">
|
||||
<view class="p-2 bg-page rounded">
|
||||
<text class="text-xs text-muted">值神</text>
|
||||
<text class="text-base font-medium block">{{almanac.duty}}</text>
|
||||
</view>
|
||||
<view class="p-2 bg-page rounded">
|
||||
<text class="text-xs text-muted">黄道</text>
|
||||
<text class="text-base font-medium block">{{almanac.twelveStar.name}}({{almanac.twelveStar.ecliptic}})</text>
|
||||
</view>
|
||||
<view class="p-2 bg-page rounded">
|
||||
<text class="text-xs text-muted">二十八宿</text>
|
||||
<text class="text-base font-medium block">{{almanac.twentyEightStar.name}}</text>
|
||||
</view>
|
||||
<view class="p-2 bg-page rounded">
|
||||
<text class="text-xs text-muted">六曜</text>
|
||||
<text class="text-base font-medium block">{{almanac.sixStar}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 快捷入口 -->
|
||||
<view class="grid grid-cols-4 gap-2 mt-2">
|
||||
<view class="quick-entry" bindtap="navTo" data-url="/pages/calendar/calendar">
|
||||
<image src="/images/calendar.png" class="quick-icon" mode="aspectFit"/>
|
||||
<text class="text-sm">日历</text>
|
||||
</view>
|
||||
<view class="quick-entry" bindtap="navTo" data-url="/pages/bazi/bazi">
|
||||
<image src="/images/bazi.png" class="quick-icon" mode="aspectFit"/>
|
||||
<text class="text-sm">八字</text>
|
||||
</view>
|
||||
<view class="quick-entry" bindtap="navTo" data-url="/pages/fortune/fortune">
|
||||
<image src="/images/fortune.png" class="quick-icon" mode="aspectFit"/>
|
||||
<text class="text-sm">运势</text>
|
||||
</view>
|
||||
<view class="quick-entry" bindtap="navTo" data-url="/pages/divination/divination">
|
||||
<image src="/images/divination.png" class="quick-icon" mode="aspectFit"/>
|
||||
<text class="text-sm">占卜</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,31 @@
|
||||
.container {
|
||||
padding: 20rpx;
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.date-card {
|
||||
background: linear-gradient(135deg, #C41E3A 0%, #8B1A2B 100%);
|
||||
color: #FFFFFF;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.date-card .text-muted {
|
||||
color: rgba(255,255,255,0.7);
|
||||
}
|
||||
|
||||
.quick-entry {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24rpx;
|
||||
background: #FFFFFF;
|
||||
border-radius: 16rpx;
|
||||
border: 1rpx solid #E8D5C4;
|
||||
}
|
||||
|
||||
.quick-icon {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user