From 8190d6e5ac14616d85e3992169ecef6d99d03b76 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 13 十一月 2020 15:29:57 +0800 Subject: [PATCH] 2020-11-13 --- src/menu/header/index.jsx | 77 ++------------------------------------ 1 files changed, 4 insertions(+), 73 deletions(-) diff --git a/src/menu/header/index.jsx b/src/menu/header/index.jsx index 348c2e1..7087ee9 100644 --- a/src/menu/header/index.jsx +++ b/src/menu/header/index.jsx @@ -1,103 +1,34 @@ import React, {Component} from 'react' -import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { connect } from 'react-redux' -import { withRouter } from 'react-router-dom' -// import { Icon, Modal } from 'antd' -import { logout } from '@/store/action' -import zhCN from '@/locales/zh-CN/mob.js' -import enUS from '@/locales/en-US/mob.js' import avatar from '@/assets/img/avatar.jpg' import './index.scss' -// const { confirm } = Modal - -class MobHeader extends Component { - static propTpyes = { - saveIng: PropTypes.any, - triggerSave: PropTypes.func, - closeView: PropTypes.func - } - +class MenuHeader extends Component { state = { - dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, logourl: window.GLOB.mainlogo, avatar: sessionStorage.getItem('CloudAvatar') || avatar, userName: sessionStorage.getItem('CloudUserName') } - // logout = () => { - // // 閫�鍑虹櫥褰� - // let _this = this - // confirm({ - // title: this.state.dict['mob.logout.hint'], - // content: '', - // onOk() { - // sessionStorage.clear() - // _this.props.logout() - // _this.props.history.replace('/login') - // }, - // onCancel() {} - // }) - // } - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + return !is(fromJS(this.state), fromJS(nextState)) } - - // componentDidMount () { - // this.getImage() - // } - - // getImage = () => { - // const { logourl } = this.state - // const _this = this - - // let xhr = new XMLHttpRequest() - // xhr.open('get', logourl, true) - // xhr.responseType = 'blob' - // xhr.onload = function () { - // if (this.status === 200) { - // // document.getElementById(imgId).src = URL.createObjectURL(this.response) - // _this.setState({ - // logourl: URL.createObjectURL(this.response) - // }) - // } - // } - // xhr.send(null) - // } render () { return ( <header className="menu-header-container"> <div className="header-logo"><img src={this.state.logourl} alt=""/></div> - {/* <Dropdown className="header-setting" overlay={ - <Menu> - <Menu.Item key="2" onClick={this.logout}>{this.state.dict['mob.logout']}</Menu.Item> - </Menu> - }> */} <div className="header-setting"> <img src={this.state.avatar} alt=""/> <span> - <span className="username">{this.state.userName}</span>{/* <Icon type="down" /> */} + <span className="username">{this.state.userName}</span> </span> </div> - {/* </Dropdown> */} </header> ) } } -const mapStateToProps = () => { - return {} -} - -const mapDispatchToProps = (dispatch) => { - return { - logout: () => dispatch(logout()) - } -} - -export default withRouter(connect(mapStateToProps, mapDispatchToProps)(MobHeader)) \ No newline at end of file +export default MenuHeader \ No newline at end of file -- Gitblit v1.8.0