content.jsx 1.3 KB

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