1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- import React, { Component } from 'react';
- import "../content.less";
- import LeftTab from '../leftTab';
- import {getMenu} from '../publicMenu.js'
- class Content extends Component {
- constructor() {
- super();
- this.state = {
- loading: false,
- component: <div></div>,
- };
- }
- componentWillMount() {
- var ids=window.location.href.indexOf('rid=');
- var idk=window.location.href.substr(ids+4);
- var rid=idk.split('#');
- let menu=getMenu(rid);
- let curry;
- if(menu[0].subMenus.length>0){
- curry=menu[0].subMenus[0].url.split('#');
- }else{
- curry=menu[0].url.split('#');
- };
- if (window.location.hash) {
- this.getKey(window.location.hash.substr(1));
- } else {
- this.getKey(curry[1]);
- };
- }
- getKey(key) {
- switch (key) {
- case "order": //派单管理
- require.ensure([], () => {
- let Module = require("./order/index").default;
- this.setState({
- component: <Module />,
- });
- });
- break;
- case "personnelAll":
- require.ensure([], () => {
- const PersonnelAll = require("./personnel/personnelAll").default;
- this.setState({
- component: <PersonnelAll ApiUrl={""} />,
- });
- });
- break;
- //催款列表
- case "pressList":
- require.ensure([], () => {
- const PressList = require("../order/orderNew/pressList").default;
- this.setState({
- component: <PressList />,
- });
- });
- break;
- case "bonusList":
- require.ensure([], () => {
- const BonusList = require("./personnel/bonusList").default;
- this.setState({
- component: <BonusList ApiUrl={""} />,
- });
- });
- break;
- default:
- require.ensure([], () => {
- let Module = require("../module").default;
- this.setState({
- component: <Module />,
- });
- });
- };
- window.location.hash = key;
- }
- render() {
- return (
- <div className="manage-content">
- <LeftTab handlekey={this.getKey.bind(this)} />
- <div className="content-right">
- {this.state.component}
- </div>
- </div>
- )
- }
- }
- export default Content;
|