Files
teach_sys_Demo/src/components/Sidebar/index.jsx
KQL 4e0e96e6b8 UI优化更新:面试模拟、简历面试、项目库、求职策略等多个页面改进
主要更新:
- 面试模拟页:移除上滑查看评价,添加渐进式评分(72→81→89)
- 简历面试页:添加岗位头像、标签背景、面试题加粗等视觉优化
- 项目库页:添加"我完成的项目库"板块,增加hover效果
- 求职策略详情页:优化圆柱体和矩形对齐,添加CSV岗位数据,调整批次文字位置
- 企业岗位列表页:添加返回按钮功能
- 全局:统一岗位级别术语(普通岗/技术骨干岗/储备干部岗)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-05 20:46:03 +08:00

97 lines
3.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 ICON from "@/assets/images/Sidebar/sidebar_icon.png";
import ICONRETRACT from "@/assets/images/Sidebar/logo.png";
import BTNICON from "@/assets/images/Sidebar/btn_icon.png";
import routes from "@/routes";
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);
};
// 切换侧边栏展开/折叠状态
const toggleSidebar = () => {
setIsCollapsed((prev) => !prev);
};
return (
<div
className={`${
!isCollapsed
? "sidebar-retract-wrapper sidebar-expand-wrapper"
: "sidebar-expand-wrapper"
}`}
>
<div className="sidebar-title">
<img src={isCollapsed ? ICON : ICONRETRACT} alt="icon" />
</div>
<div className="user-info-wrapper">
<img
alt="avatar"
className="user-avatar"
src={studentInfo?.avatar || "//p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/3ee5f13fb09879ecb5185e440cef6eb9.png~tplv-uwbnlip3yd-webp.webp"}
/>
{isCollapsed && (
<div className="user-info">
<span className="user-name">{studentInfo?.realName}</span>
<span className="user-id">学号{studentInfo?.id}</span>
</div>
)}
</div>
<Statistic
className="visitor-count"
groupSeparator
value={87}
prefix="HR访问量"
/>
<ul className="sidebar-menu">
{routes
.filter((item) => item.showMenu)
?.map((item) => (
<div key={item.key} className="sidebar-menu-item-wrapper">
<p className="sidebar-menu-title">{item.name}</p>
{item.routes
?.filter((i) => i.showMenuItem)
?.map((j) => (
<li
className={
location.pathname === j.path ||
(j.path === '/company-jobs' && location.pathname === '/company-jobs-list') ||
(j.path === '/job-strategy' && location.pathname === '/job-strategy-detail')
? "sidebar-menu-item-active sidebar-menu-item"
: "sidebar-menu-item"
}
key={j.path}
onClick={() => handleNavClick(j.path)}
>
<IconFont
className="sidebar-menu-icon"
src={
location.pathname === j.path ||
(j.path === '/company-jobs' && location.pathname === '/company-jobs-list') ||
(j.path === '/job-strategy' && location.pathname === '/job-strategy-detail')
? j.active
: j.default
}
/>
<span className="sidebar-menu-text">{j.name}</span>
</li>
))}
</div>
))}
</ul>
<div className="sidebar-btn" onClick={toggleSidebar}>
<img src={BTNICON} alt="btn" className="sidebar-btn-icon" />
</div>
</div>
);
};
export default Sidebar;