content.jsx 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. import React, { Component } from 'react';
  2. import '../content.less';
  3. import LeftTab from '../leftTab';
  4. import TechDemand from './techDemand';
  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. //管理
  34. case 'techDemandManage':
  35. require.ensure([], () => {
  36. const TechDemand = require('./techDemand').default;
  37. this.setState({
  38. component: TechDemand,
  39. listApiUrl: '/api/admin/demand/manageList',
  40. detailApiUrl: '/api/admin/demand/orgDemandDetail'
  41. });
  42. });
  43. break;
  44. //我的
  45. case 'myTechDemand':
  46. require.ensure([], () => {
  47. const MyTechDemand = require('./myTechDemand').default;
  48. this.setState({
  49. component: MyTechDemand,
  50. listApiUrl: '/api/admin/demand/myList',
  51. detailApiUrl: '/api/admin/demand/orgDemandDetail'
  52. });
  53. });
  54. break;
  55. //查询
  56. case 'techDemandQuery':
  57. require.ensure([], () => {
  58. const TechDemandQuery = require('./techDemandQuery').default;
  59. this.setState({
  60. component: TechDemandQuery,
  61. listApiUrl: '/api/admin/demand/orgList',
  62. detailApiUrl: '/api/admin/demand/orgDemandDetail'
  63. });
  64. });
  65. break;
  66. //四川
  67. case 'siChuan':
  68. require.ensure([], () => {
  69. const SiChuan = require('./sichuan/sichuan').default;
  70. this.setState({
  71. component: SiChuan,
  72. listApiUrl: '/api/admin/achievement/myList',
  73. detailApiUrl: '/api/admin/achievement/orgDetail'
  74. });
  75. });
  76. break;
  77. //四川
  78. case 'siChuanMan':
  79. require.ensure([], () => {
  80. const siChuanMan = require('./sichuan/sichuanman').default;
  81. this.setState({
  82. component: siChuanMan,
  83. listApiUrl: '/api/admin/achievement/myList',
  84. detailApiUrl: '/api/admin/achievement/orgDetail'
  85. });
  86. });
  87. break;
  88. // case 'userTechDemand':
  89. // require.ensure([], () => {
  90. // const TechDemand = require('./techDemand').default;
  91. // this.setState({
  92. // component: TechDemand,
  93. // listApiUrl: '/api/admin/demand/userList',
  94. // detailApiUrl: '/api/admin/demand/userDemandDetail'
  95. // });
  96. // });
  97. // break;
  98. // case 'orgDemandOrder':
  99. // require.ensure([], () => {
  100. // const DemandOrder = require('./demandOrder').default;
  101. // this.setState({
  102. // component: DemandOrder,
  103. // listApiUrl: '/api/admin/portal/order/orgDemandOrderList',
  104. // detailApiUrl: '/api/admin/demand/orgDemandDetail'
  105. // });
  106. // });
  107. // break;
  108. // case 'userDemandOrder':
  109. // require.ensure([], () => {
  110. // const DemandOrder = require('./demandOrder').default;
  111. // this.setState({
  112. // component: DemandOrder,
  113. // listApiUrl: '/api/admin/portal/order/userDemandOrderList',
  114. // detailApiUrl: '/api/admin/demand/userDemandDetail'
  115. // });
  116. // });
  117. // break;
  118. //需求审核
  119. case 'techDemandAudit':
  120. require.ensure([], () => {
  121. const TechDemandPublish = require('./demandAudit/techDemandAudit.jsx').default;
  122. this.setState({
  123. component: TechDemandPublish,
  124. listApiUrl: '/api/admin/portal/order/userDemandOrderList',
  125. detailApiUrl: '/api/admin/demand/userDemandDetail'
  126. });
  127. });
  128. break;
  129. //需求发布
  130. case 'techDemandPublish':
  131. require.ensure([], () => {
  132. const TechDemandPublish = require('./demandRelease/techDemandRelease.jsx').default;
  133. this.setState({
  134. component: TechDemandPublish,
  135. listApiUrl: '/api/admin/portal/order/userDemandOrderList',
  136. detailApiUrl: '/api/admin/demand/userDemandDetail'
  137. });
  138. });
  139. break;
  140. //需求发布新
  141. case 'releaseDemand':
  142. require.ensure([], () => {
  143. const ReleaseDemand = require('./releaseDemand.jsx').default;
  144. this.setState({
  145. component: ReleaseDemand,
  146. listApiUrl: '/api/admin/portal/order/userDemandOrderList',
  147. detailApiUrl: '/api/admin/demand/userDemandDetail'
  148. });
  149. });
  150. break;
  151. default:
  152. require.ensure([], () => {
  153. const Module = require('../module').default;
  154. this.setState({
  155. component:Module
  156. });
  157. });
  158. };
  159. window.location.hash = key;
  160. }
  161. render() {
  162. return (
  163. <div className="manage-content">
  164. <LeftTab handlekey={this.getKey.bind(this)} />
  165. <div className="content-right">
  166. <this.state.component
  167. data-listApiUrl={this.state.listApiUrl}
  168. data-detailApiUrl={this.state.detailApiUrl} />
  169. </div>
  170. </div>
  171. )
  172. }
  173. }
  174. export default Content;