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/index.jsx | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/gz-customerSystem/src/components/Layout/index.jsx b/gz-customerSystem/src/components/Layout/index.jsx index daa4cc1..1b04597 100644 --- a/gz-customerSystem/src/components/Layout/index.jsx +++ b/gz-customerSystem/src/components/Layout/index.jsx @@ -55,6 +55,7 @@ //网格跳转请求状态 const [gridStatus, setGridStatus] = useState(false) const [searchParams] = useSearchParams(); + const [userData, setUserData] = useState({}); // 切换头部menu @@ -122,6 +123,8 @@ $$.clearSessionStorage(); $$.setSessionStorage('customerSystemToken', res.data?.token); $$.setLocal('customerSystemUser', res.data || {}); + console.log('getGridToken', res.data); + setUserData(res.data || {}) let ctUseroleList = res.data?.ctUseroleList || []; console.log(ctUseroleList); const roleId = ctUseroleList[0]?.roleId @@ -136,6 +139,7 @@ } } } + // 初始化 格式化数据适应菜单栏 useEffect(() => { @@ -154,6 +158,7 @@ return; } let customerSystemUser = $$.getLocal('customerSystemUser'); + setUserData(customerSystemUser || {}) let ctUseroleList = customerSystemUser?.ctUseroleList || []; if (ctUseroleList[0]?.roleId) { setRoleActive({ id: ctUseroleList[0]?.roleId, roleName: ctUseroleList[0]?.roleName, powerMap: {} }); @@ -212,6 +217,10 @@ getRolePower(roleActive.id, roleActive.roleName); } }, [roleActive.id]); + useEffect(() => { + let customerSystemUser = $$.getLocal('customerSystemUser'); + setUserData(customerSystemUser || {}); + }, [headerUserChange]); console.log(gridStatus); return ( <> @@ -222,6 +231,7 @@ handleClickMenu={handleClickHeaderMenu} headerUserChange={headerUserChange} handleChangeRole={handleChangeRole} + userData={userData} /> {gridStatus && isNotNav ? ( <main className="layout-main" id="layoutMain"> -- Gitblit v1.8.0