diff --git a/src/App.vue b/src/App.vue
index 182b7d8..0fc3ddb 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,6 +1,11 @@
diff --git a/src/components/Profile/ProfilePopup.vue b/src/components/Profile/ProfilePopup.vue
index 9d754f3..6e03a80 100644
--- a/src/components/Profile/ProfilePopup.vue
+++ b/src/components/Profile/ProfilePopup.vue
@@ -28,12 +28,6 @@
cm
-
-
-
- Kg
-
-
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index 1dfd4a2..2712886 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -1,16 +1,16 @@
-
-
-
-
- {{ greeting }}
-
-
- {{ today }}
-
-
+
+
+
+ {{ greeting }}
+
+
+ {{ today }}
+
+
+
@@ -18,22 +18,16 @@
-
-
- {{ item.icon }}
-
-
-
- {{ item.label }}
-
+ {{ item.icon }}
+ {{ item.label }}
-
+
{{ item.value }}
-
+
{{ item.sub }}
@@ -83,9 +77,14 @@ import GlucosePopup from "@/components/Home/GlucosePopup.vue";
import TempPopup from "@/components/Home/TempPopup.vue";
import { ref, computed, watch } from 'vue'
import { useRecordStore } from '@/store/record'
-import { countRecordsByMonth, getDateStr, getDayRecords } from '@/utils/record'
+import {getDateStr, getDayRecords, getTimeStr} from '@/utils/record'
import type { IHealthRecord } from "@/type/record";
-import {onShow} from "@dcloudio/uni-app";
+import { onShow } from "@dcloudio/uni-app";
+import appLogo from '@/static/logo.png'
+import {getOverview, getProfile} from "@/utils/profile";
+import type {IOverview} from "@/type/profile";
+
+const imgURL = appLogo
defineOptions({
name: 'Home',
@@ -130,43 +129,73 @@ const overviewItems = computed(() => {
// 体重:取最新一条
const weight = list.filter(r => r.type === 'weight').pop()
// 血压:取最新一条
- const bp = list.filter(r => r.type === 'bloodPressure').pop()
+ const bloodPressure = list.filter(r => r.type === 'bloodPressure').pop()
// 睡眠:取最新一条
const sleep = list.filter(r => r.type === 'sleep').pop()
// 运动:全部累加
const sports = list.filter(r => r.type === 'sport')
const sportTotal = sports.reduce((sum, r) => sum + (r.duration || 0), 0)
+ // 血糖:取最新一条
+ const bloodSugar = list.filter(r => r.type === 'bloodSugar').pop()
+ // 体温:取最新一条
+ const temperature = list.filter(r => r.type === 'temperature').pop()
- return [
- {
- icon: '⚖️',
- label: '体重',
- value: weight ? `${weight.value} kg` : '未记录',
- sub: '',
- bg: 'bg-[#E89E3A]',
- },
- {
- icon: '😴',
- label: '睡眠',
- value: sleep ? `${sleep.duration}h` : '未记录',
- sub: '',
- bg: 'bg-[#2E5B8C]',
- },
- {
- icon: '🏃',
- label: '运动',
- value: sportTotal > 0 ? `${sportTotal}min` : '0min',
- sub: sportTotal >= 30 ? '已达标' : '目标 30min',
- bg: 'bg-[#3A7C5B]',
- },
- {
- icon: '❤️',
- label: '血压',
- value: bp ? `${bp.systolic}/${bp.diastolic}` : '未记录',
- sub: '',
- bg: 'bg-[#C04A3C]',
- },
- ]
+ const overviewList = getOverview()
+ const result = [] as IOverview[]
+
+ overviewList.forEach((item) => {
+ if (item === 'weight') {
+ const profile = getProfile()
+ result.push({
+ icon: '⚖️',
+ label: '体重',
+ value: weight ? `${weight.value} kg` : '未记录',
+ sub: weight ? profile.height ? `BMI:${(weight.value / Math.pow(profile.height / 100, 2)).toFixed(2)} ` : '身高未知' : '',
+ })
+ }
+ else if (item === 'sleep') {
+ result.push({
+ icon: '😴',
+ label: '睡眠',
+ value: sleep ? `${sleep.duration}h` : '未记录',
+ sub: sleep ? `${getTimeStr(sleep.startTime)} ~ ${getTimeStr(sleep.endTime)}` : '',
+ })
+ }
+ else if (item === 'sport') {
+ result.push({
+ icon: '🏃',
+ label: '运动',
+ value: sportTotal > 0 ? `${sportTotal}min` : '0min',
+ sub: sportTotal >= 30 ? '已达标' : '目标 30min',
+ })
+ }
+ else if (item === 'bloodPressure') {
+ result.push({
+ icon: '❤️',
+ label: '血压',
+ value: bloodPressure ? `${bloodPressure.systolic}/${bloodPressure.diastolic}` : '未记录',
+ sub: bloodPressure ? `心率:${bloodPressure.heartRate}` : '',
+ })
+ }
+ else if (item === 'bloodSugar') {
+ result.push({
+ icon: '🩸',
+ label: '血糖',
+ value: bloodSugar ? `${bloodSugar.value}mmol/L` : '未记录',
+ sub: bloodSugar ? `${bloodSugar.period}` : '',
+ })
+ }
+ else if (item === 'temperature') {
+ result.push({
+ icon: '🌡️',
+ label: '体温',
+ value: temperature ? `${temperature.value}℃` : '未记录',
+ sub: temperature ? `${temperature.location}` : '',
+ })
+ }
+ })
+
+ return result
})
// 今日计划
diff --git a/src/pages/record/index.vue b/src/pages/record/index.vue
index 10071a9..24be1ca 100644
--- a/src/pages/record/index.vue
+++ b/src/pages/record/index.vue
@@ -13,64 +13,57 @@
-
+
+
+ {{ option.payload }}
+
+
-
-
{{ group.date }}
- 周{{ group.weekday }}
+ 周{{ group.weekday }}
-
-
-
-
-
-
+ class="mb-5 last:mb-0"
+ >
+
+
+
+ {{ item.time }}
+
+ {{ getRecordStatus(item).label }}
+
+
-
-
-
- {{ item.time }}
-
- {{ getRecordStatus(item).label }}
-
-
+
+ {{ getRecordMeta(item.type).icon }}
+ {{ getRecordMeta(item.type).label }}
+
-
-
- {{ getRecordMeta(item.type).icon }}
-
- {{ getRecordMeta(item.type).label }}
-
+
+ {{ getRecordValue(item) }}
+
+
- {{ getRecordValue(item) }}
-
-
- {{ item.note }}
-
+
+ {{ item.note }}
+
@@ -91,6 +84,7 @@