Commit 923065c1 authored by 崔佳豪's avatar 崔佳豪

fix: toggleIndustry 事件清除

parent e9057518
...@@ -56,6 +56,7 @@ const renderIndustries = (config, callback) => ...@@ -56,6 +56,7 @@ const renderIndustries = (config, callback) =>
} }
}); });
let loginAction = null;
const BootPage = props => { const BootPage = props => {
const [loadding, setLoadding] = useState(false); const [loadding, setLoadding] = useState(false);
...@@ -70,24 +71,25 @@ const BootPage = props => { ...@@ -70,24 +71,25 @@ const BootPage = props => {
event.preventDefault(); event.preventDefault();
setLoadding(true); setLoadding(true);
const config = props.global; const config = props.global;
const loginAction = new LoginAction(props); // const loginAction = new LoginAction(props);
config.uiwidgets = []; config.uiwidgets = [];
config.widgets = []; config.widgets = [];
config.allWidgets = []; config.allWidgets = [];
props.instance && props.instance.updateConfig(config); props.instance && props.instance.updateConfig(config);
// props.instance && props.instance.getUserInfoAndConfig('', true, type); // props.instance && props.instance.getUserInfoAndConfig('', true, type);
loginAction.getUserInfoAndConfig('', true, type); loginAction && loginAction.getUserInfoAndConfig('', true, type);
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
loginAction.events.on('toggleIndustry', event => { // loginAction.events.on('toggleIndustry', event => {
setLoadding(false); // setLoadding(false);
// props.history.push(`/?client=${props.global.client}`); // // props.history.push(`/?client=${props.global.client}`);
initMicroApps(); // debugger
// 加载首页 // initMicroApps();
history.push(props.global.homepage ?? `/?client=${props.global.client}`); // // 加载首页
window.share.event.emit('triggerMicro', props.global); // history.push(props.global.homepage ?? `/?client=${props.global.client}`);
props.updateCurrentIndex(0); // window.share.event.emit('triggerMicro', props.global);
// window.location.reload(); // props.updateCurrentIndex(0);
}); // // window.location.reload();
// });
}, []); }, []);
useEffect(() => { useEffect(() => {
// eslint-disable-next-line no-use-before-define // eslint-disable-next-line no-use-before-define
...@@ -102,8 +104,20 @@ const BootPage = props => { ...@@ -102,8 +104,20 @@ const BootPage = props => {
}; };
useEffect(() => { useEffect(() => {
window.addEventListener('resize', handleResize); window.addEventListener('resize', handleResize);
loginAction = new LoginAction(props);
loginAction.events.on('toggleIndustry', async (event) => {
setLoadding(false);
props.history.push(`/?client=${props.global.client}`);
initMicroApps();
// 加载首页
// history.push(props.global.homepage ?? `/?client=${props.global.client}`);
window.share.event.emit('triggerMicro', props.global);
props.updateCurrentIndex(0);
// window.location.reload();
});
return () => { return () => {
window.removeEventListener('resize', handleResize); window.removeEventListener('resize', handleResize);
loginAction.events.removeAllListeners('toggleIndustry');
}; };
}); });
const renderIndustr = useMemo( const renderIndustr = useMemo(
......
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