123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import React, { Component } from 'react';
- import '../content.less';
- import LeftTab from './leftTab';
- import TechDemand from './techDemand';
- class Content extends Component {
- constructor() {
- super();
- this.state = {
- loading: false,
- component: 'div',
- apiUrl: 'orgList'
- };
- }
- componentWillMount() {
- if (window.location.hash) {
- this.getKey(window.location.hash.substr(1));
- } else {
- this.getKey("techDemandOrg");
- };
- }
- getKey(key) {
- switch (key) {
- case 'techDemandOrg':
- require.ensure([], () => {
- const TechDemand = require('./techDemand').default;
- this.setState({
- component: TechDemand,
- listApiUrl: '/api/admin/demand/orgList',
- detailApiUrl:'/api/admin/demand/orgDemandDetail'
- });
- });
- break;
- case 'techDemandUser':
- require.ensure([], () => {
- const TechDemand = require('./techDemand').default;
- this.setState({
- component: TechDemand,
- listApiUrl: '/api/admin/demand/userList',
- detailApiUrl:'/api/admin/demand/userDemandDetail'
- });
- });
- break;
- };
- window.location.hash = key;
- }
- render() {
- return (
- <div className="manage-content">
- <LeftTab handlekey={this.getKey.bind(this)} />
- <div className="content-right">
- <this.state.component
- data-listApiUrl={this.state.listApiUrl}
- data-detailApiUrl={this.state.detailApiUrl} />
- </div>
- </div>
- )
- }
- }
- export default Content;
|