Commit a4e5654c authored by 杨思琦's avatar 杨思琦

fix: 修改web4加载

parent 529066bd
Pipeline #71589 waiting for manual action with stages
......@@ -114,9 +114,9 @@
"@wisdom-map/arcgismap": "1.4.0-151",
"@wisdom-map/basemap": "1.1.0-24",
"@wisdom-map/util": "^1.0.28-0",
"@wisdom-utils/components": "0.1.297",
"@wisdom-utils/components": "0.1.299",
"@wisdom-utils/runtime": "0.0.46",
"@wisdom-utils/utils": "0.1.337",
"@wisdom-utils/utils": "0.1.339",
"animate.css": "^4.1.1",
"antd": "4.21.2",
"compression": "1.7.4",
......
......@@ -23,6 +23,7 @@ import { waterMark } from '../utils/mark';
import layoutStyles from './BasicLayout.less';
import SecurityLayout from './SecurityLayout';
import Site from './Site';
import { initSaveMicroApps } from '../micro';
const { params } = helpers;
......@@ -242,13 +243,6 @@ const transformFloatMenu = (routes, homepage) => {
return routes.concat(route);
};
const finishInitWeb = homepage => {
event.emit('initweb', false);
typeof homepage === 'string' &&
homepage !== '' &&
window.history.replaceState({ delete: true }, null, `/civbase/${homepage}`);
};
const Layout = props => {
const currentProduct = `__global__recent_productIndex__micro_${window.location.hostname}_${params.getParams(
'client',
......@@ -282,6 +276,13 @@ const Layout = props => {
event.on('initweb', ret => {
setInitWebContent(ret);
});
event.on('finishInitWeb', path => {
window.history.replaceState(null, null, path.replace('widget', ''));
setTimeout(() => {
setInitWebContent(false);
window.history.replaceState(null, null, path);
});
});
}, []);
useEffect(() => {
......@@ -484,29 +485,12 @@ const Layout = props => {
window.location.pathname.startsWith('/civbase/civ_webgis') && null
)}
</Suspense>
{subLoading && <Loading loading={subLoading} />}
<div id="micro-container" className="subapp-container">
{props.children}
</div>
<Modal
title={<div style={{ textAlign: 'center' }}>温馨提示</div>}
centered
width="333px"
visible={initWebContent}
cancelText="取消"
okText="确定"
onOk={() => {
finishInitWeb(props.global?.homepage ?? '');
}}
onCancel={() => {
finishInitWeb(props.global?.homepage ?? '');
}}
zIndex={2000}
>
缓存仅支持最新功能,若要体验完整版请进行相关功能升级,或点击确认完成初次兼容加载后再次进入功能即可
</Modal>
{subLoading && <Loading loading={subLoading} />}
{initWebContent && <Loading loading={initWebContent} />}
</BasicLayout>
</SecurityLayout>
);
......
......@@ -194,16 +194,7 @@ export const initSaveMicroApps = (pathName = '', global) => {
const micro = microApps.filter(app => !/civweb4/.test(app.name)) ?? [];
if(/civweb4/.test(pathName) && !web4Load) {
event.emit("initweb", true);
micro.map((app) => {
const filter = micorManager.filter(mic => typeof(app.name) === 'string' && app.name.indexOf(mic.name) >= 0) ?? []
if(filter.length === 0) {
micorManager.push({
...loadMicroApp(app, Configuration, LifeCycle),
name: app?.name,
store: app?.props?.store
})
}
})
loadMicroApps(micro, pathName);
web4Load = true;
} else {
const target = micorManager.slice(-1)[0] ?? null;
......@@ -219,6 +210,28 @@ export const initSaveMicroApps = (pathName = '', global) => {
})
};
export const loadMicroApps = (apps, pathName) => {
const micro = apps.shift();
const filter = micorManager.filter(mic => typeof(micro.name) === 'string' && micro.name.indexOf(mic.name) >= 0) ?? []
if(filter.length === 0) {
micorManager.push({
...loadMicroApp(micro, Configuration, LifeCycle).mountPromise.then(() => {
if(apps.length > 0) {
loadMicroApps(apps, pathName);
} else {
event.emit("finishInitWeb", pathName);
}
}),
name: micro?.name,
store: micro?.props?.store
})
} else if(apps.length === 0) {
event.emit("finishInitWeb", pathName);
} else {
loadMicroApps(apps, pathName);
}
}
export const initMicroApps = (url) => {
if(!window.qiankunStarted) {
// /* eslint-disable */
......@@ -238,11 +251,10 @@ export const initMicroApps = (url) => {
micorManager = [];
}));
window.qiankunStarted = true;
initSaveMicroApps(url);
start(Configuration);
setTimeout(() => {
initSaveMicroApps(url);
})
runAfterFirstMounted(() => {
event.emit('loading', false);
prefetchApps(micro);
Logger.info('[MainApp] first app mounted');
});
......
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