content.jsx 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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></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 'star':
  34. // require.ensure([], () => {
  35. // const Star = require('./bigShot/star').default;
  36. // this.setState({
  37. // component: <Star />
  38. // });
  39. // });
  40. // break;
  41. // case 'lecture':
  42. // require.ensure([], () => {
  43. // const Lecture = require('./bigShot/lecture').default;
  44. // this.setState({
  45. // component: <Lecture />
  46. // });
  47. // });
  48. // break;
  49. // case 'banner':
  50. // require.ensure([], () => {
  51. // const Banner = require('./bannerManage/bannerManage').default;
  52. // this.setState({
  53. // component: <Banner />
  54. // });
  55. // });
  56. // break;
  57. // case 'flash':
  58. // require.ensure([], () => {
  59. // const News = require('./news/news').default;
  60. // this.setState({
  61. // component: <News newsType={1} />
  62. // });
  63. // });
  64. // break;
  65. // case 'nationalPolicy':
  66. // require.ensure([], () => {
  67. // const News = require('./news/news').default;
  68. // this.setState({
  69. // component: <News newsType={4} />
  70. // });
  71. // });
  72. // break;
  73. // case 'localPolicy':
  74. // require.ensure([], () => {
  75. // const News = require('./news/news').default;
  76. // this.setState({
  77. // component: <News newsType={5} />
  78. // });
  79. // });
  80. // break;
  81. // case 'jitao':
  82. // require.ensure([], () => {
  83. // const News = require('./news/news').default;
  84. // this.setState({
  85. // component: <News newsType={3} />
  86. // });
  87. // });
  88. // break;
  89. // case 'contact':
  90. // require.ensure([], () => {
  91. // const News = require('./news/news').default;
  92. // this.setState({
  93. // component: <News newsType={2} />
  94. // });
  95. // });
  96. // break;
  97. // case 'activity':
  98. // require.ensure([], () => {
  99. // const Activity = require('./activity/activity').default;
  100. // this.setState({
  101. // component: <Activity />
  102. // });
  103. // });
  104. // break;
  105. // case 'activityUserList':
  106. // require.ensure([], () => {
  107. // const ActivityUserList = require('./activity/activityUserList').default;
  108. // this.setState({
  109. // component: <ActivityUserList />
  110. // });
  111. // });
  112. // break;
  113. case 'techPolicyManage': //科技政策管理1
  114. require.ensure([], () => {
  115. const Manage = require('./policy/manage').default;
  116. this.setState({
  117. component: <Manage />,
  118. });
  119. });
  120. break;
  121. case 'techPolicyPublish': //科技政策发布1
  122. require.ensure([], () => {
  123. const TechPolicyPublishs = require('./policy/techPolicyPublishs').default;
  124. this.setState({
  125. component: <TechPolicyPublishs />,
  126. });
  127. });
  128. break;
  129. case 'techPolicyQuery': //科技政策查询1
  130. require.ensure([], () => {
  131. const Inquiry = require('./policy/inquiry').default;
  132. this.setState({
  133. component: <Inquiry />,
  134. });
  135. });
  136. break;
  137. case 'techPolicyAudit': //科技政策审核1
  138. require.ensure([], () => {
  139. const TechPolicyAudits = require('./policy/techPolicyAudits').default;
  140. this.setState({
  141. component: <TechPolicyAudits />,
  142. });
  143. });
  144. break;
  145. case 'techActivityManage':
  146. require.ensure([], () => {
  147. const Module = require('../module').default;
  148. this.setState({
  149. component: <Module />,
  150. });
  151. });
  152. break;
  153. case 'techActivityAudit':
  154. require.ensure([], () => {
  155. const Module = require('../module').default;
  156. this.setState({
  157. component: <Module />,
  158. });
  159. });
  160. break;
  161. case 'techActivityPublish':
  162. require.ensure([], () => {
  163. const Module = require('../module').default;
  164. this.setState({
  165. component: <Module />,
  166. });
  167. });
  168. break;
  169. case 'techActivityQuery': //科技政策查询
  170. require.ensure([], () => {
  171. const Module = require('../module').default;
  172. this.setState({
  173. component: <Module />,
  174. });
  175. });
  176. break;
  177. default:
  178. require.ensure([], () => {
  179. const Module = require('../module').default;
  180. this.setState({
  181. component:<Module />
  182. });
  183. });
  184. };
  185. window.location.hash = key;
  186. }
  187. render() {
  188. return (
  189. <div className="manage-content">
  190. <LeftTab handlekey={this.getKey.bind(this)} />
  191. <div className="content-right">
  192. {this.state.component}
  193. </div>
  194. </div>
  195. )
  196. }
  197. }
  198. export default Content;