diff --git a/src/components/Layout/index_new.jsx b/src/components/Layout/index_new.jsx
new file mode 100644
index 0000000..e69de29
diff --git a/src/components/Rank/index.jsx b/src/components/Rank/index.jsx
index d385c72..12cbfaa 100644
--- a/src/components/Rank/index.jsx
+++ b/src/components/Rank/index.jsx
@@ -1,6 +1,9 @@
import { Avatar, Skeleton } from "@arco-design/web-react";
import "./index.css";
+const positions = ["item2", "item1", "item3"];
+const icons = ["icon2", "icon1", "icon3"];
+
const Rank = ({ className, data = null, loading = false }) => {
if (loading) {
return (
@@ -11,7 +14,7 @@ const Rank = ({ className, data = null, loading = false }) => {
);
}
- if (!data || !data.rankings || data.rankings.length === 0) {
+ if (!data || !data?.rankings || data?.rankings?.length === 0) {
return (
班级排名
@@ -20,15 +23,15 @@ const Rank = ({ className, data = null, loading = false }) => {
);
}
- const rankings = data.rankings.slice(0, 6);
-
+ const rankings = data?.rankings?.slice(0, 6);
+
// 安全处理领奖台学生,确保至少有3个位置
const podiumStudents = [
rankings[1] || null, // 第2名
- rankings[0] || null, // 第1名
- rankings[2] || null // 第3名
+ rankings[0] || null, // 第1名
+ rankings[2] || null, // 第3名
];
-
+
const listStudents = rankings.slice(3);
return (
@@ -37,21 +40,11 @@ const Rank = ({ className, data = null, loading = false }) => {
{podiumStudents.map((student, index) => {
- const positions = ["item2", "item1", "item3"];
- const icons = ["icon2", "icon1", "icon3"];
-
- if (!student) {
- return (
- -
-
- -
-
-
- );
- }
-
- return (
- -
+ return student ? (
+
-
{student.avatar ? (
@@ -64,6 +57,15 @@ const Rank = ({ className, data = null, loading = false }) => {
+ ) : (
+ -
+
+ -
+
+
);
})}
diff --git a/src/components/Sidebar/index.jsx b/src/components/Sidebar/index.jsx
index 88b96bb..e1a1747 100644
--- a/src/components/Sidebar/index.jsx
+++ b/src/components/Sidebar/index.jsx
@@ -1,5 +1,6 @@
import { useNavigate, useLocation } from "react-router-dom";
import { Statistic } from "@arco-design/web-react";
+import { useSelector } from "react-redux";
import IconFont from "@/components/IconFont";
import Logo from "@/assets/images/Sidebar/logo.png";
import BTNICON from "@/assets/images/Sidebar/btn_icon.png";
@@ -9,6 +10,7 @@ import "./index.css";
const Sidebar = ({ isCollapsed, setIsCollapsed }) => {
const navigate = useNavigate();
const location = useLocation();
+ const studentInfo = useSelector((state) => state.student.studentInfo);
const handleNavClick = (path) => {
navigate(path);
diff --git a/src/pages/CompanyJobsListPage/index.jsx b/src/pages/CompanyJobsListPage/index.jsx
index e27b5f9..1f0787a 100644
--- a/src/pages/CompanyJobsListPage/index.jsx
+++ b/src/pages/CompanyJobsListPage/index.jsx
@@ -1,73 +1,46 @@
-import { useState, useEffect } from "react";
-import { useNavigate } from "react-router-dom";
+import { useState, useCallback } from "react";
+import JobList from "@/pages/CompanyJobsPage/components/JobList";
+import InfiniteScroll from "@/components/InfiniteScroll";
import { getJobsList } from "@/services";
import { mapJobList } from "@/utils/dataMapper";
-import JobList from "@/pages/CompanyJobsPage/components/JobList";
-
import "./index.css";
+const PAGE_SIZE = 20;
+
const CompanyJobsListPage = () => {
const [jobs, setJobs] = useState([]);
- const [loading, setLoading] = useState(true);
- const [page, setPage] = useState(1);
- const [total, setTotal] = useState(0);
- const navigate = useNavigate();
+ const [listPage, setListPage] = useState(1);
+ const [listHasMore, setListHasMore] = useState(true);
- useEffect(() => {
- fetchJobs();
- }, [page]);
-
- const fetchJobs = async () => {
- try {
- setLoading(true);
- const response = await getJobsList({
- page,
- pageSize: 20,
- isActive: true,
+ const fetchJobs = useCallback(async () => {
+ const res = await getJobsList({
+ page: listPage,
+ pageSize: PAGE_SIZE,
+ isActive: true,
+ });
+ if (res.success) {
+ const mappedJobs = mapJobList(res.data);
+ setJobs((prevList) => {
+ const newList = [...prevList, ...mappedJobs];
+ if (res.total === newList?.length) {
+ setListHasMore(false);
+ } else {
+ setListPage((prevPage) => prevPage + 1);
+ }
+ return newList;
});
-
- const mappedJobs = mapJobList(response.data || response);
- setJobs(mappedJobs);
- setTotal(response.total || mappedJobs.length);
- } catch (error) {
- console.error("Failed to fetch jobs:", error);
- setJobs([]);
- } finally {
- setLoading(false);
}
- };
-
- if (loading && jobs.length === 0) {
- return (
-
- );
- }
+ }, [listPage]);
return (
-
+
- {jobs.length === 0 && !loading && (
-
- 暂无岗位信息
-
- )}
-
+
);
};
diff --git a/src/pages/CompanyJobsPage/components/JobInfoModal/index.jsx b/src/pages/CompanyJobsPage/components/JobInfoModal/index.jsx
index a90ed43..9278d5e 100644
--- a/src/pages/CompanyJobsPage/components/JobInfoModal/index.jsx
+++ b/src/pages/CompanyJobsPage/components/JobInfoModal/index.jsx
@@ -1,10 +1,10 @@
-import { useState } from "react";
+import { useState, useCallback } from "react";
import { useSelector } from "react-redux";
import { Input } from "@arco-design/web-react";
import Modal from "@/components/Modal";
import InfiniteScroll from "@/components/InfiniteScroll";
-import ResumeInfoModal from "@/pages/CompanyJobsPage/components/ResumeInfoModal";
import FILEICON from "@/assets/images/CompanyJobsPage/file_icon.png";
+import ResumeInfoModal from "../ResumeInfoModal";
import { getResumesList } from "@/services";
import "./index.css";
@@ -24,7 +24,7 @@ export default ({ visible, onClose, data }) => {
onClose();
};
- const queryResumeList = async () => {
+ const queryResumeList = useCallback(async () => {
const res = await getResumesList({
page: listPage,
pageSize: PAGE_SIZE,
@@ -41,7 +41,7 @@ export default ({ visible, onClose, data }) => {
return newList;
});
}
- };
+ }, [listPage, studentInfo?.id]);
// 点击立即投递
const handleClickDeliverBtn = (e) => {
@@ -50,18 +50,19 @@ export default ({ visible, onClose, data }) => {
};
const onSearch = (value) => {
+ // todo
console.log(value);
};
// 选择简历投递
const userResumesClick = (item) => {
+ // todo
console.log(item);
};
// 点击简历详情
const userResumesBtnClick = (e, item) => {
e.stopPropagation();
- console.log(item);
setResumeInfoModalShow(true);
};
@@ -185,6 +186,7 @@ export default ({ visible, onClose, data }) => {
setResumeInfoModalShow(false)}
/>
>
diff --git a/src/pages/CompanyJobsPage/index.css b/src/pages/CompanyJobsPage/index.css
index b3f0295..0181d75 100644
--- a/src/pages/CompanyJobsPage/index.css
+++ b/src/pages/CompanyJobsPage/index.css
@@ -98,6 +98,7 @@
margin-bottom: 20px;
box-sizing: border-box;
padding: 20px;
+ list-style: none;
.company-jobs-page-interview-item-info {
width: 100%;
diff --git a/src/pages/Dashboard/components/EchartsProgress/index.jsx b/src/pages/Dashboard/components/EchartsProgress/index.jsx
index 2b7c8fe..5acd7a9 100644
--- a/src/pages/Dashboard/components/EchartsProgress/index.jsx
+++ b/src/pages/Dashboard/components/EchartsProgress/index.jsx
@@ -92,7 +92,7 @@ const EchartsProgress = ({
return () => {
window.removeEventListener("resize", resizeHandler);
};
- }, [percent, strokeWidth]);
+ }, [backgroundColor, percent, progressColor, strokeWidth]);
return ;
};
diff --git a/src/pages/Dashboard/components/TaskList/index.jsx b/src/pages/Dashboard/components/TaskList/index.jsx
index a70bea1..42ed918 100644
--- a/src/pages/Dashboard/components/TaskList/index.jsx
+++ b/src/pages/Dashboard/components/TaskList/index.jsx
@@ -12,41 +12,43 @@ const TaskList = ({ tasks = [], selectedDate, loading }) => {
}
const formatDate = (date) => {
- return date.toLocaleDateString('zh-CN', {
- year: 'numeric',
- month: 'long',
- day: 'numeric'
+ return date.toLocaleDateString("zh-CN", {
+ year: "numeric",
+ month: "long",
+ day: "numeric",
});
};
const getTaskTypeText = (type) => {
const typeMap = {
- 'HOMEWORK': '作业',
- 'PROJECT': '项目',
- 'REPORT': '报告',
- 'INTERVIEW': '面试',
- 'OTHER': '其他'
+ HOMEWORK: "作业",
+ PROJECT: "项目",
+ REPORT: "报告",
+ INTERVIEW: "面试",
+ OTHER: "其他",
};
return typeMap[type] || type;
};
- const getPriorityClass = (priority) => {
- const classMap = {
- 'URGENT': 'urgent',
- 'HIGH': 'high',
- 'MEDIUM': 'medium',
- 'LOW': 'low'
- };
- return classMap[priority] || 'medium';
- };
+ // const getPriorityClass = (priority) => {
+ // const classMap = {
+ // URGENT: "urgent",
+ // HIGH: "high",
+ // MEDIUM: "medium",
+ // LOW: "low",
+ // };
+ // return classMap[priority] || "medium";
+ // };
return (
事项 - {formatDate(selectedDate)}
- {tasks.length > 0 && ({tasks.length})}
+ {tasks.length > 0 && (
+ ({tasks.length})
+ )}
-
+
{tasks.length === 0 ? (
@@ -60,11 +62,11 @@ const TaskList = ({ tasks = [], selectedDate, loading }) => {
{item?.teacherAvatar ? (

) : (
- item?.teacherName?.charAt(0) || 'T'
+ item?.teacherName?.charAt(0) || "T"
)}
- {item?.teacherName || '未知教师'}
+ {item?.teacherName || "未知教师"}
{
{item?.duration}
-
+ {/*
{item.status === 'PENDING' ? '待完成' :
item.status === 'IN_PROGRESS' ? '进行中' :
item.status === 'COMPLETED' ? '已完成' : '未知'}
-
+ */}
diff --git a/src/pages/Dashboard/index.jsx b/src/pages/Dashboard/index.jsx
index 6700863..e94f4a7 100644
--- a/src/pages/Dashboard/index.jsx
+++ b/src/pages/Dashboard/index.jsx
@@ -30,7 +30,7 @@ const Dashboard = () => {
setDashboardData(response);
}
} catch (error) {
- console.error('Failed to fetch dashboard data:', error);
+ console.error("Failed to fetch dashboard data:", error);
} finally {
setLoading(false);
}
@@ -41,11 +41,11 @@ const Dashboard = () => {
if (!dashboardData?.tasks?.allTasks) return [];
// Check if date is valid before calling toISOString
if (!date || isNaN(date.getTime())) {
- console.warn('Invalid date provided to getTasksForDate:', date);
+ console.warn("Invalid date provided to getTasksForDate:", date);
return [];
}
- const dateStr = date.toISOString().split('T')[0];
- return dashboardData.tasks.allTasks.filter(task => task.date === dateStr);
+ const dateStr = date.toISOString().split("T")[0];
+ return dashboardData.tasks.allTasks.filter((task) => task.date === dateStr);
};
return (
@@ -53,29 +53,33 @@ const Dashboard = () => {