forked from Gitlink/forgeplus-react
parent
7eb4809a8d
commit
837cabf05d
|
|
@ -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") {
|
||||
|
|
|
|||
|
|
@ -245,7 +245,8 @@ function ZoneUser(props){
|
|||
|
||||
function apply() {
|
||||
if(checkIfLogin()===false){
|
||||
showLoginDialog()
|
||||
// showLoginDialog()
|
||||
showLoginDialog(`/zone/${deptId}/user`)
|
||||
return false;
|
||||
}
|
||||
setApplyVisible(!applyVisible)
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
<div className="information_main">
|
||||
{ (!isSearch && !projectCateDetail && !isSourcedetail && deptId!=="apply") && (id ? <PublicBanner {...props} data={data} temp={ temp } adminUrl={adminUrl} id={id}/> : <div style={{ width: '100%', height: '450px' }}></div>)}
|
||||
{ (!isSearch && !projectCateDetail && !isSourcedetail && deptId!=="apply") && (id && adminLoaded ? <PublicBanner {...props} data={data} temp={ temp } adminUrl={adminUrl} id={id}/> : <div style={{ width: '100%', height: '450px' }}></div>)}
|
||||
<Switch>
|
||||
<Route
|
||||
path="/zone/:deptId/news/self"
|
||||
|
|
@ -324,7 +325,7 @@ function Index(props){
|
|||
<VIP {...props} {...p} id={id} temp={ temp } sectionMemberTitle={data && data.sectionMemberTitle}/>
|
||||
)}
|
||||
></Route>
|
||||
{(!adminUrl && data && data.sectionPointsShow) && (
|
||||
{(adminLoaded && !adminUrl && data && data.sectionPointsShow) && (
|
||||
<Route
|
||||
path="/zone/:deptId/user"
|
||||
render={(p) => (
|
||||
|
|
@ -332,7 +333,7 @@ function Index(props){
|
|||
)}
|
||||
></Route>
|
||||
)}
|
||||
{(!adminUrl && data && data.sectionPointsShow) && (
|
||||
{(adminLoaded && !adminUrl && data && data.sectionPointsShow) && (
|
||||
<Route
|
||||
path="/zone/:deptId/score"
|
||||
render={(p) => (
|
||||
|
|
|
|||
Loading…
Reference in New Issue