content.jsx 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. import React, { Component } from 'react';
  2. import '../content.less';
  3. import './content.less';
  4. import LeftTab from '../leftTab';
  5. import {getMenu} from '../publicMenu.js'
  6. class Content extends Component {
  7. constructor() {
  8. super();
  9. this.state = {
  10. loading: false,
  11. component: <div />,
  12. };
  13. }
  14. componentWillMount() {
  15. var ids=window.location.href.indexOf('rid=');
  16. var idk=window.location.href.substr(ids+4);
  17. var rid=idk.split('#');
  18. let menu=getMenu(rid);
  19. let curry;
  20. if(menu[0].subMenus.length>0){
  21. curry=menu[0].subMenus[0].url.split('#');
  22. }else{
  23. curry=menu[0].url.split('#');
  24. };
  25. if (window.location.hash) {
  26. this.getKey(window.location.hash.substr(1));
  27. } else {
  28. this.getKey(curry[1]);
  29. };
  30. }
  31. getKey(key) {
  32. switch (key) {
  33. case 'softwareConfigure':
  34. require.ensure([], () => {
  35. const SoftwareConfigure = require('./projectConfigure/softwareConfigure').default;
  36. this.setState({
  37. component:<SoftwareConfigure />,
  38. });
  39. });
  40. break;
  41. case 'officialFees':
  42. require.ensure([], () => {
  43. const OfficialFees = require('./projectConfigure/officialFees').default;
  44. this.setState({
  45. component:<OfficialFees />,
  46. });
  47. });
  48. break;
  49. case 'patentFees':
  50. require.ensure([], () => {
  51. const PatentFees = require('./projectConfigure/patentFees').default;
  52. this.setState({
  53. component:<PatentFees />,
  54. });
  55. });
  56. break;
  57. case 'organization':
  58. require.ensure([], () => {
  59. const Organization = require('./organization/organization').default;
  60. this.setState({
  61. component:<Organization />,
  62. });
  63. });
  64. break;
  65. case 'workeTimes':
  66. require.ensure([], () => {
  67. const WorkeTimes = require('./workeTimes/index').default;
  68. this.setState({
  69. component:<WorkeTimes />,
  70. });
  71. });
  72. break;
  73. case 'businessCategory':
  74. require.ensure([], () => {
  75. const BusinessCategory = require('./business/businessCategory').default;
  76. this.setState({
  77. component:<BusinessCategory />
  78. });
  79. });
  80. break;
  81. case 'businessProject':
  82. require.ensure([], () => {
  83. const BusinessProject = require('./business/businessProject').default;
  84. this.setState({
  85. component:<BusinessProject />
  86. });
  87. });
  88. break;
  89. case 'businessQuery':
  90. require.ensure([], () => {
  91. const BusinessQuery = require('./business/businessQuery').default;
  92. this.setState({
  93. component:<BusinessQuery />
  94. });
  95. });
  96. break;
  97. case 'user':
  98. require.ensure([], () => {
  99. const User = require('./userManagementS/user').default;
  100. this.setState({
  101. component: <User />
  102. });
  103. });
  104. break;
  105. case 'roles':
  106. require.ensure([], () => {
  107. const Roles = require('./userManagementS/roles').default;
  108. this.setState({
  109. component:<Roles />,
  110. });
  111. });
  112. break;
  113. case 'permission':
  114. require.ensure([], () => {
  115. const Jurisdiction = require('./userManagementS/jurisdiction').default;
  116. this.setState({
  117. component: <Jurisdiction />
  118. });
  119. });
  120. break;
  121. default:
  122. require.ensure([], () => {
  123. const Module = require('../module').default;
  124. this.setState({
  125. component:<Module />
  126. });
  127. });
  128. };
  129. window.location.hash = key;
  130. }
  131. render() {
  132. return (
  133. <div className="manage-content">
  134. <LeftTab handlekey={this.getKey.bind(this)} />
  135. <div className="content-right">
  136. {this.state.component}
  137. </div>
  138. </div>
  139. )
  140. }
  141. }
  142. export default Content;