content.jsx 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. import React, { Component } from 'react';
  2. import '../content.less';
  3. import LeftTab from './leftTab';
  4. import TechAchievement from './techAchievement';
  5. class Content extends Component {
  6. constructor() {
  7. super();
  8. this.state = {
  9. loading: false,
  10. component: 'div'
  11. };
  12. }
  13. componentWillMount() {
  14. if (window.location.hash) {
  15. this.getKey(window.location.hash.substr(1));
  16. } else {
  17. this.getKey("techAchievementManage");
  18. };
  19. }
  20. getKey(key) {
  21. switch (key) {
  22. case 'techAchievementManage':
  23. require.ensure([], () => {
  24. const TechAchievement = require('./techAchievement').default;
  25. this.setState({
  26. component: TechAchievement,
  27. listApiUrl: '/api/admin/achievement/orgList',
  28. detailApiUrl: '/api/admin/achievement/orgDetail'
  29. });
  30. });
  31. break;
  32. //新增空白
  33. case 'myTechAchievement':
  34. require.ensure([], () => {
  35. const Module = require('../module').default;
  36. this.setState({
  37. component: Module,
  38. });
  39. });
  40. break;
  41. case 'techAchievementQuery':
  42. require.ensure([], () => {
  43. const Module = require('../module').default;
  44. this.setState({
  45. component: Module,
  46. });
  47. });
  48. break;
  49. case 'techAchievementAudit':
  50. require.ensure([], () => {
  51. const Module = require('../module').default;
  52. this.setState({
  53. component: Module,
  54. });
  55. });
  56. break;
  57. case 'techAchievementPublish':
  58. require.ensure([], () => {
  59. const Module = require('../module').default;
  60. this.setState({
  61. component: Module,
  62. });
  63. });
  64. break;
  65. //-------//
  66. case 'userTechAchievement':
  67. require.ensure([], () => {
  68. const TechAchievement = require('./techAchievement').default;
  69. this.setState({
  70. component: TechAchievement,
  71. listApiUrl: '/api/admin/achievement/userList',
  72. detailApiUrl: '/api/admin/achievement/userDetail'
  73. });
  74. });
  75. break;
  76. case 'userAchievementOrder':
  77. require.ensure([], () => {
  78. const AchievementOrder = require('./achievementOrder').default;
  79. this.setState({
  80. component: AchievementOrder,
  81. listApiUrl: '/api/admin/portal/order/userAchievementOrderList',
  82. detailApiUrl: '/api/admin/achievement/userDetail'
  83. });
  84. });
  85. break;
  86. case 'orgAchievementOrder':
  87. require.ensure([], () => {
  88. const AchievementOrder = require('./achievementOrder').default;
  89. this.setState({
  90. component: AchievementOrder,
  91. listApiUrl: '/api/admin/portal/order/orgAchievementOrderList',
  92. detailApiUrl: '/api/admin/achievement/orgDetail'
  93. });
  94. });
  95. break;
  96. };
  97. window.location.hash = key;
  98. }
  99. render() {
  100. return (
  101. <div className="manage-content">
  102. <LeftTab handlekey={this.getKey.bind(this)} />
  103. <div className="content-right">
  104. <this.state.component
  105. data-listApiUrl={this.state.listApiUrl}
  106. data-detailApiUrl={this.state.detailApiUrl} />
  107. </div>
  108. </div>
  109. )
  110. }
  111. }
  112. export default Content;