leftTab.jsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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" : array.includes("5") // 财务专员
  37. ? "statisticsCw" : array.includes("6") // 财务经理
  38. ? "statisticsCw" : "no"}>
  39. 数据统计
  40. </Menu.Item>
  41. <Menu.Item key="normal">
  42. 常用功能
  43. </Menu.Item>
  44. <Menu.Item key="contacts">
  45. 常用联系人
  46. </Menu.Item>
  47. </Menu >
  48. );
  49. },
  50. });
  51. export default LeftTab;