fix: 修复学校端 DashboardView 调用 getLessonTrend 参数错误

问题:前端 API 已改为传入 startDate 和 endDate,但 DashboardView.vue 仍传入数字 7
修复:改为计算 7 天前的日期和今天日期,以 YYYY-MM-DD 格式传递
This commit is contained in:
En 2026-03-23 09:52:48 +08:00
parent c1f5b5085e
commit 1b1679585d

View File

@ -653,11 +653,13 @@ const loadCourseStats = async () => {
}
};
//
// 7
const loadTrendData = async () => {
trendLoading.value = true;
try {
const data = await getLessonTrend(7);
const endDate = new Date().toISOString().split('T')[0];
const startDate = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0];
const data = await getLessonTrend(startDate, endDate);
lessonTrendData.value = data;
} catch (error) {
console.error('Failed to load trend data:', error);