解决合并冲突: 整合班级排名功能和学习进度功能

- 保留完整的班级排名显示逻辑(领奖台+列表)
- 整合学习进度查询功能
- 兼容不同的响应数据格式
- 添加加载状态和错误处理
This commit is contained in:
2025-08-25 14:32:11 +08:00
26 changed files with 951 additions and 236 deletions

View File

@@ -6,7 +6,7 @@ import StudyStatus from "./components/StudyStatus";
import Rank from "@/components/Rank";
import StageProgress from "@/components/StageProgress";
import TaskList from "./components/TaskList";
import { getClassRanking } from "@/services/dashboard";
import { getClassRanking, getStudyRecordsProgress } from "@/services";
import "./index.css";
const Dashboard = () => {
@@ -15,13 +15,18 @@ const Dashboard = () => {
useEffect(() => {
fetchRankingData();
fetchLearningProgressSummary();
}, []);
// 获取班级排名数据
const fetchRankingData = async () => {
try {
setRankingLoading(true);
const response = await getClassRanking();
if (response) {
if (response && response.success) {
setRankingData(response.data);
} else if (response) {
// 兼容直接返回数据的情况
setRankingData(response);
}
} catch (error) {
@@ -31,6 +36,16 @@ const Dashboard = () => {
}
};
// 获取整体学习进度
const fetchLearningProgressSummary = async () => {
try {
const res = await getStudyRecordsProgress();
console.log("learningProgressSummary", res);
} catch (error) {
console.error('Failed to fetch learning progress:', error);
}
};
return (
<div className="dashboard">
<StageProgress showBlockageAlert={true} />