forked from Gitlink/forgeplus-react
/默认进入页面
This commit is contained in:
parent
2c25b817c0
commit
3fe9e97ae5
|
|
@ -46,10 +46,6 @@ const Projects = Loadable({
|
|||
loader: () => import('./forge/Index'),
|
||||
loading: Loading,
|
||||
})
|
||||
const Home = Loadable({
|
||||
loader: () => import('./forge/Home'),
|
||||
loading: Loading,
|
||||
})
|
||||
//403页面
|
||||
const Shixunauthority = Loadable({
|
||||
loader: () => import('./modules/403/Shixunauthority'),
|
||||
|
|
@ -67,7 +63,7 @@ const http500 = Loadable({
|
|||
loading: Loading,
|
||||
})
|
||||
const InfosIndex = Loadable({
|
||||
loader: () => import('./forge/users/Infos'),
|
||||
loader: () => import('./forge/users/Index'),
|
||||
loading: Loading,
|
||||
})
|
||||
// 组织
|
||||
|
|
@ -253,7 +249,7 @@ class App extends Component {
|
|||
<Route exact path="/"
|
||||
render={
|
||||
(props) => (
|
||||
<Home {...this.props} {...props} {...this.state}></Home>
|
||||
<Projects {...this.props} {...props} {...this.state}></Projects>
|
||||
)
|
||||
}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ if (isDev) {
|
|||
}
|
||||
debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' :
|
||||
window.location.search.indexOf('debug=s') !== -1 ? 'student' :
|
||||
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin'
|
||||
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || ''
|
||||
}
|
||||
function clearAllCookie() {
|
||||
cookie.remove('_educoder_session', { path: '/' });
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
import React , { useEffect } from 'react';
|
||||
import { SnackbarHOC } from "educoder";
|
||||
import { CNotificationHOC } from "../modules/courses/common/CNotificationHOC";
|
||||
import { TPMIndexHOC } from "../modules/tpm/TPMIndexHOC";
|
||||
import ProjectIndex from './Main/Index';
|
||||
import PersonIndex from './users/Infos';
|
||||
|
||||
import { Spin } from 'antd';
|
||||
|
||||
export default (CNotificationHOC()(SnackbarHOC()(
|
||||
TPMIndexHOC((props)=>{
|
||||
const { pathname } = props.history.location;
|
||||
const { current_user } = props;
|
||||
useEffect(()=>{
|
||||
if(pathname === "/" && (current_user && current_user.login)){
|
||||
props.history.push(`/users/${current_user && current_user.login}`)
|
||||
}
|
||||
})
|
||||
return(
|
||||
pathname === "/" && (current_user && current_user.login) ?
|
||||
<Spin spinning={true}/>
|
||||
:
|
||||
<ProjectIndex {...props} />
|
||||
)
|
||||
})
|
||||
)))
|
||||
|
|
@ -27,6 +27,11 @@ const ProjectDetail = Loadable({
|
|||
loading: Loading,
|
||||
});
|
||||
|
||||
const Infos = Loadable({
|
||||
loader: () => import("./users/Infos"),
|
||||
loading: Loading,
|
||||
});
|
||||
|
||||
class Index extends Component {
|
||||
render() {
|
||||
return (
|
||||
|
|
@ -35,20 +40,30 @@ class Index extends Component {
|
|||
<Route
|
||||
path="/projects/:projectsType/new"
|
||||
render={(props) => (
|
||||
<ProjectNew {...this.props} {...props} {...this.state} />
|
||||
<ProjectNew {...this.props} {...props} />
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/projects/:projectsId"
|
||||
render={(props) => (
|
||||
<ProjectDetail {...this.props} {...props} {...this.state} />
|
||||
<ProjectDetail {...this.props} {...props} />
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
exact
|
||||
path="/projects"
|
||||
render={(props) => (
|
||||
<ProjectIndex {...this.props} {...props} {...this.state} />
|
||||
<ProjectIndex {...this.props} {...props} />
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
exact
|
||||
path="/"
|
||||
render={(props) => (
|
||||
this.props.current_user && this.props.current_user.login ?
|
||||
<Infos {...this.props} {...props} />
|
||||
:
|
||||
<ProjectIndex {...this.props} {...props} />
|
||||
)}
|
||||
></Route>
|
||||
</Switch>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
import React from 'react';
|
||||
import { Route, Switch } from "react-router-dom";
|
||||
import Loadable from "react-loadable";
|
||||
import Loading from "../../Loading";
|
||||
import { withRouter } from "react-router";
|
||||
import { SnackbarHOC } from "educoder";
|
||||
import { CNotificationHOC } from "../../modules/courses/common/CNotificationHOC";
|
||||
import { TPMIndexHOC } from "../../modules/tpm/TPMIndexHOC";
|
||||
const Infos = Loadable({
|
||||
loader: () => import("./Infos"),
|
||||
loading: Loading,
|
||||
});
|
||||
export default withRouter(
|
||||
(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC((props)=>{
|
||||
return(
|
||||
<Switch {...props}>
|
||||
<Route
|
||||
path="/users/:username"
|
||||
render={(props) => {
|
||||
return <Infos {...props} />;
|
||||
}}
|
||||
></Route>
|
||||
</Switch>
|
||||
)
|
||||
}))))
|
||||
)
|
||||
|
|
@ -8,9 +8,6 @@ import { getImageUrl } from "educoder";
|
|||
import { Route, Switch } from "react-router-dom";
|
||||
import { withRouter } from "react-router";
|
||||
|
||||
import { SnackbarHOC } from "educoder";
|
||||
import { CNotificationHOC } from "../../modules/courses/common/CNotificationHOC";
|
||||
import { TPMIndexHOC } from "../../modules/tpm/TPMIndexHOC";
|
||||
import "./new_user.css";
|
||||
import "../css/index.css";
|
||||
import './Index.scss';
|
||||
|
|
@ -60,7 +57,10 @@ class Infos extends Component {
|
|||
this.setState({
|
||||
isSpin: true,
|
||||
});
|
||||
let url = `/users/${this.props.match.params.username}.json`;
|
||||
const { current_user } = this.props;
|
||||
const { username } = this.props.match.params;
|
||||
|
||||
let url = `/users/${username || (current_user && current_user.login)}.json`;
|
||||
axios
|
||||
.get(url)
|
||||
.then((result) => {
|
||||
|
|
@ -281,7 +281,12 @@ class Infos extends Component {
|
|||
return <InfosUser {...this.props} {...this.state} />;
|
||||
}}
|
||||
></Route>
|
||||
|
||||
<Route
|
||||
path="/"
|
||||
render={(props) => {
|
||||
return <InfosUser {...this.props} {...this.state} />;
|
||||
}}
|
||||
></Route>
|
||||
</Switch>
|
||||
</div>
|
||||
)}
|
||||
|
|
@ -292,9 +297,4 @@ class Infos extends Component {
|
|||
);
|
||||
}
|
||||
}
|
||||
export default withRouter(
|
||||
ImageLayerOfCommentHOC({
|
||||
imgSelector: ".imageLayerParent img, .imageLayerParent .imageTarget",
|
||||
parentSelector: ".newMain",
|
||||
})(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Infos))))
|
||||
);
|
||||
export default Infos;
|
||||
|
|
|
|||
Loading…
Reference in New Issue