content.jsx 1.7 KB

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