content.jsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import React from 'react';
  2. import '../../content.less';
  3. import LeftTab from '../leftTab.jsx';
  4. import ProjectOrder from './orderOrder/projectOrder.jsx';
  5. import ProjectManage from './projectManagement/projectManage.jsx';
  6. import MyTask from './myTask/projectManage.jsx';
  7. import Module from '../../module.jsx';
  8. const Content = React.createClass({
  9. getInitialState() {
  10. return {
  11. loading: false,
  12. leftKey: 'myProject',
  13. };
  14. },
  15. handlekey(key) {
  16. this.setState({
  17. leftKey: key,
  18. });
  19. window.location.hash = key;
  20. },
  21. componentWillMount(){
  22. if ( window.location.hash ) {
  23. this.handlekey(window.location.hash.substr(1));
  24. };
  25. },
  26. render() {
  27. return (
  28. <div className="manage-content">
  29. <LeftTab handlekey={this.handlekey} />
  30. <div className="content-right">
  31. {(() => {
  32. switch (this.state.leftKey) {
  33. case 'myProject':
  34. return <ProjectOrder />;
  35. case 'projectManage':
  36. return <ProjectManage />;
  37. case 'myTask':
  38. return <MyTask />;
  39. default:
  40. return <Module />;
  41. };
  42. })()}
  43. </div>
  44. </div>
  45. )
  46. }
  47. });
  48. export default Content;