content.jsx 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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.jsx'
  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. // case 'userTechDemand':
  67. // require.ensure([], () => {
  68. // const TechDemand = require('./techDemand').default;
  69. // this.setState({
  70. // component: TechDemand,
  71. // listApiUrl: '/api/admin/demand/userList',
  72. // detailApiUrl: '/api/admin/demand/userDemandDetail'
  73. // });
  74. // });
  75. // break;
  76. // case 'orgDemandOrder':
  77. // require.ensure([], () => {
  78. // const DemandOrder = require('./demandOrder').default;
  79. // this.setState({
  80. // component: DemandOrder,
  81. // listApiUrl: '/api/admin/portal/order/orgDemandOrderList',
  82. // detailApiUrl: '/api/admin/demand/orgDemandDetail'
  83. // });
  84. // });
  85. // break;
  86. // case 'userDemandOrder':
  87. // require.ensure([], () => {
  88. // const DemandOrder = require('./demandOrder').default;
  89. // this.setState({
  90. // component: DemandOrder,
  91. // listApiUrl: '/api/admin/portal/order/userDemandOrderList',
  92. // detailApiUrl: '/api/admin/demand/userDemandDetail'
  93. // });
  94. // });
  95. // break;
  96. //需求审核
  97. case 'techDemandAudit':
  98. require.ensure([], () => {
  99. const TechDemandPublish = require('./demandAudit/techDemandAudit.jsx').default;
  100. this.setState({
  101. component: TechDemandPublish,
  102. listApiUrl: '/api/admin/portal/order/userDemandOrderList',
  103. detailApiUrl: '/api/admin/demand/userDemandDetail'
  104. });
  105. });
  106. break;
  107. //需求发布
  108. case 'techDemandPublish':
  109. require.ensure([], () => {
  110. const TechDemandPublish = require('./demandRelease/techDemandRelease.jsx').default;
  111. this.setState({
  112. component: TechDemandPublish,
  113. listApiUrl: '/api/admin/portal/order/userDemandOrderList',
  114. detailApiUrl: '/api/admin/demand/userDemandDetail'
  115. });
  116. });
  117. break;
  118. default:
  119. require.ensure([], () => {
  120. const Module = require('../module').default;
  121. this.setState({
  122. component:Module
  123. });
  124. });
  125. };
  126. window.location.hash = key;
  127. }
  128. render() {
  129. return (
  130. <div className="manage-content">
  131. <LeftTab handlekey={this.getKey.bind(this)} />
  132. <div className="content-right">
  133. <this.state.component
  134. data-listApiUrl={this.state.listApiUrl}
  135. data-detailApiUrl={this.state.detailApiUrl} />
  136. </div>
  137. </div>
  138. )
  139. }
  140. }
  141. export default Content;