fix
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 4m27s
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 1s

This commit is contained in:
SunCheng
2026-02-11 13:00:01 +08:00
parent ca3e929770
commit 51172e8c5a
88 changed files with 10076 additions and 142 deletions

View File

@@ -397,12 +397,21 @@ const loadWeeklyData = async () => {
})
if (dailyResult?.success && dailyResult.data) {
// 转换数据格式以适配图表组件
trendStats.value = dailyResult.data.map(item => ({
date: item.date,
amount: (item.income || 0) - (item.expense || 0),
count: item.count || 0
}))
// ⚠️ 注意: API 返回的 data 按日期顺序排列,但只有 day 字段(天数)
// 需要根据 weekStart 和索引重建完整日期
trendStats.value = dailyResult.data.map((item, index) => {
// 从 weekStart 开始,按索引递增天数
const date = new Date(weekStart)
date.setDate(weekStart.getDate() + index)
const dateStr = formatDateToString(date)
return {
date: dateStr,
expense: item.expense || 0,
income: item.income || 0,
count: item.count || 0
}
})
}
} catch (error) {
console.error('加载周度数据失败:', error)
@@ -638,6 +647,9 @@ const isLastPeriod = () => {
const handleTouchStart = (e) => {
touchStartX.value = e.touches[0].clientX
touchStartY.value = e.touches[0].clientY
// 重置 touchEnd 值,防止使用上次的残留值
touchEndX.value = touchStartX.value
touchEndY.value = touchStartY.value
}
const handleTouchMove = (e) => {
@@ -645,12 +657,21 @@ const handleTouchMove = (e) => {
touchEndY.value = e.touches[0].clientY
}
const handleTouchEnd = () => {
const handleTouchEnd = (e) => {
// 如果 touchEnd 事件中还有 changedTouches,使用它来获取最终位置
if (e.changedTouches && e.changedTouches.length > 0) {
touchEndX.value = e.changedTouches[0].clientX
touchEndY.value = e.changedTouches[0].clientY
}
const deltaX = touchEndX.value - touchStartX.value
const deltaY = touchEndY.value - touchStartY.value
// 判断是否是水平滑动(水平距离大于垂直距离)
if (Math.abs(deltaX) > Math.abs(deltaY) && Math.abs(deltaX) > 50) {
// 最小滑动距离阈值(像素)
const MIN_SWIPE_DISTANCE = 50
// 判断是否是水平滑动(水平距离大于垂直距离且超过阈值)
if (Math.abs(deltaX) > Math.abs(deltaY) && Math.abs(deltaX) > MIN_SWIPE_DISTANCE) {
if (deltaX > 0) {
// 右滑 - 上一个周期
handlePrevPeriod()
@@ -744,7 +765,7 @@ onMounted(() => {
overflow-y: auto;
-webkit-overflow-scrolling: touch;
overscroll-behavior: contain;
background-color: var(--bg-secondary);
background-color: var(--bg-primary);
/* 改善滚动性能 */
will-change: scroll-position;
/* 防止滚动卡顿 */
@@ -753,7 +774,7 @@ onMounted(() => {
.statistics-content {
padding: var(--spacing-md);
padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
padding-bottom: calc(95px + env(safe-area-inset-bottom, 0px));
min-height: 100%;
/* 确保内容足够高以便滚动 */
display: flex;
@@ -781,7 +802,7 @@ onMounted(() => {
.statistics-content {
padding: var(--spacing-sm);
padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px));
padding-bottom: calc(95px + env(safe-area-inset-bottom, 0px));
}
}
</style>