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