import React, { useEffect, useState } from 'react' import { useLocation } from 'react-router' import { useDispatch, useSelector } from 'react-redux' import './index.less' import MapCtrl from './MapCtrl/index' import HomePanelsLayoutPage from './homePanelsLayoutPage' import Ysgzq from '../ysgzq/ssyq' import Sssq from '../ysgzq/sssq' import Ddxsfx from '../fxdd/dqxsfx' // import Tqyb from '../fxdd/tqyb' import Fhxs from './fhxs' import Tqyb from './tqyb' import Btn from './btn' const HomePage = () => { const getLayerVisible = (s:any) => s.map.layerVisible; const mode = useSelector((s:any) => s.map.mode); const layerVisible = useSelector(getLayerVisible); const [showPanels, setShowPanels] = useState(true) const location = useLocation() const dispatch = useDispatch() const pathname = location.pathname useEffect(() => { // if (pathname !== '/mgr/home') { // dispatch.map.setLayerVisible({ ShuiKuLayer: false }) // dispatch.map.setZhongxingSk(true) // } else { // dispatch.map.setLayerVisible({ ShuiKuLayer: true }) // dispatch.map.setZhongxingSk(true) // } }, [pathname]) useEffect(() => { // if (pathname == '/mgr/home' && !showPanels) { // dispatch.map.setZhongxingSk(true) // dispatch.map.setLayerVisible({ AdcdLayer: true }) // dispatch.map.setLayerVisible({ ShuiKuLayer: true }) // } }, [showPanels]) return (
{/* 控制按钮 */} {/* 地图 */} {/*首页面板*/} {pathname === '/mgr/home' ? ( ) : null} {/*四预-防洪形势*/} {pathname === '/mgr/sy/fhxzfx' ? ( ) : null} {/*四预-天气预报*/} {pathname === '/mgr/sy/tqyb' ? ( ) : null} {/*雨水工灾情面板-雨情*/} {pathname === '/mgr/ysgzq/ssyq' ? (
) : null} {/*雨水工灾情面板-水情*/} {pathname === '/mgr/ysgzq/sssq' ? (
) : null} {/*防汛调度面板-当前形势*/} {pathname === '/mgr/fxdd/dqxsfx' ? (
) : null} {/*防汛调度-天气预报面板*/} {/* {pathname === '/mgr/fxdd/tqyb' ? (
) : null} */}
) } export default HomePage