content.jsx 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. //法务催收中
  34. case "collectioningn":
  35. require.ensure([], () => {
  36. const Collectioningn = require("./collectioning").default;
  37. this.setState({
  38. component: <Collectioningn />,
  39. });
  40. });
  41. break;
  42. // 已完成法务
  43. case "completedLegalAffairs":
  44. require.ensure([], () => {
  45. const CompletedLegalAffairs =
  46. require("./completedLegalAffairs").default;
  47. this.setState({
  48. component: <CompletedLegalAffairs />,
  49. });
  50. });
  51. break;
  52. // 延期法务
  53. case "delayLegalAffairs":
  54. require.ensure([], () => {
  55. const DelayLegalAffairs =
  56. require("./delayLegalAffairs").default;
  57. this.setState({
  58. component: <DelayLegalAffairs />,
  59. });
  60. });
  61. break;
  62. //订单新增空白
  63. default:
  64. require.ensure([], () => {
  65. const Module = require("../module").default;
  66. this.setState({
  67. component: <Module />,
  68. });
  69. });
  70. }
  71. window.location.hash = key;
  72. }
  73. render() {
  74. return (
  75. <div className="manage-content">
  76. <LeftTab handlekey={this.getKey.bind(this)} />
  77. <div className="content-right">{this.state.component}</div>
  78. </div>
  79. );
  80. }
  81. }
  82. export default Content;