content.jsx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import React from 'react';
  2. import '../../content.less';
  3. import LeftTab from '../leftTab.jsx';
  4. import Comprehensive from './comprehensive.jsx';
  5. import Payment from './payment.jsx';
  6. import Correction from './correction.jsx';
  7. import Express from './express.jsx';
  8. import ApplyFee from './applyFee.jsx';
  9. const Content = React.createClass({
  10. getInitialState() {
  11. return {
  12. loading: false,
  13. leftKey: 'comprehensive',
  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 'comprehensive':
  35. return <Comprehensive />;
  36. case 'payment':
  37. return <Payment />;
  38. case 'correction':
  39. return <Correction />;
  40. case 'express':
  41. return <Express />;
  42. case 'applyFee':
  43. return <ApplyFee />;
  44. };
  45. })()}
  46. </div>
  47. </div>
  48. )
  49. }
  50. });
  51. export default Content;