content.jsx 2.1 KB

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