import React from 'react';
import { Menu, Icon } from 'antd';
import '../leftTab.less';
const SubMenu = Menu.SubMenu;
const MenuItemGroup = Menu.ItemGroup;

const LeftTab = React.createClass({
  getInitialState() {
    return {
      current: ''
    };
  },
  handleClick(e) {
    this.props.handlekey(e.key);
    this.setState({
      current: e.key,
    });
  },
  componentWillMount() {
    if (window.location.hash) {
      this.state.current = window.location.hash.substr(1);
    };
  },
  render() {
    let array = window.adminData.shiroList.split(",");
    return (
      <Menu onClick={this.handleClick}
        selectedKeys={[this.state.current]}
        mode="vertical"
        className="account-left" >
        <Menu.Item
          key={
            array.includes("1") // 营销员
              ? "statisticsYxy" : array.includes("2") // 营销经理
                ? "statisticsYxy" : array.includes("8") // 咨询师 
                  ? "statisticsZxs" : array.includes("9") // 咨询师经理
                    ? "statisticsZxs" : array.includes("5") // 财务专员
                      ? "statisticsCw" : array.includes("6") // 财务经理
                        ? "statisticsCw" : "no"}>
          数据统计
        </Menu.Item>
        <Menu.Item key="normal">
          常用功能
        </Menu.Item>
        <Menu.Item key="contacts">
          常用联系人
        </Menu.Item>
      </Menu >
    );
  },
});

export default LeftTab;