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