import { Select } from "antd"; import { Menu, Dropdown } from 'antd'; import { connect } from "dva"; import router from 'umi/router'; import { webSiteContactRelation } from "@/utils/utils" const SiteSelector = ({ siteList, currentSite, dispatch }) => { const handleChange = (value) => { dispatch({ type: "global/setCurrentSite", payload: value }); dispatch({ type: "global/setCurrentContactType", payload: webSiteContactRelation[value] }); const targetSite = siteList.find(item => item.value === value); dispatch({ type: "global/setCurrentSiteName", payload: targetSite.title }); }; return ( siteList.length ? ( ) : null ); }; export default connect(({ global }) => ({ siteList: global.siteList, currentSite: global.currentSite, }))(SiteSelector);