feat: 🎸 对接了一些接口
This commit is contained in:
@@ -16,7 +16,9 @@ const Layout = ({ children }) => {
|
|||||||
|
|
||||||
const queryLoginStudentInfo = async () => {
|
const queryLoginStudentInfo = async () => {
|
||||||
const res = await getLoginStudentInfo();
|
const res = await getLoginStudentInfo();
|
||||||
dispatch(setStudentInfo(res));
|
if (res.success) {
|
||||||
|
dispatch(setStudentInfo(res.data));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 初始化项目统一获取登录用户信息
|
// 初始化项目统一获取登录用户信息
|
||||||
|
|||||||
@@ -1,41 +1,23 @@
|
|||||||
import { Avatar } from "@arco-design/web-react";
|
import { Avatar } from "@arco-design/web-react";
|
||||||
import "./index.css";
|
import "./index.css";
|
||||||
|
|
||||||
const Rank = ({ className }) => {
|
const Rank = ({ className, data }) => {
|
||||||
return (
|
return (
|
||||||
<div className={`module-class-rank ${className}`}>
|
<div className={`module-class-rank ${className}`}>
|
||||||
<p className="module-class-rank-title">班级排名</p>
|
<p className="module-class-rank-title">班级排名</p>
|
||||||
|
|
||||||
<ul className="module-class-rank-podium">
|
<ul className="module-class-rank-podium">
|
||||||
<li className="module-class-rank-podium-item2">
|
{data?.rankings?.slice(0, 3)?.map((item) => (
|
||||||
<Avatar className="module-class-rank-podium-avatar">
|
<li className="module-class-rank-podium-item2" key={item.rank}>
|
||||||
<img
|
<Avatar className="module-class-rank-podium-avatar">
|
||||||
alt="avatar"
|
<img alt="avatar" src={item?.avatar} />
|
||||||
src="//p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/3ee5f13fb09879ecb5185e440cef6eb9.png~tplv-uwbnlip3yd-webp.webp"
|
</Avatar>
|
||||||
/>
|
<span className="module-class-rank-podium-name">
|
||||||
</Avatar>
|
{item.studentName}
|
||||||
<span className="module-class-rank-podium-name">你好呀</span>
|
</span>
|
||||||
<i className="module-class-rank-podium-icon2"></i>
|
<i className="module-class-rank-podium-icon2"></i>
|
||||||
</li>
|
</li>
|
||||||
<li className="module-class-rank-podium-item1">
|
))}
|
||||||
<Avatar className="module-class-rank-podium-avatar">
|
|
||||||
<img
|
|
||||||
alt="avatar"
|
|
||||||
src="//p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/3ee5f13fb09879ecb5185e440cef6eb9.png~tplv-uwbnlip3yd-webp.webp"
|
|
||||||
/>
|
|
||||||
</Avatar>
|
|
||||||
<span className="module-class-rank-podium-name">你好呀</span>
|
|
||||||
<i className="module-class-rank-podium-icon1"></i>
|
|
||||||
</li>
|
|
||||||
<li className="module-class-rank-podium-item3">
|
|
||||||
<Avatar className="module-class-rank-podium-avatar">
|
|
||||||
<img
|
|
||||||
alt="avatar"
|
|
||||||
src="//p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/3ee5f13fb09879ecb5185e440cef6eb9.png~tplv-uwbnlip3yd-webp.webp"
|
|
||||||
/>
|
|
||||||
</Avatar>
|
|
||||||
<span className="module-class-rank-podium-name">你好呀</span>
|
|
||||||
<i className="module-class-rank-podium-icon3"></i>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<ul className="module-class-rank-list">
|
<ul className="module-class-rank-list">
|
||||||
<li className="module-class-rank-list-item">
|
<li className="module-class-rank-list-item">
|
||||||
|
|||||||
@@ -1,14 +1,23 @@
|
|||||||
import "./index.css";
|
import { useNavigate } from "react-router-dom";
|
||||||
import icon1 from "@/assets/images/Dashboard/QuickAccess/icon1.png";
|
import icon1 from "@/assets/images/Dashboard/QuickAccess/icon1.png";
|
||||||
import icon2 from "@/assets/images/Dashboard/QuickAccess/icon2.png";
|
import icon2 from "@/assets/images/Dashboard/QuickAccess/icon2.png";
|
||||||
import icon3 from "@/assets/images/Dashboard/QuickAccess/icon3.png";
|
import icon3 from "@/assets/images/Dashboard/QuickAccess/icon3.png";
|
||||||
|
import "./index.css";
|
||||||
|
|
||||||
const QuickAccess = () => {
|
const QuickAccess = () => {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const handleClick = (path) => {
|
||||||
|
navigate(path);
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<div className="module-quick-access-wrapper">
|
<div className="module-quick-access-wrapper">
|
||||||
<p className="module-quick-access-title">快捷入口</p>
|
<p className="module-quick-access-title">快捷入口</p>
|
||||||
<ul className="module-quick-access-list">
|
<ul className="module-quick-access-list">
|
||||||
<li className="module-quick-access-item">
|
<li
|
||||||
|
className="module-quick-access-item"
|
||||||
|
onClick={() => handleClick("/expert-support")}
|
||||||
|
>
|
||||||
<img
|
<img
|
||||||
src={icon1}
|
src={icon1}
|
||||||
alt="icon1"
|
alt="icon1"
|
||||||
@@ -16,7 +25,10 @@ const QuickAccess = () => {
|
|||||||
/>
|
/>
|
||||||
<p className="module-quick-access-item-text">专家支持中心</p>
|
<p className="module-quick-access-item-text">专家支持中心</p>
|
||||||
</li>
|
</li>
|
||||||
<li className="module-quick-access-item">
|
<li
|
||||||
|
className="module-quick-access-item"
|
||||||
|
onClick={() => handleClick("/live")}
|
||||||
|
>
|
||||||
<img
|
<img
|
||||||
src={icon2}
|
src={icon2}
|
||||||
alt="icon1"
|
alt="icon1"
|
||||||
@@ -24,7 +36,10 @@ const QuickAccess = () => {
|
|||||||
/>
|
/>
|
||||||
<p className="module-quick-access-item-text">课程直播间</p>
|
<p className="module-quick-access-item-text">课程直播间</p>
|
||||||
</li>
|
</li>
|
||||||
<li className="module-quick-access-item">
|
<li
|
||||||
|
className="module-quick-access-item"
|
||||||
|
onClick={() => handleClick("/career-tree")}
|
||||||
|
>
|
||||||
<img
|
<img
|
||||||
src={icon3}
|
src={icon3}
|
||||||
alt="icon1"
|
alt="icon1"
|
||||||
|
|||||||
@@ -6,9 +6,31 @@ import StudyStatus from "./components/StudyStatus";
|
|||||||
import Rank from "@/components/Rank";
|
import Rank from "@/components/Rank";
|
||||||
import StageProgress from "@/components/StageProgress";
|
import StageProgress from "@/components/StageProgress";
|
||||||
import TaskList from "./components/TaskList";
|
import TaskList from "./components/TaskList";
|
||||||
|
import { getClassRanking, getLearningProgressSummary } from "@/services";
|
||||||
import "./index.css";
|
import "./index.css";
|
||||||
|
|
||||||
const Dashboard = () => {
|
const Dashboard = () => {
|
||||||
|
const [rankData, setRankData] = useState([]); // 班级排名数据
|
||||||
|
|
||||||
|
// 获取整体学习进度
|
||||||
|
const queryLearningProgressSummary = async () => {
|
||||||
|
const res = await getLearningProgressSummary({ period: "semester" });
|
||||||
|
console.log("learningProgressSummary", res);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取班级排名
|
||||||
|
const queryRankData = async () => {
|
||||||
|
const res = await getClassRanking();
|
||||||
|
if (res.success) {
|
||||||
|
setRankData(res.data);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
queryRankData();
|
||||||
|
queryLearningProgressSummary();
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="dashboard">
|
<div className="dashboard">
|
||||||
<StageProgress showBlockageAlert={true} />
|
<StageProgress showBlockageAlert={true} />
|
||||||
@@ -18,7 +40,7 @@ const Dashboard = () => {
|
|||||||
<QuickAccess />
|
<QuickAccess />
|
||||||
<CalendarTaskModule />
|
<CalendarTaskModule />
|
||||||
<StudyStatus />
|
<StudyStatus />
|
||||||
<Rank />
|
<Rank data={rankData} />
|
||||||
<TaskList />
|
<TaskList />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const ProfileCard = () => {
|
|||||||
<li className="profile-card-achievement-info-item">
|
<li className="profile-card-achievement-info-item">
|
||||||
<span className="profile-card-achievement-info-item-title">学分</span>
|
<span className="profile-card-achievement-info-item-title">学分</span>
|
||||||
<span className="profile-card-achievement-info-item-text">
|
<span className="profile-card-achievement-info-item-text">
|
||||||
{studentInfo?.totalCredits || 0}
|
{studentInfo?.myRank?.score || "-"}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li className="profile-card-achievement-info-item">
|
<li className="profile-card-achievement-info-item">
|
||||||
@@ -35,7 +35,7 @@ const ProfileCard = () => {
|
|||||||
班级排名
|
班级排名
|
||||||
</span>
|
</span>
|
||||||
<span className="profile-card-achievement-info-item-text">
|
<span className="profile-card-achievement-info-item-text">
|
||||||
{studentInfo?.badges?.classRank || "-"}
|
{studentInfo?.myRank?.rank || "-"}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li className="profile-card-achievement-info-item">
|
<li className="profile-card-achievement-info-item">
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import * as echarts from "echarts";
|
import * as echarts from "echarts";
|
||||||
import { useState, useEffect } from "react";
|
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import StudyProgress from "../StudyProgress";
|
import StudyProgress from "../StudyProgress";
|
||||||
import ScoreRingChart from "../ScoreRingChart";
|
import ScoreRingChart from "../ScoreRingChart";
|
||||||
import AttendanceRingChart from "../AttendanceRingChart";
|
import AttendanceRingChart from "../AttendanceRingChart";
|
||||||
import { getLoginStudentProgress } from "@/services";
|
import { getDashboardStatistics } from "@/services";
|
||||||
import "./index.css";
|
import "./index.css";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
|
||||||
const ringData = [
|
const ringData = [
|
||||||
{
|
{
|
||||||
@@ -54,17 +54,14 @@ const attendanceData = [
|
|||||||
const StudyStudes = () => {
|
const StudyStudes = () => {
|
||||||
const studentInfo = useSelector((state) => state.student.studentInfo);
|
const studentInfo = useSelector((state) => state.student.studentInfo);
|
||||||
|
|
||||||
const [progressData, setProgressData] = useState({});
|
// 获取仪表盘数据
|
||||||
|
const queryDashboardStatistics = async () => {
|
||||||
const queryLoginStudentProgress = async () => {
|
const res = await getDashboardStatistics();
|
||||||
const res = await getLoginStudentProgress();
|
console.log(res);
|
||||||
if (res.success) {
|
|
||||||
setProgressData(res.data);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
queryLoginStudentProgress();
|
queryDashboardStatistics();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,10 +1,40 @@
|
|||||||
|
import { useState, useEffect } from "react";
|
||||||
|
import { useDispatch } from "react-redux";
|
||||||
import ProfileCard from "./components/ProfileCard";
|
import ProfileCard from "./components/ProfileCard";
|
||||||
import Rank from "@/components/Rank";
|
import Rank from "@/components/Rank";
|
||||||
import StageProgress from "@/components/StageProgress";
|
import StageProgress from "@/components/StageProgress";
|
||||||
import StudyStudes from "./components/StudyStudes";
|
import StudyStudes from "./components/StudyStudes";
|
||||||
|
import { updateStudentInfo } from "@/store/slices/studentSlice";
|
||||||
|
import { getClassRanking, getLearningProgressSummary } from "@/services";
|
||||||
import "./index.css";
|
import "./index.css";
|
||||||
|
|
||||||
const PersonalProfile = () => {
|
const PersonalProfile = () => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const [rankData, setRankData] = useState([]); // 班级排名数据
|
||||||
|
|
||||||
|
const queryLearningProgressSummary = async () => {
|
||||||
|
const res = await getLearningProgressSummary({ period: "semester" });
|
||||||
|
console.log("learningProgressSummary", res);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取班级排名
|
||||||
|
const queryRankData = async () => {
|
||||||
|
const res = await getClassRanking();
|
||||||
|
if (res.success) {
|
||||||
|
const studentInfo = {
|
||||||
|
myRank: res.data.myRank,
|
||||||
|
classInfo: res.data.classInfo,
|
||||||
|
};
|
||||||
|
setRankData(res.data);
|
||||||
|
dispatch(updateStudentInfo(studentInfo));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
queryRankData();
|
||||||
|
queryLearningProgressSummary();
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="personal-profile">
|
<div className="personal-profile">
|
||||||
<StageProgress />
|
<StageProgress />
|
||||||
@@ -13,7 +43,7 @@ const PersonalProfile = () => {
|
|||||||
<div className="unified-profile-layout">
|
<div className="unified-profile-layout">
|
||||||
<div className="unified-profile-left">
|
<div className="unified-profile-left">
|
||||||
<ProfileCard />
|
<ProfileCard />
|
||||||
<Rank className="unified-profile-rank" />
|
<Rank className="unified-profile-rank" data={rankData} />
|
||||||
</div>
|
</div>
|
||||||
<div className="unified-profile-right">
|
<div className="unified-profile-right">
|
||||||
<StudyStudes />
|
<StudyStudes />
|
||||||
|
|||||||
@@ -1,30 +1,31 @@
|
|||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
|
|
||||||
// 获取当前学生的仪表板统计信息
|
// 获取当前学生的学习进度汇总
|
||||||
export async function getDashboardStatistics() {
|
export async function getLearningProgressSummary(queryParams = {}) {
|
||||||
return request({
|
return request({
|
||||||
url: `/api/dashboard/stats`,
|
url: `/api/dashboard/learning-summary`,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
params: queryParams,
|
||||||
namespace: "dashboardLoading",
|
namespace: "dashboardLoading",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取当前学生的学习进度汇总
|
// 获取我的任务
|
||||||
export async function getLearningProgressSummary(params = {}) {
|
export async function getMyTasks(queryParams = {}) {
|
||||||
return request({
|
return request({
|
||||||
url: `/api/dashboard/learning-summary`,
|
url: `/api/tasks/my-tasks`,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
params,
|
params: queryParams,
|
||||||
namespace: "dashboardLoading",
|
namespace: "dashboardLoading",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取当前学生班级排名
|
// 获取当前学生班级排名
|
||||||
export async function getClassRanking(params = {}) {
|
export async function getClassRanking(queryParams = {}) {
|
||||||
return request({
|
return request({
|
||||||
url: `/api/rankings/class`,
|
url: `/api/rankings/class`,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
params,
|
params: queryParams,
|
||||||
namespace: "dashboardLoading",
|
namespace: "dashboardLoading",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,35 +1,41 @@
|
|||||||
// 统一的API服务接口 - 基于当前认证用户
|
// 统一的API服务接口 - 基于当前认证用户
|
||||||
import {
|
import {
|
||||||
getDashboardStatistics,
|
|
||||||
getLearningProgressSummary,
|
getLearningProgressSummary,
|
||||||
|
getMyTasks,
|
||||||
getClassRanking,
|
getClassRanking,
|
||||||
} from "./dashboard";
|
} from "./dashboard";
|
||||||
import { getProjectsList } from "./projectLibrary";
|
import { getProjectsList } from "./projectLibrary";
|
||||||
import { getJobsList, getInterviewsList } from "./companyJobs";
|
import { getJobsList, getInterviewsList } from "./companyJobs";
|
||||||
import { getLoginStudentInfo } from "./global";
|
import { getLoginStudentInfo } from "./global";
|
||||||
import { getLoginStudentProgress, getClassRank, getMyRanking } from "./personalProfile";
|
import {
|
||||||
|
getDashboardStatistics,
|
||||||
|
getLoginStudentProgress,
|
||||||
|
getClassRank,
|
||||||
|
getMyRanking,
|
||||||
|
} from "./personalProfile";
|
||||||
import { getResumesList, getResumesDetail } from "./resumeInterview";
|
import { getResumesList, getResumesDetail } from "./resumeInterview";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
// 仪表盘相关
|
// 仪表盘相关
|
||||||
getDashboardStatistics, // 获取当前学生仪表盘统计
|
getMyTasks, // 获取我的任务
|
||||||
getLearningProgressSummary, // 获取当前学生学习进度汇总
|
getDashboardStatistics, // 获取当前学生仪表盘统计
|
||||||
|
getLearningProgressSummary, // 获取当前学生学习进度汇总
|
||||||
|
|
||||||
// 排名相关
|
// 排名相关
|
||||||
getClassRanking, // 获取当前学生班级排名
|
getClassRanking, // 获取当前学生班级排名
|
||||||
getMyRanking, // 获取当前学生详细排名信息
|
getMyRanking, // 获取当前学生详细排名信息
|
||||||
|
|
||||||
// 学生信息相关
|
// 学生信息相关
|
||||||
getLoginStudentInfo, // 获取当前登录学生基本信息
|
getLoginStudentInfo, // 获取当前登录学生基本信息
|
||||||
getLoginStudentProgress, // 获取当前学生学习进度
|
getLoginStudentProgress, // 获取当前学生学习进度
|
||||||
getClassRank, // 获取班级排名(别名)
|
getClassRank, // 获取班级排名(别名)
|
||||||
|
|
||||||
// 项目和作品相关
|
// 项目和作品相关
|
||||||
getProjectsList, // 获取项目列表
|
getProjectsList, // 获取项目列表
|
||||||
|
|
||||||
// 求职相关
|
// 求职相关
|
||||||
getJobsList, // 获取岗位列表
|
getJobsList, // 获取岗位列表
|
||||||
getInterviewsList, // 获取面试列表
|
getInterviewsList, // 获取面试列表
|
||||||
getResumesList, // 获取简历列表
|
getResumesList, // 获取简历列表
|
||||||
getResumesDetail, // 获取简历详情
|
getResumesDetail, // 获取简历详情
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,6 +9,15 @@ export async function getLoginStudentProgress() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取仪表板统计信息
|
||||||
|
export async function getDashboardStatistics() {
|
||||||
|
return request({
|
||||||
|
url: `/api/dashboard/stats`,
|
||||||
|
method: "GET",
|
||||||
|
namespace: "dashboardLoading",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 获取当前学生班级排名
|
// 获取当前学生班级排名
|
||||||
export async function getClassRank(queryParams = {}) {
|
export async function getClassRank(queryParams = {}) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@@ -49,24 +49,6 @@ axiosInstance.interceptors.response.use(
|
|||||||
(response) => {
|
(response) => {
|
||||||
// 处理响应数据
|
// 处理响应数据
|
||||||
const res = response.data;
|
const res = response.data;
|
||||||
|
|
||||||
// 后端统一返回格式 {success, data, message}
|
|
||||||
if (res.success !== undefined) {
|
|
||||||
if (res.success) {
|
|
||||||
// 如果有分页信息,保留完整结构
|
|
||||||
if (res.total !== undefined) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
// 否则只返回data
|
|
||||||
return res.data || res;
|
|
||||||
} else {
|
|
||||||
// 处理业务错误
|
|
||||||
console.error("业务错误:", res.message);
|
|
||||||
return Promise.reject(new Error(res.message || "请求失败"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 兼容直接返回数据的情况
|
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user