Commit a5f82f10 authored by 邓晓峰's avatar 邓晓峰

fix: basic layout load mircro bug

parent d9fe2826
Pipeline #23192 skipped with stages
const argv = require('./argv');
console.log(argv.port)
module.exports = parseInt(argv.port || process.env.PORT || '3005', 10);
module.exports = parseInt(argv.port || process.env.PORT || '3004', 10);
......@@ -71,7 +71,7 @@ class AvatarDropdown extends React.Component {
Cookies.set('site', '', {
path: '/',
});
localStorage.removeItem('access_token');
if (
window.globalConfig.style === 'ios' &&
window.globalConfig.loginTemplate === 'IOSCloud.html'
......@@ -79,7 +79,7 @@ class AvatarDropdown extends React.Component {
window.location.href = `${window.location.origin}/#login`;
return false;
}
debugger
this.props.updateCurrentIndex && this.props.updateCurrentIndex(0);
this.props.updateConfig && this.props.updateConfig({});
this.props.updateComplexConfig && this.props.updateComplexConfig({});
......
......@@ -389,25 +389,35 @@ const BasicLayout = props => {
// }, [props.currentMenuIndex, props.route, props.menu]);
useEffect(() => {
setLoading(true);
clearTime = setTimeout(() => (setCurrentRoutes(props.route.routes[props.currentMenuIndex]), setLoading(false)), 400);
return () => clearTimeout && clearTimeout(clearTime);
}, [props.currentMenuIndex]);
useEffect(() => {
const menu = props.menu.filter(item => !item.hideInMenu);
setLoading(true);
clearTime = setTimeout(() => {
props.route && (props.route.routes.filter(item => !item.hideInMenu || item.path !== '/404' || item.path !== '/500')).length === 0 && setLoading(true);
if(menu.length > 0 && props.route && props.route.routes.length > 0) {
if(props.currentMenuIndex !== -1) {
setCurrentRoutes(props.route.routes[props.currentMenuIndex]);
setLoading(false);
}
}, 400);
return () => clearTimeout && clearTimeout(clearTime);
}, [props.menu]);
}, [props.currentMenuIndex]);
// useEffect(() => {
// debugger
// // const menu = props.menu.filter(item => !item.hideInMenu);
// setLoading(true);
// setCurrentRoutes([]);
// clearTime = setTimeout(() => {
// debugger
// // props.route && (props.route.routes.filter(item => !item.hideInMenu || item.path !== '/404' || item.path !== '/500')).length === 0 && setLoading(true);
// if(props.route && props.route.routes.length > 0 && props.route.routes[props.currentMenuIndex].path !== currentRoutes.path) {
// setCurrentRoutes(props.route.routes[props.currentMenuIndex]);
// setLoading(false);
// }
// }, 400);
// return () => clearTimeout && clearTimeout(clearTime);
// }, [props.route]);
useEffect(() => {
siteAction.setGlobalConfig(props.global);
......@@ -565,7 +575,6 @@ const BasicLayout = props => {
});
const logo = props.global.get('bannerLogo') ? `http://panda-water.cn/web4/${props.global.get('bannerLogo')}` : defaultSetting.logo;
const renderComplexLayout = children => {
const complexConfig = props.complexConfig.toJS
? props.complexConfig.toJS()
......
......@@ -334,6 +334,7 @@ class Site {
loginSite[token] = site;
localStorage.setItem('loginSite', JSON.stringify(loginSite));
const self = this;
self.props.updateCurrentIndex && self.props.updateCurrentIndex(-1);
const login = new Login(this.props, () => {
self.setLoading(false);
// eslint-disable-next-line no-unused-expressions
......@@ -346,6 +347,7 @@ class Site {
self.getCityStationsForUser().then(res => {
window.share.event.emit('updateSite', res);
});
self.props && self.props.updateCollapsed && self.props.updateCollapsed(false);
self.props && self.props.updateComplexConfig && self.props.updateComplexConfig({});
// window.location.reload();
......
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