12345678910111213141516171819202122232425262728293031 |
- import { Select } 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] });
- };
- return (
- siteList.length ? (
- <Select
- value={currentSite}
- style={{ width: 150 }}
- onChange={handleChange}
- >
- {siteList.map((site) => (
- <Select.Option key={site.name} value={site.value}>
- {site.title}
- </Select.Option>
- ))}
- </Select>
- ) : null
- );
- };
- export default connect(({ global }) => ({
- siteList: global.siteList,
- currentSite: global.currentSite,
- }))(SiteSelector);
|