| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 | import React, { Component } from 'react';import '../content.less';import './content.less';import LeftTab from '../leftTab';import { getMenu } from '../publicMenu.js'class Content extends Component {  constructor() {    super();    this.state = {      loading: false,      component: <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 'standard':        require.ensure([], () => {          const Standard = require('./stList/index').default;          this.setState({            component: <Standard />          });        });        break;      // 标准平台链接      case 'standardLink':        require.ensure([], () => {          const StandardLink = require('./slLink/index').default;          this.setState({            component: <StandardLink />          });        });        break;      default:        require.ensure([], () => {          const 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;
 |