import './Header.scss' import React, { Component } from 'react' import PropTypes from 'prop-types' import { connect } from 'react-redux' import { Link } from 'react-router-dom' import { Icon, Layout, Menu} from 'antd' import { logoutActions, loginTypeAction} from '../../actions/login' const { Header } = Layout; const ToolUser = (props)=> ( ); ToolUser.propTypes={ user:PropTypes.string, msg:PropTypes.string, relieveLink:PropTypes.func, logout:PropTypes.func }; const ToolGuest = ()=> ( ); ToolGuest.propTypes={ onLogin:PropTypes.func, onReg:PropTypes.func } class HeaderCom extends Component { constructor(props) { super(props); this.state = { current : window.location.hash.split("#")[1] } } static propTypes ={ user: PropTypes.string, msg: PropTypes.string, login:PropTypes.bool, relieveLink:PropTypes.func, logoutActions:PropTypes.func, loginTypeAction:PropTypes.func } linkTo = (e) =>{ this.setState({ current : e.key }) } relieveLink = () => { this.setState({ current : "" }) } logout = (e) => { e.preventDefault(); this.props.logoutActions(); } handleLogin = (e) => { e.preventDefault(); this.props.loginTypeAction("1"); } handleReg = (e)=>{ e.preventDefault(); this.props.loginTypeAction("2"); } render () { const { login, user, msg } = this.props; return (
YAPI
首页 分组 接口
{login?:}
) } } export default connect( (state) => { return{ user: state.login.userName, msg: null, login:state.login.isLogin } }, { loginTypeAction, logoutActions } )(HeaderCom)