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
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:
@@ -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>
|
||||
@@ -1,4 +1,4 @@
|
||||
<template>
|
||||
<template>
|
||||
<div class="daily-trend-card common-card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">
|
||||
@@ -333,7 +333,7 @@ onBeforeUnmount(() => {
|
||||
@import '@/assets/theme.css';
|
||||
|
||||
.daily-trend-card {
|
||||
background: var(--bg-primary);
|
||||
background: var(--bg-secondary);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: var(--spacing-xl);
|
||||
margin-bottom: var(--spacing-xl);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<template>
|
||||
<template>
|
||||
<!-- 支出分类统计 -->
|
||||
<div
|
||||
class="common-card"
|
||||
@@ -274,7 +274,7 @@ onBeforeUnmount(() => {
|
||||
|
||||
// 通用卡片样式
|
||||
.common-card {
|
||||
background: var(--bg-primary);
|
||||
background: var(--bg-secondary);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: var(--spacing-xl);
|
||||
margin-bottom: var(--spacing-xl);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<template>
|
||||
<template>
|
||||
<div class="income-balance-card common-card">
|
||||
<div class="stats-row">
|
||||
<div class="stat-item">
|
||||
@@ -50,7 +50,7 @@ const balanceClass = computed(() => ({
|
||||
@import '@/assets/theme.css';
|
||||
|
||||
.income-balance-card {
|
||||
background: var(--bg-primary);
|
||||
background: var(--bg-secondary);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: var(--spacing-xl);
|
||||
margin-bottom: var(--spacing-xl);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<template>
|
||||
<template>
|
||||
<!-- 收支和不计收支并列显示 -->
|
||||
<div class="side-by-side-cards">
|
||||
<!-- 收入分类统计 -->
|
||||
@@ -155,7 +155,7 @@ const noneCategories = computed(() => {
|
||||
|
||||
// 通用卡片样式
|
||||
.common-card {
|
||||
background: var(--bg-primary);
|
||||
background: var(--bg-secondary);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: var(--spacing-xl);
|
||||
margin-bottom: var(--spacing-xl);
|
||||
|
||||
@@ -373,18 +373,16 @@ const updateChart = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 显示累计值和当日值
|
||||
// 只显示当日值
|
||||
params.forEach((param) => {
|
||||
const color = param.seriesName === '支出' ? '#ff6b6b' : '#4ade80'
|
||||
const cumulativeValue = param.value
|
||||
const dailyValue = param.seriesName === '支出' ? dailyExpense : dailyIncome
|
||||
|
||||
content += `<span style="display:inline-block;margin-right:5px;border-radius:50%;width:10px;height:10px;background-color:${color}"></span>`
|
||||
content += `${param.seriesName}累计: ¥${cumulativeValue.toFixed(2)}`
|
||||
if (dailyValue > 0) {
|
||||
content += ` (当日: ¥${dailyValue.toFixed(2)})`
|
||||
content += `<span style="display:inline-block;margin-right:5px;border-radius:50%;width:10px;height:10px;background-color:${color}"></span>`
|
||||
content += `${param.seriesName}: ¥${dailyValue.toFixed(2)}`
|
||||
content += '<br/>'
|
||||
}
|
||||
content += '<br/>'
|
||||
})
|
||||
} catch (error) {
|
||||
console.warn('格式化tooltip失败:', error)
|
||||
@@ -432,7 +430,7 @@ onBeforeUnmount(() => {
|
||||
|
||||
// 通用卡片样式
|
||||
.common-card {
|
||||
background: var(--bg-primary);
|
||||
background: var(--bg-secondary);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: var(--spacing-xl);
|
||||
margin-bottom: var(--spacing-xl);
|
||||
|
||||
Reference in New Issue
Block a user