forgeplus-react/src/modules/paths/Index.js

59 lines
2.0 KiB
JavaScript

import React, { Component } from 'react';
import { SnackbarHOC, CNotificationHOC } from 'educoder';
import { Route, Switch } from 'react-router-dom';
import Loadable from 'react-loadable';
import Loading from '../../Loading';
import { TPMIndexHOC } from '../tpm/TPMIndexHOC';
const PathsDetail = Loadable({
loader: () => import('./PathDetail/PathDetailIndex'),
loading: Loading,
})
const PathsNew = Loadable({
loader: () => import('./PathNew'),
loading: Loading,
})
const Statistics = Loadable({
loader: () => import('./statics'),
loading: Loading
});
const ShixunPaths = Loadable({
loader: () => import('./ShixunPaths'),
loading: Loading,
})
class Index extends Component {
constructor(props) {
super(props)
}
render() {
return (
<div>
<Switch {...this.props}>
<Route path="/paths/:pathId/statistics" component={Statistics} {...this.props} {...this.state}></Route>
<Route path="/paths/new"
render={(props) => (<PathsNew {...this.props} {...this.state} {...props} />)}
></Route>
<Route path="/paths/:pathId/edit"
render={(props) => (<PathsNew {...this.props} {...this.state} {...props} />)}
></Route>
{/*编辑页面*/}
<Route path="/paths/:pathId"
render={(props) => (<PathsDetail {...this.props} {...this.state} {...props} />)}
></Route>
{/*<Route path="/paths/:pathId" exact component = {PathsDetail} {...this.props} {...this.state}></Route>*/}
<Route path="/paths" exact
render={(props) => (<ShixunPaths {...this.props} {...this.state} {...props} />)}
></Route>
</Switch>
</div>
)
}
}
export default CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Index)));