content.jsx 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. if (userData.type == 1) {
  45. return <GroupLeftTab handlekey={this.handlekey} />;
  46. } else {
  47. return <LeftTab handlekey={this.handlekey} />;
  48. };
  49. })()}
  50. <div className="content-right">
  51. {(() => {
  52. switch (this.state.leftKey) {
  53. case 'base':
  54. return <Base />;
  55. case 'person':
  56. return <Person />;
  57. case 'edu':
  58. return <Edu />;
  59. case 'pfs':
  60. return <Pfs />;
  61. case 'ablt':
  62. return <Ablt />;
  63. case 'group':
  64. return <Group />;
  65. case 'company':
  66. return <Company />;
  67. case 'tech':
  68. return <Tech />;
  69. case 'hrSituation':
  70. return <HrSituation />;
  71. };
  72. })()}
  73. </div>
  74. </div>
  75. )
  76. }
  77. });
  78. export default Content;