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

feat: update kit_global_config

parent d92c9e5c
Pipeline #23278 skipped with stages
......@@ -89,7 +89,17 @@ const appReducer = (state = initialState, action) => {
// eslint-disable-next-line no-undef,no-case-declarations
const config = window.globalConfig;
// eslint-disable-next-line no-case-declarations
const generMenu = generRoutes(config.widgets || []);
let generMenu = generRoutes(config.widgets || []);
// eslint-disable-next-line no-case-declarations
const { homepage } = window.globalConfig;
if (homepage !== '') {
const index = generMenu.findIndex(
item => item.level === -1 && item.url !== '',
);
if (index > -1) {
generMenu = generMenu.reverse();
}
}
// eslint-disable-next-line no-case-declarations
const flatMenu = generFlatRoutes(generMenu || []);
return state.merge({
......
......@@ -376,17 +376,26 @@ const BasicLayout = props => {
}, [props.location.pathname, currentRoutes]);
// useEffect(() => {
// const menu = props.menu.filter(item => !item.hideInMenu);
// if(menu.length === 0) {
// setLoading(true);
// }
// 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]);
// setLoading(false);
// }
// }, [props.currentMenuIndex, props.route, props.menu]);
// setLoading(true);
//
//
// debugger
//
// setTimeout(() => {
// debugger
// const routes = props.route.routes;
// if(routes.length > 0 && props.currentMenuIndex !== -1) {
// if(currentRoutes && !currentRoutes.routes) {
// setCurrentRoutes(props.route.routes[props.currentMenuIndex]);
// setLoading(false);
// }
//
// }
//
// }, 400)
//
// }, [props.currentMenuIndex, props.route]);
//
useEffect(() => {
setLoading(true);
clearTime = setTimeout(() => {
......@@ -573,7 +582,7 @@ const BasicLayout = props => {
title: props.global && props.global.get('title') || defaultSetting.title
});
const logo = props.global.get('bannerLogo') ? `http://panda-water.cn/web4/${props.global.get('bannerLogo')}` : defaultSetting.logo;
const logo = props.global.get('bannerLogo') ?window.globalConfig.transformDevAssetsBaseURL(props.global.get('bannerLogo')): defaultSetting.logo;
const renderComplexLayout = children => {
const complexConfig = props.complexConfig.toJS
? props.complexConfig.toJS()
......
......@@ -165,7 +165,7 @@ class Site {
self.globalConfig.userInfo.groupType = allStation[0].groupType;
}
}
debugger
debugger;
if (allStation.length > 1) {
self.currentStationName = arr[arr.length - 1];
self.citySelector = self.AvailableofRegionName(projectStation);
......@@ -347,9 +347,13 @@ 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.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.share.event.emit('triggerMicro', this.props.global);
});
......
......@@ -29,13 +29,9 @@ const MICRO_STATUS = {
};
export const initMicroApps = (loader, store) => {
<<<<<<< HEAD
console.log(window.globalConfig);
=======
/* eslint-disable */
const config = createStoreage.get('globalConfig');
const application = config.products || [];
>>>>>>> d395e004dcda0c599173220f273809c42294cca2
const entrys =
process.env.NODE_ENV !== 'production'
? micorConfig.dev
......@@ -74,10 +70,6 @@ export const initMicroApps = (loader, store) => {
],
beforeMount: [
app => {
<<<<<<< HEAD
store.dispatch(actionCreators.updateMicroMounted(false));
=======
>>>>>>> 0e8f6915ac6e5dc6a04d3511197675755ca3bc00
Logger.info(`[LifeCycle] before mount %c%s ${app.name}`);
},
],
......
......@@ -704,7 +704,7 @@ class Login {
return data
} else {
message.error({
duration: 2000,
duration: 300,
content: `授权失败:${res.msg}`
});
self.events.emit('loginError', res.msg);
......
......@@ -29,17 +29,7 @@ export const dyRoutes = routes => {
{
path: '/',
component: BasicLayout,
routes: [
...dyRoutes,
{
path: '/404',
component: NotFound,
},
{
path: '/500',
component: ServiceFail,
},
],
routes: dyRoutes,
},
{
path: '/404',
......
......@@ -71,7 +71,8 @@ const generRotes = (widgets, parent, level = 0) => {
});
} else {
const baseURL = item.product || DEFAULT_APPLICATION;
let url = item.hasOwnProperty('url') && item.url !== undefined ? `/${baseURL}/${item.url.replace(/\s*/g, '')}`
if(item.hasOwnProperty('url') && item.url === '') return;
let url = item.hasOwnProperty('url') && item.url !== undefined && item.url !== '' ? `/${baseURL}/${item.url.replace(/\s*/g, '')}`
: !item.hasOwnProperty('url')
? guid('web_console')
: '';
......
......@@ -158,18 +158,11 @@ export const asyncAction = action => {
wait.then(() => setTimeout(() => callback()));
};
};
export const combineURLs = (baseURL, relativeURL) => {
return relativeURL ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, ''): baseURL;
}
export function getAssetsURL(relativeURL) {
//CityTemp 后端约定的本地文件夹路径
if(!relativeURL) return;
return combineURLs(window.location.origin, relativeURL);
}
export function getToken() {
return Cookies.get('token');
};
export function setToken(token) {
Cookies.set(token)
Cookies.set(token);
}
export const closeTabAction = (history, returnUrl, callback) => {};
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