跳转个人中心

This commit is contained in:
caishi 2020-06-12 11:13:45 +08:00
parent 29fca686b6
commit ba2044b459
3 changed files with 21 additions and 45 deletions

View File

@ -12,7 +12,6 @@ import LoginDialog from './modules/login/LoginDialog';
import Notcompletedysl from './modules/user/Notcompletedysl';
import Trialapplicationysl from './modules/login/Trialapplicationysl';
import Trialapplicationreview from './modules/user/Trialapplicationreview';
import Addcourses from "./modules/courses/coursesPublic/Addcourses";
import AccountProfile from "./modules/user/AccountProfile";
import Accountnewprofile from './modules/user/Accountnewprofile';
import Certifiedprofessional from './modules/modals/Certifiedprofessional';
@ -48,14 +47,11 @@ const Projects = Loadable({
loader: () => import('./forge/Index'),
loading: Loading,
})
//403页面
const Shixunauthority = Loadable({
loader: () => import('./modules/403/Shixunauthority'),
loading: Loading,
})
//404页面
const Shixunnopage = Loadable({
loader: () => import('./modules/404/Shixunnopage'),
@ -67,11 +63,6 @@ const http500 = Loadable({
loader: () => import('./modules/500/http500'),
loading: Loading,
})
// 个人主页
// const InfosIndex = Loadable({
// loader: () => import('./modules/user/usersInfo/InfosIndex'),
// loading: Loading,
// })
const InfosIndex = Loadable({
loader: () => import('./forge/users/Infos'),
loading: Loading,
@ -92,7 +83,6 @@ class App extends Component {
occupation: 0,
mygetHelmetapi: null,
}
}
HideAddcoursestypess = (i) => {
this.setState({
@ -156,7 +146,7 @@ class App extends Component {
this.setState({
mygetHelmetapi: undefined
});
document.title = "EduCoder";
document.title = "Forge";
var link = document.createElement('link'),
oldLink = document.getElementById('dynamic-favicon');
link.id = 'dynamic-favicon';
@ -185,8 +175,6 @@ class App extends Component {
getAppdata = () => {
let url = "/setting.json";
axios.get(url).then((response) => {
// console.log("app.js开始请求/setting.json");
// console.log("获取当前定制信息");
if (response) {
if (response.data) {
this.setState({
@ -204,27 +192,18 @@ class App extends Component {
} catch (e) {
this.gettablogourlnull();
}
} else {
this.gettablogourlnull();
}
} else {
this.gettablogourlnull();
}
}).catch((error) => {
this.gettablogourlnull();
});
};
render() {
let { mygetHelmetapi } = this.state;
return (
<Provider store={store}>
<ConfigProvider locale={zhCN}>
@ -234,7 +213,6 @@ class App extends Component {
<Notcompletedysl {...this.props} {...this.state}></Notcompletedysl>
<Trialapplicationysl {...this.props} {...this.state}></Trialapplicationysl>
<Trialapplicationreview {...this.props} {...this.state}></Trialapplicationreview>
<Addcourses {...this.props} {...this.state} HideAddcoursestypess={(i) => this.HideAddcoursestypess(i)} />
<AccountProfile {...this.props} {...this.state} />
<Certifiedprofessional {...this.props} {...this.state} ModalCancelsy={this.ModalCancelsy} ModalshowCancelsy={this.ModalshowCancelsy} />
<Router>
@ -252,8 +230,7 @@ class App extends Component {
<Route path="/403" component={Shixunauthority} />
<Route path="/500" component={http500} />
<Route
path={"/organize"}
<Route path={"/organize"}
render={
(props) => {
return (<OrganizeIndex {...this.props} {...props} {...this.state} />)
@ -263,20 +240,20 @@ class App extends Component {
{/*404*/}
<Route path="/nopage" component={Shixunnopage} />
{/* 个人主页 */}
<Route path="/users/:username"
<Route path="/users/:username"
render={
(props) => {
return (<InfosIndex {...this.props} {...props} {...this.state} />)
}
}></Route>
}></Route>
<Route exact path="/"
render={
(props) => (<Projects {...this.props} {...props} {...this.state}></Projects>)
(props) => (
<Projects {...this.props} {...props} {...this.state}></Projects>
)
}
/>
<Route component={Shixunnopage} />
</Switch>
</Router>
</MuiThemeProvider>

View File

@ -27,7 +27,6 @@ const ProjectDetail = Loadable({
loading: Loading,
});
class Index extends Component {
render() {
return (
@ -52,15 +51,12 @@ class Index extends Component {
<ProjectIndex {...this.props} {...props} {...this.state} />
)}
></Route>
<Route
exact
path="/"
render={(props) => (
<ProjectIndex
{...this.props}
{...props}
{...this.state}
></ProjectIndex>
<Route exact path="/" render={(props) => (
<ProjectIndex
{...this.props}
{...props}
{...this.state}
></ProjectIndex>
)}
/>
</Switch>

View File

@ -53,6 +53,9 @@ export function TPMIndexHOC(WrappedComponent) {
componentWillUnmount() {
window.removeEventListener('keyup', this.keyupListener)
}
componentWillMount(){
this.fetchUsers();
}
componentDidMount() {
window.addEventListener('keyup', this.keyupListener)
@ -70,7 +73,6 @@ export function TPMIndexHOC(WrappedComponent) {
} else if (this.props.match.path === "/classrooms") {
document.title = "教学课堂";
}
this.fetchUsers();
///请求定制化的信息
this.getAppdata();
@ -163,10 +165,11 @@ export function TPMIndexHOC(WrappedComponent) {
this.setState({
tpmLoading: false
})
// const { pathname } = this.props.history.location;
// if(pathname && pathname === "/"){
// this.props.history.push(`/users/${response.data.login}`);
// }
const { pathname } = this.props.history.location;
console.log("pathname ",pathname);
if(pathname ==="/"){
this.props.history.push(`/users/${response.data.login}`);
}
}
}).catch((error) => {
console.log(error)