fix(miniprogram): 小程序审计修复 — 安全加固+功能链路+输入验证
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled

安全修复:
- H1: Token 刷新竞态条件 → Singleton Promise 模式防止并发刷新
- H4: 移除 store 中的 token 明文状态,统一走 secure storage
- H5: 登录/绑定手机号添加 loading 防重复点击保护
- H6: Analytics 改用 request.ts 统一请求层,不再绕过认证
- M1: logout 清理所有残留数据(openid/tenant_id/analytics_queue)
- M2/M7: 敏感数据(user/openid/tenant_id)统一走加密存储
- M3: 移除开发日志中的请求体打印
- M4: secure-storage 解密失败返回 null 而非空串

功能修复:
- F1: 今日体征概览 API 支持 patient_id 查询参数(后端+前端)
- F2: 积分商城对无患者档案用户展示引导 UI
- M6: daily-monitoring 添加 Zod 数值范围验证

清理:
- L4: 移除 devLogin 开发辅助函数
This commit is contained in:
iven
2026-04-27 00:41:30 +08:00
parent 2defbd7ab3
commit 3424a33b6b
12 changed files with 198 additions and 63 deletions

View File

@@ -1,6 +1,6 @@
---
title: 微信小程序(患者端)
updated: 2026-04-25
updated: 2026-04-26
status: active
tags: [miniprogram, taro, wechat, patient]
---
@@ -55,25 +55,59 @@ POST /auth/wechat/login { code }
后端解密手机号 → 创建/关联用户 → 返回 JWT → 跳转首页
```
### 页面结构(20 个页面10 个目录)
### 页面结构(40 个页面15 个目录)
#### 患者端页面
| 页面路径 | 说明 |
|----------|------|
| `pages/login/index` | 登录页(微信登录 + 协议勾选) |
| `pages/index/index` | 首页(今日健康、快捷服务) |
| `pages/health/trend/index` | 健康趋势(体征数据折线图 |
| `pages/health/index` | 健康上报Tab 页 |
| `pages/health/input/index` | 健康数据录入Zod 验证) |
| `pages/health/trend/index` | 健康趋势(体征数据折线图) |
| `pages/health/daily-monitoring/index` | 日常监测数据 |
| `pages/appointment/index` | 预约列表 |
| `pages/appointment/create/index` | 预约挂号 |
| `pages/appointment/detail/index` | 预约详情 |
| `pages/article/index` | 健康资讯 |
| `pages/profile/index` | 个人中心 |
| `pages/profile/family/index` | 家庭成员管理 |
| `pages/article/index` | 健康资讯列表 |
| `pages/article/detail/index` | 文章详情 |
| `pages/report/detail/index` | 健康报告详情 |
| `pages/ai-report/list/index` | AI 分析报告列表 |
| `pages/ai-report/detail/index` | AI 分析报告详情 |
| `pages/followup/detail/index` | 随访详情 |
| `pages/report/index` | 健康报告查看 |
| `pages/consultation/index` | 咨询列表Tab 页) |
| `pages/consultation/detail/index` | 咨询详情 |
| `pages/mall/index` | 积分商城Tab 页) |
| `pages/mall/detail/index` | 商品详情 |
| `pages/mall/exchange/index` | 积分兑换 |
| `pages/mall/orders/index` | 积分订单 |
| `pages/events/index` | 线下活动 |
| `pages/profile/index` | 个人中心Tab 页) |
| `pages/profile/family/index` | 家庭成员管理 |
| `pages/profile/family-add/index` | 添加家庭成员 |
| `pages/profile/reports/index` | 我的报告 |
| `pages/profile/followups/index` | 我的随访 |
| `pages/profile/medication/index` | 用药记录 |
| `pages/profile/settings/index` | 设置 |
| `pages/legal/user-agreement` | 用户服务协议 |
| `pages/legal/privacy-policy` | 隐私政策 |
### 服务层10 个文件
#### 医护端页面8 个
| 页面路径 | 说明 |
|----------|------|
| `pages/doctor/index` | 医护首页 |
| `pages/doctor/patients/index` | 患者列表 |
| `pages/doctor/patients/detail/index` | 患者详情 |
| `pages/doctor/consultation/index` | 咨询管理 |
| `pages/doctor/consultation/detail/index` | 咨询详情 |
| `pages/doctor/followup/index` | 随访管理 |
| `pages/doctor/followup/detail/index` | 随访详情 |
| `pages/doctor/report/index` | 报告管理 |
| `pages/doctor/report/detail/index` | 报告详情 |
### 服务层10+ 个文件)
| 文件 | 覆盖 |
|------|------|
@@ -201,5 +235,6 @@ secret = "<通过环境变量 ERP__WECHAT__SECRET 设置>"
| 日期 | 变更 |
|------|------|
| 2026-04-26 | 全面更新40 页面(含 9 个医护端页面、15 目录、5 个 Tab 页、积分商城、线下活动 |
| 2026-04-25 | 全面更新20 页面、10 服务、9 组件、Zod 验证、加密密钥外部化说明 |
| 2026-04-24 | 创建小程序 wiki 页面,记录登录流程、环境配置、历史陷阱 |