优化展示
This commit is contained in:
1 parent
80c73fd46c
commit
19cece0e00
6 files changed
+808
-200
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const tabs = [
|
const tabs = [
|
||||||
{ to: '/today', label: '今日' },
|
{ to: '/today', label: '照护' },
|
||||||
{ to: '/timeline', label: '记录' },
|
{ to: '/timeline', label: '记录' },
|
||||||
{ to: '/stats', label: '统计' },
|
{ to: '/stats', label: '统计' },
|
||||||
{ to: '/settings', label: '家庭' }
|
{ to: '/settings', label: '家庭' }
|
||||||
|
|||||||
@@ -1,52 +1,352 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted } from 'vue'
|
import { computed, onMounted, ref, watch } from 'vue'
|
||||||
|
import { getRecords } from '../api/client'
|
||||||
import { useCareStore } from '../stores/careStore'
|
import { useCareStore } from '../stores/careStore'
|
||||||
import { formatMinutes, formatFeedingMethod } from '../utils/format'
|
import type { CareRecord } from '../types/domain'
|
||||||
|
import { formatFeedingMethod, formatMinutes, getLocalDateStr } from '../utils/format'
|
||||||
|
|
||||||
const store = useCareStore()
|
const store = useCareStore()
|
||||||
|
type RangeMode = 3 | 7 | 14 | 'custom'
|
||||||
|
const rangeMode = ref<RangeMode>(7)
|
||||||
|
const loadingStats = ref(false)
|
||||||
|
const rangeRecords = ref<Record<string, CareRecord[]>>({})
|
||||||
|
const todayStr = getLocalDateStr(new Date())
|
||||||
|
const customEndDate = ref(todayStr)
|
||||||
|
const customStartDate = ref(getLocalDateStr(addDays(new Date(), -6)))
|
||||||
|
|
||||||
onMounted(() => {
|
const rangeOptions: Array<{ label: string; value: RangeMode }> = [
|
||||||
store.load()
|
{ label: '近3天', value: 3 },
|
||||||
|
{ label: '近7天', value: 7 },
|
||||||
|
{ label: '近14天', value: 14 },
|
||||||
|
{ label: '自定义', value: 'custom' }
|
||||||
|
]
|
||||||
|
|
||||||
|
function addDays(date: Date, days: number) {
|
||||||
|
const next = new Date(date)
|
||||||
|
next.setDate(next.getDate() + days)
|
||||||
|
return next
|
||||||
|
}
|
||||||
|
|
||||||
|
function dateLabel(date: string) {
|
||||||
|
const [, month, day] = date.split('-')
|
||||||
|
return `${Number(month)}/${Number(day)}`
|
||||||
|
}
|
||||||
|
|
||||||
|
function daysBetween(start: Date, end: Date) {
|
||||||
|
const dayMs = 24 * 60 * 60 * 1000
|
||||||
|
const startDay = new Date(start.getFullYear(), start.getMonth(), start.getDate()).getTime()
|
||||||
|
const endDay = new Date(end.getFullYear(), end.getMonth(), end.getDate()).getTime()
|
||||||
|
return Math.round((endDay - startDay) / dayMs) + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeCustomDates() {
|
||||||
|
let start = new Date(`${customStartDate.value}T00:00:00`)
|
||||||
|
let end = new Date(`${customEndDate.value}T00:00:00`)
|
||||||
|
if (Number.isNaN(start.getTime()) || Number.isNaN(end.getTime())) {
|
||||||
|
const today = store.getServerNow()
|
||||||
|
end = today
|
||||||
|
start = addDays(today, -6)
|
||||||
|
}
|
||||||
|
if (start > end) {
|
||||||
|
const oldStart = start
|
||||||
|
start = end
|
||||||
|
end = oldStart
|
||||||
|
}
|
||||||
|
if (daysBetween(start, end) > 31) {
|
||||||
|
start = addDays(end, -30)
|
||||||
|
}
|
||||||
|
customStartDate.value = getLocalDateStr(start)
|
||||||
|
customEndDate.value = getLocalDateStr(end)
|
||||||
|
return { start, end }
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectedDates = computed(() => {
|
||||||
|
if (rangeMode.value !== 'custom') {
|
||||||
|
const today = store.getServerNow()
|
||||||
|
const days = rangeMode.value
|
||||||
|
return Array.from({ length: days }, (_, index) => getLocalDateStr(addDays(today, index - days + 1)))
|
||||||
|
}
|
||||||
|
const { start, end } = normalizeCustomDates()
|
||||||
|
return Array.from({ length: daysBetween(start, end) }, (_, index) => getLocalDateStr(addDays(start, index)))
|
||||||
|
})
|
||||||
|
|
||||||
|
function safeDateTime(value?: string | null) {
|
||||||
|
if (!value) return null
|
||||||
|
const time = new Date(value).getTime()
|
||||||
|
return Number.isNaN(time) ? null : time
|
||||||
|
}
|
||||||
|
|
||||||
|
function sumPauseSegments(record: CareRecord) {
|
||||||
|
if (!record.pauseSegmentsJson) return { count: 0, seconds: 0 }
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(record.pauseSegmentsJson)
|
||||||
|
if (!Array.isArray(parsed)) return { count: 0, seconds: 0 }
|
||||||
|
return parsed.reduce(
|
||||||
|
(acc, item) => ({
|
||||||
|
count: acc.count + 1,
|
||||||
|
seconds: acc.seconds + (Number(item?.durationSeconds) || 0)
|
||||||
|
}),
|
||||||
|
{ count: 0, seconds: 0 }
|
||||||
|
)
|
||||||
|
} catch {
|
||||||
|
return { count: 0, seconds: 0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadRangeStats() {
|
||||||
|
if (!store.baby) return
|
||||||
|
loadingStats.value = true
|
||||||
|
try {
|
||||||
|
const entries = await Promise.all(
|
||||||
|
selectedDates.value.map(async (date) => {
|
||||||
|
const records = await getRecords(store.baby!.babyId, date)
|
||||||
|
return [date, records] as const
|
||||||
|
})
|
||||||
|
)
|
||||||
|
rangeRecords.value = Object.fromEntries(entries)
|
||||||
|
} finally {
|
||||||
|
loadingStats.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await store.load()
|
||||||
|
await loadRangeStats()
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(rangeMode, loadRangeStats)
|
||||||
|
watch([customStartDate, customEndDate], () => {
|
||||||
|
if (rangeMode.value === 'custom') {
|
||||||
|
loadRangeStats()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
watch(() => store.baby?.babyId, loadRangeStats)
|
||||||
|
|
||||||
|
const dayRows = computed(() => {
|
||||||
|
return Object.entries(rangeRecords.value).map(([date, records]) => {
|
||||||
|
const feedingRecords = records.filter(record => record.recordType === 'feeding')
|
||||||
|
const sleepRecords = records.filter(record => record.recordType === 'sleep')
|
||||||
|
const peeCount = records.filter(record => record.recordType === 'excretion' && record.excretionType === 'pee').length
|
||||||
|
const poopCount = records.filter(record => record.recordType === 'excretion' && record.excretionType === 'poop').length
|
||||||
|
const sleepMinutes = sleepRecords.reduce((sum, record) => sum + (record.durationMinutes || 0), 0)
|
||||||
|
const milkMl = feedingRecords.reduce((sum, record) => sum + (record.amountMl || 0), 0)
|
||||||
|
const effectiveFeedingMinutes = feedingRecords.reduce(
|
||||||
|
(sum, record) => sum + (record.effectiveFeedingMinutes || ((record.leftDurationMinutes || 0) + (record.rightDurationMinutes || 0))),
|
||||||
|
0
|
||||||
|
)
|
||||||
|
|
||||||
|
return {
|
||||||
|
date,
|
||||||
|
label: dateLabel(date),
|
||||||
|
feedingCount: feedingRecords.length,
|
||||||
|
sleepMinutes,
|
||||||
|
sleepCount: sleepRecords.length,
|
||||||
|
peeCount,
|
||||||
|
poopCount,
|
||||||
|
milkMl,
|
||||||
|
effectiveFeedingMinutes
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
const allRecords = computed(() => Object.values(rangeRecords.value).flat())
|
||||||
|
|
||||||
|
const totals = computed(() => {
|
||||||
|
const records = allRecords.value
|
||||||
|
const feedingRecords = records.filter(record => record.recordType === 'feeding')
|
||||||
|
const sleepRecords = records.filter(record => record.recordType === 'sleep')
|
||||||
|
const excretionRecords = records.filter(record => record.recordType === 'excretion')
|
||||||
|
const pause = feedingRecords.reduce(
|
||||||
|
(acc, record) => {
|
||||||
|
const item = sumPauseSegments(record)
|
||||||
|
return { count: acc.count + item.count, seconds: acc.seconds + item.seconds }
|
||||||
|
},
|
||||||
|
{ count: 0, seconds: 0 }
|
||||||
|
)
|
||||||
|
|
||||||
|
return {
|
||||||
|
feedingCount: feedingRecords.length,
|
||||||
|
sleepMinutes: sleepRecords.reduce((sum, record) => sum + (record.durationMinutes || 0), 0),
|
||||||
|
sleepCount: sleepRecords.length,
|
||||||
|
peeCount: excretionRecords.filter(record => record.excretionType === 'pee').length,
|
||||||
|
poopCount: excretionRecords.filter(record => record.excretionType === 'poop').length,
|
||||||
|
milkMl: feedingRecords.reduce((sum, record) => sum + (record.amountMl || 0), 0),
|
||||||
|
effectiveFeedingMinutes: feedingRecords.reduce(
|
||||||
|
(sum, record) => sum + (record.effectiveFeedingMinutes || ((record.leftDurationMinutes || 0) + (record.rightDurationMinutes || 0))),
|
||||||
|
0
|
||||||
|
),
|
||||||
|
leftMinutes: feedingRecords.reduce((sum, record) => sum + (record.leftDurationMinutes || 0), 0),
|
||||||
|
rightMinutes: feedingRecords.reduce((sum, record) => sum + (record.rightDurationMinutes || 0), 0),
|
||||||
|
pauseCount: pause.count,
|
||||||
|
pauseMinutes: Math.round(pause.seconds / 60)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const feedingMethods = computed(() => {
|
||||||
|
const map: Record<string, number> = {}
|
||||||
|
allRecords.value
|
||||||
|
.filter(record => record.recordType === 'feeding')
|
||||||
|
.forEach(record => {
|
||||||
|
const method = record.feedingMethod || 'other'
|
||||||
|
map[method] = (map[method] || 0) + 1
|
||||||
|
})
|
||||||
|
return Object.entries(map)
|
||||||
|
})
|
||||||
|
|
||||||
|
const maxFeedingCount = computed(() => Math.max(1, ...dayRows.value.map(row => row.feedingCount)))
|
||||||
|
const maxSleepMinutes = computed(() => Math.max(1, ...dayRows.value.map(row => row.sleepMinutes)))
|
||||||
|
const avgSleepMinutes = computed(() => totals.value.sleepCount ? Math.round(totals.value.sleepMinutes / totals.value.sleepCount) : 0)
|
||||||
|
const totalCareEvents = computed(() => totals.value.feedingCount + totals.value.sleepCount + totals.value.peeCount + totals.value.poopCount)
|
||||||
|
|
||||||
|
const feedingBars = computed(() => {
|
||||||
|
return dayRows.value.map(row => ({
|
||||||
|
...row,
|
||||||
|
height: Math.max(8, Math.round((row.feedingCount / maxFeedingCount.value) * 100))
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
|
||||||
|
const sleepPoints = computed(() => {
|
||||||
|
if (!dayRows.value.length) return []
|
||||||
|
const lastIndex = Math.max(1, dayRows.value.length - 1)
|
||||||
|
return dayRows.value.map((row, index) => ({
|
||||||
|
...row,
|
||||||
|
x: Math.round((index / lastIndex) * 100),
|
||||||
|
y: Math.round(86 - (row.sleepMinutes / maxSleepMinutes.value) * 72)
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
|
||||||
|
const sleepPolyline = computed(() => sleepPoints.value.map(point => `${point.x},${point.y}`).join(' '))
|
||||||
|
|
||||||
|
const latestRecordTime = computed(() => {
|
||||||
|
const times = allRecords.value
|
||||||
|
.map(record => safeDateTime(record.startTime))
|
||||||
|
.filter((time): time is number => time !== null)
|
||||||
|
if (!times.length) return '暂无记录'
|
||||||
|
const latest = new Date(Math.max(...times))
|
||||||
|
return `${getLocalDateStr(latest)} ${String(latest.getHours()).padStart(2, '0')}:${String(latest.getMinutes()).padStart(2, '0')}`
|
||||||
|
})
|
||||||
|
|
||||||
|
const rangeLabel = computed(() => {
|
||||||
|
if (rangeMode.value !== 'custom') return `近${rangeMode.value}天`
|
||||||
|
return `${dateLabel(customStartDate.value)} - ${dateLabel(customEndDate.value)}`
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="page">
|
<section class="page stats-page">
|
||||||
<header class="page-header">
|
<header class="stats-header">
|
||||||
<p class="eyebrow">每日统计</p>
|
<div>
|
||||||
<h1>今天是否记录完整</h1>
|
<p class="eyebrow">照护统计</p>
|
||||||
<p>当前只展示明确事实统计,不做医疗判断。</p>
|
<h1>这几天的照护节奏</h1>
|
||||||
|
</div>
|
||||||
|
<span class="stats-updated">{{ rangeLabel }} · {{ latestRecordTime }}</span>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section class="panel">
|
<div class="stats-range-tabs">
|
||||||
<div class="stat-row">
|
<button
|
||||||
<span>今日喂奶次数</span>
|
v-for="option in rangeOptions"
|
||||||
<strong>{{ store.summary?.feedingCount ?? 0 }} 次</strong>
|
:key="option.value"
|
||||||
|
type="button"
|
||||||
|
:class="{ active: rangeMode === option.value }"
|
||||||
|
@click="rangeMode = option.value"
|
||||||
|
>
|
||||||
|
{{ option.label }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="rangeMode === 'custom'" class="stats-custom-range">
|
||||||
|
<label>
|
||||||
|
开始
|
||||||
|
<input v-model="customStartDate" type="date" />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
结束
|
||||||
|
<input v-model="customEndDate" type="date" />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p v-if="loadingStats" class="notice">正在整理统计...</p>
|
||||||
|
|
||||||
|
<section class="stats-rhythm">
|
||||||
|
<div class="rhythm-orbit" :style="{ '--feeding': totals.feedingCount, '--sleep': totals.sleepCount, '--excretion': totals.peeCount + totals.poopCount }">
|
||||||
|
<strong>{{ totalCareEvents }}</strong>
|
||||||
|
<span>照护记录</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-row">
|
<div class="rhythm-metrics">
|
||||||
<span>今日睡眠总时长</span>
|
<div>
|
||||||
<strong>{{ formatMinutes(store.summary?.sleepTotalMinutes ?? 0) }}</strong>
|
<span>喂养</span>
|
||||||
</div>
|
<strong>{{ totals.feedingCount }}次</strong>
|
||||||
<div class="stat-row">
|
</div>
|
||||||
<span>今日小便次数</span>
|
<div>
|
||||||
<strong>{{ store.summary?.peeCount ?? 0 }} 次</strong>
|
<span>睡眠</span>
|
||||||
</div>
|
<strong>{{ formatMinutes(totals.sleepMinutes) }}</strong>
|
||||||
<div class="stat-row">
|
</div>
|
||||||
<span>今日大便次数</span>
|
<div>
|
||||||
<strong>{{ store.summary?.poopCount ?? 0 }} 次</strong>
|
<span>排泄</span>
|
||||||
|
<strong>{{ totals.peeCount + totals.poopCount }}次</strong>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="panel">
|
<section class="graph-section">
|
||||||
<div class="panel-title">
|
<div class="graph-title">
|
||||||
<h2>喂奶方式</h2>
|
<h2>喂养趋势</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-row" v-for="(count, method) in store.summary?.feedingMethodCounts || {}" :key="method">
|
<div class="feeding-column-chart" :style="{ '--days': dayRows.length }">
|
||||||
<span>{{ formatFeedingMethod(method as string) }}</span>
|
<div v-for="row in feedingBars" :key="`feeding-${row.date}`" class="feeding-column">
|
||||||
<strong>{{ count }} 次</strong>
|
<strong>{{ row.feedingCount }}</strong>
|
||||||
|
<div>
|
||||||
|
<i :style="{ height: `${row.height}%` }"></i>
|
||||||
|
</div>
|
||||||
|
<span>{{ row.label }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="graph-facts">
|
||||||
|
<span>有效亲喂 {{ formatMinutes(totals.effectiveFeedingMinutes) }}</span>
|
||||||
|
<span>奶量 {{ totals.milkMl }}ml</span>
|
||||||
|
<span>左右 {{ totals.leftMinutes }} / {{ totals.rightMinutes }}分</span>
|
||||||
|
<span>暂停 {{ totals.pauseCount }}次</span>
|
||||||
|
</div>
|
||||||
|
<div v-if="feedingMethods.length" class="method-pills">
|
||||||
|
<span v-for="[method, count] in feedingMethods" :key="method">
|
||||||
|
{{ formatFeedingMethod(method) }} {{ count }}次
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="graph-section">
|
||||||
|
<div class="graph-title">
|
||||||
|
<h2>睡眠趋势</h2>
|
||||||
|
<span>{{ totals.sleepCount }}段 · 平均 {{ formatMinutes(avgSleepMinutes) }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="sleep-line-chart">
|
||||||
|
<svg viewBox="0 0 100 100" preserveAspectRatio="none" aria-hidden="true">
|
||||||
|
<polyline class="sleep-area" :points="`0,92 ${sleepPolyline} 100,92`" />
|
||||||
|
<polyline class="sleep-line" :points="sleepPolyline" />
|
||||||
|
<circle v-for="point in sleepPoints" :key="`sleep-dot-${point.date}`" :cx="point.x" :cy="point.y" r="1.8" />
|
||||||
|
</svg>
|
||||||
|
<div class="sleep-axis">
|
||||||
|
<span v-for="point in sleepPoints" :key="`sleep-label-${point.date}`">{{ point.label }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="graph-section">
|
||||||
|
<div class="graph-title">
|
||||||
|
<h2>排泄趋势</h2>
|
||||||
|
<span>小便 {{ totals.peeCount }} · 大便 {{ totals.poopCount }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="excretion-list">
|
||||||
|
<div v-for="row in dayRows" :key="`excretion-${row.date}`">
|
||||||
|
<span>{{ row.label }}</span>
|
||||||
|
<div class="excretion-dots">
|
||||||
|
<i v-for="i in row.peeCount" :key="`pee-${row.date}-${i}`" class="pee"></i>
|
||||||
|
<i v-for="i in row.poopCount" :key="`poop-${row.date}-${i}`" class="poop"></i>
|
||||||
|
<em v-if="row.peeCount + row.poopCount === 0">无记录</em>
|
||||||
|
</div>
|
||||||
|
<strong>{{ row.peeCount + row.poopCount }}</strong>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p v-if="!Object.keys(store.summary?.feedingMethodCounts || {}).length" class="empty">暂无喂奶记录。</p>
|
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -30,8 +30,6 @@ const breastSide = ref<'left' | 'right'>(store.preferences.defaultBreastSide ||
|
|||||||
const showBabyPicker = ref(false)
|
const showBabyPicker = ref(false)
|
||||||
const showMemberPicker = ref(false)
|
const showMemberPicker = ref(false)
|
||||||
|
|
||||||
// 一次性亲喂配置
|
|
||||||
const breastSideMode = ref<'left' | 'right' | 'both'>('both')
|
|
||||||
const oneClickDuration = ref(20)
|
const oneClickDuration = ref(20)
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
@@ -102,13 +100,6 @@ function formatSec(seconds: number) {
|
|||||||
return `${String(m).padStart(2, '0')}:${String(s).padStart(2, '0')}`
|
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') {
|
function handleCardClick(side: 'left' | 'right') {
|
||||||
if (store.bfTimerActive) {
|
if (store.bfTimerActive) {
|
||||||
store.switchBreastfeedSide(side)
|
store.switchBreastfeedSide(side)
|
||||||
@@ -167,18 +158,10 @@ async function handleOneClickBreastfeeding() {
|
|||||||
const startTime = `${getLocalDateStr(startDate)}T${getLocalTimeStr(startDate)}:00`
|
const startTime = `${getLocalDateStr(startDate)}T${getLocalTimeStr(startDate)}:00`
|
||||||
const endTime = `${getLocalDateStr(now)}T${getLocalTimeStr(now)}:00`
|
const endTime = `${getLocalDateStr(now)}T${getLocalTimeStr(now)}:00`
|
||||||
|
|
||||||
let leftDur: number | undefined
|
const firstSideMinutes = Math.ceil(dur / 2)
|
||||||
let rightDur: number | undefined
|
const secondSideMinutes = Math.floor(dur / 2)
|
||||||
if (breastSideMode.value === 'both') {
|
const leftDur = breastSide.value === 'left' ? firstSideMinutes : secondSideMinutes
|
||||||
leftDur = Math.floor(dur / 2)
|
const rightDur = breastSide.value === 'right' ? firstSideMinutes : secondSideMinutes
|
||||||
rightDur = Math.ceil(dur / 2)
|
|
||||||
} else if (breastSideMode.value === 'left') {
|
|
||||||
leftDur = dur
|
|
||||||
rightDur = 0
|
|
||||||
} else {
|
|
||||||
leftDur = 0
|
|
||||||
rightDur = dur
|
|
||||||
}
|
|
||||||
|
|
||||||
const startStr = `${String(startDate.getHours()).padStart(2, '0')}:${String(startDate.getMinutes()).padStart(2, '0')}`
|
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')}`
|
const endStr = `${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`
|
||||||
@@ -192,7 +175,7 @@ async function handleOneClickBreastfeeding() {
|
|||||||
leftDurationMinutes: leftDur,
|
leftDurationMinutes: leftDur,
|
||||||
rightDurationMinutes: rightDur,
|
rightDurationMinutes: rightDur,
|
||||||
effectiveFeedingMinutes: dur,
|
effectiveFeedingMinutes: dur,
|
||||||
breastSide: breastSideMode.value
|
breastSide: breastSide.value
|
||||||
}),
|
}),
|
||||||
`已记录亲喂 ${dur}分钟(${startStr} ~ ${endStr})`
|
`已记录亲喂 ${dur}分钟(${startStr} ~ ${endStr})`
|
||||||
)
|
)
|
||||||
@@ -269,7 +252,6 @@ async function handleOneClickBreastfeeding() {
|
|||||||
<h2>喂养</h2>
|
<h2>喂养</h2>
|
||||||
<span v-if="store.bfTimerActive" class="bf-live-badge">亲喂进行中</span>
|
<span v-if="store.bfTimerActive" class="bf-live-badge">亲喂进行中</span>
|
||||||
</div>
|
</div>
|
||||||
<p>支持亲喂、挤出母乳、配方奶与混合喂养多模式快捷记录。</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 四大喂养方式切换 Tab -->
|
<!-- 四大喂养方式切换 Tab -->
|
||||||
@@ -313,16 +295,9 @@ async function handleOneClickBreastfeeding() {
|
|||||||
{{ formatSec(store.bfLeftSeconds) }}
|
{{ formatSec(store.bfLeftSeconds) }}
|
||||||
</div>
|
</div>
|
||||||
<div v-if="store.bfTimerActive" class="bf-card-footer">
|
<div v-if="store.bfTimerActive" class="bf-card-footer">
|
||||||
<button
|
<span class="bf-active-hint" :class="{ muted: store.bfActiveSide !== 'left' }">
|
||||||
v-if="store.bfActiveSide !== 'left'"
|
{{ store.bfActiveSide === 'left' ? (store.bfPaused ? '继续时从这里开始' : '正在喂奶') : '点击切换到左侧' }}
|
||||||
class="bf-switch-chip"
|
</span>
|
||||||
type="button"
|
|
||||||
:disabled="operating"
|
|
||||||
@click.stop="!operating && store.switchBreastfeedSide('left')"
|
|
||||||
>
|
|
||||||
切至左侧
|
|
||||||
</button>
|
|
||||||
<span v-else class="bf-active-hint">正在喂奶</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -348,80 +323,33 @@ async function handleOneClickBreastfeeding() {
|
|||||||
{{ formatSec(store.bfRightSeconds) }}
|
{{ formatSec(store.bfRightSeconds) }}
|
||||||
</div>
|
</div>
|
||||||
<div v-if="store.bfTimerActive" class="bf-card-footer">
|
<div v-if="store.bfTimerActive" class="bf-card-footer">
|
||||||
<button
|
<span class="bf-active-hint" :class="{ muted: store.bfActiveSide !== 'right' }">
|
||||||
v-if="store.bfActiveSide !== 'right'"
|
{{ store.bfActiveSide === 'right' ? (store.bfPaused ? '继续时从这里开始' : '正在喂奶') : '点击切换到右侧' }}
|
||||||
class="bf-switch-chip"
|
</span>
|
||||||
type="button"
|
|
||||||
:disabled="operating"
|
|
||||||
@click.stop="!operating && store.switchBreastfeedSide('right')"
|
|
||||||
>
|
|
||||||
切至右侧
|
|
||||||
</button>
|
|
||||||
<span v-else class="bf-active-hint">正在喂奶</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 计时汇总横条 -->
|
<!-- 未在计时状态下的一键补记时长配置 -->
|
||||||
<div v-if="store.bfTimerActive" class="bf-summary-bar">
|
|
||||||
<span>本次亲喂总计:<strong>{{ formatTotalBfTime() }}</strong></span>
|
|
||||||
<small>(左侧 {{ formatSec(store.bfLeftSeconds) }} · 右侧 {{ formatSec(store.bfRightSeconds) }}{{ store.bfPaused ? ' · 已暂停' : '' }})</small>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 未在计时状态下的亲喂模式与时长配置 -->
|
|
||||||
<div v-if="!store.bfTimerActive" class="bf-config-box">
|
<div v-if="!store.bfTimerActive" class="bf-config-box">
|
||||||
<div style="display: flex; justify-content: space-between; align-items: center;">
|
<div class="bf-duration-row">
|
||||||
<span style="font-size: 13px; font-weight: 700; color: #475569;">亲喂模式</span>
|
<span>快速补记</span>
|
||||||
<div class="chip-group" style="margin: 0;">
|
<div class="bf-duration-chips">
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="chip sm"
|
|
||||||
:class="{ active: breastSideMode === 'both' }"
|
|
||||||
@click="breastSideMode = 'both'"
|
|
||||||
>
|
|
||||||
双侧均喂
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="chip sm"
|
|
||||||
:class="{ active: breastSideMode === 'left' }"
|
|
||||||
@click="breastSideMode = 'left'"
|
|
||||||
>
|
|
||||||
仅左侧
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="chip sm"
|
|
||||||
:class="{ active: breastSideMode === 'right' }"
|
|
||||||
@click="breastSideMode = 'right'"
|
|
||||||
>
|
|
||||||
仅右侧
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style="display: flex; justify-content: space-between; align-items: center; margin-top: 10px;">
|
|
||||||
<span style="font-size: 13px; font-weight: 700; color: #475569;">一次性记录时长</span>
|
|
||||||
<div class="chip-group" style="margin: 0;">
|
|
||||||
<button
|
<button
|
||||||
v-for="d in [10, 15, 20, 30]"
|
v-for="d in [10, 15, 20, 30]"
|
||||||
:key="d"
|
:key="d"
|
||||||
type="button"
|
type="button"
|
||||||
class="chip sm"
|
class="bf-duration-chip"
|
||||||
:class="{ active: oneClickDuration === d }"
|
:class="{ active: oneClickDuration === d }"
|
||||||
@click="oneClickDuration = d"
|
@click="oneClickDuration = d"
|
||||||
>
|
>
|
||||||
{{ d }}分钟
|
{{ d }}分
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="font-size: 12px; color: #64748b; margin-top: 8px; background: #ffffff; padding: 6px 10px; border-radius: 6px; border: 1px dashed #e2e8f0;">
|
<div class="bf-quick-hint">
|
||||||
💡 一键记录将按
|
一键补记会按当前优先侧分配:左侧 {{ breastSide === 'left' ? Math.ceil(oneClickDuration / 2) : Math.floor(oneClickDuration / 2) }}分 · 右侧 {{ breastSide === 'right' ? Math.ceil(oneClickDuration / 2) : Math.floor(oneClickDuration / 2) }}分
|
||||||
<strong>
|
|
||||||
{{ breastSideMode === 'both' ? `左侧 ${Math.floor(oneClickDuration / 2)}分 + 右侧 ${Math.ceil(oneClickDuration / 2)}分(总计 ${oneClickDuration}分)` : breastSideMode === 'left' ? `左侧 ${oneClickDuration}分钟` : `右侧 ${oneClickDuration}分钟` }}
|
|
||||||
</strong>
|
|
||||||
自动推导起止时间并入库
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -433,9 +361,9 @@ async function handleOneClickBreastfeeding() {
|
|||||||
type="primary"
|
type="primary"
|
||||||
:loading="operating"
|
:loading="operating"
|
||||||
:disabled="operating"
|
:disabled="operating"
|
||||||
@click="runWithTip(() => store.startBreastfeedTimer(breastSideMode === 'right' ? 'right' : 'left'), `已开始亲喂计时(${breastSideMode === 'right' ? '右侧开始' : '左侧开始'})`)"
|
@click="runWithTip(() => store.startBreastfeedTimer(breastSide), `已开始亲喂计时(${breastSide === 'right' ? '右侧开始' : '左侧开始'})`)"
|
||||||
>
|
>
|
||||||
开始亲喂 ({{ breastSideMode === 'right' ? '右侧开始' : '左侧开始' }})
|
开始亲喂
|
||||||
</van-button>
|
</van-button>
|
||||||
<van-button
|
<van-button
|
||||||
block
|
block
|
||||||
@@ -446,20 +374,11 @@ async function handleOneClickBreastfeeding() {
|
|||||||
:disabled="operating"
|
:disabled="operating"
|
||||||
@click="handleOneClickBreastfeeding"
|
@click="handleOneClickBreastfeeding"
|
||||||
>
|
>
|
||||||
一键记录 {{ oneClickDuration }}分钟
|
补记 {{ oneClickDuration }}分钟
|
||||||
</van-button>
|
</van-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else class="two-actions">
|
<div v-else class="two-actions bf-live-actions">
|
||||||
<van-button
|
|
||||||
block
|
|
||||||
round
|
|
||||||
type="warning"
|
|
||||||
:disabled="operating"
|
|
||||||
@click="store.bfPaused ? store.resumeBreastfeedTimer(store.bfActiveSide === 'left' ? 'right' : 'left') : store.switchBreastfeedSide(store.bfActiveSide === 'left' ? 'right' : 'left')"
|
|
||||||
>
|
|
||||||
⇄ {{ store.bfPaused ? '切换并继续' : '切换到' }}{{ store.bfActiveSide === 'left' ? '右侧' : '左侧' }}
|
|
||||||
</van-button>
|
|
||||||
<van-button
|
<van-button
|
||||||
block
|
block
|
||||||
round
|
round
|
||||||
@@ -597,7 +516,6 @@ async function handleOneClickBreastfeeding() {
|
|||||||
<section class="panel">
|
<section class="panel">
|
||||||
<div class="panel-title">
|
<div class="panel-title">
|
||||||
<h2>快速记录</h2>
|
<h2>快速记录</h2>
|
||||||
<p>尿尿、便便和睡眠优先保证动作清晰。</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="action-grid compact-actions">
|
<div class="action-grid compact-actions">
|
||||||
<button
|
<button
|
||||||
|
|||||||
+429
-62
@@ -924,19 +924,20 @@ button {
|
|||||||
.feeding-segmented-nav {
|
.feeding-segmented-nav {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(4, 1fr);
|
grid-template-columns: repeat(4, 1fr);
|
||||||
gap: 6px;
|
gap: 4px;
|
||||||
background: #f1f5f9;
|
background: #eef3f8;
|
||||||
padding: 4px;
|
padding: 5px;
|
||||||
border-radius: 12px;
|
border-radius: 16px;
|
||||||
margin: 10px 0 14px;
|
margin: 12px 0 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.feeding-tab-btn {
|
.feeding-tab-btn {
|
||||||
position: relative;
|
position: relative;
|
||||||
border: none;
|
border: none;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
|
min-height: 40px;
|
||||||
padding: 8px 4px;
|
padding: 8px 4px;
|
||||||
border-radius: 9px;
|
border-radius: 12px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #64748b;
|
color: #64748b;
|
||||||
@@ -952,7 +953,7 @@ button {
|
|||||||
.feeding-tab-btn.active {
|
.feeding-tab-btn.active {
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
color: #1e293b;
|
color: #1e293b;
|
||||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
|
box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-live-dot {
|
.tab-live-dot {
|
||||||
@@ -984,28 +985,30 @@ button {
|
|||||||
.bf-dual-grid {
|
.bf-dual-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(2, 1fr);
|
grid-template-columns: repeat(2, 1fr);
|
||||||
gap: 12px;
|
gap: 10px;
|
||||||
margin-top: 10px;
|
margin-top: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bf-side-card {
|
.bf-side-card {
|
||||||
background: #fdfbf7;
|
background: #fffdf9;
|
||||||
border: 2px solid #ede8de;
|
border: 1.5px solid #eee7dc;
|
||||||
border-radius: 12px;
|
border-radius: 18px;
|
||||||
padding: 12px;
|
padding: 14px 12px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
min-height: 106px;
|
min-height: 120px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
box-shadow: 0 8px 20px rgba(51, 36, 16, 0.04);
|
||||||
}
|
}
|
||||||
|
|
||||||
.bf-side-card.selected {
|
.bf-side-card.selected {
|
||||||
border-color: #2b70f0;
|
border-color: #2585ff;
|
||||||
background: #f0f5ff;
|
background: #f4f8ff;
|
||||||
|
box-shadow: inset 0 0 0 1px rgba(37, 133, 255, 0.28), 0 10px 22px rgba(37, 133, 255, 0.08);
|
||||||
}
|
}
|
||||||
|
|
||||||
.bf-side-card.active {
|
.bf-side-card.active {
|
||||||
@@ -1022,16 +1025,16 @@ button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.bf-card-title {
|
.bf-card-title {
|
||||||
font-size: 14px;
|
font-size: 15px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #24292f;
|
color: #24292f;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bf-status-tag {
|
.bf-status-tag {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
font-weight: 600;
|
font-weight: 700;
|
||||||
padding: 2px 6px;
|
padding: 4px 8px;
|
||||||
border-radius: 4px;
|
border-radius: 999px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bf-status-tag.timing {
|
.bf-status-tag.timing {
|
||||||
@@ -1056,12 +1059,13 @@ button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.bf-card-time {
|
.bf-card-time {
|
||||||
font-size: 26px;
|
font-size: 30px;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
color: #1f2937;
|
color: #111827;
|
||||||
letter-spacing: 0.5px;
|
letter-spacing: 0;
|
||||||
margin: 6px 0;
|
margin: 10px 0 4px;
|
||||||
font-variant-numeric: tabular-nums;
|
font-variant-numeric: tabular-nums;
|
||||||
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bf-side-card.active .bf-card-time {
|
.bf-side-card.active .bf-card-time {
|
||||||
@@ -1075,54 +1079,71 @@ button {
|
|||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bf-switch-chip {
|
|
||||||
background: #e0e7ff;
|
|
||||||
color: #4338ca;
|
|
||||||
border: none;
|
|
||||||
border-radius: 999px;
|
|
||||||
padding: 4px 10px;
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 600;
|
|
||||||
cursor: pointer;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bf-switch-chip:active {
|
|
||||||
background: #c7d2fe;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bf-switch-chip:disabled {
|
|
||||||
opacity: 0.5;
|
|
||||||
cursor: not-allowed;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bf-active-hint {
|
.bf-active-hint {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
font-weight: 600;
|
font-weight: 700;
|
||||||
color: #10b981;
|
color: #10b981;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bf-summary-bar {
|
.bf-active-hint.muted {
|
||||||
display: flex;
|
color: #64748b;
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
gap: 2px;
|
|
||||||
background: #f8fafc;
|
|
||||||
border: 1px dashed #cbd5e1;
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 8px 12px;
|
|
||||||
margin-top: 10px;
|
|
||||||
font-size: 13px;
|
|
||||||
color: #334155;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.bf-config-box {
|
.bf-config-box {
|
||||||
background: #f8fafc;
|
background: #f8fafc;
|
||||||
border: 1px solid #e2e8f0;
|
border: 1px solid #e5edf5;
|
||||||
border-radius: 10px;
|
border-radius: 16px;
|
||||||
padding: 10px 12px;
|
padding: 12px;
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bf-duration-row {
|
||||||
|
display: grid;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bf-duration-row > span {
|
||||||
|
color: #475569;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bf-duration-chips {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bf-duration-chip {
|
||||||
|
border: 0;
|
||||||
|
min-height: 38px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #ffffff;
|
||||||
|
color: #475569;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 800;
|
||||||
|
box-shadow: inset 0 0 0 1px #e2e8f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bf-duration-chip.active {
|
||||||
|
background: #a46208;
|
||||||
|
color: #ffffff;
|
||||||
|
box-shadow: 0 8px 16px rgba(164, 98, 8, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bf-quick-hint {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: #ffffff;
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.5;
|
||||||
|
padding: 9px 10px;
|
||||||
|
box-shadow: inset 0 0 0 1px #e8eef6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bf-live-actions {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bf-live-badge {
|
.bf-live-badge {
|
||||||
@@ -1149,6 +1170,352 @@ button {
|
|||||||
margin-bottom: 18px;
|
margin-bottom: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.stats-page {
|
||||||
|
display: grid;
|
||||||
|
gap: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-header h1 {
|
||||||
|
margin: 4px 0 0;
|
||||||
|
color: #071b35;
|
||||||
|
font-size: 28px;
|
||||||
|
line-height: 1.18;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-updated {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 700;
|
||||||
|
padding-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-range-tabs {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
gap: 6px;
|
||||||
|
border-radius: 18px;
|
||||||
|
background: #eef3f8;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-range-tabs button {
|
||||||
|
border: 0;
|
||||||
|
min-height: 42px;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: transparent;
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-range-tabs button.active {
|
||||||
|
background: #ffffff;
|
||||||
|
color: #9a5f08;
|
||||||
|
box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-custom-range {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: -4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-custom-range label {
|
||||||
|
display: grid;
|
||||||
|
gap: 6px;
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-custom-range input {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 42px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: #ffffff;
|
||||||
|
color: #071b35;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 800;
|
||||||
|
padding: 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-rhythm {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 124px 1fr;
|
||||||
|
align-items: center;
|
||||||
|
gap: 18px;
|
||||||
|
padding: 10px 0 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rhythm-orbit {
|
||||||
|
--feeding: 0;
|
||||||
|
--sleep: 0;
|
||||||
|
--excretion: 0;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
align-content: center;
|
||||||
|
width: 118px;
|
||||||
|
height: 118px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background:
|
||||||
|
radial-gradient(circle at center, #fffaf1 0 54%, transparent 55%),
|
||||||
|
conic-gradient(#2b8cff 0 40%, #8b7cf6 40% 70%, #84cc16 70% 100%);
|
||||||
|
box-shadow: 0 16px 34px rgba(51, 36, 16, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rhythm-orbit strong {
|
||||||
|
color: #071b35;
|
||||||
|
font-size: 30px;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rhythm-orbit span {
|
||||||
|
margin-top: 4px;
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rhythm-metrics {
|
||||||
|
display: grid;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rhythm-metrics div {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 52px 1fr;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 10px;
|
||||||
|
border-bottom: 1px solid #eee7dc;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rhythm-metrics div:last-child {
|
||||||
|
border-bottom: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rhythm-metrics span {
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rhythm-metrics strong {
|
||||||
|
color: #071b35;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-section {
|
||||||
|
display: grid;
|
||||||
|
gap: 14px;
|
||||||
|
border-top: 1px solid #eee7dc;
|
||||||
|
padding-top: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-title {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-title h2 {
|
||||||
|
margin: 0;
|
||||||
|
color: #071b35;
|
||||||
|
font-size: 21px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-title span {
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 800;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feeding-column-chart {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(var(--days, 7), minmax(22px, 1fr));
|
||||||
|
align-items: end;
|
||||||
|
gap: 8px;
|
||||||
|
min-height: 176px;
|
||||||
|
padding: 8px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feeding-column {
|
||||||
|
display: grid;
|
||||||
|
grid-template-rows: 24px 118px 20px;
|
||||||
|
align-items: end;
|
||||||
|
gap: 7px;
|
||||||
|
min-width: 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feeding-column > strong {
|
||||||
|
color: #071b35;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feeding-column > div {
|
||||||
|
display: flex;
|
||||||
|
align-items: end;
|
||||||
|
justify-content: center;
|
||||||
|
height: 118px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #eef3f8;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feeding-column i {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 8px;
|
||||||
|
border-radius: inherit;
|
||||||
|
background: linear-gradient(180deg, #73b7ff 0%, #2b8cff 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.feeding-column span {
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-facts {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
overflow-x: auto;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-facts span {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #f8fafc;
|
||||||
|
color: #475569;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 800;
|
||||||
|
padding: 8px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-line-chart {
|
||||||
|
display: grid;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-line-chart svg {
|
||||||
|
width: 100%;
|
||||||
|
height: 178px;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-area {
|
||||||
|
fill: rgba(139, 124, 246, 0.12);
|
||||||
|
stroke: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-line {
|
||||||
|
fill: none;
|
||||||
|
stroke: #8b7cf6;
|
||||||
|
stroke-width: 4;
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
vector-effect: non-scaling-stroke;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-line-chart circle {
|
||||||
|
fill: #ffffff;
|
||||||
|
stroke: #8b7cf6;
|
||||||
|
stroke-width: 3;
|
||||||
|
vector-effect: non-scaling-stroke;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-axis {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.method-pills {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.method-pills span {
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #fff7e8;
|
||||||
|
color: #925f12;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 800;
|
||||||
|
padding: 7px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.excretion-list {
|
||||||
|
display: grid;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.excretion-list > div {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 42px 1fr 34px;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.excretion-list span {
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.excretion-list strong {
|
||||||
|
color: #071b35;
|
||||||
|
font-size: 13px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.excretion-dots {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 6px;
|
||||||
|
min-height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.excretion-dots i {
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
border-radius: 999px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.excretion-dots .pee {
|
||||||
|
background: #38bdf8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.excretion-dots .poop {
|
||||||
|
background: #84cc16;
|
||||||
|
}
|
||||||
|
|
||||||
|
.excretion-dots em {
|
||||||
|
color: #94a3b8;
|
||||||
|
font-size: 12px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
.bottom-nav {
|
.bottom-nav {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# 统计页跨天汇总重设计
|
||||||
|
|
||||||
|
## 背景
|
||||||
|
|
||||||
|
原统计页只展示今日喂养、睡眠、大小便次数,与今日页顶部卡片重复。统计页应承担跨天汇总与趋势回顾,而不是再次展示今日操作概览。
|
||||||
|
|
||||||
|
## 设计目标
|
||||||
|
|
||||||
|
- 统计页默认展示近 7 天数据,并支持近 3 天、近 7 天、近 14 天切换。
|
||||||
|
- 保留事实汇总,不做医疗判断。
|
||||||
|
- 聚焦家庭真正会回看的内容:
|
||||||
|
- 总览汇总:喂养、睡眠、排泄总量;
|
||||||
|
- 喂养趋势:每日喂养次数、奶量、亲喂有效时长、左右侧累计;
|
||||||
|
- 睡眠趋势:每日睡眠时长、睡眠段数、平均单段时长;
|
||||||
|
- 排泄趋势:每日小便、大便记录。
|
||||||
|
- 移动端优先,使用大触控分段按钮、紧凑趋势条和少量高价值指标。
|
||||||
|
|
||||||
|
## 暂不处理
|
||||||
|
|
||||||
|
- 暂不新增后端跨天统计接口,前端先基于现有按日期查询记录接口聚合。
|
||||||
|
- 暂不展示记录完整度日历。
|
||||||
|
- 暂不做医疗建议或异常判断。
|
||||||
@@ -29,6 +29,7 @@
|
|||||||
- [2026-09-26-server-shanghai-timezone-and-timeline-grouping.md](./2026-09-26-server-shanghai-timezone-and-timeline-grouping.md): 照护记录页面按日分组优化与服务端上海时区校准设计方案。
|
- [2026-09-26-server-shanghai-timezone-and-timeline-grouping.md](./2026-09-26-server-shanghai-timezone-and-timeline-grouping.md): 照护记录页面按日分组优化与服务端上海时区校准设计方案。
|
||||||
- [2026-09-26-care-rule-quick-manual-log.md](./2026-09-26-care-rule-quick-manual-log.md): 常用规则补记照护与多条明细草稿确认方案。
|
- [2026-09-26-care-rule-quick-manual-log.md](./2026-09-26-care-rule-quick-manual-log.md): 常用规则补记照护与多条明细草稿确认方案。
|
||||||
- [2026-09-26-family-home-and-onboarding.md](./2026-09-26-family-home-and-onboarding.md): 家庭页入口合并、多宝宝/多成员层级与新用户创建/加入家庭闭环设计。
|
- [2026-09-26-family-home-and-onboarding.md](./2026-09-26-family-home-and-onboarding.md): 家庭页入口合并、多宝宝/多成员层级与新用户创建/加入家庭闭环设计。
|
||||||
|
- [2026-09-28-stats-range-summary-redesign.md](./2026-09-28-stats-range-summary-redesign.md): 统计页从今日重复数据调整为跨天汇总与趋势回顾。
|
||||||
|
|
||||||
## 记录原则
|
## 记录原则
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user