content.jsx 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. import React, { Component } from 'react';
  2. import '../content.less';
  3. import LeftTab from '../leftTab';
  4. import TechAchievement from './techAchievement';
  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 'techAchievementManage':
  35. require.ensure([], () => {
  36. const TechAchievement = require('./techAchievement').default;
  37. this.setState({
  38. component: TechAchievement,
  39. listApiUrl: '/api/admin/achievement/manageList',
  40. detailApiUrl: '/api/admin/achievement/orgDetail'
  41. });
  42. });
  43. break;
  44. //我的
  45. case 'myTechAchievement':
  46. require.ensure([], () => {
  47. const MyTechAchievement = require('./myTechAchievement').default;
  48. this.setState({
  49. component: MyTechAchievement,
  50. listApiUrl: '/api/admin/achievement/myList',
  51. detailApiUrl: '/api/admin/achievement/orgDetail'
  52. });
  53. });
  54. break;
  55. //四川
  56. case 'siChuan':
  57. require.ensure([], () => {
  58. const SiChuan = require('./sichuan/sichuan').default;
  59. this.setState({
  60. component: SiChuan,
  61. listApiUrl: '/api/admin/achievement/myList',
  62. detailApiUrl: '/api/admin/achievement/orgDetail'
  63. });
  64. });
  65. break;
  66. //查询
  67. case 'techAchievementQuery':
  68. require.ensure([], () => {
  69. const TechAchievementQuery = require('./techAchievementQuery').default;
  70. this.setState({
  71. component: TechAchievementQuery,
  72. listApiUrl: '/api/admin/achievement/orgList',
  73. detailApiUrl: '/api/admin/achievement/orgDetail'
  74. });
  75. });
  76. break;
  77. // case 'userTechAchievement':
  78. // require.ensure([], () => {
  79. // const TechAchievement = require('./techAchievement').default;
  80. // this.setState({
  81. // component: TechAchievement,
  82. // listApiUrl: '/api/admin/achievement/userList',
  83. // detailApiUrl: '/api/admin/achievement/userDetail'
  84. // });
  85. // });
  86. // break;
  87. // case 'userAchievementOrder':
  88. // require.ensure([], () => {
  89. // const AchievementOrder = require('./achievementOrder').default;
  90. // this.setState({
  91. // component: AchievementOrder,
  92. // listApiUrl: '/api/admin/portal/order/userAchievementOrderList',
  93. // detailApiUrl: '/api/admin/achievement/userDetail'
  94. // });
  95. // });
  96. // break;
  97. // case 'orgAchievementOrder':
  98. // require.ensure([], () => {
  99. // const AchievementOrder = require('./achievementOrder').default;
  100. // this.setState({
  101. // component: AchievementOrder,
  102. // listApiUrl: '/api/admin/portal/order/orgAchievementOrderList',
  103. // detailApiUrl: '/api/admin/achievement/orgDetail'
  104. // });
  105. // });
  106. // break;
  107. //审核
  108. case 'techAchievementAudit':
  109. require.ensure([], () => {
  110. const AchievementList = require('./techAchievementAudit/techAchievementAudit').default;
  111. this.setState({
  112. component: AchievementList,
  113. listApiUrl: '/api/admin/portal/order/orgAchievementOrderList',
  114. detailApiUrl: '/api/admin/achievement/orgDetail'
  115. });
  116. });
  117. break;
  118. //发布
  119. case 'techAchievementPublish':
  120. require.ensure([], () => {
  121. const AchievementList = require('./techAchievementRelease/techAchievementAudit').default;
  122. this.setState({
  123. component: AchievementList,
  124. listApiUrl: '/api/admin/achievement/userList',
  125. detailApiUrl: '/api/admin/achievement/userDetail'
  126. });
  127. });
  128. break;
  129. //发布新
  130. case 'releaseResults':
  131. require.ensure([], () => {
  132. const ReleaseResults = require('./releaseResults').default;
  133. this.setState({
  134. component: ReleaseResults,
  135. listApiUrl: '/api/admin/achievement/userList',
  136. detailApiUrl: '/api/admin/achievement/userDetail'
  137. });
  138. });
  139. break;
  140. default:
  141. require.ensure([], () => {
  142. const Module = require('../module').default;
  143. this.setState({
  144. component:Module
  145. });
  146. });
  147. };
  148. window.location.hash = key;
  149. }
  150. render() {
  151. return (
  152. <div className="manage-content">
  153. <LeftTab handlekey={this.getKey.bind(this)} />
  154. <div className="content-right">
  155. <this.state.component
  156. data-listApiUrl={this.state.listApiUrl}
  157. data-detailApiUrl={this.state.detailApiUrl} />
  158. </div>
  159. </div>
  160. )
  161. }
  162. }
  163. export default Content;