Commit f478a91c authored by 徐乐's avatar 徐乐

feat: 修改

parent d4bfdb79
...@@ -226,73 +226,76 @@ const renderSite = ({ data, config, loading, setLoading, action, actionRef, setM ...@@ -226,73 +226,76 @@ const renderSite = ({ data, config, loading, setLoading, action, actionRef, setM
</> </>
); );
}; };
//切换集成站点
const checkIntegration = (val, loginAction, props) => {
if (val.subType == '外链') {
window.open(val.url, "_blank");
} else {
let cli = val.url?.indexOf('client=') >= 0 ? val.url.split('client=')[1] : '';
const config = props.global;
config.uiwidgets = [];
config.widgets = [];
config.allWidgets = [];
if (cli) {
config.client = cli;
}
props.instance && props.instance.updateConfig(config);
loginAction && loginAction.getUserInfoAndConfig('', true, val.type, cli);
props.history.push(`/?client=${cli}`); // const renderIntegration = (inData, loginAction, props) => {
props.updateCurrentIndex(0); // const [visible, setVisible] = useState(false);
defaultApp(); // if (inData.length <= 1) {
} // return <></>
} // }
// let choiceOne = inData?.find(function (a) {
const renderIntegration = (inData, loginAction, props) => { // return a.url?.indexOf(window?.globalConfig?.client) >= 0
const [visible, setVisible] = useState(false); // })
if (inData.length <= 1) {
return <></> // //切换集成站点
} // const checkIntegration = (val, loginAction, props) => {
let choiceOne = inData?.find(function (a) { // if (val.subType == '外链') {
return a.url?.indexOf(window?.globalConfig?.client) >= 0 // window.open(val.url, "_blank");
}) // } else {
return ( // let cli = val.url?.indexOf('client=') >= 0 ? val.url.split('client=')[1] : '';
<>
<Popover // const config = props.global;
placement="bottomLeft" // config.uiwidgets = [];
trigger="click" // config.widgets = [];
visible={visible} // config.allWidgets = [];
content={ // if (cli) {
<div className={layoutStyles.integrationList}> // config.client = cli;
{ // }
inData && inData.map((val) => (
<p onClick={() => checkIntegration(val, loginAction, props)}>{val.name}</p> // props.instance && props.instance.updateConfig(config);
)) // loginAction && loginAction.getUserInfoAndConfig('', true, val.type, cli);
}
</div> // // props.history.push(`/?client=${cli}`);
} // // props.updateCurrentIndex(0);
arrowPointAtCenter // // defaultApp();
overlayClassName={classNames(layoutStyles.stationsWrapper, layoutStyles.stationsTop2)} // }
onVisibleChange={visible => setVisible(visible)} // }
>
{inData.length > 1 ? ( // return (
<div className={layoutStyles.toggleSite}> // <>
<img src={require('../assets/basic/site.png')} className={layoutStyles.site} /> // <Popover
<span className={layoutStyles.name}>{choiceOne?.name ?? ''}</span> // placement="bottomLeft"
<ArrowIcon // trigger="click"
className={layoutStyles.arrow} // visible={visible}
style={{ // content={
transform: !visible ? `rotate(0deg)` : `rotate(180deg)`, // <div className={layoutStyles.integrationList}>
}} // {
/> // inData && inData.map((val) => (
</div> // <p onClick={() => checkIntegration(val, loginAction, props)}>{val.name}</p>
) : null} // ))
</Popover> // }
</> // </div>
) // }
} // arrowPointAtCenter
// overlayClassName={classNames(layoutStyles.stationsWrapper, layoutStyles.stationsTop2)}
// onVisibleChange={visible => setVisible(visible)}
// >
// {inData.length > 1 ? (
// <div className={layoutStyles.toggleSite}>
// <img src={require('../assets/basic/site.png')} className={layoutStyles.site} />
// <span className={layoutStyles.name}>{choiceOne?.name ?? ''}</span>
// <ArrowIcon
// className={layoutStyles.arrow}
// style={{
// transform: !visible ? `rotate(0deg)` : `rotate(180deg)`,
// }}
// />
// </div>
// ) : null}
// </Popover>
// </>
// )
// }
// import defaultProps from '../defaultProps'; // import defaultProps from '../defaultProps';
const pickRoutes = memoized((routes, pathname, locale) => { const pickRoutes = memoized((routes, pathname, locale) => {
...@@ -334,6 +337,8 @@ const Layout = props => { ...@@ -334,6 +337,8 @@ const Layout = props => {
const actionRef = useRef(); const actionRef = useRef();
const history = useHistory(); const history = useHistory();
const location = useLocation(); const location = useLocation();
const [visible, setVisible] = useState(false);
const [integrationLoading, setIntegrationLoading] = useState(false);
const { routeConfig = {}, matchPath } = pickRoutes(props.flatMenu, location.pathname); const { routeConfig = {}, matchPath } = pickRoutes(props.flatMenu, location.pathname);
// useEffect(() => { // useEffect(() => {
...@@ -397,8 +402,22 @@ const Layout = props => { ...@@ -397,8 +402,22 @@ const Layout = props => {
window.share.event.on('updateSite', res => { window.share.event.on('updateSite', res => {
setCityData(res); setCityData(res);
}); });
const handleToggleIndustry = event => {
setVisible(false);
setIntegrationLoading(false);
props.history.push(`/?client=${window.globalConfig.homepage.client}`);
props.updateCurrentIndex(0);
defaultApp();
};
if (window?.globalConfig?.isIntegration > 1) {
loginAction.events.on('toggleIndustry', handleToggleIndustry);
}
return () => { return () => {
window.share.event.removeAllListeners('updateSite'); window.share.event.removeAllListeners('updateSite');
loginAction.events.removeListener('toggleIndustry', handleToggleIndustry);
}; };
}, []); }, []);
...@@ -529,6 +548,77 @@ const Layout = props => { ...@@ -529,6 +548,77 @@ const Layout = props => {
} }
return false; return false;
}; };
//渲染集成站点切换弹框
const renderIntegration = (inData, loginAction, props) => {
if (inData.length <= 1) {
return <></>
}
let choiceOne = inData?.find(function (a) {
return a.url?.indexOf(window?.globalConfig?.client) >= 0
})
//切换集成站点
const checkIntegration = (val, loginAction, props) => {
if (val.subType == '外链') {
window.open(val.url, "_blank");
} else {
let cli = val.url?.indexOf('client=') >= 0 ? val.url.split('client=')[1] : '';
setIntegrationLoading(true);
const config = props.global;
config.uiwidgets = [];
config.widgets = [];
config.allWidgets = [];
if (cli) {
config.client = cli;
}
props.instance && props.instance.updateConfig(config);
loginAction && loginAction.getUserInfoAndConfig('', true, val.type, cli);
// props.history.push(`/?client=${cli}`);
// props.updateCurrentIndex(0);
// defaultApp();
}
}
return (
<>
<Popover
placement="bottomLeft"
trigger="click"
visible={visible}
content={
<div className={layoutStyles.integrationList}>
{
<Loading loading={integrationLoading} />
}
{
inData && inData.map((val) => (
<p onClick={() => checkIntegration(val, loginAction, props)}>{val.name}</p>
))
}
</div>
}
arrowPointAtCenter
overlayClassName={classNames(layoutStyles.stationsWrapper, layoutStyles.stationsTop2)}
onVisibleChange={visible => setVisible(visible)}
>
{inData.length > 1 ? (
<div className={layoutStyles.toggleSite}>
<img src={require('../assets/basic/site.png')} className={layoutStyles.site} />
<span className={layoutStyles.name}>{choiceOne?.name ?? ''}</span>
<ArrowIcon
className={layoutStyles.arrow}
style={{
transform: !visible ? `rotate(0deg)` : `rotate(180deg)`,
}}
/>
</div>
) : null}
</Popover>
</>
)
}
return ( return (
<SecurityLayout {...props}> <SecurityLayout {...props}>
<BasicLayout <BasicLayout
......
...@@ -350,6 +350,7 @@ ...@@ -350,6 +350,7 @@
.integrationList{ .integrationList{
display: flex; display: flex;
position: relative;
} }
.integrationList p{ .integrationList p{
margin: 0 10px; margin: 0 10px;
......
...@@ -434,7 +434,11 @@ class Login { ...@@ -434,7 +434,11 @@ class Login {
hideFeedback, hideFeedback,
// mapsettings: config.mapsettings // mapsettings: config.mapsettings
}); });
self.updateConfig && self.updateConfig(self.globalConfig);
if (this.globalConfig?.isIntegration >= 1) {
self.updateConfig && self.updateConfig(self.globalConfig);
}
self.getProjectItems().then(res => { self.getProjectItems().then(res => {
window.subSysCfg = {}; window.subSysCfg = {};
self.globalConfig = Object.assign(self.globalConfig, { self.globalConfig = Object.assign(self.globalConfig, {
...@@ -505,6 +509,9 @@ class Login { ...@@ -505,6 +509,9 @@ class Login {
// if (mainConf.productType) // if (mainConf.productType)
// self.globalConfig.productType = mainConf.productType; // self.globalConfig.productType = mainConf.productType;
} }
if (this.globalConfig?.isIntegration >= 1) {
self.updateConfig && self.updateConfig(self.globalConfig);
}
this.isOpenYanshi(self, getIndustry); this.isOpenYanshi(self, getIndustry);
}); });
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment