12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- 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([], () => {
- const Order = require("./administration/order")
- .default;
- this.setState({
- component: <Order/>
- });
- });
- break;
- //客服订单详情查询
- case "followUp":
- require.ensure([], () => {
- const FollowUp = require("./administration/FollowUp")
- .default;
- this.setState({
- component: <FollowUp/>
- });
- });
- break;
- default:
- require.ensure([], () => {
- const Module = require("../module").default;
- this.setState({
- component: <Module ApiUrl={""} />
- });
- });
- };
- 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;
|