content.jsx 1.4 KB

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