|  | @@ -1,36 +1,21 @@
 | 
	
		
			
				|  |  |  import logo from '@/assets/img/logo.png'
 | 
	
		
			
				|  |  | -import { DEL_USER_INFO } from '@/store/modules/user/types'
 | 
	
		
			
				|  |  |  import { RootState } from '@/store/reducers'
 | 
	
		
			
				|  |  |  import { iMenuItem } from '@/types/router'
 | 
	
		
			
				|  |  | -import consts from '@/utils/consts'
 | 
	
		
			
				|  |  |  import { Button, Dropdown, Menu } from "antd"
 | 
	
		
			
				|  |  | -import React, { useEffect } from 'react'
 | 
	
		
			
				|  |  | +import React from 'react'
 | 
	
		
			
				|  |  |  import { connect } from 'react-redux'
 | 
	
		
			
				|  |  | -import { Link, RouteComponentProps, withRouter } from "react-router-dom"
 | 
	
		
			
				|  |  | -import { apiLogout } from './api'
 | 
	
		
			
				|  |  | +import { Link } from "react-router-dom"
 | 
	
		
			
				|  |  | +import store from 'store'
 | 
	
		
			
				|  |  |  import styles from './index.module.scss'
 | 
	
		
			
				|  |  |  import './index.scss'
 | 
	
		
			
				|  |  |  import MenuItem from './MenuItem'
 | 
	
		
			
				|  |  | -interface iMenuProps extends RouteComponentProps{
 | 
	
		
			
				|  |  | +interface iMenuProps {
 | 
	
		
			
				|  |  |    list: iMenuItem[],
 | 
	
		
			
				|  |  | -  history: any
 | 
	
		
			
				|  |  |    username: string
 | 
	
		
			
				|  |  | -  logout: Function
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const NavSider:React.FC<iMenuProps> = (props)=> {
 | 
	
		
			
				|  |  | -  const { list: MeunList, history, username, logout } = props
 | 
	
		
			
				|  |  | -  const handleLogout = async () => {
 | 
	
		
			
				|  |  | -      const { code = -1 } = await apiLogout()
 | 
	
		
			
				|  |  | -      if (code === consts.RET_CODE.SUCCESS) {
 | 
	
		
			
				|  |  | -        history.push('/')
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -  useEffect(() => {
 | 
	
		
			
				|  |  | -    return () => {
 | 
	
		
			
				|  |  | -      logout()
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -  }, [])
 | 
	
		
			
				|  |  | +  const { list: MeunList, username } = props
 | 
	
		
			
				|  |  |    return (
 | 
	
		
			
				|  |  |      <div className="main-nav">
 | 
	
		
			
				|  |  |        <div className="logo"><img src={logo}></img></div>
 | 
	
	
		
			
				|  | @@ -49,25 +34,7 @@ const NavSider:React.FC<iMenuProps> = (props)=> {
 | 
	
		
			
				|  |  |              )
 | 
	
		
			
				|  |  |            }
 | 
	
		
			
				|  |  |            <div className="pi-text-center">
 | 
	
		
			
				|  |  | -            <Dropdown overlay={() => {
 | 
	
		
			
				|  |  | -                return (
 | 
	
		
			
				|  |  | -                  <Menu>
 | 
	
		
			
				|  |  | -                    <Menu.Item key="0">
 | 
	
		
			
				|  |  | -                      <Link to="/acount/safe">账号资料</Link>
 | 
	
		
			
				|  |  | -                    </Menu.Item>
 | 
	
		
			
				|  |  | -                    <Menu.Item key="1">
 | 
	
		
			
				|  |  | -                      <Link to="/acount/safe">账号安全</Link>
 | 
	
		
			
				|  |  | -                    </Menu.Item>
 | 
	
		
			
				|  |  | -                    <Menu.Divider />
 | 
	
		
			
				|  |  | -                    <Menu.Item key="2">
 | 
	
		
			
				|  |  | -                      <Link to="/acount/safe">帮助中心</Link>
 | 
	
		
			
				|  |  | -                    </Menu.Item>
 | 
	
		
			
				|  |  | -                    <Menu.Item key="3">
 | 
	
		
			
				|  |  | -                      <span onClick={handleLogout}>退出登录</span>
 | 
	
		
			
				|  |  | -                    </Menu.Item>
 | 
	
		
			
				|  |  | -                  </Menu>
 | 
	
		
			
				|  |  | -                )
 | 
	
		
			
				|  |  | -            }} trigger={[ 'click' ]} placement="topRight">
 | 
	
		
			
				|  |  | +            <Dropdown overlay={DropMenu} trigger={[ 'click' ]} placement="topRight">
 | 
	
		
			
				|  |  |                <Button size="small" className={styles.bottomBtn}>{username}</Button>
 | 
	
		
			
				|  |  |              </Dropdown>
 | 
	
		
			
				|  |  |            </div>
 | 
	
	
		
			
				|  | @@ -81,9 +48,24 @@ const mapStateToProps = (state:RootState) => {
 | 
	
		
			
				|  |  |      username: state.user.userInfo.Name
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | -const mapDispathToProps = {
 | 
	
		
			
				|  |  | -  logout: () => {
 | 
	
		
			
				|  |  | -    return { type: DEL_USER_INFO }
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const DropMenu = () => {
 | 
	
		
			
				|  |  | +  return (
 | 
	
		
			
				|  |  | +    <Menu>
 | 
	
		
			
				|  |  | +      <Menu.Item key="0">
 | 
	
		
			
				|  |  | +        <Link to="/acount/safe">账号资料</Link>
 | 
	
		
			
				|  |  | +      </Menu.Item>
 | 
	
		
			
				|  |  | +      <Menu.Item key="1">
 | 
	
		
			
				|  |  | +        <Link to="/acount/safe">账号安全</Link>
 | 
	
		
			
				|  |  | +      </Menu.Item>
 | 
	
		
			
				|  |  | +      <Menu.Divider />
 | 
	
		
			
				|  |  | +      <Menu.Item key="2">
 | 
	
		
			
				|  |  | +        <Link to="/acount/safe">帮助中心</Link>
 | 
	
		
			
				|  |  | +      </Menu.Item>
 | 
	
		
			
				|  |  | +      <Menu.Item key="3">
 | 
	
		
			
				|  |  | +        <span onClick={store.dispatch()}>退出登录</span>
 | 
	
		
			
				|  |  | +      </Menu.Item>
 | 
	
		
			
				|  |  | +    </Menu>
 | 
	
		
			
				|  |  | +  )
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | -export default withRouter(connect(mapStateToProps, mapDispathToProps)(NavSider))
 | 
	
		
			
				|  |  | +export default connect(mapStateToProps)(NavSider)
 |