diff --git a/src/App.js b/src/App.js index 34a177917..66bc88fa9 100644 --- a/src/App.js +++ b/src/App.js @@ -25,6 +25,7 @@ import { initAxiosInterceptors } from './AppConfig' import cookie from 'react-cookies'; import InfosIndex from './forge/users/Index' import OrganizeIndex from './forge/Team/Index' +import { connect } from 'react-redux'; window.marked = marked; const theme = createMuiTheme({ @@ -170,7 +171,7 @@ class App extends Component { mydisplay: false, occupation: 0, mygetHelmetapi: null, - pathType: null, + pathType: props.projectBase && props.projectBase.author && props.projectBase.author.type, pathName: null, } } @@ -652,5 +653,18 @@ moment.defineLocale('zh-cn', { doy: 4 // The week that contains Jan 4th is the first week of the year. } }); -export default SnackbarHOC()(App); + + +const mapStateToProps = (state) => { + const { + projectBase, + } = state.projectReducer; + return { + projectBase, + }; +} + +export default connect( + mapStateToProps, +)(SnackbarHOC()(App)); diff --git a/src/forge/Team/Index.jsx b/src/forge/Team/Index.jsx index f435cb76b..0461b26ec 100644 --- a/src/forge/Team/Index.jsx +++ b/src/forge/Team/Index.jsx @@ -7,6 +7,7 @@ import { withRouter } from "react-router"; import { SnackbarHOC } from "educoder"; import { CNotificationHOC } from "../../modules/courses/common/CNotificationHOC"; import { TPMIndexHOC } from "../../modules/tpm/TPMIndexHOC"; +import ProjectDetail from '../Main/Detail' import '../css/index.scss'; import './Index.scss'; @@ -35,10 +36,10 @@ const SubDetailIndex = Loadable({ loading: Loading, }); // forge项目详情 -const ProjectDetail = Loadable({ - loader: () => import("../Main/Detail"), - loading: Loading, -}); +// const ProjectDetail = Loadable({ +// loader: () => import("../Main/Detail"), +// loading: Loading, +// }); const team = CNotificationHOC()(SnackbarHOC()(TPMIndexHOC( ((props)=>{ return ( diff --git a/src/forge/users/Index.jsx b/src/forge/users/Index.jsx index 305269c42..bdd2db132 100644 --- a/src/forge/users/Index.jsx +++ b/src/forge/users/Index.jsx @@ -6,15 +6,17 @@ import { withRouter } from "react-router"; import { SnackbarHOC } from "educoder"; import { CNotificationHOC } from "../../modules/courses/common/CNotificationHOC"; import { TPMIndexHOC } from "../../modules/tpm/TPMIndexHOC"; +import ProjectDetail from '../Main/Detail' + const Infos = Loadable({ loader: () => import("./Infos"), loading: Loading, }); // forge项目详情 -const ProjectDetail = Loadable({ - loader: () => import("../Main/Detail"), - loading: Loading, -}); +// const ProjectDetail = Loadable({ +// loader: () => import("../Main/Detail"), +// loading: Loading, +// }); class DetailTop extends Component { constructor(props) { diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index 74232654e..d986a3de1 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -61,12 +61,13 @@ export function TPMIndexHOC(WrappedComponent) { window.removeEventListener('keyup', this.keyupListener) } componentWillMount() { + this.setState({ + current_user: {} + }) if (!__SERVER__) { this.fetchUsers(); } else { - this.setState({ - current_user: {} - }) + } }