content.jsx 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import React from 'react';
  2. import '../content.less';
  3. import LeftTab from './leftTab.jsx';
  4. import Patent from './patent';
  5. import Intellectual from './intellectual';
  6. import Activity from './activity';
  7. import Standard from './standard';
  8. import ActivityCostList from './activityCostList';
  9. import TechProduct from './techProduct';
  10. import Ratepay from './ratepay';
  11. import Finance from './finance';
  12. const Content = React.createClass({
  13. getInitialState() {
  14. return {
  15. loading: false,
  16. leftKey: 'patent',
  17. userType: '0'
  18. };
  19. },
  20. handlekey(key) {
  21. this.setState({
  22. leftKey: key,
  23. });
  24. window.location.hash = key;
  25. },
  26. componentWillMount() {
  27. if (window.location.hash) {
  28. this.handlekey(window.location.hash.substr(1));
  29. };
  30. },
  31. render() {
  32. return (
  33. <div className="acc-content">
  34. <LeftTab handlekey={this.handlekey} />
  35. <div className="content-right">
  36. {(() => {
  37. switch (this.state.leftKey) {
  38. case 'patent':
  39. return <Patent />;
  40. case 'intellectual':
  41. return <Intellectual />;
  42. case 'activity':
  43. return <Activity />;
  44. case 'standard':
  45. return <Standard />;
  46. case 'activityCostList':
  47. return <ActivityCostList />;
  48. case 'techProduct':
  49. return <TechProduct />;
  50. case 'ratepay':
  51. return <Ratepay />;
  52. case 'finance':
  53. return <Finance />;
  54. };
  55. })()}
  56. </div>
  57. </div>
  58. )
  59. }
  60. });
  61. export default Content;