From 78eed586f6a0d15162c89878c53a301e7b142a8a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 10 十月 2022 00:07:06 +0800
Subject: [PATCH] Merge branch 'master' into positec

---
 src/components/header/index.jsx |   46 ++++++++++++++++++++++++----------------------
 1 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx
index 6ecc8a9..03f6d5c 100644
--- a/src/components/header/index.jsx
+++ b/src/components/header/index.jsx
@@ -4,14 +4,12 @@
 import {connect} from 'react-redux'
 import { is, fromJS } from 'immutable'
 import moment from 'moment'
-import { Dropdown, Menu, Modal, Form, notification, Switch, Input } from 'antd'
+import { Dropdown, Menu, Modal, notification, Switch, Input } from 'antd'
 import { SearchOutlined, DownOutlined, MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons'
 
 import {
   toggleCollapse,
   modifyMainMenu,
-  initActionPermission,
-  initMenuPermission,
   logout
 } from '@/store/action'
 import asyncComponent from '@/utils/asyncSpinComponent'
@@ -185,7 +183,8 @@
       }
 
       this.props.modifyMainMenu(mainMenu)
-      this.props.initMenuPermission([...thdMenuList, {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'}])
+
+      window.GLOB.mkThdMenus = [...thdMenuList, {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'}]
 
       if (_menu) { // 寤舵椂鎵撳紑锛岄槻姝㈡爣绛剧粍鏈畬鎴愬姞杞�
         setTimeout(() => {
@@ -196,6 +195,7 @@
           }
         }, 200)
       }
+      MKEmitter.emit('mkMenuLoaded')
     })
     
     // 鑾峰彇瑙掕壊鏉冮檺, edition_type 鎺ュ彛鐗堟湰鎺у埗 ''銆�'Y'銆�'A'
@@ -207,14 +207,14 @@
       }).then(result => {
         let _permAction = {loaded: true} // 鎸夐挳鏉冮檺
 
-        if (result && result.status) {
+        if (result.status) {
           if (result.UserRoles_Menu) {
             result.UserRoles_Menu.forEach(menu => {
               if (!menu.MenuID) return
               _permAction[menu.MenuID] = true
             })
           }
-        } else if (result) {
+        } else {
           notification.error({
             top: 92,
             message: result.message,
@@ -222,7 +222,8 @@
           })
         }
 
-        this.props.initActionPermission(_permAction)
+        MKEmitter.emit('mkActionLoaded')
+        window.GLOB.mkActions = _permAction
       })
     }, 50)
   }
@@ -617,9 +618,9 @@
     return (
       <header className="header-container ant-menu-dark" id="main-header-container">
         <div className={'header-logo ' + (collapse && navBar !== 'topmenu' ? 'collapse' : '')} onClick={this.changeToHome}><img src={this.state.logourl} alt=""/></div>
-        <div className={'header-collapse ' + (collapse && navBar !== 'topmenu' ? 'collapse' : '')}>
-          {navBar !== 'topmenu' ? (collapse ? <MenuUnfoldOutlined onClick={this.handleCollapse}/> : <MenuFoldOutlined onClick={this.handleCollapse}/>) : null}
-        </div>
+        {navBar !== 'topmenu' ? <div className={'header-collapse ' + (collapse ? 'collapse' : '')}>
+          {collapse ? <MenuUnfoldOutlined onClick={this.handleCollapse}/> : <MenuFoldOutlined onClick={this.handleCollapse}/>}
+        </div> : <div style={{width: '20px', height: '45px'}}></div>}
         {/* 姝e父鑿滃崟 */}
         {navBar !== 'topmenu' && menulist ?
           <ul className="header-menu">{
@@ -713,15 +714,9 @@
             })}
           </ul> : null
         }
-        {/* 澶村儚銆佺敤鎴峰悕 */}
-        <Dropdown className="header-setting" overlay={menu}>
-          <div>
-            <img src={this.state.avatar || avatar} alt=""/>
-            <span>
-              <span className="username"><span>{this.state.fullName}</span>{this.state.userName ? <span>{this.state.userName}</span> : null}</span> <DownOutlined />
-            </span>
-          </div>
-        </Dropdown>
+        {!menulist ?
+          <div className="header-menu"></div> : null
+        }
         {/* 鑿滃崟鎼滅储 */}
         {thdMenuList.length > 0 ?
           <Dropdown overlayClassName="menu-select-dropdown" getPopupContainer={() => document.getElementById('main-header-container')} overlay={
@@ -758,6 +753,15 @@
             <SearchOutlined className="search-menu" />
           </Dropdown> : null
         }
+        {/* 澶村儚銆佺敤鎴峰悕 */}
+        <Dropdown className="header-setting" overlay={menu}>
+          <div>
+            <img src={this.state.avatar || avatar} alt=""/>
+            <span>
+              <span className="username"><span>{this.state.fullName}</span>{this.state.userName ? <span>{this.state.userName}</span> : null}</span> <DownOutlined />
+            </span>
+          </div>
+        </Dropdown>
         {/* 淇敼瀵嗙爜 */}
         <Modal
           title={this.state.dict['main.password']}
@@ -797,10 +801,8 @@
   return {
     toggleCollapse: (collapse) => dispatch(toggleCollapse(collapse)),
     modifyMainMenu: (mainMenu) => dispatch(modifyMainMenu(mainMenu)),
-    initActionPermission: (permAction) => dispatch(initActionPermission(permAction)),
-    initMenuPermission: (permMenus) => dispatch(initMenuPermission(permMenus)),
     logout: () => dispatch(logout())
   }
 }
 
-export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Form.create()(Header)))
\ No newline at end of file
+export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Header))
\ No newline at end of file

--
Gitblit v1.8.0