fix: 修复学校端 DashboardView 调用 getLessonTrend 参数错误
问题:前端 API 已改为传入 startDate 和 endDate,但 DashboardView.vue 仍传入数字 7 修复:改为计算 7 天前的日期和今天日期,以 YYYY-MM-DD 格式传递
This commit is contained in:
parent
c1f5b5085e
commit
1b1679585d
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user