Explorar el Código

[Feat 0000] 优化门户在两个子应用宿主路由间切换

hongrunxia hace 1 semana
padre
commit
3621a200b9

+ 8 - 14
src/qiankun/index.ts

@@ -35,23 +35,17 @@ const mountMicroApp = (name, isReFresh = false) => {
   }
 };
 
-// 卸载app的方法
 const unmountMicroApps = async (multipleApp) => {
-  // [fix-subapp-loading] 修复卸载竞态:原实现用 multipleApp.filter(async (name) => { await …unmount() })
-  // —— async 回调使 filter 立即返回、await 不被任何方等待,卸载是"发射后不管";
-  // 且判断条件 multipleApp.some 是函数引用(恒真)。改为顺序 await 逐个卸载,完成后清理注册表,
-  // 避免旧实例与新实例并存争抢容器/共享状态(子应用切页互清场景)。
-  if (!multipleApp || multipleApp.length === 0) return;
-  for (const key of Object.keys(activeApps)) {
-    if (multipleApp.some((name) => name.includes(key))) {
-      try {
-        await activeApps[key].unmount();
-      } catch (e) {
-        console.error('[fix-subapp-loading] 微应用卸载失败:', key, e);
-      }
-      delete activeApps[key];
+  if (JSON.stringify(activeApps) !== '{}' && multipleApp.some) {
+    for (const key in activeApps) {
+      multipleApp.filter(async (name) => {
+        if (name.includes(key)) {
+          await activeApps[key].unmount();
+        }
+      });
     }
   }
+  if (!multipleApp || multipleApp.length === 0) return;
 };
 
 export { mountMicroApp, unmountMicroApps, activeApps };

+ 4 - 1
src/views/vent/monitorManager/mainFanMonitor/components/entryThree.vue

@@ -6,7 +6,10 @@
       class="threejs-Object-CSS"
       style="position: absolute; top: 0; z-index: 1; width: 100%; height: 100%; overflow: hidden; pointer-events: none"
     >
-      <div style="position: relative" v-if="selectData['modalTyoe'] && selectData['modalTyoe'] !== 'mainWindRect-Inverse'">
+      <div
+        style="position: relative"
+        v-if="hasPermission('mainFan:hideCss3DModal') && selectData['modalTyoe'] && selectData['modalTyoe'] !== 'mainWindRect-Inverse'"
+      >
         <template v-if="!fanSwitchoverSimulation">
           <div class="elementTag" id="inputBox1" v-if="backMonitorIsShow">
             <div class="elementContent elementContent-r">