leftTab.jsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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: ''
  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. ? "statisticsYxy" : array.includes("2") // 营销经理
  34. ? "statisticsYxy" : array.includes("8") // 咨询师
  35. ? "statisticsZxs" : array.includes("9") // 咨询师经理
  36. ? "statisticsZxs" : "no"}>
  37. 数据统计
  38. </Menu.Item>
  39. <Menu.Item key="normal">
  40. 常用功能
  41. </Menu.Item>
  42. <Menu.Item key="contacts">
  43. 常用联系人
  44. </Menu.Item>
  45. </Menu >
  46. );
  47. },
  48. });
  49. export default LeftTab;