diff --git a/src/layout/Sider.js b/src/layout/Sider.js index 90723ff..6f9f022 100644 --- a/src/layout/Sider.js +++ b/src/layout/Sider.js @@ -90,7 +90,12 @@ const Sider = (props) => { /** 回到首页 */ const navToHome = () => { setActiveMenu(null); - props.history.push({ pathname: "/home" }); + if (localStorage.getItem("webOrgId") == '00300000-0000-0000-0000-000000000000' ) { + props.history.replace('/grouphome') + }else{ + props.history.replace('/home') + } + // props.history.push({ pathname: "/home" }); }; const navToLarge = () => { setActiveMenu('largeScreen'); diff --git a/src/models/app.js b/src/models/app.js index b65403c..c61fa76 100644 --- a/src/models/app.js +++ b/src/models/app.js @@ -26,7 +26,13 @@ export default { } else { - dispatch(routerRedux.push('/home')) + if (localStorage.getItem("webOrgId") == '00300000-0000-0000-0000-000000000000') { + dispatch(routerRedux.replace('/grouphome')) + + }else{ + dispatch(routerRedux.replace('/home')) + } + } } }) diff --git a/src/models/login.js b/src/models/login.js index 3a75fdc..c16ab72 100644 --- a/src/models/login.js +++ b/src/models/login.js @@ -155,7 +155,13 @@ export default { window.location.replace(config.guideH5Host); // dispatch(routerRedux.push("/HomeMobileNew")); } else { - dispatch(routerRedux.push("/home")); + if (localStorage.getItem("webOrgId") == '00300000-0000-0000-0000-000000000000') { + dispatch(routerRedux.replace('/grouphome')) + + }else{ + dispatch(routerRedux.replace('/home')) + } + } // 新开 tab 页面,直接从 login 路径进来,则需要重新检查一下是否登录,未登录则执行登录获取到菜单以及必要数据 dispatch({ diff --git a/src/routes/Backend.js b/src/routes/Backend.js index c7e1827..21f9a83 100644 --- a/src/routes/Backend.js +++ b/src/routes/Backend.js @@ -195,7 +195,12 @@ const Backend = (props) => { const [collapsed, setCollapsed] = useState(false) const navToHome = () => { - props.history.push({ pathname: '/home' }) + if (localStorage.getItem("webOrgId") == '00300000-0000-0000-0000-000000000000') { + props.history.replace('/grouphome') + + }else{ + props.history.replace('/home') + } } return ( diff --git a/src/routes/GroupHome.js b/src/routes/GroupHome.js index a870d72..7915574 100644 --- a/src/routes/GroupHome.js +++ b/src/routes/GroupHome.js @@ -207,10 +207,9 @@ class GroupHome extends React.Component { } componentDidMount() { - if (localStorage.getItem("webOrgId") !== '00300000-0000-0000-0000-000000000000') { - history.replace('/home') - // props.history.push({ pathname: "/grouphome" }); - } + // if (localStorage.getItem("webOrgId") !== '00300000-0000-0000-0000-000000000000') { + // history.replace('/home') + // } if (window.navigator.userAgent.indexOf("Windows") < 1) { window.location.replace(config.guideH5Host); openNotificationMobile("bottomRight"); diff --git a/src/routes/Home.js b/src/routes/Home.js index 3e4f88c..c6989ec 100644 --- a/src/routes/Home.js +++ b/src/routes/Home.js @@ -214,11 +214,10 @@ class Home extends React.Component { componentDidMount() { this._isMounted = true; // 组件挂载时设为true const currentPath = this.props.location.pathname; - if (localStorage.getItem("webOrgId") == '00300000-0000-0000-0000-000000000000' && currentPath !== '/grouphome') { - this.props.history.replace('/grouphome') - return - // props.history.push({ pathname: "/grouphome" }); - } + // if (localStorage.getItem("webOrgId") == '00300000-0000-0000-0000-000000000000' && currentPath !== '/grouphome') { + // this.props.history.replace('/grouphome') + // return + // } if (window.navigator.userAgent.indexOf("Windows") < 1) { window.location.replace(config.guideH5Host); openNotificationMobile("bottomRight"); diff --git a/src/routes/Login.js b/src/routes/Login.js index a65aa03..53d68c3 100644 --- a/src/routes/Login.js +++ b/src/routes/Login.js @@ -277,7 +277,13 @@ class LoginPage extends React.Component { window.location.replace(config.guideH5Host) // this.props.history.push({ pathname: '/HomeMobileNew' }) } else { - this.props.history.push({ pathname: '/home' }) + if (localStorage.getItem("webOrgId") == '00300000-0000-0000-0000-000000000000' ) { + this.props.history.replace('/grouphome') + + }else{ + this.props.history.replace('/home') + } + } } })