diff --git a/public/react/src/modules/courses/Index.js b/public/react/src/modules/courses/Index.js index 1b1c523c0..7da04dd0e 100644 --- a/public/react/src/modules/courses/Index.js +++ b/public/react/src/modules/courses/Index.js @@ -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{ {/*毕设任务题库详情*/} () + (props) => () } > {/*毕设内容题库详情*/} () + (props) => () } > {/*分组作业题库详情*/} () + (props) => () } > {/* 普通作业题库详情*/} () + (props) => () } > {/* 资源列表页 */} () + (props) => () } > () + (props) => () } > () + (props) => () } > {/*课堂讨论*/} () + (props) => () } > @@ -512,19 +521,19 @@ class CoursesIndex extends Component{ {/* 毕设问答 */} () + (props) => () } > {/* 毕设选题新建页 */} () + (props) => () }> {/* 毕设选题编辑页*/} () + (props) => () }> {/* 毕设选题详情页 */} @@ -537,7 +546,7 @@ class CoursesIndex extends Component{ {/* 毕设选题列表 */} () + (props) => () }> @@ -545,21 +554,21 @@ class CoursesIndex extends Component{ {/* 作品评阅 https://www.trustie.net/issues/19981 */} () + (props) => () } > {/* 新建作品 */} () + (props) => () } > {/* 修改作品 */} () + (props) => () } > @@ -567,20 +576,20 @@ class CoursesIndex extends Component{ () + (props) => () } > () + (props) => () }> () + (props) => () } > @@ -589,7 +598,7 @@ class CoursesIndex extends Component{ {/* 修改毕设任务 https://www.trustie.net/issues/19981 */} () + (props) => () } > @@ -597,7 +606,7 @@ class CoursesIndex extends Component{ {/* 新建毕设任务 https://www.trustie.net/issues/19981 */} () + (props) => () } > @@ -605,87 +614,87 @@ class CoursesIndex extends Component{ {/* 毕设任务列表 https://www.trustie.net/issues/19981 */} () + (props) => () } > {/*/!* 毕业设计主 https://www.trustie.net/issues/19981 *!/*/} {/* ()*/} + {/*(props) => ()*/} {/*}*/} {/*>*/} {/*/!* 资源子目录 https://www.trustie.net/issues/19917 *!/*/} {/* ()*/} + {/*(props) => ()*/} {/*}*/} {/*>*/} {/* 教师列表*/} () + (props) => () } > {/* 学生列表*/} () + (props) => () } > {/* 分班列表 */} () + (props) => () } > {/* 普通作业 */} () + (props) => () } > {/* 分组作业 */} () + (props) => () } > {/* 普通作业 */} () + (props) => () } > {/* 分组作业 */} () + (props) => () } > {/* 问卷答题 */} () + (props) => () } > {/* 问卷详情 */} () + (props) => () } > {/* 问卷新建 */} () + (props) => () } > {/*/!* 问卷编辑 *!/*/} @@ -697,7 +706,7 @@ class CoursesIndex extends Component{ {/* 问卷 */} () + (props) => () } > @@ -705,20 +714,20 @@ class CoursesIndex extends Component{ {/* 试卷查看/评阅 */} () + (props)=>() } > {/*试卷新建 */} () + (props) => () } > {/*试卷新建 */} () + (props) => () } > @@ -726,7 +735,7 @@ class CoursesIndex extends Component{ () + (props) => () } > @@ -735,14 +744,14 @@ class CoursesIndex extends Component{ () + (props) => () } > {/* 试卷 */} () + (props) => () } > @@ -750,65 +759,65 @@ class CoursesIndex extends Component{ {/*实训查重详情*/} () + (props) => () } > () + (props) => () } > {/*实训查重列表*/} () + (props) => () } > () + (props) => () } > {/*实训报告*/} () + (props) => () } > () + (props) => () } > {/*教师列表*/} () + (props) => () } > () + (props) => () } > {/*实训作业page*/} () + (props) => () } > {/*实训作业设置*/} () + (props) => () } > () + (props) => () } > {/*/!*实训作品列表教师*!/*/} @@ -847,21 +856,21 @@ class CoursesIndex extends Component{ {/*实训作业问答主目录*/} () + (props) => () } > {/*实训作业问答子目录*/} () + (props) => () } > {/*新建课堂*/} () + (props) => () } > {/*新建精品课堂*/} @@ -869,47 +878,47 @@ class CoursesIndex extends Component{ {/*id 是否是私有或者公有*/} () + (props) => () } > {/*修改精品课堂*/} () + (props) => () } > {/*修改课堂*/} () + (props) => () } > {/* 实训作业子页面*/} () + (props) => () } > {/* 实训作业页面*/} () + (props) => () } > {/*/!*实训作业and课堂详情页*!/*/} () + (props) => () } > {/*课堂首页*/} () + (props) => () } > {/**/} @@ -919,4 +928,4 @@ class CoursesIndex extends Component{ } } -export default ImageLayerOfCommentHOC({imgSelector: '.imageLayerParent img, .imageLayerParent .imageTarget', parentSelector: '.newMain'}) (CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC(CoursesIndex) ))); \ No newline at end of file +export default withRouter(ImageLayerOfCommentHOC({imgSelector: '.imageLayerParent img, .imageLayerParent .imageTarget', parentSelector: '.newMain'}) (CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC(CoursesIndex) )))); \ No newline at end of file