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

fix: basic layout load mircro bug

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