import React, { useEffect, useReducer, useRef, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { Checkbox, message } from 'antd'; import {CloseOutlined} from '@ant-design/icons'; import { useLocation } from 'react-router' import './index.less' export default function Btn() { const showPanels = useSelector((s) => s.runtime.showPanels) const homeCheckedObj = useSelector((s) => s.runtime.homeCheckedObj) const layerVisible = useSelector(s => s.map.layerVisible); const mode = useSelector(s=>s.map.mode) const dispatch = useDispatch() const location = useLocation() const [open, setOpen] = useState(false) const layerVisibleChanged = (event)=>{ const vo = { [event.target.name]: event.target.checked }; dispatch.map.setLayerVisible(vo); } const mapType = (event)=>{ const name = event.target.name const checked = event.target.checked if(name==='SatelliteImage'&&checked){ dispatch.map.setMode('2d'); dispatch.map.setLayerVisible({ ['SatelliteImage']: true }); dispatch.map.setLayerVisible({ ['OfflineMap']: false }); dispatch.map.setLayerSetting({HLLayer: 'B'}) dispatch.map.setLayerSetting({LakeLayer: 'B'}) } if(name==='OfflineMap'&&checked){ dispatch.map.setMode('2d'); dispatch.map.setLayerVisible({ ['OfflineMap']: true }); dispatch.map.setLayerVisible({ ['SatelliteImage']: false }); dispatch.map.setLayerSetting({HLLayer: 'A',}) dispatch.map.setLayerSetting({LakeLayer: 'A'}) } if(name === '3d'&&'&&checked'){ if(location.pathname==='/mgr/sy/tqyb'){ message.error('天气预报无法切换3d视图') return } dispatch.map.setMode('3d'); dispatch.map.setLayerVisible({ ['SatelliteImage']: false }); dispatch.map.setLayerVisible({ ['OfflineMap']: false }); dispatch.map.setLayerSetting({HLLayer: 'B'}) dispatch.map.setLayerSetting({LakeLayer: 'B'}) } } return (



