add previousPathName

dev_oauth
hjm 6 years ago
parent 946c4c922c
commit c424983aec

@ -1,6 +1,7 @@
import React, { Component } from 'react';
import { SnackbarHOC } from 'educoder';
import {BrowserRouter as Router,Route,Switch} from 'react-router-dom';
import { withRouter } from 'react-router'
import Loadable from 'react-loadable';
import Loading from '../../Loading';
import axios from 'axios';
@ -309,6 +310,13 @@ class CoursesIndex extends Component{
componentDidMount(){
// this.updataleftNav()
this.historyArray = []
this.props.history.listen( location => {
console.log(location)
this.historyArray.unshift(location.pathname)
this.historyArray.length = 2;
//Do your stuff here
});
}
updataleftNav=()=>{
@ -443,6 +451,7 @@ class CoursesIndex extends Component{
render() {
const common = {
previousPathName: this.historyArray && this.historyArray[1]
// isAdmin: this.isAdmin,
// isStudent: this.isStudent,
// isAdminOrStudent: this.isAdminOrStudent,
@ -464,47 +473,47 @@ class CoursesIndex extends Component{
{/*毕设任务题库详情*/}
<Route path="/banks/gtopic_topics/:workid"
render={
(props) => (<Completetaskpage {...this.props} {...props} {...this.state} />)
(props) => (<Completetaskpage {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*毕设内容题库详情*/}
<Route path="/banks/gtask_topics/:workid"
render={
(props) => (<CompletetopicdePage {...this.props} {...props} {...this.state} />)
(props) => (<CompletetopicdePage {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*分组作业题库详情*/}
<Route path="/banks/group_topics/:workid"
render={
(props) => (<GroupjobbankPage {...this.props} {...props} {...this.state} />)
(props) => (<GroupjobbankPage {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 普通作业题库详情*/}
<Route path="/banks/normal_topics/:workid"
render={
(props) => (<Generaljobbankdetails {...this.props} {...props} {...this.state} />)
(props) => (<Generaljobbankdetails {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 资源列表页 */}
<Route path="/courses/:coursesId/file/:Id" exact
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
<Route path="/courses/:coursesId/files/:main_id"
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
<Route exact path="/courses/:coursesId/boards/:boardId"
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*课堂讨论*/}
<Route path="/courses/:coursesId/boards/:boardId"
render={
(props) => (<BoardIndex {...this.props} {...props} {...this.state} />)
(props) => (<BoardIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
@ -512,19 +521,19 @@ class CoursesIndex extends Component{
{/* 毕设问答 */}
<Route path="/courses/:coursesId/graduation_topics/postwork/new"
render={
(props) => (<GraduateTopicPostWorksNew {...this.props} {...props} {...this.state} />)
(props) => (<GraduateTopicPostWorksNew {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 毕设选题新建页 */}
<Route path="/courses/:coursesId/graduation_topics/new"
render={
(props) => (<GraduateTopicNew {...this.props} {...props} {...this.state} />)
(props) => (<GraduateTopicNew {...this.props} {...props} {...this.state} {...common}/>)
}></Route>
{/* 毕设选题编辑页*/}
<Route path="/courses/:coursesId/graduation_topics/:topicId/edit"
render={
(props) => (<GraduateTopicNew {...this.props} {...props} {...this.state} />)
(props) => (<GraduateTopicNew {...this.props} {...props} {...this.state} {...common}/>)
}></Route>
{/* 毕设选题详情页 */}
@ -537,7 +546,7 @@ class CoursesIndex extends Component{
{/* 毕设选题列表 */}
<Route path="/courses/:coursesId/graduation_topics/:Id" exact
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}></Route>
@ -545,21 +554,21 @@ class CoursesIndex extends Component{
{/* 作品评阅 https://www.trustie.net/issues/19981 */}
<Route path="/courses/:coursesId/graduation_tasks/:category_id/appraise"
render={
(props) => (<GraduationTasksappraise {...this.props} {...props} {...this.state} />)
(props) => (<GraduationTasksappraise {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 新建作品 */}
<Route path="/courses/:coursesId/graduation_tasks/:category_id/:task_Id/works/new"
render={
(props) => (<GraduationTasksSubmitnewApp {...this.props} {...props} {...this.state} />)
(props) => (<GraduationTasksSubmitnewApp {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 修改作品 */}
<Route path="/courses/:coursesId/graduation_tasks/:category_id/:work_Id/works/edit"
render={
(props) => (<GraduationTasksSubmiteditApp {...this.props} {...props} {...this.state} />)
(props) => (<GraduationTasksSubmiteditApp {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
@ -567,20 +576,20 @@ class CoursesIndex extends Component{
<Route path="/courses/:coursesId/graduation_tasks/:category_id/:task_Id/setting"
render={
(props) => (<GraduationTaskssetting {...this.props} {...props} {...this.state} />)
(props) => (<GraduationTaskssetting {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
<Route path="/courses/:coursesId/graduation_tasks/:category_id/:task_Id/questions"
render={
(props) => (<GraduationTasksquestions {...this.props} {...props} {...this.state} />)
(props) => (<GraduationTasksquestions {...this.props} {...props} {...this.state} {...common}/>)
}></Route>
<Route path="/courses/:coursesId/graduation_tasks/:category_id/:task_Id/list"
render={
(props) => (<GraduationTaskssettinglist {...this.props} {...props} {...this.state} />)
(props) => (<GraduationTaskssettinglist {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
@ -589,7 +598,7 @@ class CoursesIndex extends Component{
{/* 修改毕设任务 https://www.trustie.net/issues/19981 */}
<Route path="/courses/:coursesId/graduation_tasks/:category_id/edit"
render={
(props) => (<GraduationTaskseditApp {...this.props} {...props} {...this.state} />)
(props) => (<GraduationTaskseditApp {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
@ -597,7 +606,7 @@ class CoursesIndex extends Component{
{/* 新建毕设任务 https://www.trustie.net/issues/19981 */}
<Route path="/courses/:coursesId/graduation_tasks/:category_id/new"
render={
(props) => (<GraduationTasksnewApp {...this.props} {...props} {...this.state} />)
(props) => (<GraduationTasksnewApp {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
@ -605,87 +614,87 @@ class CoursesIndex extends Component{
{/* 毕设任务列表 https://www.trustie.net/issues/19981 */}
<Route path="/courses/:coursesId/graduation_tasks/:Id" exact
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*/!* 毕业设计主 https://www.trustie.net/issues/19981 *!/*/}
{/*<Route path="/courses/:coursesId/graduation"*/}
{/*render={*/}
{/*(props) => (<GraduationTopics {...this.props} {...props} {...this.state} />)*/}
{/*(props) => (<GraduationTopics {...this.props} {...props} {...this.state} {...common}/>)*/}
{/*}*/}
{/*></Route>*/}
{/*/!* 资源子目录 https://www.trustie.net/issues/19917 *!/*/}
{/*<Route path="/courses/:coursesId/attachment/attachment/:attachmentId"*/}
{/*render={*/}
{/*(props) => (<Files {...this.props} {...props} {...this.state} />)*/}
{/*(props) => (<Files {...this.props} {...props} {...this.state} {...common}/>)*/}
{/*}*/}
{/*></Route>*/}
{/* 教师列表*/}
<Route path="/courses/:coursesId/teachers"
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 学生列表*/}
<Route path="/courses/:coursesId/students"
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 分班列表 */}
<Route path="/courses/:coursesId/course_groups/:course_group_id"
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 普通作业 */}
<Route path="/courses/:coursesId/common_homeworks/:category_id" exact
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 分组作业 */}
<Route path="/courses/:coursesId/group_homeworks/:category_id" exact
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 普通作业 */}
<Route path="/courses/:coursesId/common_homeworks/" strict
render={
(props) => (<CommonWork {...this.props} {...props} {...this.state} />)
(props) => (<CommonWork {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 分组作业 */}
<Route path="/courses/:coursesId/group_homeworks/" strict
render={
(props) => (<GroupWork {...this.props} {...props} {...this.state} />)
(props) => (<GroupWork {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 问卷答题 */}
<Route path="/courses/:coursesId/polls/:pollId/users/:login"
render={
(props) => (<PollInfo {...this.props} {...props} {...this.state} />)
(props) => (<PollInfo {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 问卷详情 */}
<Route path="/courses/:coursesId/polls/:pollId/detail"
render={
(props) => (<PollDetail {...this.props} {...props} {...this.state} />)
(props) => (<PollDetail {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 问卷新建 */}
<Route path="/courses/:coursesId/polls/:pollid/:news"
render={
(props) => (<PollNew {...this.props} {...props} {...this.state} />)
(props) => (<PollNew {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*/!* 问卷编辑 *!/*/}
@ -697,7 +706,7 @@ class CoursesIndex extends Component{
{/* 问卷 */}
<Route path="/courses/:coursesId/polls/:Id"
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
@ -705,20 +714,20 @@ class CoursesIndex extends Component{
{/* 试卷查看/评阅 */}
<Route exact path="/courses/:coursesId/exercises/:Id/users/:userId"
render={
(props)=>(<ExerciseReviewAndAnswer {...this.props} {...props} {...this.state} />)
(props)=>(<ExerciseReviewAndAnswer {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*试卷新建 */}
<Route exact path="/courses/:coursesId/exercises/new"
render={
(props) => (<ExerciseNew {...this.props} {...props} {...this.state} />)
(props) => (<ExerciseNew {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*试卷新建 */}
<Route exact path="/courses/:coursesId/exercises/:Id/edit"
render={
(props) => (<ExerciseNew {...this.props} {...props} {...this.state} />)
(props) => (<ExerciseNew {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
@ -726,7 +735,7 @@ class CoursesIndex extends Component{
<Route path="/courses/:coursesId/exercises/:Id/student_exercise_list"
render={
(props) => (<Testpapersettinghomepage {...this.props} {...props} {...this.state} />)
(props) => (<Testpapersettinghomepage {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
@ -735,14 +744,14 @@ class CoursesIndex extends Component{
<Route
path="/courses/:coursesId/exercises/:Id/Studentshavecompletedthelist"
render={
(props) => (<Studentshavecompletedthelist {...this.props} {...props} {...this.state} />)
(props) => (<Studentshavecompletedthelist {...this.props} {...props} {...this.state} {...common}/>)
}
>
</Route>
{/* 试卷 */}
<Route path="/courses/:coursesId/exercises/:Id"
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
@ -750,65 +759,65 @@ class CoursesIndex extends Component{
{/*实训查重详情*/}
<Route path="/courses/:coursesId/shixun_homeworks/:homeworkid/review_detail/:userid"
render={
(props) => (<ShixunWorkDetails {...this.props} {...props} {...this.state} />)
(props) => (<ShixunWorkDetails {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
<Route path="/courses/:coursesId/shixun_homework/:homeworkid/review_detail/:userid"
render={
(props) => (<ShixunWorkDetails {...this.props} {...props} {...this.state} />)
(props) => (<ShixunWorkDetails {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*实训查重列表*/}
<Route path="/courses/:coursesId/shixun_homeworks/:homeworkid/student_work"
render={
(props) => (<ShixunHomeworkPage {...this.props} {...props} {...this.state} />)
(props) => (<ShixunHomeworkPage {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
<Route path="/courses/:coursesId/shixun_homework/:homeworkid/student_work"
render={
(props) => (<ShixunHomeworkPage {...this.props} {...props} {...this.state} />)
(props) => (<ShixunHomeworkPage {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*实训报告*/}
<Route path="/courses/:coursesId/shixun_homeworks/:homeworkid/shixun_work_report"
render={
(props) => (<ShixunWorkReport {...this.props} {...props} {...this.state} />)
(props) => (<ShixunWorkReport {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
<Route path="/courses/:coursesId/shixun_homework/:homeworkid/shixun_work_report"
render={
(props) => (<ShixunWorkReport {...this.props} {...props} {...this.state} />)
(props) => (<ShixunWorkReport {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*教师列表*/}
<Route path="/courses/:coursesId/shixun_homeworks/:homeworkid/list"
render={
(props) => (<ShixunHomeworkPage {...this.props} {...props} {...this.state} />)
(props) => (<ShixunHomeworkPage {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
<Route path="/courses/:coursesId/shixun_homework/:homeworkid/list"
render={
(props) => (<ShixunHomeworkPage {...this.props} {...props} {...this.state} />)
(props) => (<ShixunHomeworkPage {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*实训作业page*/}
<Route path="/courses/:coursesId/shixun_homeworks/:homeworkid/Page"
render={
(props) => (<ShixunHomeworkPage {...this.props} {...props} {...this.state} />)
(props) => (<ShixunHomeworkPage {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*实训作业设置*/}
<Route path="/courses/:coursesId/shixun_homeworks/:homeworkid/settings"
render={
(props) => (<ShixunHomeworkPage {...this.props} {...props} {...this.state} />)
(props) => (<ShixunHomeworkPage {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
<Route path="/courses/:coursesId/shixun_homework/:homeworkid/settings"
render={
(props) => (<ShixunHomeworkPage {...this.props} {...props} {...this.state} />)
(props) => (<ShixunHomeworkPage {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*/!*实训作品列表教师*!/*/}
@ -847,21 +856,21 @@ class CoursesIndex extends Component{
{/*实训作业问答主目录*/}
<Route path="/courses/:coursesId/shixun_homeworks/:homeworkid/questions"
render={
(props) => (<ShixunHomeworkPage {...this.props} {...props} {...this.state} />)
(props) => (<ShixunHomeworkPage {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*实训作业问答子目录*/}
<Route path="/courses/:coursesId/shixun_homework/:homeworkid/questions"
render={
(props) => (<ShixunHomeworkPage {...this.props} {...props} {...this.state} />)
(props) => (<ShixunHomeworkPage {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*新建课堂*/}
<Route path="/courses/new"
render={
(props) => (<WrappedCoursesNewApp {...this.props} {...props} {...this.state} />)
(props) => (<WrappedCoursesNewApp {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*新建精品课堂*/}
@ -869,47 +878,47 @@ class CoursesIndex extends Component{
{/*id 是否是私有或者公有*/}
<Route path="/courses/news/:subjectid/newgold/:id"
render={
(props) => (<WrappedCoursesNewAppGoldclass {...this.props} {...props} {...this.state} />)
(props) => (<WrappedCoursesNewAppGoldclass {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*修改精品课堂*/}
<Route path="/courses/:coursesId/newgolds/settings"
render={
(props) => (<WrappedCoursesNewAppGoldclass {...this.props} {...props} {...this.state} />)
(props) => (<WrappedCoursesNewAppGoldclass {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*修改课堂*/}
<Route path="/courses/:coursesId/settings"
render={
(props) => (<WrappedCoursesNewApp {...this.props} {...props} {...this.state} />)
(props) => (<WrappedCoursesNewApp {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 实训作业子页面*/}
<Route path="/courses/:coursesId/shixun_homework/:category_id"
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 实训作业页面*/}
<Route path="/courses/:coursesId/shixun_homeworks/:main_id"
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*/!*实训作业and课堂详情页*!/*/}
<Route path="/courses/:coursesId"
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*课堂首页*/}
<Route path="/courses"
render={
(props) => (<CoursesHome {...this.props} {...props} {...this.state} />)
(props) => (<CoursesHome {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/*<Route exact path="/courses" component={CoursesHome} {...this.props} {...props} {...this.state} ></Route>*/}
@ -919,4 +928,4 @@ class CoursesIndex extends Component{
}
}
export default ImageLayerOfCommentHOC({imgSelector: '.imageLayerParent img, .imageLayerParent .imageTarget', parentSelector: '.newMain'}) (CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC(CoursesIndex) )));
export default withRouter(ImageLayerOfCommentHOC({imgSelector: '.imageLayerParent img, .imageLayerParent .imageTarget', parentSelector: '.newMain'}) (CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC(CoursesIndex) ))));
Loading…
Cancel
Save