import { IdcardOutlined, LikeTwoTone, MailOutlined, StarTwoTone } from '@ant-design/icons' import { Menu } from 'antd' import PubSub from 'pubsub-js' import React, { Component } from 'react' import CollectionBag from './components/collection-bag' import GoodBag from './components/good-bag' import './index.less' export default class PersonalCenter extends Component { constructor(props) { super(props) this.state = { currentKeyMap: 0, //选中的menu userName: '', //姓名 intervieweEamil: '', //邮箱 headImg: '', //头像 department: '', //部门 practiceAmount: 0, //练题数 inputAmount: 0, //录题数 goodAmount: 0, //点赞数 collectionAmount: 0, //收藏数 subMenuList: [] } } personList = { // 0: '刷题', 0: '收藏', 1: '点赞' } componentDidMount() { PubSub.subscribe('handleToRender', () => { this.setState({}) }) } /** * 切换菜单 * @param {*} e */ handleClick = e => { console.log('--------', e) //截取_后的字符 let index = e.keyPath[0].lastIndexOf('_') let index2 = e.keyPath[0].substring(index + 1, e.keyPath[0].length) // console.log('index2>>>>', index2) this.setState({ currentKeyMap: Number(index2) }) } render() { let { headImg, userName, intervieweEamil, department, goodAmount, collectionAmount, practiceAmount, inputAmount } = this.state const { currentKeyMap } = this.state return (