content.jsx 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import React from 'react';
  2. import '../content.less';
  3. import LeftTab from './leftTab.jsx';
  4. import GroupLeftTab from './leftTabgroup.jsx';
  5. import Base from './base.jsx';
  6. import Group from './group.jsx';
  7. import Person from './person.jsx';
  8. import Company from './company.jsx';
  9. import Edu from './edu.jsx';
  10. import Tech from './tech.jsx';
  11. import Pfs from './pfs.jsx';
  12. import Ablt from './ablt.jsx';
  13. const Content = React.createClass({
  14. getInitialState() {
  15. return {
  16. loading: false,
  17. leftKey: 'base',
  18. userType: '0'
  19. };
  20. },
  21. handlekey(key) {
  22. this.setState({
  23. leftKey: key,
  24. });
  25. },
  26. componentWillMount() {
  27. if (userData) {
  28. if (userData.type == '0') {
  29. this.state.leftKey = 'base';
  30. } else if (userData.type == '1') {
  31. this.state.leftKey = 'group';
  32. };
  33. }
  34. },
  35. render() {
  36. return (
  37. <div className="acc-content">
  38. {(() => {
  39. switch (userData.type || this.state.userType) {
  40. case '0':
  41. return <LeftTab handlekey={this.handlekey} />;
  42. case '1':
  43. return <GroupLeftTab handlekey={this.handlekey} />;
  44. };
  45. })()}
  46. <div className="content-right">
  47. {(() => {
  48. switch (this.state.leftKey) {
  49. case 'base':
  50. return <Base />;
  51. case 'person':
  52. return <Person />;
  53. case 'edu':
  54. return <Edu />;
  55. case 'pfs':
  56. return <Pfs />;
  57. case 'ablt':
  58. return <Ablt />;
  59. case 'group':
  60. return <Group />;
  61. case 'company':
  62. return <Company />;
  63. case 'tech':
  64. return <Tech />;
  65. };
  66. })()}
  67. </div>
  68. </div>
  69. )
  70. }
  71. });
  72. export default Content;