diff --git a/src/components/GlobalHeader/index.js b/src/components/GlobalHeader/index.js
index 6e39d2f8aa2e06ad263eb10ababfdead12143f0a..222002c288f9f1d918adaf2afa6b1917199630af 100644
--- a/src/components/GlobalHeader/index.js
+++ b/src/components/GlobalHeader/index.js
@@ -1,22 +1,16 @@
import React, { PureComponent } from 'react';
-import { Layout, Menu, Icon, Spin, Tag, Dropdown, Avatar, message, Divider } from 'antd';
+import { Layout, Menu, Icon, Spin, Tag, Dropdown, Avatar, Divider } from 'antd';
import moment from 'moment';
import groupBy from 'lodash/groupBy';
import Debounce from 'lodash-decorators/debounce';
import { Link } from 'dva/router';
import NoticeIcon from '../../components/NoticeIcon';
import HeaderSearch from '../../components/HeaderSearch';
-import logo from '../../assets/logo.svg';
import styles from './index.less';
const { Header } = Layout;
export default class GlobalHeader extends PureComponent {
- componentDidMount() {
- this.props.dispatch({
- type: 'user/fetchCurrent',
- });
- }
componentWillUnmount() {
this.triggerResizeEvent.cancel();
}
@@ -47,33 +41,9 @@ export default class GlobalHeader extends PureComponent {
});
return groupBy(newNotices, 'type');
}
- handleNoticeClear = (type) => {
- message.success(`清空了${type}`);
- this.props.dispatch({
- type: 'global/clearNotices',
- payload: type,
- });
- }
- handleNoticeVisibleChange = (visible) => {
- if (visible) {
- this.props.dispatch({
- type: 'global/fetchNotices',
- });
- }
- }
- handleMenuClick = ({ key }) => {
- if (key === 'logout') {
- this.props.dispatch({
- type: 'login/logout',
- });
- }
- }
toggle = () => {
- const { collapsed } = this.props;
- this.props.dispatch({
- type: 'global/changeLayoutCollapsed',
- payload: !collapsed,
- });
+ const { collapsed, onCollapse } = this.props;
+ onCollapse(!collapsed);
this.triggerResizeEvent();
}
@Debounce(600)
@@ -84,10 +54,11 @@ export default class GlobalHeader extends PureComponent {
}
render() {
const {
- currentUser, collapsed, fetchingNotices, isMobile,
+ currentUser, collapsed, fetchingNotices, isMobile, logo,
+ onNoticeVisibleChange, onMenuClick, onNoticeClear,
} = this.props;
const menu = (
-