content.jsx 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. import HrSituation from './hrSituation.jsx';
  14. const Content = React.createClass({
  15. getInitialState() {
  16. return {
  17. loading: false,
  18. leftKey: 'standard',
  19. userType: '0'
  20. };
  21. },
  22. handlekey(key) {
  23. this.setState({
  24. leftKey: key,
  25. });
  26. window.location.hash = key;
  27. },
  28. componentWillMount() {
  29. if (userData) {
  30. if (userData.type == '0') {
  31. this.state.leftKey = 'base';
  32. } else if (userData.type == '1') {
  33. this.state.leftKey = 'group';
  34. };
  35. };
  36. if (window.location.hash) {
  37. this.handlekey(window.location.hash.substr(1));
  38. };
  39. },
  40. render() {
  41. return (
  42. <div className="acc-content">
  43. {(() => {
  44. switch (userData.type || this.state.userType) {
  45. case '0':
  46. return <LeftTab handlekey={this.handlekey} />;
  47. case '1':
  48. return <GroupLeftTab handlekey={this.handlekey} />;
  49. };
  50. })()}
  51. <div className="content-right">
  52. {(() => {
  53. switch (this.state.leftKey) {
  54. case 'base':
  55. return <Base />;
  56. case 'person':
  57. return <Person />;
  58. case 'edu':
  59. return <Edu />;
  60. case 'pfs':
  61. return <Pfs />;
  62. case 'ablt':
  63. return <Ablt />;
  64. case 'group':
  65. return <Group />;
  66. case 'company':
  67. return <Company />;
  68. case 'tech':
  69. return <Tech />;
  70. case 'hrSituation':
  71. return <HrSituation />;
  72. };
  73. })()}
  74. </div>
  75. </div>
  76. )
  77. }
  78. });
  79. export default Content;