content.jsx 1.2 KB

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