content.jsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 queryProject={0}/>;
  38. case 'projectQuery':
  39. return <ProjectManage queryProject={1}/>;
  40. case 'myTask':
  41. return <MyTask />;
  42. case 'taskManagement':
  43. return <TaskManagement />;
  44. default:
  45. return <Module />;
  46. };
  47. })()}
  48. </div>
  49. </div>
  50. )
  51. }
  52. });
  53. export default Content;