Commit 4fc185fd authored by 邓晓峰's avatar 邓晓峰

fix: 修复开启网关后获取全局配置

parent 68952f56
Pipeline #47012 passed with stages
in 8 minutes 49 seconds
......@@ -37,7 +37,7 @@ const MICRO_STATUS = {
};
export const initMicroApps = () => {
/* eslint-disable */
const config = window.globalConfig || {};
//createStoreage.get('globalConfig');
......@@ -190,12 +190,12 @@ export const initMicroApps = () => {
addGlobalUncaughtErrorHandler(event => {
console.log(event);
});
};
export const defaultApp = () => {
// eslint-disable-next-line no-undef
const config = window.globalConfig;
......@@ -211,14 +211,14 @@ export const defaultApp = () => {
// createStoreage.set('init_web4', true)
// }
// let homepage = config.homepage.replace('civweb4/', '');
let url = !config.home ? (config.homepage === '' ? `/civbase/civweb4`: `/civbase/civweb4/${config.homepage.replace(/^\//, '').replace(/^civweb4\//, '')}`) : `/civbase/${config.homepage.replace(/^\//, '')}`;
let url = !config.home ? ((config.homepage === '' || _.isNull(config.homepage)) ? `/civbase/civweb4`: `/civbase/civweb4/${config.homepage.replace(/^\//, '').replace(/^civweb4\//, '')}`) : `/civbase/${config.homepage.replace(/^\//, '')}`;
/**
* issue 处理监听路由规则
*/
// if(url === '/civbase/civweb4/') {
// url = url.replace(/civweb4\//, 'civweb4');
// }
setDefaultMountApp(url);
// if(config.homepage.indexOf('civweb4') > -1) createStoreage.set('init_web4', true);
}
......@@ -238,7 +238,7 @@ window.app = {
modules: {},
require: function (request, method) {
if (request !== '.' && this.modules[request]) {
return _.isFunction(this.modules[request]) ? this.modules[request]() : _.isFunction(this.modules[request][method]) && this.modules[request][method]();
}
......@@ -277,7 +277,7 @@ window.app = {
return _.isFunction(this.modules[request]) && this.modules[request]();
},
define: function (name, context, index) {
let keys = context.keys();
for (let key of keys) {
let parts = name.indexOf('@') > -1 ? [name, ...(key.slice(1).split('/'))] : (name + key.slice(1)).split('/');
......@@ -293,7 +293,7 @@ window.app = {
dir[parts[parts.length - 1]] = context.bind(context, key);
}
if (index && index !== null) {
this.modules[name] = this.modules[name][index];
}
},
......
This diff is collapsed.
......@@ -64,7 +64,7 @@ const generRotes = (widgets, parent, level = 0) => {
const path = `/civweb/${guid('web_console')}`;
const subKey = guid('panda');
const alias = DEFAULT_APPLICATION;
const convertURL = transformURL(item.icon.replace(/\s*/g, ''));
const convertURL = item.icon ? transformURL(item.icon.replace(/\s*/g, '')): '';
const icon = (item && item.icon && item.icon !== null &&
isAbsoluteURL(convertURL) ? convertURL: /(\\|\/)/.test(convertURL) ?
window.globalConfig.transformDevAssetsBaseURL(transformURL(item.icon.replace(/\s*/g, ''))): item.icon
......@@ -164,7 +164,7 @@ export const transformWidgets = (widgets) => {
return widgets.map(item => {
const widgets = item.widgets;
const homepage = window.globalConfig.homepage;
const homePageConvertArray = homepage.split("/");
const homePageConvertArray = homepage ? homepage.split("/"): [];
const findIndex = widgets && widgets.findIndex(item => item.label === '系统菜单组');
if(findIndex === -1 && homePageConvertArray[0] !== 'civweb4') {
const index = widgets.findIndex(item => item.label === '首页');
......
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