From 33192361be37c24b92cf2a62797b9f418f1fd462 Mon Sep 17 00:00:00 2001
From: Cxx0822 <1556464090@qq.com>
Date: Fri, 21 Aug 2026 15:48:35 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E8=AE=B0=E5=BD=95?=
=?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=BC=B9=E7=AA=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/Home/BpPopup.vue | 119 ++++++++++++++++++++
src/components/Home/GlucosePopup.vue | 114 ++++++++++++++++++++
src/components/Home/RecordPopup.vue | 115 ++++++++++++++++++++
src/components/Home/SleepPopup.vue | 146 +++++++++++++++++++++++++
src/components/Home/SportPopup.vue | 109 +++++++++++++++++++
src/components/Home/TempPopup.vue | 112 +++++++++++++++++++
src/components/Home/WeightPopup.vue | 69 ++++++++++++
src/pages/index/index.vue | 156 +++------------------------
src/pages/record/record.vue | 6 +-
src/store/record.ts | 79 ++++++++++++++
src/utils/index.ts | 8 ++
11 files changed, 885 insertions(+), 148 deletions(-)
create mode 100644 src/components/Home/BpPopup.vue
create mode 100644 src/components/Home/GlucosePopup.vue
create mode 100644 src/components/Home/RecordPopup.vue
create mode 100644 src/components/Home/SleepPopup.vue
create mode 100644 src/components/Home/SportPopup.vue
create mode 100644 src/components/Home/TempPopup.vue
create mode 100644 src/components/Home/WeightPopup.vue
create mode 100644 src/store/record.ts
diff --git a/src/components/Home/BpPopup.vue b/src/components/Home/BpPopup.vue
new file mode 100644
index 0000000..06a92a7
--- /dev/null
+++ b/src/components/Home/BpPopup.vue
@@ -0,0 +1,119 @@
+
+
+
+ 🩺 记录血压
+
+
+
+
+
+
+
+ mmHg
+
+
+
+
+
+
+
+ mmHg
+
+
+
+
+
+
+ bpm
+
+
+
+
+
+
+
+
+
+ 保存
+
+
+
+
+
+
diff --git a/src/components/Home/GlucosePopup.vue b/src/components/Home/GlucosePopup.vue
new file mode 100644
index 0000000..b5deaf7
--- /dev/null
+++ b/src/components/Home/GlucosePopup.vue
@@ -0,0 +1,114 @@
+
+
+
+ 💉 记录血糖
+
+
+
+
+
+
+
+ mmol/L
+
+
+
+
+
+
+
+ {{ item.label }}
+
+
+
+
+
+
+
+
+
+
+ 保存
+
+
+
+
+
+
diff --git a/src/components/Home/RecordPopup.vue b/src/components/Home/RecordPopup.vue
new file mode 100644
index 0000000..3285138
--- /dev/null
+++ b/src/components/Home/RecordPopup.vue
@@ -0,0 +1,115 @@
+
+
+
+ 选择记录类型
+
+
+
+
+ {{ item.icon }}
+
+ {{ item.label }}
+
+
+
+
+
+
diff --git a/src/components/Home/SleepPopup.vue b/src/components/Home/SleepPopup.vue
new file mode 100644
index 0000000..9c4729f
--- /dev/null
+++ b/src/components/Home/SleepPopup.vue
@@ -0,0 +1,146 @@
+
+
+
+ 💤 记录睡眠
+
+
+
+
+
+
+
+
+
+ {{ sleepDuration }}
+
+
+
+
+
+
+
+
+ 保存
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/Home/SportPopup.vue b/src/components/Home/SportPopup.vue
new file mode 100644
index 0000000..c6aebb3
--- /dev/null
+++ b/src/components/Home/SportPopup.vue
@@ -0,0 +1,109 @@
+
+
+
+ 🏃 记录运动
+
+
+
+
+
+
+
+ {{ item.label }}
+
+
+
+
+
+
+
+
+ 分钟
+
+
+
+
+
+
+
+
+ 保存
+
+
+
+
+
+
diff --git a/src/components/Home/TempPopup.vue b/src/components/Home/TempPopup.vue
new file mode 100644
index 0000000..e430c10
--- /dev/null
+++ b/src/components/Home/TempPopup.vue
@@ -0,0 +1,112 @@
+
+
+
+ 🌡️ 记录体温
+
+
+
+
+
+
+
+ ℃
+
+
+
+
+
+
+
+ {{ item.label }}
+
+
+
+
+
+
+
+
+
+
+ 保存
+
+
+
+
+
+
diff --git a/src/components/Home/WeightPopup.vue b/src/components/Home/WeightPopup.vue
new file mode 100644
index 0000000..d5c13f3
--- /dev/null
+++ b/src/components/Home/WeightPopup.vue
@@ -0,0 +1,69 @@
+
+
+
+ ⚖️ 记录体重
+
+
+
+
+
+
+ Kg
+
+
+
+
+
+
+
+ 保存
+
+
+
+
+
+
+
+
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index 1ed4a00..3802ef2 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -64,85 +64,21 @@
-
-
- 选择记录类型
-
-
-
-
- {{ item.icon }}
-
- {{ item.label }}
-
-
-
+
-
-
- ⚖️ 记录体重(Kg)
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
- 保存
-
-
-
-
-
-
-
+
diff --git a/src/pages/record/record.vue b/src/pages/record/record.vue
index be15044..7309df4 100644
--- a/src/pages/record/record.vue
+++ b/src/pages/record/record.vue
@@ -1,8 +1,6 @@
-
-
-
+
@@ -17,7 +15,7 @@
-
+
({
+ list: [] as any[],
+ loading: false,
+ showFab: true,
+ showRecordPopup: false,
+ showWeightPopup: false,
+ weightForm: {
+ value: 1,
+ note: '',
+ time: '' as number | string,
+ },
+ showSleepPopup: false,
+ sleepForm: {
+ startTime: '' as number | string,
+ endTime: '' as number | string,
+ note: '',
+ time: '' as number | string,
+ },
+ showSportPopup: false,
+ sportForm: {
+ type: '',
+ duration: 0,
+ note: '',
+ time: '' as number | string,
+ },
+ showBpPopup: false,
+ bpForm: {
+ systolic: 0,
+ diastolic: 0,
+ heartRate: 0,
+ time: Date.now(),
+ note: '',
+ },
+ showGlucosePopup: false,
+ glucoseForm: {
+ value: 0,
+ period: '' as string,
+ time: Date.now(),
+ note: '',
+ },
+ showTempPopup: false,
+ tempForm: {
+ value: 36.5,
+ location: '' as string,
+ time: Date.now(),
+ note: '',
+ },
+ }),
+ actions: {
+ setLoading(val: boolean) {
+ this.loading = val
+ },
+
+ async fetchList() {
+ this.loading = true
+ try {
+ const res = await fetch('/api/record/list')
+ this.list = await res.json()
+ }
+ finally {
+ this.loading = false
+ }
+ },
+
+ addRecord(item: any) {
+ this.list.push(item)
+ },
+
+ removeRecord(id: string) {
+ this.list = this.list.filter(item => item.id !== id)
+ },
+ reset() {
+
+ },
+ },
+})
diff --git a/src/utils/index.ts b/src/utils/index.ts
index f86d774..79007e3 100644
--- a/src/utils/index.ts
+++ b/src/utils/index.ts
@@ -149,3 +149,11 @@ export const isDoubleTokenMode = import.meta.env.VITE_AUTH_MODE === 'double'
* 通常为 /pages/index/index
*/
export const HOME_PAGE = `/${(pages as PageMetaDatum[]).find(page => page.type === 'home')?.path || (pages as PageMetaDatum[])[0].path}`
+
+export function formatTime(ts: string | number) {
+ if (!ts)
+ return ''
+ const d = new Date(ts)
+ const pad = (n: number) => String(n).padStart(2, '0')
+ return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`
+}