From a09205214e5cb6803563cb06c6d9f58d68916b73 Mon Sep 17 00:00:00 2001 From: xusd <hugeinfo123> Date: Mon, 16 Sep 2024 22:11:21 +0800 Subject: [PATCH] 调整网格调整,修正头部head数据传输逻辑 --- gz-customerSystem/src/components/Layout/Header.jsx | 21 +++++++++------------ 1 files changed, 9 insertions(+), 12 deletions(-) diff --git a/gz-customerSystem/src/components/Layout/Header.jsx b/gz-customerSystem/src/components/Layout/Header.jsx index c0d8f4a..bb24e9b 100644 --- a/gz-customerSystem/src/components/Layout/Header.jsx +++ b/gz-customerSystem/src/components/Layout/Header.jsx @@ -2,7 +2,7 @@ * @Company: hugeInfo * @Author: ldh * @Date: 2022-03-11 11:33:21 - * @LastEditTime: 2024-08-22 11:51:48 + * @LastEditTime: 2024-09-11 09:45:36 * @LastEditors: dminyi 1301963064@qq.com * @Version: 1.0.0 * @Description: 头部组件 @@ -13,6 +13,7 @@ import { Menu, Badge, Avatar, Dropdown, Space, Form, Input, Button, Radio } from 'antd'; import { BellOutlined, LogoutOutlined, UserOutlined, FormOutlined, UserSwitchOutlined, DownCircleFilled } from '@ant-design/icons'; import { mediationCenter, mediationCenter_active, operateCenter, operateCenter_active } from '../../assets/images/icon'; +import { yewu } from '../../assets/images'; import * as $$ from '../../utils/utility'; import MyMessage from '../../views/myMessage'; import MyModal from '../MyModal'; @@ -36,10 +37,9 @@ * handleClickMenu: function 头部导航点击 * handleChangeRole: function 切换角色 */ -const Header = ({ roleActive, headerMenu, headerMenuActive, headerUserChange, handleClickMenu, handleChangeRole }) => { - let navigate = useNavigate(); +const Header = ({ roleActive, headerMenu, headerMenuActive, headerUserChange, handleClickMenu, handleChangeRole,userData }) => { - const [data, setData] = useState([]); + let navigate = useNavigate(); // 修改密码窗口显示隐藏 const [visible, setVisible] = useState(false); @@ -51,7 +51,7 @@ const [myMessageVisible, setMyMessageVisible] = useState(false); const headerMenuIcon = { - 'mediate': { icon: mediationCenter, iconActive: mediationCenter_active }, + 'mediate': { icon: yewu, iconActive: yewu }, 'operation': { icon: operateCenter, iconActive: operateCenter_active }, }; @@ -72,7 +72,7 @@ const userMenu = ( <Menu> - {data?.ctUseroleList?.length > 1 && ( + {userData?.ctUseroleList?.length > 1 && ( <> <Menu.Item key="changeRole" onClick={() => setRoleModal({ visible: true, value: roleActive.id })}> <UserSwitchOutlined style={{ marginRight: '8px' }} /> @@ -109,9 +109,6 @@ } } - useEffect(() => { - setData($$.getLocal('customerSystemUser') || {}); - }, [headerUserChange]); return ( <header className="header"> @@ -154,9 +151,9 @@ <div className="header-user-avatar"> <Avatar icon={<UserOutlined />} /> <div> - <div className="header-user-name">{data?.trueName || '-'}</div> + <div className="header-user-name">{userData?.trueName || '-'}</div> <div className="header-user-unit"> - <span>{data?.unit || '-'}</span> + <span>{userData?.unit || '-'}</span> <span className="public-rightBorder">{roleActive.roleName || '-'}</span> <DownCircleFilled style={{ fontSize: '10px', marginLeft: '8px', color: '#ffffff' }} /> </div> @@ -172,7 +169,7 @@ value={roleModal.value} onChange={(e) => setRoleModal({ visible: true, value: e.target.value, name: e.target.label, roleCode: e.target.roleCode })} > - {data?.ctUseroleList?.map((x) => ( + {userData?.ctUseroleList?.map((x) => ( <Radio key={x.roleId} value={x.roleId} label={x.roleName} roleCode={x.roleCode}> {x.roleName} </Radio> -- Gitblit v1.8.0