123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- import React, { Component } from 'react';
- import '../content.less';
- import LeftTab from '../leftTab';
- import TechAchievement from './techAchievement';
- 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 'techAchievementManage':
- require.ensure([], () => {
- const TechAchievement = require('./techAchievement').default;
- this.setState({
- component: TechAchievement,
- listApiUrl: '/api/admin/achievement/manageList',
- detailApiUrl: '/api/admin/achievement/orgDetail'
- });
- });
- break;
- //我的
- case 'myTechAchievement':
- require.ensure([], () => {
- const MyTechAchievement = require('./myTechAchievement').default;
- this.setState({
- component: MyTechAchievement,
- listApiUrl: '/api/admin/achievement/myList',
- detailApiUrl: '/api/admin/achievement/orgDetail'
- });
- });
- break;
- //四川
- case 'siChuan':
- require.ensure([], () => {
- const SiChuan = require('./sichuan/sichuan').default;
- this.setState({
- component: SiChuan,
- listApiUrl: '/api/admin/achievement/myList',
- detailApiUrl: '/api/admin/achievement/orgDetail'
- });
- });
- break;
- //查询
- case 'techAchievementQuery':
- require.ensure([], () => {
- const TechAchievementQuery = require('./techAchievementQuery').default;
- this.setState({
- component: TechAchievementQuery,
- listApiUrl: '/api/admin/achievement/orgList',
- detailApiUrl: '/api/admin/achievement/orgDetail'
- });
- });
- break;
- // case 'userTechAchievement':
- // require.ensure([], () => {
- // const TechAchievement = require('./techAchievement').default;
- // this.setState({
- // component: TechAchievement,
- // listApiUrl: '/api/admin/achievement/userList',
- // detailApiUrl: '/api/admin/achievement/userDetail'
- // });
- // });
- // break;
- // case 'userAchievementOrder':
- // require.ensure([], () => {
- // const AchievementOrder = require('./achievementOrder').default;
- // this.setState({
- // component: AchievementOrder,
- // listApiUrl: '/api/admin/portal/order/userAchievementOrderList',
- // detailApiUrl: '/api/admin/achievement/userDetail'
- // });
- // });
- // break;
- // case 'orgAchievementOrder':
- // require.ensure([], () => {
- // const AchievementOrder = require('./achievementOrder').default;
- // this.setState({
- // component: AchievementOrder,
- // listApiUrl: '/api/admin/portal/order/orgAchievementOrderList',
- // detailApiUrl: '/api/admin/achievement/orgDetail'
- // });
- // });
- // break;
- //审核
- case 'techAchievementAudit':
- require.ensure([], () => {
- const AchievementList = require('./techAchievementAudit/techAchievementAudit').default;
- this.setState({
- component: AchievementList,
- listApiUrl: '/api/admin/portal/order/orgAchievementOrderList',
- detailApiUrl: '/api/admin/achievement/orgDetail'
- });
- });
- break;
- //发布
- case 'techAchievementPublish':
- require.ensure([], () => {
- const AchievementList = require('./techAchievementRelease/techAchievementAudit').default;
- this.setState({
- component: AchievementList,
- listApiUrl: '/api/admin/achievement/userList',
- detailApiUrl: '/api/admin/achievement/userDetail'
- });
- });
- break;
- //发布新
- case 'releaseResults':
- require.ensure([], () => {
- const ReleaseResults = require('./releaseResults').default;
- this.setState({
- component: ReleaseResults,
- listApiUrl: '/api/admin/achievement/userList',
- detailApiUrl: '/api/admin/achievement/userDetail'
- });
- });
- 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
- data-listApiUrl={this.state.listApiUrl}
- data-detailApiUrl={this.state.detailApiUrl} />
- </div>
- </div>
- )
- }
- }
- export default Content;
|