From 19cece0e009c0642c2ed73155d47ca646dfafb20 Mon Sep 17 00:00:00 2001 From: gs Date: Mon, 28 Sep 2026 19:55:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/App.vue | 2 +- apps/web/src/pages/StatsPage.vue | 364 +++++++++++-- apps/web/src/pages/TodayPage.vue | 128 +---- apps/web/src/style.css | 491 +++++++++++++++--- ...2026-09-28-stats-range-summary-redesign.md | 22 + doc/README.md | 1 + 6 files changed, 808 insertions(+), 200 deletions(-) create mode 100644 doc/2026-09-28-stats-range-summary-redesign.md diff --git a/apps/web/src/App.vue b/apps/web/src/App.vue index d3161de..a50d7be 100644 --- a/apps/web/src/App.vue +++ b/apps/web/src/App.vue @@ -1,6 +1,6 @@ - diff --git a/apps/web/src/pages/TodayPage.vue b/apps/web/src/pages/TodayPage.vue index 4ad2b26..9427a7c 100644 --- a/apps/web/src/pages/TodayPage.vue +++ b/apps/web/src/pages/TodayPage.vue @@ -30,8 +30,6 @@ const breastSide = ref<'left' | 'right'>(store.preferences.defaultBreastSide || const showBabyPicker = ref(false) const showMemberPicker = ref(false) -// 一次性亲喂配置 -const breastSideMode = ref<'left' | 'right' | 'both'>('both') const oneClickDuration = ref(20) watch( @@ -102,13 +100,6 @@ function formatSec(seconds: number) { return `${String(m).padStart(2, '0')}:${String(s).padStart(2, '0')}` } -function formatTotalBfTime() { - const total = store.bfLeftSeconds + store.bfRightSeconds - const m = Math.floor(total / 60) - const s = total % 60 - return `${m}分${String(s).padStart(2, '0')}秒` -} - function handleCardClick(side: 'left' | 'right') { if (store.bfTimerActive) { store.switchBreastfeedSide(side) @@ -167,18 +158,10 @@ async function handleOneClickBreastfeeding() { const startTime = `${getLocalDateStr(startDate)}T${getLocalTimeStr(startDate)}:00` const endTime = `${getLocalDateStr(now)}T${getLocalTimeStr(now)}:00` - let leftDur: number | undefined - let rightDur: number | undefined - if (breastSideMode.value === 'both') { - leftDur = Math.floor(dur / 2) - rightDur = Math.ceil(dur / 2) - } else if (breastSideMode.value === 'left') { - leftDur = dur - rightDur = 0 - } else { - leftDur = 0 - rightDur = dur - } + const firstSideMinutes = Math.ceil(dur / 2) + const secondSideMinutes = Math.floor(dur / 2) + const leftDur = breastSide.value === 'left' ? firstSideMinutes : secondSideMinutes + const rightDur = breastSide.value === 'right' ? firstSideMinutes : secondSideMinutes const startStr = `${String(startDate.getHours()).padStart(2, '0')}:${String(startDate.getMinutes()).padStart(2, '0')}` const endStr = `${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}` @@ -192,7 +175,7 @@ async function handleOneClickBreastfeeding() { leftDurationMinutes: leftDur, rightDurationMinutes: rightDur, effectiveFeedingMinutes: dur, - breastSide: breastSideMode.value + breastSide: breastSide.value }), `已记录亲喂 ${dur}分钟(${startStr} ~ ${endStr})` ) @@ -269,7 +252,6 @@ async function handleOneClickBreastfeeding() {

喂养

亲喂进行中 -

支持亲喂、挤出母乳、配方奶与混合喂养多模式快捷记录。

@@ -313,16 +295,9 @@ async function handleOneClickBreastfeeding() { {{ formatSec(store.bfLeftSeconds) }} @@ -348,80 +323,33 @@ async function handleOneClickBreastfeeding() { {{ formatSec(store.bfRightSeconds) }} - -
- 本次亲喂总计:{{ formatTotalBfTime() }} - (左侧 {{ formatSec(store.bfLeftSeconds) }} · 右侧 {{ formatSec(store.bfRightSeconds) }}{{ store.bfPaused ? ' · 已暂停' : '' }}) -
- - +
-
- 亲喂模式 -
- - - -
-
- -
- 一次性记录时长 -
+
+ 快速补记 +
-
- 💡 一键记录将按 - - {{ breastSideMode === 'both' ? `左侧 ${Math.floor(oneClickDuration / 2)}分 + 右侧 ${Math.ceil(oneClickDuration / 2)}分(总计 ${oneClickDuration}分)` : breastSideMode === 'left' ? `左侧 ${oneClickDuration}分钟` : `右侧 ${oneClickDuration}分钟` }} - - 自动推导起止时间并入库 +
+ 一键补记会按当前优先侧分配:左侧 {{ breastSide === 'left' ? Math.ceil(oneClickDuration / 2) : Math.floor(oneClickDuration / 2) }}分 · 右侧 {{ breastSide === 'right' ? Math.ceil(oneClickDuration / 2) : Math.floor(oneClickDuration / 2) }}分
@@ -433,9 +361,9 @@ async function handleOneClickBreastfeeding() { type="primary" :loading="operating" :disabled="operating" - @click="runWithTip(() => store.startBreastfeedTimer(breastSideMode === 'right' ? 'right' : 'left'), `已开始亲喂计时(${breastSideMode === 'right' ? '右侧开始' : '左侧开始'})`)" + @click="runWithTip(() => store.startBreastfeedTimer(breastSide), `已开始亲喂计时(${breastSide === 'right' ? '右侧开始' : '左侧开始'})`)" > - 开始亲喂 ({{ breastSideMode === 'right' ? '右侧开始' : '左侧开始' }}) + 开始亲喂 - 一键记录 {{ oneClickDuration }}分钟 + 补记 {{ oneClickDuration }}分钟
-
- - ⇄ {{ store.bfPaused ? '切换并继续' : '切换到' }}{{ store.bfActiveSide === 'left' ? '右侧' : '左侧' }} - +

快速记录

-

尿尿、便便和睡眠优先保证动作清晰。