diff --git a/src/main/resources/app2/src/services/studentDrinkStatsService.js b/src/main/resources/app2/src/services/studentDrinkStatsService.js new file mode 100644 index 0000000..027be23 --- /dev/null +++ b/src/main/resources/app2/src/services/studentDrinkStatsService.js @@ -0,0 +1,49 @@ +// src/services/studentDrinkStatsService.js +import apiClient from '@/services/api' + +export const studentDrinkStatsService = { + /** + * 获取今日饮水统计 + */ + async getTodayStats(studentId) { + try { + const response = await apiClient.post('/api/student/drink-stats/today', { + studentId: studentId + }) + return response.data + } catch (error) { + console.error('获取今日饮水统计失败:', error) + throw error + } + }, + + /** + * 获取本周饮水统计 + */ + async getThisWeekStats(studentId) { + try { + const response = await apiClient.post('/api/student/drink-stats/this-week', { + studentId: studentId + }) + return response.data + } catch (error) { + console.error('获取本周饮水统计失败:', error) + throw error + } + }, + + /** + * 获取本月饮水统计 + */ + async getThisMonthStats(studentId) { + try { + const response = await apiClient.post('/api/student/drink-stats/this-month', { + studentId: studentId + }) + return response.data + } catch (error) { + console.error('获取本月饮水统计失败:', error) + throw error + } + } +} diff --git a/src/main/resources/app2/src/views/ProfilePage.vue b/src/main/resources/app2/src/views/ProfilePage.vue index 0669cfb..29fb07e 100644 --- a/src/main/resources/app2/src/views/ProfilePage.vue +++ b/src/main/resources/app2/src/views/ProfilePage.vue @@ -39,18 +39,36 @@