fix: 增加农历。

This commit is contained in:
tianyongbao
2025-11-14 20:31:04 +08:00
parent 4bc5b0db98
commit 2531c5b3c4
2 changed files with 298 additions and 2 deletions

View File

@@ -61,6 +61,7 @@ import listPlugin from '@fullcalendar/list'
import interactionPlugin from '@fullcalendar/interaction'
import dayjs from 'dayjs'
import { getAccountCalendarInfo } from '@/api/invest/accountAnalysis.js'
import calendar from '@/utils/calendar.js'
export default {
name: 'PlanManagement',
components: {},
@@ -131,6 +132,28 @@ export default {
eventContent: function () {
return { html: '' };
},
dayCellContent: function(arg) {
const dateNum = arg.dayNumberText.replace('日', '')
try {
const lunar = calendar.solar2lunar(arg.date.getFullYear(), arg.date.getMonth() + 1, arg.date.getDate())
if (!lunar || !lunar.IDayCn) {
return {
html: `<div class="date-cell"><div class="solar-date">${dateNum}</div></div>`
}
}
const lunarText = lunar.IDayCn === '初一' ? lunar.IMonthCn : lunar.IDayCn
return {
html: `<div class="date-cell">
<div class="solar-date">${dateNum}</div>
<div class="lunar-date">${lunarText}</div>
</div>`
}
} catch (e) {
return {
html: `<div class="date-cell"><div class="solar-date">${dateNum}</div></div>`
}
}
},
moreLinkClick: function() {
return false;
},
@@ -605,6 +628,7 @@ page {
cursor: pointer;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
@@ -623,11 +647,53 @@ page {
:deep(.fc-daygrid-day-number) {
padding: 2rpx;
font-size: 20rpx;
font-weight: 500;
font-size: 26rpx;
font-weight: 600;
color: #333;
}
:deep(.date-cell) {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
padding: 0;
height: 100%;
}
:deep(.solar-date) {
font-size: 24rpx;
font-weight: 600;
color: #333;
line-height: 1;
}
:deep(.lunar-date) {
font-size: 18rpx;
color: #999;
line-height: 1;
margin-top: 2rpx;
transform: scale(0.9);
}
:deep(.fc-day-today .solar-date) {
color: #667eea;
}
:deep(.fc-day-today .lunar-date) {
color: #667eea;
opacity: 0.8;
}
:deep(.fc-day-other .solar-date) {
color: #adb5bd !important;
}
:deep(.fc-day-other .lunar-date) {
color: #ced4da !important;
}
:deep(.fc-daygrid-day-top) {
flex-direction: row;
margin-bottom: 2rpx;