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

fix: load micro config

parent af263493
This diff was suppressed by a .gitattributes entry.
......@@ -5,10 +5,16 @@ export default {
dev: [
{
name: 'civ_monitor',
entry: `//${window.location.hostname}:8082/civ_monitor`,
entry: `//${window.location.hostname}:8081/civ_monitor`,
container: '#micro-container',
activeRule: genActiveRule('/civbase/civ_monitor'),
},
{
name: 'civ_water',
entry: `//${window.location.hostname}:8083/civ_water`,
container: '#micro-container',
activeRule: genActiveRule('/civbase/civ_water'),
},
{
name: 'civweb4',
entry: `//${window.location.hostname}:3020/civweb4`,
......
/* eslint-disable */
// const proxyURL = process.env.NODE_ENV !== 'production' ? 'http://192.168.10.150:8777' : window.location.origin;
const proxyURL = 'http://172.16.10.183:8087';
const proxyURL = 'http://192.168.19.105:8530';
module.exports = {
assetsRoot: process.env.NODE_ENV !== 'production' ? proxyURL : './',
dev: {
......
......@@ -23089,9 +23089,9 @@
"dev": true
},
"kit_global_config": {
"version": "1.0.26",
"resolved": "https://g.civnet.cn:4873/kit_global_config/-/kit_global_config-1.0.26.tgz",
"integrity": "sha512-uLrOcaYyKHM0T2Di9iIkzkgIpGex4tFNy3c34x4WkcLL3QaivVKpqE5OZ0hU8BxOPsLDjCqTXR/CcMLNMcT4Yg==",
"version": "1.0.28",
"resolved": "https://g.civnet.cn:4873/kit_global_config/-/kit_global_config-1.0.28.tgz",
"integrity": "sha512-S9I6UYZxH2KY/cS85j5WW3bk+NqKREDaIZRdP4q6xGr4m0bTFPCckzHmUnccDbErbBJJrKx8+HI4ABCmzZ8dlw==",
"requires": {
"@babel/runtime": "^7.10.5",
"js-base64": "^3.5.2",
......@@ -112,7 +112,7 @@
"immutable": "^4.0.0-rc.12",
"js-base64": "^3.5.2",
"js-cookie": "^2.2.1",
"kit_global_config": "^1.0.26",
"kit_global_config": "^1.0.28",
"kit_logger": "^1.0.2",
"kit_utils": "^1.3.11",
"lodash": "4.17.11",
......
......@@ -33,29 +33,30 @@ const MICRO_STATUS = {
export const initMicroApps = (loader, store) => {
/* eslint-disable */
debugger
const config = createStoreage.get('globalConfig');
const application = config.products || [];
let products = [];
application && Array.isArray(application) && application.length > 0 && application.map(item => {
products.push({
name: item.PackageName,
entry: item.RouteUrl.replace(
// eslint-disable-next-line no-template-curly-in-string
'localhost:${port}',
window.location.host,
) + (item.PackageName.indexOf('civweb4') > -1 ? `/${item.PackageName}` : `/civbase/${item.PackageName}`),
entry: "//" + window.location.host + (`/${item.PackageName}`),
// item.RouteUrl.replace(
// // eslint-disable-next-line no-template-curly-in-string
// 'localhost:${port}',
// window.location.host,
// ) + (item.PackageName.indexOf('civweb4') > -1 ? `/${item.PackageName}` : `/${item.PackageName}`),
container: '#micro-container',
activeRule: genActiveRule(`/civbase/${item.PackageName}`),
props: item.DefaultSetting
})
});
// console.log(products);
console.log("products", products);
const entrys =
process.env.NODE_ENV !== 'production'
? micorConfig.dev
: products;
process.env.NODE_ENV !== 'production' ?
micorConfig.dev :
products;
registerMicroApps(
entrys.map(item => {
......@@ -69,8 +70,7 @@ export const initMicroApps = (loader, store) => {
XMLHttpRequest: window.XMLHttpRequest,
};
return item;
}),
{
}), {
beforeLoad: [
app => {
store.dispatch(actionCreators.updateMicroMounted(true));
......@@ -173,13 +173,13 @@ export const defaultApp = () => {
// const startWith = config.homepage ? config.homepage.split('/') : [];
// console.log(findPathByLeafId(config.homepage, '', 'url'))
const basePath =
config.homepage !== '' && FILTER_FOLER_REG.test(config.homepage)
? 'civweb4'
: 'civweb4';
config.homepage !== '' && FILTER_FOLER_REG.test(config.homepage) ?
'civweb4' :
'civweb4';
const defaultURL =
config.homepage === ''
? `/${pkg.name.toLocaleLowerCase()}/${basePath}?client=${config.client}`
: `/${pkg.name.toLocaleLowerCase()}/${basePath}/${config.homepage}`;
config.homepage === '' ?
`/${pkg.name.toLocaleLowerCase()}/${basePath}?client=${config.client}` :
`/${pkg.name.toLocaleLowerCase()}/${basePath}/${config.homepage}`;
setDefaultMountApp(defaultURL);
}
};
......@@ -199,8 +199,8 @@ window.app = {
},
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('/');
for (let key of keys) {
let parts = name.indexOf('@') > -1 ? [name, ...(key.slice(1).split('/'))] : (name + key.slice(1)).split('/');
parts = parts.filter(item => item !== "");
let dir = this.modules;
for (let i = 0; i < parts.length - 1; i++) {
......@@ -212,7 +212,7 @@ window.app = {
}
dir[parts[parts.length - 1]] = context.bind(context, key);
}
if(index && index !== null) {
if (index && index !== null) {
this.modules[name] = this.modules[name][index];
}
},
......@@ -286,4 +286,3 @@ window.app.define('rc-tree-select', require.context('../node_modules/rc-tree-sel
window.app.define('rc-trigger', require.context('../node_modules/rc-trigger/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('rc-upload', require.context('../node_modules/rc-upload/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('rc-virtual-list', require.context('../node_modules/rc-virtual-list/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
\ No newline at end of file
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