Commit 8785b51c authored by 杨思琦's avatar 杨思琦

fix: 预加载修改

parent 3c571f0f
const slash = require('slash2');
const proxy = require('./proxy');
const defaultSetting = require('./defaultSetting');
const cesiumBuild = "../node_modules/@wisdom-cesium/panda_cesium_source/lib";
const cesiumSource = '../node_modules/@wisdom-cesium/panda_cesium_source/lib';
const pkgName = require('../package.json').name;
// eslint-disable-next-line import/order
const { NODE_ENV } = process.env;
......@@ -100,30 +98,7 @@ module.exports = {
},
javascriptEnabled: true,
},
copy: [
{
from: path.join(pkgName, cesiumBuild, './Workers'),
to: 'Workers',
},
{
from: path.join(pkgName, cesiumSource, 'Assets'),
to: 'Assets',
},
{
from: path.join(pkgName, cesiumSource, 'Widgets'),
to: 'Widgets',
},
{
from: path.join(pkgName, cesiumSource, 'ThirdParty'),
to: 'ThirdParty',
},
],
define: {
// eslint-disable-next-line no-useless-escape
CESIUM_BASE_URL: JSON.stringify(CESIUM_BASE_URL).replace(/\"/g, ''),
},
alias: {
cesium: path.resolve(__dirname, cesiumSource),
'@esri/arcgis-html-sanitizer': path.resolve(
__dirname,
'../node_modules/@esri/arcgis-html-sanitizer/dist/esm/index.js',
......
......@@ -113,8 +113,8 @@
"@wisdom-components/basictable": "^1.5.16",
"@wisdom-components/empty": "^1.4.1",
"@wisdom-components/videoslidermodal": "^1.1.60",
"@wisdom-map/amap":"^2.0.9",
"@wisdom-map/arcgismap":"^2.0.31",
"@wisdom-map/amap":"^2.0.14",
"@wisdom-map/arcgismap":"^2.0.42",
"@wisdom-map/basemap":"^2.0.2",
"@wisdom-map/util":"1.2.9",
"@wisdom-utils/components": "0.1.370",
......
......@@ -313,26 +313,35 @@ export const initMicroApps = (url) => {
if(url.indexOf(app.name) > -1 && microPackage[app.name] && microPackage[app.name].map) {
loadMicroPackage(app.name);
}
return !/civweb4/.test(app.name) && url.indexOf(app.name) < 0 && !app.noPrefetch
return !/civweb4/.test(app.name) && url.indexOf(app.name) < 0 && ['civ_water', 'civ_webgis', 'civ_monitor', 'civ_workflow'].indexOf(app.name) > -1 && !app.noPrefetch
}) ?? [];
if(window?.qiankunIsCache){
microStore.on("event:dropCache", (() => {
micorManager.map((micro) => {
micro.unmount && micro.unmount();
micro = null;
})
micorManager = [];
micorManager = null;
}));
window.qiankunStarted = true;
initSaveMicroApps(url);
start(Configuration);
runAfterFirstMounted(() => {
const initAfterMounted = () => {
window.parent && window.parent.postMessage({ type: 'runAfterFirstMounted' }, '*');
event.emit('loading', false);
Logger.info('[MainApp] first app mounted');
}
if(url.indexOf('civbase/civ_base') > -1) {
initAfterMounted();
prefetchApps(micro);
} else {
runAfterFirstMounted(() => {
initAfterMounted();
setTimeout(() => {
prefetchApps(micro);
}, 5000)
Logger.info('[MainApp] first app mounted');
});
}
addGlobalUncaughtErrorHandler(event => {
console.log(event);
});
......@@ -340,10 +349,7 @@ export const initMicroApps = (url) => {
window.qiankunStarted = true;
registerMicroApps(microApps, LifeCycle);
start(Configuration);
setTimeout(() => {
url.indexOf('civbase/civ_base') > -1 && event.emit('loading', false)
})
runAfterFirstMounted(() => {
const initAfterMounted = () => {
micro.forEach((app) => {
if(microPackage[app.name] && microPackage[app.name].map) {
loadMicroPackage(app.name);
......@@ -351,8 +357,17 @@ export const initMicroApps = (url) => {
})
window.parent && window.parent.postMessage({ type: 'runAfterFirstMounted' }, '*');
event.emit('loading', false);
Logger.info('[MainApp] first app mounted');
Logger.info('[MainApp]first app mounted');
}
if(url.indexOf('civbase/civ_base') > -1) {
setTimeout(() => {
initAfterMounted();
})
} else {
runAfterFirstMounted(() => {
initAfterMounted();
});
}
addGlobalUncaughtErrorHandler(event => {
console.log(event);
});
......
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