diff --git a/project.config.json b/project.config.json
new file mode 100644
index 0000000..038a843
--- /dev/null
+++ b/project.config.json
@@ -0,0 +1,28 @@
+{
+ "appid": "wx59440638480c6218",
+ "compileType": "miniprogram",
+ "libVersion": "3.17.1",
+ "packOptions": {
+ "ignore": [],
+ "include": []
+ },
+ "setting": {
+ "coverView": true,
+ "es6": true,
+ "postcss": true,
+ "minified": true,
+ "enhance": true,
+ "showShadowRootInWxmlPanel": true,
+ "packNpmRelationList": [],
+ "babelSetting": {
+ "ignore": [],
+ "disablePlugins": [],
+ "outputPath": ""
+ }
+ },
+ "condition": {},
+ "editorSetting": {
+ "tabIndent": "insertSpaces",
+ "tabSize": 2
+ }
+}
\ No newline at end of file
diff --git a/src/App.vue b/src/App.vue
index 0fc3ddb..683141e 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,11 +1,14 @@
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index 2712886..d8a234f 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -36,6 +36,8 @@
+
+
@@ -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() {
diff --git a/src/pages/record/index.vue b/src/pages/record/index.vue
index 24be1ca..84fec5f 100644
--- a/src/pages/record/index.vue
+++ b/src/pages/record/index.vue
@@ -157,7 +157,6 @@ function handleChangeSegment() {
}
function deleteClick(item: IHealthRecord) {
- console.log(item)
wx.showModal({
title: '提示',
content: '确定删除这条记录吗?',
diff --git a/src/pages/user/index.vue b/src/pages/user/index.vue
index 9dba9ea..8c5071c 100644
--- a/src/pages/user/index.vue
+++ b/src/pages/user/index.vue
@@ -21,9 +21,9 @@
-
-
-
+
+
+
@@ -31,6 +31,8 @@
+
+
@@ -38,8 +40,9 @@
import ProfilePopup from "@/components/Profile/ProfilePopup.vue";
import StoragePopup from "@/components/Profile/StoragePopup.vue";
import OverviewPopup from "@/components/Profile/OverviewPopup.vue";
+import PlanPopup from "@/components/Profile/PlanPopup.vue";
import { computed, ref, watch } from 'vue'
-import { getOverview, getProfile } from '@/utils/profile'
+import { getOverview, getPlan, getProfile } from '@/utils/profile'
import { useProfileStore } from '@/store/profile'
import type { IProfile } from "@/type/profile";
import { countRecordsByMonth, getTotalCount } from "@/utils/record";
@@ -72,6 +75,11 @@ function openOverviewPopup() {
profileStore.showOverviewPopup = true
}
+function openPlanPopup() {
+ profileStore.planList = getPlan()
+ profileStore.showPlanPopup = true
+}
+
function openStoragePopup() {
profileStore.storageStats = countRecordsByMonth()
profileStore.storageTotal = getTotalCount()
diff --git a/src/store/profile.ts b/src/store/profile.ts
index 4fea5f3..799f7ae 100644
--- a/src/store/profile.ts
+++ b/src/store/profile.ts
@@ -7,6 +7,7 @@ export const useProfileStore = defineStore('profile', {
showProfilePopup: false,
showStoragePopup: false,
showOverviewPopup: false,
+ showPlanPopup: false,
profileForm: {
gender: '',
height: 0,
@@ -15,6 +16,7 @@ export const useProfileStore = defineStore('profile', {
storageStats: [] as IStats[],
storageTotal: 0,
overviewList: [] as string[],
+ planList: [] as string[],
isRefresh: false,
}),
actions: {
diff --git a/src/type/profile.ts b/src/type/profile.ts
index 5ad5e1a..f25583e 100644
--- a/src/type/profile.ts
+++ b/src/type/profile.ts
@@ -7,6 +7,12 @@ export interface IProfile {
export interface IOverview {
icon: string
label: string
- value:string
+ value: string
sub: string
}
+
+export interface IPlan {
+ icon: string
+ label: string
+ done: boolean
+}
diff --git a/src/utils/profile.ts b/src/utils/profile.ts
index 7499548..970adbb 100644
--- a/src/utils/profile.ts
+++ b/src/utils/profile.ts
@@ -1,8 +1,8 @@
import type { IProfile } from "@/type/profile";
const PROFILE_KEY = 'user_profile'
-
const OVERVIEW_KEY = 'user_overview'
+const PLAN_KEY = 'user_plan'
function getEmptyProfile(): IProfile {
return {
@@ -28,3 +28,11 @@ export function saveOverview(data: string[]) {
wx.setStorageSync(OVERVIEW_KEY, data)
}
+export function getPlan(): string[] {
+ return wx.getStorageSync(PLAN_KEY) || []
+}
+
+export function savePlan(data: string[]) {
+ wx.setStorageSync(PLAN_KEY, data)
+}
+