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',