From 051981a2211bb86f88a6d68f2e29816f8caeac20 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 04 八月 2023 09:18:10 +0800
Subject: [PATCH] 2023-08-04

---
 src/components/header/index.jsx |   37 +++++++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx
index 730c358..5fac2c3 100644
--- a/src/components/header/index.jsx
+++ b/src/components/header/index.jsx
@@ -135,12 +135,9 @@
 
       window.GLOB.mkThdMenus = [...thdMenuList, {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'}]
 
-      if (_menu) { // 寤舵椂鎵撳紑锛岄槻姝㈡爣绛剧粍鏈畬鎴愬姞杞�
-        setTimeout(() => {
-          MKEmitter.emit('modifyTabs', _menu)
-        }, 200)
+      if (_menu) {
+        this.openTab(_menu, 0)
       }
-      MKEmitter.emit('mkMenuLoaded')
     })
     
     // 鑾峰彇瑙掕壊鏉冮檺, edition_type 鎺ュ彛鐗堟湰鎺у埗 ''銆�'Y'銆�'A'
@@ -167,10 +164,24 @@
           })
         }
 
-        MKEmitter.emit('mkActionLoaded')
         window.GLOB.mkActions = _permAction
       })
     }, 50)
+  }
+
+  openTab = (menu, times) => {
+    if (times > 50) return
+    times++
+
+    let tabgroup = document.getElementById('mk-tabgroup-wrap')
+
+    if (window.GLOB.mkActions.loaded && tabgroup) {
+      MKEmitter.emit('modifyTabs', menu)
+    } else {
+      setTimeout(() => {
+        this.openTab(times)
+      }, 200)
+    }
   }
 
   getMenulist = (result) => {
@@ -251,6 +262,9 @@
                       trdItem.type = 'iframe'
                       trdItem.OpenType = 'newtab'
                     }
+                  } else if (trdItem.OpenType === 'view') {
+                    trdItem.OpenType = 'newpage'
+                    trdItem.src = '#/view/' + trd.MenuID
                   } else {
                     trdItem.src = '#/tab/' + trd.MenuID
                   }
@@ -300,8 +314,6 @@
         loginVisible: true
       })
     } else {
-      sessionStorage.setItem('isEditState', 'true')
-
       this.props.modifyMainMenu(null)
 
       this.props.history.replace('/design')
@@ -342,12 +354,11 @@
           sessionStorage.setItem('cloudDataM', res.dataM ? 'true' : '')
           sessionStorage.setItem('cloudRole_id', res.role_id || '')
 
-          sessionStorage.setItem('isEditState', 'true')
-
+          let _url = window.location.href.split('#')[0] + 'cloud'
           if (param.remember) {
-            let _url = window.location.href.split('#')[0] + 'cloud'
-
             localStorage.setItem(_url, window.btoa(window.encodeURIComponent(JSON.stringify({time: new Date().getTime(), username: param.username, password: param.password}))))
+          } else {
+            localStorage.setItem(_url, window.btoa(window.encodeURIComponent(JSON.stringify({time: new Date().getTime(), username: param.username, password: ''}))))
           }
 
           this.props.modifyMainMenu(null)
@@ -457,6 +468,8 @@
     window.addEventListener('storage', (e) => {
       if (e.key === 'getSessionStorage' && e.newValue === window.GLOB.appkey) {
         localStorage.setItem('sessionStorage', JSON.stringify(sessionStorage))
+      } else if (e.key === 'getSysPermission' && e.newValue === window.GLOB.appkey) {
+        localStorage.setItem('sysPermissions', JSON.stringify({mkThdMenus: window.GLOB.mkThdMenus, mkActions: window.GLOB.mkActions}))
       } else if (e.key === 'menuUpdate') {
         let menuId = e.newValue.split(',')[1]
         if (menuId) {

--
Gitblit v1.8.0