From 63a1e126addc119d612d82cf75dd68519160445c Mon Sep 17 00:00:00 2001 From: Cxx0822 <1556464090@qq.com> Date: Wed, 12 Nov 2025 19:41:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=A2=9E=E5=8A=A0=E5=81=A5=E5=BA=B7?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=9B=BE=E8=A1=A8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Health/HealthChart.vue | 84 +++++++++++++++++++++++++++ src/components/Health/HealthStats.vue | 36 ++++++++++++ src/layout/TabBar.vue | 5 ++ src/store/health.ts | 9 ++- src/views/health/calendar.vue | 14 ++--- src/views/health/chart.vue | 31 ++++++++++ src/views/meta.ts | 4 ++ 7 files changed, 174 insertions(+), 9 deletions(-) create mode 100644 src/components/Health/HealthChart.vue create mode 100644 src/components/Health/HealthStats.vue create mode 100644 src/views/health/chart.vue diff --git a/src/components/Health/HealthChart.vue b/src/components/Health/HealthChart.vue new file mode 100644 index 0000000..a0ed59d --- /dev/null +++ b/src/components/Health/HealthChart.vue @@ -0,0 +1,84 @@ + + + diff --git a/src/components/Health/HealthStats.vue b/src/components/Health/HealthStats.vue new file mode 100644 index 0000000..f442cfb --- /dev/null +++ b/src/components/Health/HealthStats.vue @@ -0,0 +1,36 @@ + + + diff --git a/src/layout/TabBar.vue b/src/layout/TabBar.vue index 6aff6cd..3de05ba 100644 --- a/src/layout/TabBar.vue +++ b/src/layout/TabBar.vue @@ -53,6 +53,11 @@ 记录 + + + 统计 + diff --git a/src/store/health.ts b/src/store/health.ts index 65838d5..63a8e3a 100644 --- a/src/store/health.ts +++ b/src/store/health.ts @@ -3,6 +3,7 @@ import type { IHandleApi } from 'vue3-common/types' import { queryHealthApi, updateHealthApi } from '@/apis/health.ts' import { IHealth, IHealthQuery } from '@/types/health' import { ElMessage } from 'element-plus' +import { getCurrentMonth, formatDate, getStartEndDate } from 'vue3-common/utils/dateUtil' export const useHealthStore = defineStore('health', { state: () => ({ @@ -11,6 +12,7 @@ export const useHealthStore = defineStore('health', { startDate: '', endDate: '' } as IHealthQuery, + queryMonth: getCurrentMonth(), healthApiType: 'ADD' as IHandleApi, currentHealth: { sportProject: '', @@ -20,7 +22,8 @@ export const useHealthStore = defineStore('health', { } as IHealth, selectDate: '', isScrollEnd: false, - isRefresh: false + isRefresh: false, + isLoading: false }), actions: { async queryHealthRecordList() { @@ -41,8 +44,12 @@ export const useHealthStore = defineStore('health', { } }, async refreshInfo() { + this.isLoading = true + const result = getStartEndDate(formatDate(this.queryMonth), 'month') + this.queryInfo = { startDate: result[0], endDate: result[1] } await this.queryHealthRecordList() this.isRefresh = !this.isRefresh + this.isLoading = false }, getEmptyHealth(date: string): IHealth { return { diff --git a/src/views/health/calendar.vue b/src/views/health/calendar.vue index 9096f54..407a334 100644 --- a/src/views/health/calendar.vue +++ b/src/views/health/calendar.vue @@ -12,14 +12,15 @@ diff --git a/src/views/health/chart.vue b/src/views/health/chart.vue new file mode 100644 index 0000000..86e0cad --- /dev/null +++ b/src/views/health/chart.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/src/views/meta.ts b/src/views/meta.ts index 02cf238..b5ad653 100644 --- a/src/views/meta.ts +++ b/src/views/meta.ts @@ -89,6 +89,10 @@ export const mobileHomeMeta: IRouteMetaConfig = { title: '记录', icon: '' }, + '/health/chart': { + title: '统计', + icon: '' + }, '/plan': { title: '时光日程', icon: 'home-calendar',