优化
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 39s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s

This commit is contained in:
SunCheng
2026-01-23 17:14:41 +08:00
parent 58627356f4
commit 4ff99b62c8
6 changed files with 86 additions and 542 deletions

View File

@@ -1,4 +1,4 @@
<template>
<template>
<div class="page-container calendar-container">
<van-calendar
title="日历"
@@ -11,8 +11,6 @@
@select="onDateSelect"
/>
<ContributionHeatmap ref="heatmapRef" />
<!-- 底部安全距离 -->
<div style="height: calc(60px + env(safe-area-inset-bottom, 0px))" />
@@ -58,7 +56,6 @@ import TransactionList from '@/components/TransactionList.vue'
import TransactionDetail from '@/components/TransactionDetail.vue'
import SmartClassifyButton from '@/components/SmartClassifyButton.vue'
import PopupContainer from '@/components/PopupContainer.vue'
import ContributionHeatmap from '@/components/ContributionHeatmap.vue'
const dailyStatistics = ref({})
const listVisible = ref(false)
@@ -68,23 +65,14 @@ const currentTransaction = ref(null)
const listLoading = ref(false)
const selectedDate = ref(null)
const selectedDateText = ref('')
const heatmapRef = ref(null)
// 设置日历可选范围(例如:过去2年到未来1年
const minDate = new Date(new Date().getFullYear() - 2, 0, 1) // 2年前的1月1日
const maxDate = new Date(new Date().getFullYear() + 1, 11, 31) // 明年12月31日
onMounted(async () => {
await nextTick()
setTimeout(() => {
// 计算页面高度滚动3/4高度以显示更多日期
const height = document.querySelector('.calendar-container').clientHeight * 0.43
document.querySelector('.van-calendar__body').scrollBy({
top: -height,
behavior: 'smooth'
})
}, 300)
})
// 设置日历可选范围(例如:过去1年到当前月底
const minDate = new Date(new Date().getFullYear() - 1, 0, 1) // 1年前的1月1日
let maxDate = new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0) // 当前月的最后一天
// 如果当前日超过20号则将最大日期设置为下个月月底方便用户查看和选择
if (new Date().getDate() > 20) {
maxDate = new Date(new Date().getFullYear(), new Date().getMonth() + 2, 0)
}
// 获取日历统计数据
const fetchDailyStatistics = async (year, month) => {
@@ -280,7 +268,6 @@ const onGlobalTransactionDeleted = () => {
}
const now = selectedDate.value || new Date()
fetchDailyStatistics(now.getFullYear(), now.getMonth() + 1)
heatmapRef.value?.refresh()
}
window.addEventListener &&
@@ -298,7 +285,6 @@ const onGlobalTransactionsChanged = () => {
}
const now = selectedDate.value || new Date()
fetchDailyStatistics(now.getFullYear(), now.getMonth() + 1)
heatmapRef.value?.refresh()
}
window.addEventListener &&