content.jsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import React from 'react';
  2. import '../../content.less';
  3. import LeftTab from '../leftTab.jsx';
  4. import ApplyManage from './applyManage.jsx';
  5. import WebsiteManage from './websiteManage.jsx';
  6. const Content = React.createClass({
  7. getInitialState() {
  8. return {
  9. loading: false,
  10. leftKey: 'websiteManage',
  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 'applyManage':
  32. return <ApplyManage />;
  33. case 'websiteManage':
  34. return <WebsiteManage />;
  35. };
  36. })()}
  37. </div>
  38. </div>
  39. )
  40. }
  41. });
  42. export default Content;