feat: 更新用户设置模块
This commit is contained in:
@@ -36,6 +36,8 @@
|
||||
|
||||
<!-- 今日计划 -->
|
||||
<wd-card title="🎯 今日计划" custom-class="!mx-2 !mb-0">
|
||||
<wd-empty v-if="plans.length === 0" icon="no-content" tip="暂无计划" />
|
||||
|
||||
<view v-for="(plan, idx) in plans" :key="idx">
|
||||
<view class="flex items-center justify-between py-2.5">
|
||||
<view class="flex items-center gap-2.5">
|
||||
@@ -81,8 +83,8 @@ import {getDateStr, getDayRecords, getTimeStr} from '@/utils/record'
|
||||
import type { IHealthRecord } from "@/type/record";
|
||||
import { onShow } from "@dcloudio/uni-app";
|
||||
import appLogo from '@/static/logo.png'
|
||||
import {getOverview, getProfile} from "@/utils/profile";
|
||||
import type {IOverview} from "@/type/profile";
|
||||
import {getOverview, getPlan, getProfile} from "@/utils/profile";
|
||||
import type {IOverview, IPlan} from "@/type/profile";
|
||||
|
||||
const imgURL = appLogo
|
||||
|
||||
@@ -207,18 +209,37 @@ const plans = computed(() => {
|
||||
.reduce((sum, r) => sum + (r.duration || 0), 0)
|
||||
const sleepOnTime = list
|
||||
.filter(r => r.type === 'sleep')
|
||||
.some((r) => {
|
||||
const hour = new Date(r.startTime).getHours()
|
||||
return hour <= 23
|
||||
})
|
||||
const hasBp = list.some(r => r.type === 'bloodPressure')
|
||||
.some((r) => r.duration >= 8)
|
||||
const hasBloodPressure = list.some(r => r.type === 'bloodPressure')
|
||||
const hasBloodSugar = list.some(r => r.type === 'bloodSugar')
|
||||
const hasTemperature = list.some(r => r.type === 'temperature')
|
||||
|
||||
return [
|
||||
{ icon: '⚖️', label: '记录体重', done: hasWeight },
|
||||
{ icon: '❤️', label: '测量血压', done: hasBp },
|
||||
{ icon: '🏃', label: '运动30分钟', done: sportTotal >= 30 },
|
||||
{ icon: '🛏️', label: '23:00 前入睡', done: sleepOnTime },
|
||||
]
|
||||
|
||||
const planList = getPlan()
|
||||
const result = [] as IPlan[]
|
||||
|
||||
planList.forEach((item) => {
|
||||
if (item === 'weight') {
|
||||
result.push({ icon: '⚖️', label: '记录体重', done: hasWeight })
|
||||
}
|
||||
else if (item === 'sleep') {
|
||||
result.push({ icon: '😴️', label: '睡眠时长8小时', done: sleepOnTime })
|
||||
}
|
||||
else if (item === 'sport') {
|
||||
result.push({ icon: '🏃', label: '运动30分钟', done: sportTotal >= 30 })
|
||||
}
|
||||
else if (item === 'bloodPressure') {
|
||||
result.push({ icon: '❤️', label: '测量血压', done: hasBloodPressure })
|
||||
}
|
||||
else if (item === 'bloodSugar') {
|
||||
result.push({ icon: '🩸', label: '测量血糖', done: hasBloodSugar })
|
||||
}
|
||||
else if (item === 'temperature') {
|
||||
result.push({ icon: '🌡️', label: '记录体温', done: hasTemperature })
|
||||
}
|
||||
})
|
||||
|
||||
return result
|
||||
})
|
||||
|
||||
function handelFabClick() {
|
||||
|
||||
Reference in New Issue
Block a user