From 0c439ced2c97905cb2b02f5f689a37b19369fb8a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 22 七月 2022 15:00:58 +0800
Subject: [PATCH] 2022-07-22

---
 src/views/design/header/index.jsx |   38 ++++++++++++++++++++++++--------------
 1 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/src/views/design/header/index.jsx b/src/views/design/header/index.jsx
index 7146bae..a34c34d 100644
--- a/src/views/design/header/index.jsx
+++ b/src/views/design/header/index.jsx
@@ -22,7 +22,7 @@
 import MKEmitter from '@/utils/events.js'
 import './index.scss'
 
-const EditMenu = asyncComponent(() => import('@/templates/menuconfig/editfirstmenu'))
+const EditMenu = asyncComponent(() => import('./editfirstmenu'))
 const VersionsUp = asyncComponent(() => import('./versions'))
 const { confirm } = Modal
 
@@ -32,6 +32,7 @@
     dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     userName: sessionStorage.getItem('CloudUserName'),
     avatar: Utils.getrealurl(sessionStorage.getItem('CloudAvatar')),
+    memberLevel: Utils.getMemberLevel()
   }
 
   logout = () => {
@@ -80,6 +81,12 @@
       this.props.modifyMenuTree(menulist)
       if (window.GLOB.systemType !== 'production') { // 闈炴寮忕郴缁熼�夋嫨绗竴椤�
         this.props.modifyMainMenu(menulist[0] || null)
+      } else {
+        this.props.resetEditLevel('HS')
+        window.GLOB.mkHS = true
+        this.props.modifyMainMenu({
+          MenuID: 'systemManageView'
+        })
       }
     } else {
       notification.error({
@@ -154,7 +161,7 @@
                 trdItem.type = trdItem.PageParam.Template || trdItem.type
                 trdItem.OpenType = trdItem.PageParam.OpenType || trdItem.OpenType
 
-                if (trdItem.type === 'CustomPage' && this.props.memberLevel < 20) { // 浼氬憳绛夌骇澶т簬绛変簬20鏃讹紝鏈夌紪杈戞潈闄�
+                if (trdItem.type === 'CustomPage' && this.state.memberLevel < 20) { // 浼氬憳绛夌骇澶т簬绛変簬20鏃讹紝鏈夌紪杈戞潈闄�
                   trdItem.forbidden = true
                 }
               }
@@ -195,6 +202,7 @@
 
     if (editLevel === 'HS')  return
 
+    window.GLOB.mkHS = true
     this.props.resetEditLevel('HS')
     this.props.modifyMainMenu({
       MenuID: 'systemManageView'
@@ -215,6 +223,7 @@
 
     this.props.modifyMainMenu(menulist[0] || null)
     this.props.resetEditLevel(false)
+    window.GLOB.mkHS = false
 
     MKEmitter.emit('modifyTabs', null, 'replace')
   }
@@ -222,6 +231,7 @@
   exitEdit = () => {
     // 閫�鍑虹紪杈戠姸鎬�
     this.props.resetEditLevel(false)
+    window.GLOB.mkHS = false
   }
   
   UNSAFE_componentWillMount () {
@@ -272,12 +282,13 @@
           }
         })
       }, 50)
-    } else if (window.GLOB.systemType === 'production') {
-      this.props.resetEditLevel('HS')
-      this.props.modifyMainMenu({
-        MenuID: 'systemManageView'
-      })
     }
+
+    window.addEventListener('storage', (e) => {
+      if (e.key !== 'menuUpdate') return
+
+      this.reload()
+    })
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -305,7 +316,7 @@
 
   render () {
     const { mainMenu, editLevel } = this.props
-    const { menulist } = this.state
+    const { menulist, memberLevel } = this.state
 
     return (
       <header className={'sys-header-container ant-menu-dark ' + (['level2', 'level3', 'HS'].includes(editLevel) ? 'mask' : '')} id="main-header-container">
@@ -338,7 +349,7 @@
             <div className="icon"><AppstoreOutlined /></div>
             <div className="title">搴旂敤绠$悊</div>
             <div className="detail">鍙垱寤哄強绠$悊PC銆乸ad鍙婄Щ鍔ㄧ绛変笉鍚岃澶囩殑搴旂敤锛屽疄鐜版槑绉戜簯APP銆佸井淇″叕浼楀彿銆佸皬绋嬪簭绛夊骞冲彴鐨勫簲鐢ㄥ叡浜��</div>
-            <Button type="primary" disabled={!(this.props.memberLevel >= 20)} title={this.props.memberLevel >= 20 ? '' : '浼氬憳绛夌骇涓嶅锛屾棤寮�鍙戞潈闄愩��'} onClick={() => {window.open('#/appmanage')}}>
+            <Button type="primary" disabled={!(memberLevel >= 20)} title={memberLevel >= 20 ? '' : '浼氬憳绛夌骇涓嶅锛屾棤寮�鍙戞潈闄愩��'} onClick={() => {window.open('#/appmanage')}}>
               缂栬緫
             </Button>
           </div> : null
@@ -348,7 +359,7 @@
             <div className="icon"><AppstoreOutlined /></div>
             <div className="title">搴旂敤绠$悊</div>
             <div className="detail">鍙垱寤哄強绠$悊PC銆乸ad鍙婄Щ鍔ㄧ绛変笉鍚岃澶囩殑搴旂敤锛屽疄鐜版槑绉戜簯APP銆佸井淇″叕浼楀彿銆佸皬绋嬪簭绛夊骞冲彴鐨勫簲鐢ㄥ叡浜��</div>
-            <Button type="primary" disabled={!(this.props.memberLevel >= 20)} title={this.props.memberLevel >= 20 ? '' : '浼氬憳绛夌骇涓嶅锛屾棤寮�鍙戞潈闄愩��'} onClick={() => {window.open('#/appcheck')}}>
+            <Button type="primary" disabled={!(memberLevel >= 20)} title={memberLevel >= 20 ? '' : '浼氬憳绛夌骇涓嶅锛屾棤寮�鍙戞潈闄愩��'} onClick={() => {window.open('#/appcheck')}}>
               鏌ョ湅
             </Button>
           </div> : null
@@ -358,7 +369,7 @@
             <div className="icon"><ApiOutlined /></div>
             <div className="title">鎺ュ彛璋冭瘯</div>
             <div className="detail">鍙嚜鍔ㄥ鐞嗙櫥褰曟帴鍙g殑鍙傛暟鍔犲瘑锛屼互鍙婁笟鍔℃帴鍙g殑绛惧悕璁$畻锛屾柟渚垮紑鍙戜汉鍛樼殑鎺ュ彛娴嬭瘯宸ヤ綔銆�</div>
-            <Button type="primary" disabled={!(this.props.memberLevel >= 20)} title={this.props.memberLevel >= 20 ? '' : '浼氬憳绛夌骇涓嶅锛屾棤寮�鍙戞潈闄愩��'} onClick={() => {window.open('#/interface')}}>
+            <Button type="primary" disabled={!(memberLevel >= 20)} title={memberLevel >= 20 ? '' : '浼氬憳绛夌骇涓嶅锛屾棤寮�鍙戞潈闄愩��'} onClick={() => {window.open('#/interface')}}>
               缂栬緫
             </Button>
           </div> : null
@@ -369,7 +380,7 @@
             <div className="icon"><HomeOutlined /></div>
             <div className="title">棣栭〉</div>
             <div className="detail">鍩轰簬鑷畾涔夐〉闈㈢殑棣栭〉璁捐锛屽彲瀹炵幇鐏垫椿鐨勫厓绱犻厤缃強鏍峰紡璋冩暣锛屽睍鐜板綋鍓嶇郴缁熺殑椋庢牸銆�</div>
-            <Button type="primary" disabled={!(this.props.memberLevel >= 20)} title={this.props.memberLevel >= 20 ? '' : '浼氬憳绛夌骇涓嶅锛屾棤寮�鍙戞潈闄愩��'} onClick={() => {window.open('#/menudesign/JTdCJTIyTWVudVR5cGUlMjIlM0ElMjJob21lJTIyJTJDJTIyTWVudUlkJTIyJTNBJTIyaG9tZV9wYWdlX2lkJTIyJTJDJTIyTWVudU5hbWUlMjIlM0ElMjIlRTklQTYlOTYlRTklQTElQjUlMjIlN0Q=')}}>
+            <Button type="primary" disabled={!(memberLevel >= 20)} title={memberLevel >= 20 ? '' : '浼氬憳绛夌骇涓嶅锛屾棤寮�鍙戞潈闄愩��'} onClick={() => {window.open('#/menudesign/JTdCJTIyTWVudVR5cGUlMjIlM0ElMjJob21lJTIyJTJDJTIyTWVudUlkJTIyJTNBJTIyaG9tZV9wYWdlX2lkJTIyJTJDJTIyTWVudU5hbWUlMjIlM0ElMjIlRTklQTYlOTYlRTklQTElQjUlMjIlN0Q=')}}>
               缂栬緫
             </Button>
           </div> : null
@@ -407,8 +418,7 @@
     menuTree: state.menuTree,
     mainMenu: state.mainMenu,
     editLevel: state.editLevel,
-    permAction: state.permAction,
-    memberLevel: state.memberLevel
+    permAction: state.permAction
   }
 }
 

--
Gitblit v1.8.0