优化显示样式
This commit is contained in:
1 parent
65c4642444
commit
c21b66bd38
6 files changed
+873
-343
No files matched your search
@@ -1,143 +1,200 @@
|
|||||||
# Baby Tracker (新生儿日常照护记录工具)
|
# Baby Tracker(新生儿日常照护记录工具)
|
||||||
|
|
||||||
[](https://openjdk.org/projects/jdk/21/)
|
[](https://openjdk.org/projects/jdk/21/)
|
||||||
[](https://spring.io/projects/spring-boot)
|
[](https://spring.io/projects/spring-boot)
|
||||||
[](https://vuejs.org/)
|
[](https://vuejs.org/)
|
||||||
[](https://www.typescriptlang.org/)
|
[](https://www.typescriptlang.org/)
|
||||||
[](https://baomidou.com/)
|
[](https://baomidou.com/)
|
||||||
[](LICENSE)
|
|
||||||
|
|
||||||
Baby Tracker 是一款专为**新生儿家庭(尤其顺产出院头几周)**量身打造的极简日常照护与健康记录工具。帮助新手爸妈及家庭照顾者在睡眠匮乏、节奏紧凑的环境下,以最低操作负担记录宝宝的高频照护数据,并提供直观的今日概览与统计视图。
|
Baby Tracker 是一款面向新生儿家庭的移动端照护记录工具。当前阶段聚焦“顺产 3 天新生儿家庭的每日照护记录”,帮助家人在疲惫、碎片化的照护节奏里快速记录喂养、睡眠和排泄,并用轻量摘要回看当天状态。
|
||||||
|
|
||||||
|
项目优先保证高频操作顺手、文案自然、移动端首屏轻。复杂权限、自定义指标、长周期预测和管理后台能力暂不作为当前主线。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🌟 核心功能与业务聚焦
|
## 核心功能
|
||||||
|
|
||||||
1. **核心场景深度聚焦**:
|
### 今日
|
||||||
- **喂养记录**:
|
|
||||||
- **母乳亲喂**:支持左/右侧开始、实时秒级分侧独立计时与无缝切换;提供快捷预设时长(10/15/20/30分钟)一键记录并自动按侧别推导起止时间;数据库具备结构化独立字段 `left_duration_minutes` 与 `right_duration_minutes`;
|
今日页是主要照护操作台,围绕“现在就要记录”的场景设计:
|
||||||
- **挤出母乳记录**:奶量步进调节极简化展示,默认数值与用户偏好配置实时联动。
|
|
||||||
- **睡眠记录**:入睡计时、醒来打卡、睡眠时长自动推导计算。
|
- 顶部只保留宝宝名、出生天数和当前记录人切换。
|
||||||
- **排泄观察**:小便(嘘嘘)、大便(便便)次数记录与性状特征观察。
|
- 今日摘要使用两行轻量状态条:
|
||||||
2. **贴心的人性化导航(双字对仗)**:
|
|
||||||
- **今日**(`/today`):宝宝状态卡片、实时分侧亲喂计时与一键打卡主阵地;
|
```text
|
||||||
- **记录**(`/timeline`):取代生硬金融词“流水”,清晰查阅历史照护时间线明细,支持就近弹窗编辑与补录;
|
喂奶 2 次 · 奶量 120ml
|
||||||
- **统计**(`/stats`):全天喂养频次、睡眠总时长、尿布排泄次数事实汇总,喂养方式中文直观呈现;
|
睡眠 0 分钟 · 小便 0 · 大便 0
|
||||||
- **家庭**(`/settings`):取代生硬工科词“设置”,承载宝宝成长档案、全家成员角色(爸/妈/月嫂/长辈)协同与照护习惯。
|
```
|
||||||
3. **多宝宝与多成员协同**:
|
|
||||||
- 今日顶部一体化信息卡片,直观呈现宝宝月龄天数与当前记录人;
|
- 亲喂支持左右侧独立计时、暂停/继续、左右侧切换和结束保存。
|
||||||
- 底部半屏抽屉式切换,一键平滑切换当前照护宝宝与署名看护人。
|
- 未计时时支持 `10/15/20/30 分钟` 亲喂速记,按钮文案为 `速记 xx 分钟`。
|
||||||
4. **极简操作交互**:
|
- 快速记录区区分睡眠状态动作和单次排泄动作:
|
||||||
- 专为移动端(H5 / 微信内浏览 / 手机浏览器)优化的一触即达操作流程;
|
- 未睡眠:`开始睡眠`、`速记睡眠`、`小便`、`大便`。
|
||||||
- 弱化非核心干扰:暂不引入复杂长周期图表与冗余权限配置,操作即所得。
|
- 睡眠中:展示 `睡眠中 · 入睡时间`、`结束睡眠`、`调整入睡时间`、`小便`、`大便`。
|
||||||
|
|
||||||
|
### 记录
|
||||||
|
|
||||||
|
记录页用于查看和维护历史照护时间线:
|
||||||
|
|
||||||
|
- 按日期分组展示照护记录,左侧显示开始/结束时间,右侧显示行为、奶量、时长、备注和记录人。
|
||||||
|
- 顶部只保留关键操作,避免筛选控件长期占用首屏。
|
||||||
|
- 补录入口分为:
|
||||||
|
- `补一组记录`:一次性补录一组可调整的照护行为。
|
||||||
|
- `补一条记录`:只补录一个单项行为。
|
||||||
|
- 日期和行为类型筛选统一放入底部筛选弹层。
|
||||||
|
- 排序和管理为轻量入口;删除通过管理模式多选执行,降低误删风险。
|
||||||
|
|
||||||
|
### 统计
|
||||||
|
|
||||||
|
统计页承担跨天回顾,而不是重复今日操作面板:
|
||||||
|
|
||||||
|
- 默认查看近 7 天,也支持近 3 天、近 14 天切换。
|
||||||
|
- 展示喂养次数、奶量、亲喂有效时长、睡眠时长、睡眠段数、小便和大便记录趋势。
|
||||||
|
- 当前只做事实汇总,不做医疗建议或异常判断。
|
||||||
|
|
||||||
|
### 家庭
|
||||||
|
|
||||||
|
家庭页承载低频配置和基础资料维护:
|
||||||
|
|
||||||
|
- 宝宝档案、默认宝宝和出生信息。
|
||||||
|
- 家庭资料和成员角色。
|
||||||
|
- 当前记录人和默认记录偏好。
|
||||||
|
- 常用补记规则。
|
||||||
|
|
||||||
|
底部主导航统一为:**今日 · 记录 · 统计 · 家庭**。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🛠️ 技术栈与架构概览
|
## 技术栈
|
||||||
|
|
||||||
### 前端 (Web / H5)
|
### 前端
|
||||||
- **核心框架**:Vue 3 (Composition API / `<script setup>`) + TypeScript 5
|
|
||||||
- **构建工具**:Vite 5
|
|
||||||
- **状态管理**:Pinia 2
|
|
||||||
- **UI 组件库**:Vant 4(移动端轻量级组件库)
|
|
||||||
- **类型安全**:`src/types/domain.ts` 集中收敛,`vue-tsc -b` 严格检查
|
|
||||||
|
|
||||||
### 后端 (Server)
|
- Vue 3 + Composition API + `<script setup>`
|
||||||
- **语言基准**:Java 21
|
- TypeScript 5
|
||||||
- **核心框架**:Spring Boot 3.3.5
|
- Vite 5
|
||||||
- **ORM / 持久层**:MyBatis-Plus 3.5.9
|
- Pinia 2
|
||||||
- **数据库**:MySQL 8.0+
|
- Vant 4
|
||||||
- **数据库迁移**:Flyway 10.x(增量脚本统一维护于 `sql/migration/`)
|
- 类型集中维护于 `apps/web/src/types/domain.ts`
|
||||||
- **主键算法**:自定义 32 位雪花算法(`SnowflakeIdGenerator`)
|
|
||||||
- **代码规范**:Lombok、全字段 JavaDoc 详尽注释、Controller 统一 `@RequestBody`、统一响应体 `ApiResponse<T>`
|
|
||||||
|
|
||||||
### 部署与运维
|
### 后端
|
||||||
- **容器化**:Docker + Docker Compose
|
|
||||||
- **部署形态**:Vue 静态资源打入 Spring Boot jar,单后端镜像提供 Web/H5 与 API
|
- Java 21
|
||||||
- **产物归档**:后端 jar 自动归档至 `deploy/artifacts/server`
|
- Spring Boot 3.3.5
|
||||||
|
- MyBatis-Plus 3.5.9
|
||||||
|
- MySQL 8.0+
|
||||||
|
- Flyway
|
||||||
|
- Lombok
|
||||||
|
- 自定义 32 位雪花 ID:`SnowflakeIdGenerator`
|
||||||
|
|
||||||
|
### 部署
|
||||||
|
|
||||||
|
- Vue 静态资源由前端构建后复制到 `server-java/src/main/resources/static`
|
||||||
|
- Spring Boot jar 同时承载前端页面和 `/api` 接口
|
||||||
|
- 生产部署只运行一个 `baby-tracker-server` 容器
|
||||||
|
- jar 产物归档到 `deploy/artifacts/server`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 📁 目录结构
|
## 目录结构
|
||||||
|
|
||||||
```text
|
```text
|
||||||
baby-tracker/
|
baby-tracker/
|
||||||
├── AGENTS.md # AI Agent 与开发者协作规范及核心开发准则
|
├── AGENTS.md # AI Agent 与开发者协作规范
|
||||||
├── README.md # 项目综合说明文档(本文件)
|
├── README.md # 项目说明文档
|
||||||
├── apps/
|
├── apps/
|
||||||
│ └── web/ # 前端 Vue 3 + TypeScript 移动端 H5 工程
|
│ └── web/ # Vue 3 + TypeScript 移动端 H5
|
||||||
│ ├── src/
|
│ ├── src/
|
||||||
│ │ ├── api/ # 后端 API 请求客户端封装
|
│ │ ├── api/ # API 客户端
|
||||||
│ │ ├── components/ # 业务与公共组件(Tab/抽屉/弹窗独立维护)
|
│ │ ├── components/ # 业务组件、弹窗、抽屉
|
||||||
│ │ ├── pages/ # 路由页面(容器化,聚焦布局与状态分发)
|
│ │ ├── pages/ # 路由页面
|
||||||
│ │ ├── stores/ # Pinia 状态管理
|
│ │ ├── stores/ # Pinia 状态
|
||||||
│ │ ├── types/ # 全局领域类型声明
|
│ │ ├── types/ # 领域类型
|
||||||
│ │ └── utils/ # 格式化与业务转换工具库
|
│ │ └── utils/ # 格式化与工具函数
|
||||||
|
│ ├── scripts/ # 构建后静态资源复制脚本
|
||||||
│ └── package.json
|
│ └── package.json
|
||||||
├── server-java/ # 后端 Spring Boot 3 + Java 21 工程
|
├── server-java/ # Spring Boot 后端
|
||||||
│ ├── src/main/java/com/babytracker/
|
│ ├── src/main/java/com/babytracker/
|
||||||
│ │ ├── common/ # 公共配置、模型(BaseEntity)、异常、拦截器
|
│ │ ├── common/ # 通用模型、异常、配置、拦截器
|
||||||
│ │ └── module/ # 业务模块(baby、family、record、summary)
|
│ │ └── module/ # baby、family、record、summary 等业务模块
|
||||||
│ │ ├── ro/ # Request Object 请求参数对象(全字段 Javadoc)
|
|
||||||
│ │ ├── vo/ # View Object 响应视图对象(全字段 Javadoc)
|
|
||||||
│ │ ├── dto/ # Data Transfer Object 传输对象及转换器
|
|
||||||
│ │ ├── mapper/ # MyBatis-Plus BaseMapper 映射器
|
|
||||||
│ │ └── ...Service & Controller
|
|
||||||
│ └── pom.xml
|
│ └── pom.xml
|
||||||
├── sql/ # 数据库脚本全生命周期统一维护目录
|
├── sql/ # 数据库脚本唯一维护目录
|
||||||
│ ├── migration/ # Flyway 增量演变脚本 (V1__*, V2__*, V3__* 等)
|
│ ├── migration/ # Flyway 增量脚本
|
||||||
│ ├── schema-full.sql # 全新环境快速一键建表脚本(含亲喂分侧等最新字段)
|
│ ├── schema-full.sql # 全新环境建表脚本
|
||||||
│ └── README.md # 数据库规范与说明
|
│ └── README.md
|
||||||
├── deploy/ # 生产部署与容器化目录
|
├── deploy/ # Docker 部署目录
|
||||||
│ ├── artifacts/ # 构建产物目录(.gitignore 忽略,部署包归档)
|
│ ├── artifacts/ # 构建产物目录,已忽略提交
|
||||||
│ ├── docker-compose.yml # 容器编排服务定义(单 Server 镜像)
|
│ ├── docker-compose.yml
|
||||||
│ ├── Dockerfile.server # 后端运行镜像定义
|
│ ├── Dockerfile.server
|
||||||
│ └── deploy.sh # 服务器平滑构建部署脚本
|
│ ├── deploy.sh
|
||||||
└── doc/ # 历史架构决策、调整记录与演进文档
|
│ └── README.md
|
||||||
|
└── doc/ # 产品、架构、页面和部署变更记录
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🚀 快速上手 (本地开发)
|
## 本地开发
|
||||||
|
|
||||||
### 1. 环境准备
|
### 环境要求
|
||||||
- **Java**:JDK 21
|
|
||||||
- **Node.js**:v18+ 及 npm
|
|
||||||
- **Maven**:3.9+
|
|
||||||
- **MySQL**:8.0+
|
|
||||||
|
|
||||||
### 2. 数据库配置
|
- JDK 21
|
||||||
1. 创建本地数据库:
|
- Maven 3.9+
|
||||||
```sql
|
- Node.js 18+
|
||||||
CREATE DATABASE baby_tracker CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
- MySQL 8.0+
|
||||||
```
|
|
||||||
2. 后端集成了 Flyway,启动时会自动按顺序执行 `sql/migration/` 下的迁移脚本,无需手动导入全量 SQL。
|
### 数据库
|
||||||
|
|
||||||
|
创建数据库:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
CREATE DATABASE baby_tracker CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||||
|
```
|
||||||
|
|
||||||
|
后端启动时会通过 Flyway 自动执行 `sql/migration/` 下的增量脚本。全量建表脚本维护在 `sql/schema-full.sql`。
|
||||||
|
|
||||||
|
### 启动后端
|
||||||
|
|
||||||
|
Windows PowerShell 如默认 Java 不是 21,先设置环境:
|
||||||
|
|
||||||
### 3. 后端服务启动
|
|
||||||
在 Windows PowerShell 环境下:
|
|
||||||
```powershell
|
```powershell
|
||||||
# 若本地默认 Java 非 JDK 21,先声明环境变量
|
|
||||||
$env:JAVA_HOME="D:\Java\ms-21.0.7"
|
$env:JAVA_HOME="D:\Java\ms-21.0.7"
|
||||||
$env:Path="D:\Java\apache-maven-3.9.12\bin;D:\Java\ms-21.0.7\bin;" + $env:Path
|
$env:Path="D:\Java\apache-maven-3.9.12\bin;D:\Java\ms-21.0.7\bin;" + $env:Path
|
||||||
|
```
|
||||||
|
|
||||||
|
启动服务:
|
||||||
|
|
||||||
|
```powershell
|
||||||
cd server-java
|
cd server-java
|
||||||
mvn spring-boot:run
|
mvn spring-boot:run
|
||||||
```
|
```
|
||||||
后端服务默认监听在 `http://localhost:9899`,API 前缀为 `http://localhost:9899/api`。
|
|
||||||
|
|
||||||
### 4. 前端应用启动
|
默认地址:
|
||||||
|
|
||||||
|
```text
|
||||||
|
http://localhost:9899
|
||||||
|
http://localhost:9899/api
|
||||||
|
```
|
||||||
|
|
||||||
|
### 启动前端
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd apps/web
|
cd apps/web
|
||||||
npm install
|
npm install
|
||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
前端开发服务启动后访问:`http://localhost:9890`。Vite 会将 `/api` 请求自动反向代理到本地后端的 `9899` 端口。
|
|
||||||
|
默认访问:
|
||||||
|
|
||||||
|
```text
|
||||||
|
http://localhost:9890
|
||||||
|
```
|
||||||
|
|
||||||
|
Vite 会将 `/api` 请求代理到 `http://localhost:9899`。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 📦 一键构建与打包
|
## 构建与打包
|
||||||
|
|
||||||
生产构建时先编译前端,再打后端 jar。前端构建产物会复制到后端静态资源目录,随后随 Spring Boot jar 一起打包。
|
生产构建必须先构建前端,再打后端 jar:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd apps/web
|
cd apps/web
|
||||||
@@ -147,59 +204,76 @@ cd ../../server-java
|
|||||||
mvn -DskipTests package
|
mvn -DskipTests package
|
||||||
```
|
```
|
||||||
|
|
||||||
构建完成后,将自动生成并归档:
|
`npm run build` 会执行:
|
||||||
- `deploy/artifacts/server/baby-tracker-server-0.1.0.jar`
|
|
||||||
|
1. `vue-tsc -b`
|
||||||
|
2. `vite build`
|
||||||
|
3. `node scripts/copy-artifacts.mjs`
|
||||||
|
|
||||||
|
前端产物会复制到:
|
||||||
|
|
||||||
|
```text
|
||||||
|
server-java/src/main/resources/static
|
||||||
|
```
|
||||||
|
|
||||||
|
后端 Maven 打包完成后,jar 会自动复制到:
|
||||||
|
|
||||||
|
```text
|
||||||
|
deploy/artifacts/server/baby-tracker-server-0.1.0.jar
|
||||||
|
```
|
||||||
|
|
||||||
|
`deploy/artifacts` 和前端构建后的静态资源目录均不应提交到 Git。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🚢 服务器容器化部署
|
## 服务器部署
|
||||||
|
|
||||||
1. **上传产物与配置文件**:
|
将本地构建好的 `deploy/artifacts` 上传到服务器:
|
||||||
将项目中的 `deploy/` 目录整体同步至服务器(例如 `/opt/docker/baby-tracker/deploy`)。
|
|
||||||
2. **在服务器上执行部署**:
|
```text
|
||||||
```bash
|
/opt/docker/baby-tracker/deploy/artifacts
|
||||||
cd /opt/docker/baby-tracker/deploy
|
```
|
||||||
chmod +x deploy.sh
|
|
||||||
./deploy.sh
|
在服务器执行:
|
||||||
```
|
|
||||||
3. `deploy.sh` 脚本会自动:
|
```bash
|
||||||
- 检查 `artifacts/server/baby-tracker-server-0.1.0.jar`;
|
cd /opt/docker/baby-tracker/deploy
|
||||||
- 执行 `docker compose build` 构建轻量级生产镜像;
|
./deploy.sh
|
||||||
- 启动并平滑拉起 Spring Boot 容器。
|
```
|
||||||
|
|
||||||
|
部署脚本会使用已上传 jar 构建 Docker 镜像,并重启单个 Spring Boot 容器。前端页面与 `/api` 接口同源运行在 `9899` 端口。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 📐 核心设计与协作规范
|
## 开发规范摘要
|
||||||
|
|
||||||
在对本项目进行功能新增或重构开发时,**必须严格遵循以下原则**(详细规范参见 [AGENTS.md](./AGENTS.md)):
|
详细规范以 [AGENTS.md](./AGENTS.md) 为准,核心约束包括:
|
||||||
|
|
||||||
1. **主键与 ID 规范**:所有表统一使用 `CHAR(32)` 字符串主键,由后端雪花算法生成,**严禁使用自增主键**。
|
1. 所有文件读写使用 UTF-8 无 BOM。
|
||||||
2. **通用审计字段**:所有业务表必须具备 6 大标准通用审计字段(`remark`, `deleted`, `created_by`, `created_time`, `updated_by`, `updated_time`),通过 MyBatis-Plus 拦截器统一填充,逻辑删除使用 `@TableLogic`。
|
2. 所有业务表主键统一为 `id CHAR(32)`,由后端雪花算法生成,禁止自增主键。
|
||||||
3. **接口传参规范**:所有 Controller 接口**一律严禁使用 `@PathVariable`**,一律使用 `@RequestBody` 接收统一命名的请求对象。
|
3. 所有业务表具备标准审计字段:`remark`、`deleted`、`created_by`、`created_time`、`updated_by`、`updated_time`。
|
||||||
4. **模型分层与注释规范**:
|
4. Entity 继承 `BaseEntity`,逻辑删除使用 MyBatis-Plus `@TableLogic`。
|
||||||
- `ro/`:接收前端入参(`xxRO.java`);
|
5. Controller 禁止使用 `@PathVariable`,统一用 `@RequestBody` 接收请求对象。
|
||||||
- `vo/`:输出前端视图响应(`xxVO.java`);
|
6. 接口统一返回 `ApiResponse<T>`。
|
||||||
- `dto/`:层间数据传输与静态转换工具(`xxDTO.java`、`xxConvert.java`);
|
7. 业务模型按 `ro/`、`vo/`、`dto/`、`mapper/` 分层;Entity、RO、VO、DTO 字段必须有 JavaDoc。
|
||||||
- 所有 Entity、RO、VO、DTO 字段**必须配备清晰规范的 JavaDoc 注释**。
|
8. 前端页面保持容器化,复杂弹窗、抽屉和 Tab 子模块拆到 `components/`。
|
||||||
5. **前端组件拆分与文案贴心化**:
|
9. API 客户端统一维护在 `apps/web/src/api/client.ts`。
|
||||||
- 页面文件(`pages/*.vue`)仅作为容器保持简洁;
|
10. SQL 脚本统一维护在根目录 `sql/`,禁止在后端工程内散落副本。
|
||||||
- 底部 4 个导航 Tab 统一为:**今日 · 记录 · 统计 · 家庭**;
|
|
||||||
- 复杂多 Tab 与弹窗/抽屉表单必须下沉至 `components/` 独立子组件维护。
|
|
||||||
6. **SQL 维护唯一源**:所有 SQL 脚本统一在根目录 `sql/` 下维护,禁止在 `server-java` 内部保留分散副本。
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 📖 相关文档索引
|
## 文档索引
|
||||||
|
|
||||||
详细的设计决策与各版本重构历程请参阅 [doc/ 目录](./doc/):
|
项目变更记录集中维护在 [doc/](./doc/):
|
||||||
- [总架构与演进规划方案](./doc/architecture-adjustment-plan.md)
|
|
||||||
- [32 位雪花 ID 生成与数据库主键策略](./doc/2026-09-26-id-strategy.md)
|
- [2026-09-25.md](./doc/2026-09-25.md):MVP 重构、旧原型清理与部署目录结构调整。
|
||||||
- [MyBatis-Plus 集成与 SQL 操作优化](./doc/2026-09-26-mybatis-plus-integration.md)
|
- [2026-09-26.md](./doc/2026-09-26.md):总体架构、数据模型、后端规范、前端交互与部署流程集中记录。
|
||||||
- [审计字段统一、RO/VO/DTO 分层与接口规范](./doc/2026-09-26-audit-fields-ro-vo-dto-restructure.md)
|
- [2026-09-28.md](./doc/2026-09-28.md):统计页跨天汇总与趋势回顾调整。
|
||||||
- [前端设置与流水页面组件化重构](./doc/2026-09-26-frontend-settings-timeline-component-split.md)
|
- [2026-09-29.md](./doc/2026-09-29.md):单 Jar 静态前端部署、记录页移动端时间线和结束时间补充提示。
|
||||||
- [部署脚本自动化与产物自闭环优化](./doc/2026-09-26-deploy-script-optimization.md)
|
- [2026-09-30.md](./doc/2026-09-30.md):照护页与记录页移动端首屏轻量化、摘要条和快速记录交互优化。
|
||||||
- [亲喂左右侧分别计时切换与瓶喂奶量设置优化](./doc/2026-09-26-breastfeeding-split-timer-and-bottle-settings.md)
|
|
||||||
- [今日 Tab 顶部宝宝信息展示与切换交互优化](./doc/2026-09-26-today-header-and-switchers-optimization.md)
|
维护规则:
|
||||||
- [流水编辑弹窗位置修复与亲喂总时长起止时间优化](./doc/2026-09-26-timeline-edit-modal-and-feeding-duration-optimization.md)
|
|
||||||
- [底部导航与页面文案贴心化(今日·记录·统计·家庭)优化](./doc/2026-09-26-navigation-tabs-wording-optimization.md)
|
- 重大架构、模型或页面调整应先更新 `doc/`,再进入代码实现。
|
||||||
- [亲喂左右侧时长独立字段架构设计与落地](./doc/2026-09-26-breastfeeding-split-duration-fields.md)
|
- 代码与文档不一致时,以最新文档作为下一步调整依据。
|
||||||
|
- 实现完成后同步更新 `doc/README.md` 和必要的项目 README。
|
||||||
@@ -26,6 +26,7 @@ const behaviorFilters = ref<BehaviorFilter[]>([])
|
|||||||
const sortOrder = ref<'desc' | 'asc'>('desc')
|
const sortOrder = ref<'desc' | 'asc'>('desc')
|
||||||
const manageMode = ref(false)
|
const manageMode = ref(false)
|
||||||
const selectedRecordIds = ref<string[]>([])
|
const selectedRecordIds = ref<string[]>([])
|
||||||
|
const showFilterSheet = ref(false)
|
||||||
|
|
||||||
// 补录弹窗控制
|
// 补录弹窗控制
|
||||||
const showManualModal = ref(false)
|
const showManualModal = ref(false)
|
||||||
@@ -71,10 +72,6 @@ watch(() => store.baby?.babyId || store.selectedBabyId, (newId) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
function clearFilter() {
|
|
||||||
filterDate.value = ''
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleBehaviorFilter(type: BehaviorFilter) {
|
function toggleBehaviorFilter(type: BehaviorFilter) {
|
||||||
behaviorFilters.value = behaviorFilters.value.includes(type)
|
behaviorFilters.value = behaviorFilters.value.includes(type)
|
||||||
? behaviorFilters.value.filter(item => item !== type)
|
? behaviorFilters.value.filter(item => item !== type)
|
||||||
@@ -86,6 +83,25 @@ function clearAllFilters() {
|
|||||||
behaviorFilters.value = []
|
behaviorFilters.value = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const behaviorFilterOptions: Array<{ type: BehaviorFilter; label: string }> = [
|
||||||
|
{ type: 'feeding', label: '喂奶' },
|
||||||
|
{ type: 'sleep', label: '睡眠' },
|
||||||
|
{ type: 'pee', label: '小便' },
|
||||||
|
{ type: 'poop', label: '大便' }
|
||||||
|
]
|
||||||
|
|
||||||
|
const activeBehaviorFilterText = computed(() => {
|
||||||
|
if (!behaviorFilters.value.length) return ''
|
||||||
|
return behaviorFilterOptions
|
||||||
|
.filter(option => behaviorFilters.value.includes(option.type))
|
||||||
|
.map(option => option.label)
|
||||||
|
.join('、')
|
||||||
|
})
|
||||||
|
|
||||||
|
const activeFilterCount = computed(() => {
|
||||||
|
return (filterDate.value ? 1 : 0) + behaviorFilters.value.length
|
||||||
|
})
|
||||||
|
|
||||||
function matchesBehaviorFilter(record: CareRecord) {
|
function matchesBehaviorFilter(record: CareRecord) {
|
||||||
if (!behaviorFilters.value.length) return true
|
if (!behaviorFilters.value.length) return true
|
||||||
return behaviorFilters.value.some(type => {
|
return behaviorFilters.value.some(type => {
|
||||||
@@ -216,99 +232,35 @@ const groupedRecords = computed<RecordDayGroup[]>(() => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
const totalCount = computed(() => filteredRecords.value.length)
|
|
||||||
const hasActiveFilter = computed(() => Boolean(filterDate.value) || behaviorFilters.value.length > 0)
|
const hasActiveFilter = computed(() => Boolean(filterDate.value) || behaviorFilters.value.length > 0)
|
||||||
const selectedCount = computed(() => selectedRecordIds.value.length)
|
const selectedCount = computed(() => selectedRecordIds.value.length)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="page">
|
<section class="page">
|
||||||
<header class="page-header">
|
<!-- 顶部日期、补录与轻量工具栏 -->
|
||||||
<h1>记录</h1>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<!-- 顶部过滤与排序工具栏 -->
|
|
||||||
<div class="timeline-toolbar">
|
<div class="timeline-toolbar">
|
||||||
<div class="timeline-toolbar-top">
|
|
||||||
<!-- 日期过滤输入框 -->
|
|
||||||
<div class="date-filter-box">
|
|
||||||
<span class="filter-icon">📅</span>
|
|
||||||
<input
|
|
||||||
v-model="filterDate"
|
|
||||||
type="date"
|
|
||||||
class="filter-date-input"
|
|
||||||
aria-label="筛选特定日期"
|
|
||||||
/>
|
|
||||||
<button
|
|
||||||
v-if="filterDate"
|
|
||||||
type="button"
|
|
||||||
class="clear-filter-btn"
|
|
||||||
title="查看全部日期"
|
|
||||||
@click="clearFilter"
|
|
||||||
>
|
|
||||||
✕ 全部
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="timeline-count-summary">
|
|
||||||
<span v-if="hasActiveFilter">
|
|
||||||
已筛选 <strong>{{ totalCount }}</strong> 项
|
|
||||||
</span>
|
|
||||||
<span v-else>
|
|
||||||
共 <strong>{{ totalCount }}</strong> 项
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="behavior-filter-row" aria-label="按行为筛选">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="behavior-filter-chip"
|
|
||||||
:class="{ active: behaviorFilters.includes('feeding') }"
|
|
||||||
@click="toggleBehaviorFilter('feeding')"
|
|
||||||
>
|
|
||||||
喂奶
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="behavior-filter-chip"
|
|
||||||
:class="{ active: behaviorFilters.includes('sleep') }"
|
|
||||||
@click="toggleBehaviorFilter('sleep')"
|
|
||||||
>
|
|
||||||
睡眠
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="behavior-filter-chip"
|
|
||||||
:class="{ active: behaviorFilters.includes('pee') }"
|
|
||||||
@click="toggleBehaviorFilter('pee')"
|
|
||||||
>
|
|
||||||
小便
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="behavior-filter-chip"
|
|
||||||
:class="{ active: behaviorFilters.includes('poop') }"
|
|
||||||
@click="toggleBehaviorFilter('poop')"
|
|
||||||
>
|
|
||||||
大便
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 右侧操作项:天内排序切换与补录 -->
|
|
||||||
<div class="toolbar-actions">
|
<div class="toolbar-actions">
|
||||||
<div class="record-action-row primary">
|
<div class="record-action-row primary">
|
||||||
<button class="primary-pill-button" @click="openManualModal('quick')">
|
<button class="primary-pill-button" @click="openManualModal('quick')">
|
||||||
+ 补记照护
|
+ 补一组记录
|
||||||
</button>
|
</button>
|
||||||
<button class="secondary-pill-button" @click="openManualModal('detail')">
|
<button class="secondary-pill-button" @click="openManualModal('detail')">
|
||||||
补单次
|
补一条记录
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="record-action-row subtle">
|
<div class="record-action-row subtle">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="sort-toggle-btn"
|
class="toolbar-text-btn"
|
||||||
|
:class="{ active: hasActiveFilter }"
|
||||||
|
@click="showFilterSheet = true"
|
||||||
|
>
|
||||||
|
筛选<span v-if="activeFilterCount">·{{ activeFilterCount }}</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="toolbar-text-btn"
|
||||||
:class="{ active: sortOrder === 'asc' }"
|
:class="{ active: sortOrder === 'asc' }"
|
||||||
:title="sortOrder === 'desc' ? '当前:当天内由晚到早(倒序),点击切换为正序' : '当前:当天内由早到晚(正序),点击切换为倒序'"
|
:title="sortOrder === 'desc' ? '当前:当天内由晚到早(倒序),点击切换为正序' : '当前:当天内由早到晚(正序),点击切换为倒序'"
|
||||||
@click="toggleSortOrder"
|
@click="toggleSortOrder"
|
||||||
@@ -317,7 +269,7 @@ const selectedCount = computed(() => selectedRecordIds.value.length)
|
|||||||
{{ sortOrder === 'desc' ? '倒序' : '正序' }}
|
{{ sortOrder === 'desc' ? '倒序' : '正序' }}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="manage-toggle-btn"
|
class="toolbar-text-btn"
|
||||||
:class="{ active: manageMode }"
|
:class="{ active: manageMode }"
|
||||||
@click="toggleManageMode"
|
@click="toggleManageMode"
|
||||||
>
|
>
|
||||||
@@ -330,7 +282,7 @@ const selectedCount = computed(() => selectedRecordIds.value.length)
|
|||||||
<div v-if="hasActiveFilter" class="timeline-meta-bar">
|
<div v-if="hasActiveFilter" class="timeline-meta-bar">
|
||||||
<span v-if="hasActiveFilter" class="meta-filter-active">
|
<span v-if="hasActiveFilter" class="meta-filter-active">
|
||||||
<span v-if="filterDate"><strong>{{ filterDate }}</strong></span>
|
<span v-if="filterDate"><strong>{{ filterDate }}</strong></span>
|
||||||
<span v-if="behaviorFilters.length"> 已选 {{ behaviorFilters.length }} 类行为</span>
|
<span v-if="activeBehaviorFilterText"> {{ activeBehaviorFilterText }}</span>
|
||||||
</span>
|
</span>
|
||||||
<button class="clear-filter-btn" type="button" @click="clearAllFilters">清空筛选</button>
|
<button class="clear-filter-btn" type="button" @click="clearAllFilters">清空筛选</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -438,11 +390,54 @@ const selectedCount = computed(() => selectedRecordIds.value.length)
|
|||||||
</p>
|
</p>
|
||||||
<div style="display: flex; gap: 10px; justify-content: center;">
|
<div style="display: flex; gap: 10px; justify-content: center;">
|
||||||
<button v-if="hasActiveFilter" class="secondary-btn" @click="clearAllFilters">查看全部记录</button>
|
<button v-if="hasActiveFilter" class="secondary-btn" @click="clearAllFilters">查看全部记录</button>
|
||||||
<button class="primary-pill-button" @click="openManualModal('quick')">+ 补记照护</button>
|
<button class="primary-pill-button" @click="openManualModal('quick')">+ 补一组记录</button>
|
||||||
<button class="secondary-pill-button" @click="openManualModal('detail')">补单次</button>
|
<button class="secondary-pill-button" @click="openManualModal('detail')">补一条记录</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<van-popup
|
||||||
|
v-model:show="showFilterSheet"
|
||||||
|
position="bottom"
|
||||||
|
round
|
||||||
|
safe-area-inset-bottom
|
||||||
|
teleport="body"
|
||||||
|
>
|
||||||
|
<div class="timeline-filter-sheet">
|
||||||
|
<div class="timeline-filter-sheet-head">
|
||||||
|
<div>
|
||||||
|
<h3>筛选记录</h3>
|
||||||
|
<p>按日期或照护行为缩小范围</p>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="sheet-close-btn" @click="showFilterSheet = false">完成</button>
|
||||||
|
</div>
|
||||||
|
<label class="timeline-filter-date-field">
|
||||||
|
<span>日期</span>
|
||||||
|
<input
|
||||||
|
v-model="filterDate"
|
||||||
|
type="date"
|
||||||
|
class="filter-date-input"
|
||||||
|
aria-label="筛选特定日期"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<div class="behavior-filter-row sheet" aria-label="按行为筛选">
|
||||||
|
<button
|
||||||
|
v-for="option in behaviorFilterOptions"
|
||||||
|
:key="option.type"
|
||||||
|
type="button"
|
||||||
|
class="behavior-filter-chip"
|
||||||
|
:class="{ active: behaviorFilters.includes(option.type) }"
|
||||||
|
@click="toggleBehaviorFilter(option.type)"
|
||||||
|
>
|
||||||
|
{{ option.label }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="timeline-filter-sheet-actions">
|
||||||
|
<button type="button" class="secondary-pill-button" @click="clearAllFilters">查看全部</button>
|
||||||
|
<button type="button" class="primary-pill-button" @click="showFilterSheet = false">确定</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</van-popup>
|
||||||
|
|
||||||
<!-- 弹窗:补录记录维护组件 -->
|
<!-- 弹窗:补录记录维护组件 -->
|
||||||
<TimelineManualModal v-model:show="showManualModal" :initial-mode="manualInitialMode" @success="handleRecordChanged" />
|
<TimelineManualModal v-model:show="showManualModal" :initial-mode="manualInitialMode" @success="handleRecordChanged" />
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, ref, watch } from 'vue'
|
import { computed, onMounted, ref, watch } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { showToast } from 'vant'
|
import { showToast } from 'vant'
|
||||||
import { useCareStore } from '../stores/careStore'
|
import { useCareStore } from '../stores/careStore'
|
||||||
@@ -29,8 +29,16 @@ 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 showSleepSheet = ref(false)
|
||||||
|
|
||||||
const oneClickDuration = ref(20)
|
const oneClickDuration = ref(20)
|
||||||
|
const sleepQuickDuration = ref(60)
|
||||||
|
const sleepStartDate = ref('')
|
||||||
|
const sleepStartTimeStr = ref('')
|
||||||
|
|
||||||
|
const todayMilkAmount = computed(() => {
|
||||||
|
return (store.summary?.timeline || []).reduce((sum, record) => sum + (record.amountMl || 0), 0)
|
||||||
|
})
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => store.preferences.defaultBottleAmount,
|
() => store.preferences.defaultBottleAmount,
|
||||||
@@ -180,69 +188,87 @@ async function handleOneClickBreastfeeding() {
|
|||||||
`已记录亲喂 ${dur}分钟(${startStr} ~ ${endStr})`
|
`已记录亲喂 ${dur}分钟(${startStr} ~ ${endStr})`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openSleepAssist() {
|
||||||
|
const activeSleep = store.summary?.activeSleep
|
||||||
|
if (activeSleep?.startTime) {
|
||||||
|
const start = new Date(activeSleep.startTime)
|
||||||
|
sleepStartDate.value = getLocalDateStr(start)
|
||||||
|
sleepStartTimeStr.value = getLocalTimeStr(start)
|
||||||
|
} else {
|
||||||
|
const now = store.getServerNow()
|
||||||
|
sleepStartDate.value = getLocalDateStr(now)
|
||||||
|
sleepStartTimeStr.value = getLocalTimeStr(now)
|
||||||
|
}
|
||||||
|
showSleepSheet.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleQuickSleepLog() {
|
||||||
|
const dur = sleepQuickDuration.value || 60
|
||||||
|
const now = store.getServerNow()
|
||||||
|
const start = new Date(now.getTime() - dur * 60000)
|
||||||
|
const startTime = `${getLocalDateStr(start)}T${getLocalTimeStr(start)}:00`
|
||||||
|
const endTime = `${getLocalDateStr(now)}T${getLocalTimeStr(now)}:00`
|
||||||
|
await runWithTip(
|
||||||
|
async () => {
|
||||||
|
await store.manualLog({
|
||||||
|
recordType: 'sleep',
|
||||||
|
startTime,
|
||||||
|
endTime,
|
||||||
|
durationMinutes: dur,
|
||||||
|
operatorName: store.operatorName
|
||||||
|
})
|
||||||
|
},
|
||||||
|
`已速记睡眠 ${dur}分钟`
|
||||||
|
)
|
||||||
|
showSleepSheet.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleAdjustSleepStart() {
|
||||||
|
const activeSleep = store.summary?.activeSleep
|
||||||
|
if (!activeSleep?.recordId || !sleepStartDate.value || !sleepStartTimeStr.value) return
|
||||||
|
const startTime = `${sleepStartDate.value}T${sleepStartTimeStr.value}:00`
|
||||||
|
await runWithTip(
|
||||||
|
async () => {
|
||||||
|
await store.editRecord(activeSleep.recordId, {
|
||||||
|
recordType: 'sleep',
|
||||||
|
startTime,
|
||||||
|
endTime: null,
|
||||||
|
durationMinutes: null,
|
||||||
|
operatorName: store.operatorName
|
||||||
|
})
|
||||||
|
},
|
||||||
|
'已调整入睡时间'
|
||||||
|
)
|
||||||
|
showSleepSheet.value = false
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="page">
|
<section class="page">
|
||||||
<!-- 顶部一体化温润状态卡片 -->
|
<!-- 顶部轻量上下文 -->
|
||||||
<header class="today-top-card">
|
<header class="today-top-card">
|
||||||
<!-- 顶栏:家庭名称与记录人切换胶囊 -->
|
<button class="baby-main-row" type="button" @click="showBabyPicker = true">
|
||||||
<div class="top-row">
|
<div class="baby-meta">
|
||||||
<div class="family-badge">
|
<div class="baby-name-row">
|
||||||
<span class="family-icon">🏡</span>
|
<strong class="baby-name">{{ store.baby?.name || '宝宝' }}</strong>
|
||||||
<span class="family-name">{{ store.context?.family.name || '新生儿照护家庭' }}</span>
|
<span class="baby-age-chip">{{ store.baby?.ageText || '出生第 3 天' }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
<button class="operator-pill" type="button" @click="showMemberPicker = true">
|
<button class="operator-pill" type="button" @click="showMemberPicker = true">
|
||||||
<span class="operator-avatar">{{ getRoleIcon(store.operatorName) }}</span>
|
<span class="operator-avatar">{{ getRoleIcon(store.operatorName) }}</span>
|
||||||
<span class="operator-text">{{ store.operatorName }}</span>
|
<span class="operator-text">{{ store.operatorName }}</span>
|
||||||
<span class="pill-arrow">▾</span>
|
<span class="pill-arrow">▾</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 主体:宝宝信息与切换入口 -->
|
|
||||||
<div class="baby-main-row" @click="showBabyPicker = true">
|
|
||||||
<div class="baby-avatar-wrap">
|
|
||||||
<span class="baby-avatar-emoji">👶</span>
|
|
||||||
<span class="gender-dot" :class="store.baby?.gender || 'boy'"></span>
|
|
||||||
</div>
|
|
||||||
<div class="baby-meta">
|
|
||||||
<div class="baby-name-row">
|
|
||||||
<h1 class="baby-name">{{ store.baby?.name || '宝宝' }}</h1>
|
|
||||||
<span class="baby-switch-tag">切换宝宝 ▾</span>
|
|
||||||
</div>
|
|
||||||
<div class="baby-tags">
|
|
||||||
<span class="baby-age-chip">{{ store.baby?.ageText || '出生第 3 天' }}</span>
|
|
||||||
<span v-if="store.baby?.deliveryType === 'natural'" class="baby-sub-chip">顺产</span>
|
|
||||||
<span v-else-if="store.baby?.deliveryType === 'c_section'" class="baby-sub-chip">剖腹产</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<p v-if="store.error" class="notice error">{{ store.error }}</p>
|
<p v-if="store.error" class="notice error">{{ store.error }}</p>
|
||||||
<p v-if="store.loading" class="notice">正在加载今日记录...</p>
|
<p v-if="store.loading" class="notice">正在加载今日记录...</p>
|
||||||
|
|
||||||
<section class="summary-grid">
|
<section class="summary-grid" aria-label="今日摘要">
|
||||||
<article class="metric-card">
|
<strong class="summary-primary-line">喂奶 {{ store.summary?.feedingCount ?? 0 }} 次 · 奶量 {{ todayMilkAmount }}ml</strong>
|
||||||
<span>喂奶</span>
|
<span class="summary-secondary-line">睡眠 {{ formatMinutes(store.summary?.sleepTotalMinutes ?? 0) }} · 小便 {{ store.summary?.peeCount ?? 0 }} · 大便 {{ store.summary?.poopCount ?? 0 }}</span>
|
||||||
<strong>{{ store.summary?.feedingCount ?? 0 }}</strong>
|
|
||||||
<small>今日次数</small>
|
|
||||||
</article>
|
|
||||||
<article class="metric-card">
|
|
||||||
<span>睡眠</span>
|
|
||||||
<strong>{{ formatMinutes(store.summary?.sleepTotalMinutes ?? 0) }}</strong>
|
|
||||||
<small>累计时长</small>
|
|
||||||
</article>
|
|
||||||
<article class="metric-card">
|
|
||||||
<span>小便</span>
|
|
||||||
<strong>{{ store.summary?.peeCount ?? 0 }}</strong>
|
|
||||||
<small>今日次数</small>
|
|
||||||
</article>
|
|
||||||
<article class="metric-card">
|
|
||||||
<span>大便</span>
|
|
||||||
<strong>{{ store.summary?.poopCount ?? 0 }}</strong>
|
|
||||||
<small>今日次数</small>
|
|
||||||
</article>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- 统一喂养聚合面板 -->
|
<!-- 统一喂养聚合面板 -->
|
||||||
@@ -347,10 +373,6 @@ async function handleOneClickBreastfeeding() {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<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) }}分
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 操作按钮区 -->
|
<!-- 操作按钮区 -->
|
||||||
@@ -374,7 +396,7 @@ async function handleOneClickBreastfeeding() {
|
|||||||
:disabled="operating"
|
:disabled="operating"
|
||||||
@click="handleOneClickBreastfeeding"
|
@click="handleOneClickBreastfeeding"
|
||||||
>
|
>
|
||||||
补记 {{ oneClickDuration }}分钟
|
速记 {{ oneClickDuration }}分钟
|
||||||
</van-button>
|
</van-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -517,15 +539,46 @@ async function handleOneClickBreastfeeding() {
|
|||||||
<div class="panel-title">
|
<div class="panel-title">
|
||||||
<h2>快速记录</h2>
|
<h2>快速记录</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="action-grid compact-actions">
|
<div class="quick-record-actions">
|
||||||
|
<div v-if="store.summary?.activeSleep" class="sleep-active-row">
|
||||||
|
<div class="sleep-active-main">
|
||||||
|
<strong>睡眠中 · {{ formatTime(store.summary.activeSleep.startTime) }} 入睡</strong>
|
||||||
<button
|
<button
|
||||||
class="primary-action sleep"
|
type="button"
|
||||||
:disabled="operating"
|
:disabled="operating"
|
||||||
@click="runWithTip(() => store.toggleSleep(), store.summary?.activeSleep ? '已结束睡眠记录' : '已开始睡眠记录')"
|
@click="runWithTip(() => store.toggleSleep(), '已结束睡眠记录')"
|
||||||
>
|
>
|
||||||
<strong>{{ store.summary?.activeSleep ? '结束睡眠' : '开始睡眠' }}</strong>
|
结束睡眠
|
||||||
<span>{{ store.summary?.activeSleep ? '自动计算时长' : '宝宝睡下了' }}</span>
|
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
class="sleep-adjust-link"
|
||||||
|
type="button"
|
||||||
|
:disabled="operating"
|
||||||
|
@click="openSleepAssist"
|
||||||
|
>
|
||||||
|
调整入睡时间
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<template v-else>
|
||||||
|
<button
|
||||||
|
class="primary-action sleep quick-sleep-action"
|
||||||
|
:disabled="operating"
|
||||||
|
@click="runWithTip(() => store.toggleSleep(), '已开始睡眠记录')"
|
||||||
|
>
|
||||||
|
<strong>开始睡眠</strong>
|
||||||
|
<span>宝宝睡下了</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="quick-sleep-secondary"
|
||||||
|
type="button"
|
||||||
|
:disabled="operating"
|
||||||
|
@click="openSleepAssist"
|
||||||
|
>
|
||||||
|
速记睡眠
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
<div class="quick-excretion-row">
|
||||||
<button
|
<button
|
||||||
class="primary-action pee"
|
class="primary-action pee"
|
||||||
:disabled="operating"
|
:disabled="operating"
|
||||||
@@ -543,8 +596,68 @@ async function handleOneClickBreastfeeding() {
|
|||||||
<span>记录一次</span>
|
<span>记录一次</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<van-popup
|
||||||
|
v-model:show="showSleepSheet"
|
||||||
|
position="bottom"
|
||||||
|
round
|
||||||
|
safe-area-inset-bottom
|
||||||
|
teleport="body"
|
||||||
|
>
|
||||||
|
<div class="sleep-action-sheet">
|
||||||
|
<div class="sleep-action-sheet-head">
|
||||||
|
<h3>{{ store.summary?.activeSleep ? '调整入睡时间' : '速记睡眠' }}</h3>
|
||||||
|
<button type="button" class="sheet-close-btn" @click="showSleepSheet = false">完成</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-if="store.summary?.activeSleep">
|
||||||
|
<div class="sleep-time-fields">
|
||||||
|
<label>
|
||||||
|
<span>入睡日期</span>
|
||||||
|
<input v-model="sleepStartDate" type="date" />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<span>入睡时间</span>
|
||||||
|
<input v-model="sleepStartTimeStr" type="time" />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="primary-pill-button sleep-sheet-submit"
|
||||||
|
:disabled="operating"
|
||||||
|
@click="handleAdjustSleepStart"
|
||||||
|
>
|
||||||
|
保存调整
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<div class="sleep-duration-grid" aria-label="选择睡眠时长">
|
||||||
|
<button
|
||||||
|
v-for="duration in [30, 60, 90, 120]"
|
||||||
|
:key="duration"
|
||||||
|
type="button"
|
||||||
|
class="bf-duration-chip"
|
||||||
|
:class="{ active: sleepQuickDuration === duration }"
|
||||||
|
@click="sleepQuickDuration = duration"
|
||||||
|
>
|
||||||
|
{{ duration }}分
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="primary-pill-button sleep-sheet-submit"
|
||||||
|
:disabled="operating"
|
||||||
|
@click="handleQuickSleepLog"
|
||||||
|
>
|
||||||
|
速记 {{ sleepQuickDuration }}分钟
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</van-popup>
|
||||||
|
|
||||||
<section class="panel">
|
<section class="panel">
|
||||||
<div class="panel-title">
|
<div class="panel-title">
|
||||||
<h2>最近状态</h2>
|
<h2>最近状态</h2>
|
||||||
|
|||||||
+321
-70
@@ -79,21 +79,13 @@ button {
|
|||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 顶部一体化温润状态卡片 */
|
/* 今日页轻量上下文 */
|
||||||
.today-top-card {
|
.today-top-card {
|
||||||
background: linear-gradient(135deg, #fffbf0 0%, #fff6df 100%);
|
|
||||||
border: 1px solid #f6e6c4;
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 14px 16px;
|
|
||||||
box-shadow: 0 4px 14px rgba(184, 134, 11, 0.06);
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-row {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 10px;
|
gap: 10px;
|
||||||
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.family-badge {
|
.family-badge {
|
||||||
@@ -113,12 +105,13 @@ button {
|
|||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 5px;
|
gap: 5px;
|
||||||
background: #ffffff;
|
flex: 0 0 auto;
|
||||||
|
min-height: 34px;
|
||||||
|
background: #fffaf0;
|
||||||
border: 1px solid #ebd8b2;
|
border: 1px solid #ebd8b2;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
padding: 4px 10px 4px 7px;
|
padding: 5px 10px 5px 7px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
|
|
||||||
transition: all 0.15s ease;
|
transition: all 0.15s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,19 +138,20 @@ button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.baby-main-row {
|
.baby-main-row {
|
||||||
|
min-width: 0;
|
||||||
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 12px;
|
justify-content: flex-start;
|
||||||
padding: 10px 12px;
|
padding: 0;
|
||||||
border-radius: 12px;
|
border: 0;
|
||||||
background: rgba(255, 255, 255, 0.7);
|
background: transparent;
|
||||||
border: 1px solid rgba(246, 230, 196, 0.6);
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.15s ease;
|
transition: all 0.15s ease;
|
||||||
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.baby-main-row:active {
|
.baby-main-row:active {
|
||||||
background: rgba(255, 255, 255, 0.95);
|
|
||||||
transform: scale(0.99);
|
transform: scale(0.99);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,15 +199,19 @@ button {
|
|||||||
.baby-name-row {
|
.baby-name-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 7px;
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.baby-name {
|
.baby-name {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 20px;
|
font-size: 17px;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
color: #2c2518;
|
color: #2c2518;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.baby-switch-tag {
|
.baby-switch-tag {
|
||||||
@@ -234,6 +232,7 @@ button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.baby-age-chip {
|
.baby-age-chip {
|
||||||
|
flex: 0 0 auto;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #b45309;
|
color: #b45309;
|
||||||
@@ -436,9 +435,29 @@ button {
|
|||||||
|
|
||||||
.summary-grid {
|
.summary-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
gap: 3px;
|
||||||
gap: 12px;
|
margin: 6px 0 12px;
|
||||||
margin: 16px 0;
|
padding: 9px 12px;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: #fffdf8;
|
||||||
|
border: 1px solid #f2dfba;
|
||||||
|
box-shadow: inset 3px 0 0 #f0b74f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-primary-line {
|
||||||
|
color: #17202a;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 900;
|
||||||
|
line-height: 1.35;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-secondary-line {
|
||||||
|
color: #667085;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 800;
|
||||||
|
line-height: 1.35;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.metric-card,
|
.metric-card,
|
||||||
@@ -520,6 +539,170 @@ button {
|
|||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.quick-record-actions {
|
||||||
|
display: grid;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-record-actions .primary-action {
|
||||||
|
min-height: 76px;
|
||||||
|
padding: 13px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-sleep-action {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-sleep-action strong,
|
||||||
|
.quick-sleep-action span {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-sleep-secondary {
|
||||||
|
min-height: 42px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #ffffff;
|
||||||
|
border: 1px solid #d7e5f5;
|
||||||
|
color: #2364b5;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-sleep-secondary:disabled {
|
||||||
|
opacity: 0.55;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-active-row {
|
||||||
|
display: grid;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: #ede7ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-active-main {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-active-main strong {
|
||||||
|
min-width: 0;
|
||||||
|
color: #17202a;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 1.25;
|
||||||
|
font-weight: 900;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-active-main button {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
min-height: 34px;
|
||||||
|
padding: 6px 13px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #ffffff;
|
||||||
|
color: #4c1d95;
|
||||||
|
border: 1px solid rgba(124, 58, 237, 0.18);
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-active-main button:disabled,
|
||||||
|
.sleep-adjust-link:disabled {
|
||||||
|
opacity: 0.55;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-adjust-link {
|
||||||
|
justify-self: start;
|
||||||
|
padding: 0;
|
||||||
|
background: transparent;
|
||||||
|
color: #2364b5;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.3;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-excretion-row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-excretion-row .primary-action {
|
||||||
|
min-height: 82px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-action-sheet {
|
||||||
|
padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
|
||||||
|
background: #fffdfa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-action-sheet-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-action-sheet-head h3 {
|
||||||
|
margin: 0;
|
||||||
|
color: #17202a;
|
||||||
|
font-size: 18px;
|
||||||
|
line-height: 1.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-duration-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||||
|
gap: 8px;
|
||||||
|
margin-top: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-time-fields {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-time-fields label {
|
||||||
|
display: grid;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-time-fields span {
|
||||||
|
color: #4b5563;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-time-fields input {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 42px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 1px solid #e2dbcd;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #ffffff;
|
||||||
|
padding: 8px 10px;
|
||||||
|
color: #17202a;
|
||||||
|
font: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sleep-sheet-submit {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 42px;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
.feeding {
|
.feeding {
|
||||||
background: #fff1cf;
|
background: #fff1cf;
|
||||||
}
|
}
|
||||||
@@ -1131,17 +1314,6 @@ button {
|
|||||||
box-shadow: 0 8px 16px rgba(164, 98, 8, 0.18);
|
box-shadow: 0 8px 16px rgba(164, 98, 8, 0.18);
|
||||||
}
|
}
|
||||||
|
|
||||||
.bf-quick-hint {
|
|
||||||
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 {
|
.bf-live-actions {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
@@ -2224,10 +2396,10 @@ button {
|
|||||||
|
|
||||||
/* 照护记录工具栏与按日分组样式 */
|
/* 照护记录工具栏与按日分组样式 */
|
||||||
.timeline-toolbar {
|
.timeline-toolbar {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 14px;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border-radius: 14px;
|
border-radius: 12px;
|
||||||
padding: 12px;
|
padding: 10px;
|
||||||
border: 1px solid #ede8de;
|
border: 1px solid #ede8de;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2239,35 +2411,16 @@ button {
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.timeline-toolbar-top {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.date-filter-box {
|
.date-filter-box {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background: #fdfbf7;
|
background: #fdfbf7;
|
||||||
border: 1px solid #e2dbcd;
|
border: 1px solid #e2dbcd;
|
||||||
border-radius: 8px;
|
border-radius: 9px;
|
||||||
padding: 3px 8px;
|
padding: 2px 8px;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.timeline-count-summary {
|
|
||||||
flex: 0 0 auto;
|
|
||||||
color: #65707d;
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 800;
|
|
||||||
}
|
|
||||||
|
|
||||||
.timeline-count-summary strong {
|
|
||||||
color: #8a540d;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.behavior-filter-row {
|
.behavior-filter-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -2279,14 +2432,21 @@ button {
|
|||||||
scrollbar-width: none;
|
scrollbar-width: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.behavior-filter-row.sheet {
|
||||||
|
margin-top: 16px;
|
||||||
|
padding-bottom: 0;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
.behavior-filter-row::-webkit-scrollbar {
|
.behavior-filter-row::-webkit-scrollbar {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.behavior-filter-chip {
|
.behavior-filter-chip {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
min-height: 30px;
|
min-height: 34px;
|
||||||
padding: 6px 11px;
|
padding: 7px 13px;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
background: #f4efe6;
|
background: #f4efe6;
|
||||||
color: #5d6470;
|
color: #5d6470;
|
||||||
@@ -2335,15 +2495,13 @@ button {
|
|||||||
|
|
||||||
.toolbar-actions {
|
.toolbar-actions {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 8px;
|
gap: 7px;
|
||||||
margin-top: 10px;
|
margin-top: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbar-actions .primary-pill-button,
|
.toolbar-actions .primary-pill-button,
|
||||||
.toolbar-actions .secondary-pill-button,
|
.toolbar-actions .secondary-pill-button {
|
||||||
.toolbar-actions .sort-toggle-btn,
|
min-height: 38px;
|
||||||
.toolbar-actions .manage-toggle-btn {
|
|
||||||
min-height: 34px;
|
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
@@ -2356,13 +2514,34 @@ button {
|
|||||||
|
|
||||||
.record-action-row.primary {
|
.record-action-row.primary {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
|
grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
.record-action-row.subtle {
|
.record-action-row.subtle {
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.toolbar-text-btn {
|
||||||
|
min-height: 30px;
|
||||||
|
padding: 5px 10px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #f8fafc;
|
||||||
|
color: #596575;
|
||||||
|
border: 1px solid #d7e0ea;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 800;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-text-btn.active {
|
||||||
|
background: #fff7df;
|
||||||
|
color: #8a540d;
|
||||||
|
border-color: #ead09d;
|
||||||
|
}
|
||||||
|
|
||||||
.sort-toggle-btn {
|
.sort-toggle-btn {
|
||||||
background: #f8fafc;
|
background: #f8fafc;
|
||||||
color: #475569;
|
color: #475569;
|
||||||
@@ -2410,7 +2589,7 @@ button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.timeline-meta-bar {
|
.timeline-meta-bar {
|
||||||
margin-top: 8px;
|
margin-top: 7px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #65707d;
|
color: #65707d;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -2428,6 +2607,78 @@ button {
|
|||||||
color: #1f2937;
|
color: #1f2937;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.timeline-filter-sheet {
|
||||||
|
padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
|
||||||
|
background: #fffdfa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-filter-sheet-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-filter-sheet-head h3 {
|
||||||
|
margin: 0;
|
||||||
|
color: #17202a;
|
||||||
|
font-size: 18px;
|
||||||
|
line-height: 1.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-filter-sheet-head p {
|
||||||
|
margin: 4px 0 0;
|
||||||
|
color: #72808f;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-filter-date-field {
|
||||||
|
display: grid;
|
||||||
|
gap: 8px;
|
||||||
|
margin-top: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-filter-date-field span {
|
||||||
|
color: #4b5563;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-filter-date-field .filter-date-input {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 42px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 1px solid #e2dbcd;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #ffffff;
|
||||||
|
padding: 8px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-close-btn {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
min-height: 32px;
|
||||||
|
padding: 5px 13px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #f4efe6;
|
||||||
|
color: #6f4b16;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-filter-sheet-actions {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-filter-sheet-actions .primary-pill-button,
|
||||||
|
.timeline-filter-sheet-actions .secondary-pill-button {
|
||||||
|
min-height: 40px;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
.timeline-groups {
|
.timeline-groups {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
# 2026-09-30 变更记录
|
||||||
|
|
||||||
|
## mobile-care-home-and-record-page-optimization
|
||||||
|
|
||||||
|
### 背景
|
||||||
|
|
||||||
|
照护页与记录页是新生儿家庭最高频使用的两个移动端页面。此前两个页面都存在首屏上半部分偏重的问题:
|
||||||
|
|
||||||
|
- 记录页顶部常驻日期、行为筛选、统计总数、排序、管理和两个补录入口,列表内容被明显下压。
|
||||||
|
- 照护页顶部展示家庭名、宝宝大卡片、生产方式和四宫格统计,真正的照护操作被推到较下方。
|
||||||
|
- 快速记录区中睡眠、小便、大便都使用大块按钮,部分低频辅助操作占用过多纵向空间。
|
||||||
|
|
||||||
|
本次调整以手机单手使用为优先,将页面从“概览看板”进一步收敛为“照护操作台”。
|
||||||
|
|
||||||
|
### 记录页调整
|
||||||
|
|
||||||
|
记录页保留两个不同补录场景,但重命名为更直观的用户语言:
|
||||||
|
|
||||||
|
- `补一组记录`:用于一次性补录一组可调整的照护行为。
|
||||||
|
- `补一条记录`:用于只补录一个单项行为。
|
||||||
|
|
||||||
|
记录页顶部进一步轻量化:
|
||||||
|
|
||||||
|
- 移除页面顶部 `记录` 标题。
|
||||||
|
- 移除顶部总数展示。
|
||||||
|
- 日期筛选与行为筛选统一收进底部筛选弹层。
|
||||||
|
- 顶部仅保留两个补录入口,以及轻量的 `筛选`、`倒序/正序`、`管理` 操作。
|
||||||
|
- 筛选按钮在有筛选条件时显示筛选数量,筛选状态在列表上方轻量提示。
|
||||||
|
|
||||||
|
### 照护页顶部调整
|
||||||
|
|
||||||
|
照护页顶部从“大宝宝信息卡 + 四宫格统计”改为轻量上下文与两行摘要:
|
||||||
|
|
||||||
|
- 顶部只保留宝宝名、出生天数和当前记录人切换。
|
||||||
|
- 移除顶部家庭名称展示。
|
||||||
|
- 移除首屏大头像、生产方式等低频信息。
|
||||||
|
- 今日摘要改为两行:
|
||||||
|
|
||||||
|
```text
|
||||||
|
喂奶 2 次 · 奶量 120ml
|
||||||
|
睡眠 0 分钟 · 小便 0 · 大便 0
|
||||||
|
```
|
||||||
|
|
||||||
|
其中 `奶量` 由今日记录中带 `amountMl` 的记录前端汇总得出。该值用于展示已经结构化记录的奶量,不代表亲喂摄入量估算。
|
||||||
|
|
||||||
|
### 喂养操作调整
|
||||||
|
|
||||||
|
亲喂区域继续作为照护页核心操作:
|
||||||
|
|
||||||
|
- 保留左右侧独立计时与切换。
|
||||||
|
- 亲喂非计时状态下,`补记 xx 分钟` 文案调整为 `速记 xx 分钟`。
|
||||||
|
- 删除“一键补记会按当前优先侧分配...”说明,减少操作前干扰。
|
||||||
|
|
||||||
|
### 快速记录调整
|
||||||
|
|
||||||
|
快速记录区按行为性质重新组织:
|
||||||
|
|
||||||
|
- 睡眠是状态型动作,小便和大便是单次动作。
|
||||||
|
- 未睡眠时展示:
|
||||||
|
|
||||||
|
```text
|
||||||
|
开始睡眠
|
||||||
|
速记睡眠
|
||||||
|
|
||||||
|
小便 大便
|
||||||
|
```
|
||||||
|
|
||||||
|
- 睡眠中展示:
|
||||||
|
|
||||||
|
```text
|
||||||
|
睡眠中 · 13:11 入睡 结束睡眠
|
||||||
|
调整入睡时间
|
||||||
|
|
||||||
|
小便 大便
|
||||||
|
```
|
||||||
|
|
||||||
|
交互规则:
|
||||||
|
|
||||||
|
- `开始睡眠` / `结束睡眠` 继续复用当前睡眠计时接口。
|
||||||
|
- `速记睡眠` 打开底部弹层,支持快速选择睡眠时长并生成一条完整睡眠记录。
|
||||||
|
- `调整入睡时间` 打开底部弹层,允许修改当前进行中睡眠的开始日期与开始时间。
|
||||||
|
- 小便、大便保持并排快捷按钮,减少纵向空间占用。
|
||||||
|
|
||||||
|
### 设计原则
|
||||||
|
|
||||||
|
- 首屏优先展示高频照护操作,而不是低频资料或管理信息。
|
||||||
|
- 筛选、排序、管理、调整时间等低频动作应弱化为轻入口或底部弹层。
|
||||||
|
- 摘要信息只提供当前操作所需的轻量上下文,不恢复为大面积统计卡。
|
||||||
|
- 文案尽量使用家庭照护语言,避免“批量”“流水”“管理台”等工具化表达。
|
||||||
|
|
||||||
|
### 暂不处理
|
||||||
|
|
||||||
|
- 暂不新增后端统计字段;今日奶量由前端基于 `summary.timeline` 汇总。
|
||||||
|
- 暂不估算亲喂奶量。
|
||||||
|
- 暂不重做整个今日页信息架构;本次只收紧顶部、喂养区文案和快速记录区。
|
||||||
|
- 暂不修改底部四个主 Tab。
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
- [2026-09-26.md](./2026-09-26.md): 2026-09-26 总体架构、MVP 边界、数据模型、后端规范、前端交互、照护记录与部署流程的集中变更记录。
|
- [2026-09-26.md](./2026-09-26.md): 2026-09-26 总体架构、MVP 边界、数据模型、后端规范、前端交互、照护记录与部署流程的集中变更记录。
|
||||||
- [2026-09-28.md](./2026-09-28.md): 2026-09-28 统计页跨天汇总与趋势回顾调整记录。
|
- [2026-09-28.md](./2026-09-28.md): 2026-09-28 统计页跨天汇总与趋势回顾调整记录。
|
||||||
- [2026-09-29.md](./2026-09-29.md): 2026-09-29 Vue 静态资源打入 Spring Boot Jar、记录页移动端时间线和结束时间补充提示的调整记录。
|
- [2026-09-29.md](./2026-09-29.md): 2026-09-29 Vue 静态资源打入 Spring Boot Jar、记录页移动端时间线和结束时间补充提示的调整记录。
|
||||||
|
- [2026-09-30.md](./2026-09-30.md): 2026-09-30 照护页与记录页移动端首屏轻量化、摘要条和快速记录交互优化记录。
|
||||||
|
|
||||||
## 记录原则
|
## 记录原则
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user