2020-06-02 18:54:46 +08:00
|
|
|
import React, { Component } from "react";
|
2020-03-16 14:12:11 +08:00
|
|
|
|
2020-06-02 18:54:46 +08:00
|
|
|
import { Route, Switch } from "react-router-dom";
|
|
|
|
|
import { withRouter } from "react-router";
|
2020-03-16 14:12:11 +08:00
|
|
|
|
2020-06-02 18:54:46 +08:00
|
|
|
import { SnackbarHOC } from "educoder";
|
|
|
|
|
import { CNotificationHOC } from "../modules/courses/common/CNotificationHOC";
|
|
|
|
|
import { TPMIndexHOC } from "../modules/tpm/TPMIndexHOC";
|
2020-06-22 14:07:06 +08:00
|
|
|
import "./css/index.scss";
|
2020-03-16 14:12:11 +08:00
|
|
|
|
2020-06-02 18:54:46 +08:00
|
|
|
import Loadable from "react-loadable";
|
|
|
|
|
import Loading from "../Loading";
|
|
|
|
|
import { ImageLayerOfCommentHOC } from "../modules/page/layers/ImageLayerOfCommentHOC";
|
2020-03-16 14:12:11 +08:00
|
|
|
|
2021-09-03 13:48:56 +08:00
|
|
|
|
2020-03-16 14:12:11 +08:00
|
|
|
const ProjectNew = Loadable({
|
2021-09-02 17:20:26 +08:00
|
|
|
loader: () => import("./New/Index"),
|
2020-05-11 14:18:32 +08:00
|
|
|
loading: Loading,
|
2020-06-02 18:54:46 +08:00
|
|
|
});
|
2020-03-16 14:12:11 +08:00
|
|
|
const ProjectIndex = Loadable({
|
2020-06-02 18:54:46 +08:00
|
|
|
loader: () => import("./Main/Index"),
|
2020-05-11 14:18:32 +08:00
|
|
|
loading: Loading,
|
2020-06-02 18:54:46 +08:00
|
|
|
});
|
2020-03-16 14:12:11 +08:00
|
|
|
|
2021-09-01 17:34:47 +08:00
|
|
|
// 项目详情放在用户和组织下作为二级菜单存在
|
|
|
|
|
// const ProjectDetail = Loadable({
|
|
|
|
|
// loader: () => import("./Main/Detail"),
|
|
|
|
|
// loading: Loading,
|
|
|
|
|
// });
|
2020-03-16 14:12:11 +08:00
|
|
|
|
2020-06-02 18:54:46 +08:00
|
|
|
class Index extends Component {
|
2021-05-10 17:24:49 +08:00
|
|
|
|
2021-09-02 17:20:26 +08:00
|
|
|
componentDidUpdate = () => {
|
|
|
|
|
this.props.history.listen(() => {
|
2021-05-10 17:24:49 +08:00
|
|
|
if (document.body.scrollTop || document.documentElement.scrollTop > 0) {
|
|
|
|
|
window.scrollTo(0, 0)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
2020-05-11 14:18:32 +08:00
|
|
|
render() {
|
2021-09-03 09:23:12 +08:00
|
|
|
|
2020-05-11 14:18:32 +08:00
|
|
|
return (
|
2020-03-16 14:12:11 +08:00
|
|
|
<div className="newMain clearfix">
|
|
|
|
|
<Switch {...this.props}>
|
2021-01-28 11:48:21 +08:00
|
|
|
<Route
|
2021-09-01 17:34:47 +08:00
|
|
|
path="/projects/:projectsType/new/:OIdentifier"
|
2021-01-28 11:48:21 +08:00
|
|
|
render={(props) => (
|
|
|
|
|
<ProjectNew {...this.props} {...props} />
|
|
|
|
|
)}
|
|
|
|
|
></Route>
|
2020-06-02 18:54:46 +08:00
|
|
|
<Route
|
2021-09-01 17:34:47 +08:00
|
|
|
path="/projects/:projectsType/new"
|
2020-06-02 18:54:46 +08:00
|
|
|
render={(props) => (
|
2020-06-15 15:31:21 +08:00
|
|
|
<ProjectNew {...this.props} {...props} />
|
2021-03-25 22:00:01 +08:00
|
|
|
)}
|
|
|
|
|
></Route>
|
|
|
|
|
<Route
|
2021-09-01 17:34:47 +08:00
|
|
|
path="/projects/mirror/new"
|
2021-03-25 22:00:01 +08:00
|
|
|
render={(props) => (
|
|
|
|
|
<ProjectNew {...this.props} {...props} />
|
2020-06-02 18:54:46 +08:00
|
|
|
)}
|
2020-03-16 14:12:11 +08:00
|
|
|
></Route>
|
2021-09-01 17:34:47 +08:00
|
|
|
{/* <Route
|
2021-09-01 09:33:22 +08:00
|
|
|
path="/:owner/:projectsId"
|
2020-06-02 18:54:46 +08:00
|
|
|
render={(props) => (
|
2020-06-15 15:31:21 +08:00
|
|
|
<ProjectDetail {...this.props} {...props} />
|
2020-06-02 18:54:46 +08:00
|
|
|
)}
|
2021-09-01 17:34:47 +08:00
|
|
|
></Route> */}
|
|
|
|
|
<Route
|
|
|
|
|
path="/explore"
|
2020-06-02 18:54:46 +08:00
|
|
|
render={(props) => (
|
2020-06-15 15:31:21 +08:00
|
|
|
<ProjectIndex {...this.props} {...props} />
|
|
|
|
|
)}
|
2021-09-01 17:34:47 +08:00
|
|
|
></Route>
|
2021-09-03 09:23:12 +08:00
|
|
|
|
2021-09-02 17:20:26 +08:00
|
|
|
<Route
|
|
|
|
|
path="/"
|
|
|
|
|
render={(props) => (
|
|
|
|
|
<ProjectIndex {...this.props} {...props} />
|
|
|
|
|
)}
|
|
|
|
|
></Route>
|
2020-03-16 14:12:11 +08:00
|
|
|
</Switch>
|
|
|
|
|
</div>
|
2020-06-02 18:54:46 +08:00
|
|
|
);
|
2020-03-16 14:12:11 +08:00
|
|
|
}
|
|
|
|
|
}
|
2020-06-02 18:54:46 +08:00
|
|
|
export default withRouter(
|
|
|
|
|
ImageLayerOfCommentHOC({
|
|
|
|
|
imgSelector: ".imageLayerParent img, .imageLayerParent .imageTarget",
|
|
|
|
|
parentSelector: ".newMain",
|
2021-09-01 17:34:47 +08:00
|
|
|
})(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Index))))
|
2020-06-02 18:54:46 +08:00
|
|
|
);
|
2021-09-01 17:34:47 +08:00
|
|
|
|
|
|
|
|
// export default withRouter(
|
|
|
|
|
// ImageLayerOfCommentHOC({
|
|
|
|
|
// imgSelector: ".imageLayerParent img, .imageLayerParent .imageTarget",
|
|
|
|
|
// parentSelector: ".newMain",
|
|
|
|
|
// })(Index)
|
|
|
|
|
// );
|