leftTab.jsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import React from 'react';
  2. import { Menu, Icon } from 'antd';
  3. import '../leftTab.less';
  4. const SubMenu = Menu.SubMenu;
  5. const MenuItemGroup = Menu.ItemGroup;
  6. const LeftTab = React.createClass({
  7. getInitialState() {
  8. return {
  9. current: 'statistics'
  10. };
  11. },
  12. handleClick(e) {
  13. this.props.handlekey(e.key);
  14. this.setState({
  15. current: e.key,
  16. });
  17. },
  18. componentWillMount() {
  19. if (window.location.hash) {
  20. this.state.current = window.location.hash.substr(1);
  21. };
  22. },
  23. render() {
  24. let array = window.adminData.shiroList.split(",");
  25. return (
  26. <Menu onClick={this.handleClick}
  27. selectedKeys={[this.state.current]}
  28. mode="vertical"
  29. className="account-left" >
  30. <Menu.Item
  31. key={
  32. array.includes("1") // 营销员
  33. ? "statistics" : array.includes("2") // 营销经理
  34. ? "statistics" : "no"}>
  35. 数据统计
  36. </Menu.Item>
  37. <Menu.Item key="normal">
  38. 常用功能
  39. </Menu.Item>
  40. <Menu.Item key="contacts">
  41. 常用联系人
  42. </Menu.Item>
  43. </Menu >
  44. );
  45. },
  46. });
  47. export default LeftTab;