From 837cabf05da320bbe998d379baf5ad5bed2ebd38 Mon Sep 17 00:00:00 2001 From: amypeng Date: Fri, 12 Jun 2026 08:49:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=AF=E5=88=86=E4=B8=AD=E5=BF=83=20?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 积分中心 注册返回 --- .../Information/Component/publicBanner.jsx | 52 +++++-------------- src/forge/Information/Pages/zoneUser.jsx | 3 +- src/forge/Information/index.jsx | 9 ++-- 3 files changed, 21 insertions(+), 43 deletions(-) diff --git a/src/forge/Information/Component/publicBanner.jsx b/src/forge/Information/Component/publicBanner.jsx index ce39a454..25bc003e 100644 --- a/src/forge/Information/Component/publicBanner.jsx +++ b/src/forge/Information/Component/publicBanner.jsx @@ -11,7 +11,6 @@ import uosIcon from "../img/uos.png"; const { Search } = Input; function PublicBanner(props) { - const [key, setKey] = useState("1"); const { deptId } = props.match.params; const { pathname } = props.history.location; const { data: { sectionHomepageShow, sectionHomepageTitle, sectionProjectShow, sectionDataSetShow, sectionDataSetTitle, sectionProjectTitle, sectionResourceShow, sectionResourceTitle, sectionCmsShow, sectionCmsTitle, sectionMemberShow, sectionPointsShow, sectionMemberTitle, sectionHelperShow, sectionHelperTitle }, data, adminUrl, temp, showLoginDialog, showNotification, checkIfLogin, id } = props; @@ -27,44 +26,21 @@ function PublicBanner(props) { return Boolean(sectionHomepageShow | sectionProjectShow | sectionDataSetShow | sectionResourceShow | sectionCmsShow | sectionMemberShow | sectionHelperShow | adminUrl) }, [sectionHomepageShow, sectionProjectShow, sectionDataSetShow, sectionResourceShow, sectionCmsShow, sectionMemberShow, sectionHelperShow, adminUrl]) - useEffect(() => { - if (pathname) { - const info = /[A-Za-z0-9]{0,}\/news/g; - const infodetail = /[A-Za-z0-9]{0,}\/newdetail/g; - const project = /[A-Za-z0-9]{0,}\/projects/g; - const source = /[A-Za-z0-9]{0,}\/source/g; - const vip = /[A-Za-z0-9]{0,}\/VIP/g; - const user = /[A-Za-z0-9]{0,}\/user/g; - const help = /[A-Za-z0-9]{0,}\/help/g; - const dataset = /[A-Za-z0-9]{0,}\/dataset/g; - const lesson = /[A-Za-z0-9]{0,}\/lessons/g; - if (pathname === `/zone/${deptId}`) { - setKey("1"); - } - else if (project.test(pathname)) { - setKey("2"); - } - else if (source.test(pathname)) { - setKey("3"); - } - else if (info.test(pathname) || infodetail.test(pathname)) { - setKey("4"); - } - else if (vip.test(pathname)) { - setKey("6"); - } - else if (help.test(pathname)) { - setKey("8"); - } - else if (dataset.test(pathname)) { - setKey("9"); - }else if(lesson.test(pathname)) { - setKey("10"); - } else if(user.test(pathname)) { - setKey("11"); - } + const key = useMemo(() => { + if (!pathname) return "1"; + if (pathname === `/zone/${deptId}`) return "1"; + if (/[A-Za-z0-9]{0,}\/projects/g.test(pathname)) return "2"; + if (/[A-Za-z0-9]{0,}\/source/g.test(pathname)) return "3"; + if (/[A-Za-z0-9]{0,}\/(news|newdetail)/g.test(pathname)) return "4"; + if (/[A-Za-z0-9]{0,}\/VIP/g.test(pathname)) return "6"; + if (/[A-Za-z0-9]{0,}\/help/g.test(pathname)) return "8"; + if (/[A-Za-z0-9]{0,}\/dataset/g.test(pathname)) return "9"; + if (/[A-Za-z0-9]{0,}\/lessons/g.test(pathname)) return "10"; + if (/[A-Za-z0-9]{0,}\/(user|score)/gi.test(pathname)) { + return (!adminUrl && sectionPointsShow) ? "11" : "1"; } - }, [pathname]) + return "1"; + }, [pathname, deptId, adminUrl, sectionPointsShow]) useEffect(() => { if (id && deptId && deptId === "NSCC") { diff --git a/src/forge/Information/Pages/zoneUser.jsx b/src/forge/Information/Pages/zoneUser.jsx index cba1a24c..d9c15482 100644 --- a/src/forge/Information/Pages/zoneUser.jsx +++ b/src/forge/Information/Pages/zoneUser.jsx @@ -245,7 +245,8 @@ function ZoneUser(props){ function apply() { if(checkIfLogin()===false){ - showLoginDialog() + // showLoginDialog() + showLoginDialog(`/zone/${deptId}/user`) return false; } setApplyVisible(!applyVisible) diff --git a/src/forge/Information/index.jsx b/src/forge/Information/index.jsx index f8b61d63..2e063c7d 100644 --- a/src/forge/Information/index.jsx +++ b/src/forge/Information/index.jsx @@ -149,6 +149,7 @@ const DataSetList = Loadable({ function Index(props){ const [ data , setData ] = useState(undefined); const [ adminUrl , setAdminUrl ] = useState(undefined); + const [ adminLoaded, setAdminLoaded ] = useState(false); const { deptId } = props.match.params; const [ id , setId ] = useState(undefined); const [ temp , setTemp ] = useState(tempEnum.zone); @@ -212,7 +213,7 @@ function Index(props){ }else{ setAdminUrl(undefined); } - }).catch(error=>{}) + }).catch(error=>{}).finally(() => setAdminLoaded(true)) } function getRole(id){ @@ -226,7 +227,7 @@ function Index(props){ return(
- { (!isSearch && !projectCateDetail && !isSourcedetail && deptId!=="apply") && (id ? :
)} + { (!isSearch && !projectCateDetail && !isSourcedetail && deptId!=="apply") && (id && adminLoaded ? :
)} )} > - {(!adminUrl && data && data.sectionPointsShow) && ( + {(adminLoaded && !adminUrl && data && data.sectionPointsShow) && ( ( @@ -332,7 +333,7 @@ function Index(props){ )} > )} - {(!adminUrl && data && data.sectionPointsShow) && ( + {(adminLoaded && !adminUrl && data && data.sectionPointsShow) && ( (