king
2022-10-08 9c6795fd3c44e46cf3955fbfd8f8eeca23acb7a9
src/components/header/index.jsx
@@ -10,8 +10,6 @@
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>}
        {/* 正常菜单 */}
        {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,8 +801,6 @@
  return {
    toggleCollapse: (collapse) => dispatch(toggleCollapse(collapse)),
    modifyMainMenu: (mainMenu) => dispatch(modifyMainMenu(mainMenu)),
    initActionPermission: (permAction) => dispatch(initActionPermission(permAction)),
    initMenuPermission: (permMenus) => dispatch(initMenuPermission(permMenus)),
    logout: () => dispatch(logout())
  }
}