From 0ce17259f9bf6d87c1f0db7999a52f07d96fa5f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 11 Mar 2020 22:19:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=99=AE=E9=80=9A=E4=BD=9C=E4=B8=9A=E3=80=81?= =?UTF-8?q?=E5=88=86=E7=BB=84=E4=BD=9C=E4=B8=9A=E5=A2=9E=E5=8A=A0=E4=BA=8C?= =?UTF-8?q?=E7=BA=A7=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/Index.js | 28 ++- .../src/modules/courses/ListPageIndex.js | 12 + .../courses/busyWork/CommonWorkDetailIndex.js | 50 ++++- .../src/modules/courses/busyWork/Index.js | 212 +++++++++++------- .../modules/courses/busyWork/IndexGroup.js | 199 ++++++++++------ .../src/modules/courses/busyWork/NewWork.js | 26 ++- .../src/modules/courses/busyWork/UseBank.js | 5 +- .../src/modules/courses/busyWork/common.js | 19 +- .../modules/courses/busyWork/commonWork.js | 164 +++++++++----- .../courses/coursesDetail/CoursesLeftNav.js | 44 +++- .../user/usersInfo/banks/NewGtaskForm.js | 10 +- 11 files changed, 547 insertions(+), 222 deletions(-) diff --git a/public/react/src/modules/courses/Index.js b/public/react/src/modules/courses/Index.js index b6d9c566e..f70d748eb 100644 --- a/public/react/src/modules/courses/Index.js +++ b/public/react/src/modules/courses/Index.js @@ -726,12 +726,24 @@ class CoursesIndex extends Component { (props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>) } ></Route> + {/* 子目录普通作业 */} + <Route path="/classrooms/:coursesId/common_homework/:category_id" exact + render={ + (props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>) + } + ></Route> {/* 分组作业 */} <Route path="/classrooms/:coursesId/group_homeworks/:category_id" exact render={ (props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>) } ></Route> + {/* 分组作业 */} + <Route path="/classrooms/:coursesId/group_homework/:category_id" exact + render={ + (props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>) + } + ></Route> {/* 普通作业 */} <Route path="/classrooms/:coursesId/common_homeworks/" strict @@ -739,6 +751,12 @@ class CoursesIndex extends Component { (props) => (<CommonWork {...this.props} {...props} {...this.state} {...common}/>) } ></Route> + {/* 子普通作业 */} + <Route path="/classrooms/:coursesId/common_homework/" strict + render={ + (props) => (<CommonWork {...this.props} {...props} {...this.state} {...common}/>) + } + ></Route> {/* 分组作业 */} <Route path="/classrooms/:coursesId/group_homeworks/" strict @@ -747,7 +765,15 @@ class CoursesIndex extends Component { } ></Route> - {/* 问卷答题 */} + {/* 分组作业 */} + <Route path="/classrooms/:coursesId/group_homework/" strict + render={ + (props) => (<GroupWork {...this.props} {...props} {...this.state} {...common}/>) + } + ></Route> + + + {/* 问卷答题 */} <Route path="/classrooms/:coursesId/polls/:pollId/users/:login" render={ (props) => (<PollInfo {...this.props} {...props} {...this.state} {...common}/>) diff --git a/public/react/src/modules/courses/ListPageIndex.js b/public/react/src/modules/courses/ListPageIndex.js index 3f13f619f..1bb79d28f 100644 --- a/public/react/src/modules/courses/ListPageIndex.js +++ b/public/react/src/modules/courses/ListPageIndex.js @@ -230,6 +230,12 @@ class ListPageIndex extends Component { (props) => (<CommonWork {...this.props} {...props} {...this.state} />) } ></Route> + {/* 普通作业 */} + <Route path="/classrooms/:coursesId/common_homework/:category_id" + render={ + (props) => (<CommonWork {...this.props} {...props} {...this.state} />) + } + ></Route> {/* 作品列表 */} <Route path="/classrooms/:coursesId/group_homeworks/:category_id" @@ -237,6 +243,12 @@ class ListPageIndex extends Component { (props) => (<CommonWork {...this.props} {...props} {...this.state} />) } ></Route> + {/* 作品列表 */} + <Route path="/classrooms/:coursesId/group_homework/:category_id" + render={ + (props) => (<CommonWork {...this.props} {...props} {...this.state} />) + } + ></Route> <Route exact path="/classrooms/:coursesId/boards/:boardId" render={ diff --git a/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js b/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js index 8be1c94cf..457e25114 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js @@ -179,7 +179,9 @@ class CommonWorkDetailIndex extends Component { } let exportUrl = `/homework_commons/${workId}/works_list.zip?${queryString.stringify(params)}` let exportResultUrl = `/homework_commons/${workId}/works_list.xlsx?${queryString.stringify(params)}` - document.title = course_name === undefined ? "" : course_name; + document.title=course_name === undefined ? "" : course_name; + + console.log(category_id) return ( <div> <PublishRightnow showActionButton={false} {...this.props} checkBoxValues={[workId]} @@ -375,6 +377,12 @@ class CommonWorkDetailIndex extends Component { } ></Route> + <Route exact path="/classrooms/:coursesId/common_homework/:workId/setting" + render={ + (props) => (<CommonWorkSetting {...this.props} {...props} {...this.state} {...commonHandler}/>) + } + ></Route> + {/* 作品列表 */} <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/list" render={ @@ -382,17 +390,35 @@ class CommonWorkDetailIndex extends Component { } ></Route> + {/* 作品列表 */} + <Route exact path="/classrooms/:coursesId/common_homework/:workId/list" + render={ + (props) => (<CommonWorkList ref="commonWorkList" triggerRef={this.bindRef} {...this.props} {...props} {...this.state} {...commonHandler}/>) + } + ></Route> + {/* 作业问答 */} <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/question" render={ (props) => (<CommonWorkQuestion {...this.props} {...props} {...this.state} {...commonHandler}/>) } ></Route> + <Route exact path="/classrooms/:coursesId/common_homework/:workId/question" + render={ + (props) => (<CommonWorkQuestion {...this.props} {...props} {...this.state} {...commonHandler}/>) + } + ></Route> + <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/answer" render={ (props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler}/>) } ></Route> + <Route exact path="/classrooms/:coursesId/common_homework/:workId/answer" + render={ + (props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler}/>) + } + ></Route> <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/setting" @@ -400,25 +426,43 @@ class CommonWorkDetailIndex extends Component { (props) => (<CommonWorkSetting {...this.props} {...props} {...this.state} {...commonHandler}/>) } ></Route> - + <Route exact path="/classrooms/:coursesId/group_homework/:workId/setting" + render={ + (props) => (<CommonWorkSetting {...this.props} {...props} {...this.state} {...commonHandler}/>) + } + ></Route> {/* 作品列表 */} <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/list" render={ (props) => (<CommonWorkList triggerRef={this.bindRef} {...this.props} {...props} {...this.state} {...commonHandler}/>) } ></Route> - + <Route exact path="/classrooms/:coursesId/group_homework/:workId/list" + render={ + (props) => (<CommonWorkList triggerRef={this.bindRef} {...this.props} {...props} {...this.state} {...commonHandler}/>) + } + ></Route> {/* 作业问答 */} <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/question" render={ (props) => (<CommonWorkQuestion {...this.props} {...props} {...this.state} {...commonHandler}/>) } ></Route> + <Route exact path="/classrooms/:coursesId/group_homework/:workId/question" + render={ + (props) => (<CommonWorkQuestion {...this.props} {...props} {...this.state} {...commonHandler}/>) + } + ></Route> <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/answer" render={ (props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler}/>) } ></Route> + <Route exact path="/classrooms/:coursesId/group_homework/:workId/answer" + render={ + (props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler}/>) + } + ></Route> </Switch> </div> </div> diff --git a/public/react/src/modules/courses/busyWork/Index.js b/public/react/src/modules/courses/busyWork/Index.js index 79b6c6cc6..555ffc7c4 100644 --- a/public/react/src/modules/courses/busyWork/Index.js +++ b/public/react/src/modules/courses/busyWork/Index.js @@ -57,83 +57,141 @@ class CoursesWorkIndex extends Component { render() { return ( <div> - <Switch {...this.props}> - - {/* --------------------------------------------------------------------- */} - - {/* 作业设置 */} - {/* http://localhost:3007/courses/1309/homework/9300/setting */} - <Route exact path="/courses/:coursesId/common_homeworks/:workId/setting" - render={ - (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) - } - ></Route> - - {/* 作品列表 */} - <Route exact path="/courses/:coursesId/common_homeworks/:workId/list" - render={ - (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) - } - ></Route> - {/* 作业问答 */} - <Route exact path="/courses/:coursesId/common_homeworks/:workId/question" - render={ - (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) - } - ></Route> - <Route exact path="/courses/:coursesId/common_homeworks/:workId/answer" - render={ - (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) - } - ></Route> - - {/* 评阅 */} - <Route exact path="/courses/:coursesId/common_homeworks/:workId/:studentWorkId/appraise" - render={ - (props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />) - } - ></Route> - - {/* 提交作品 */} - <Route exact path="/courses/:coursesId/common_homeworks/:workId/post" - render={ - (props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) - } - ></Route> - <Route exact path="/courses/:coursesId/common_homeworks/:workId/:studentWorkId/post_edit" - render={ - (props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) - } - ></Route> - - - {/* 新建 */} - {/* http://localhost:3007/courses/1309/common_homeworks/9299/edit/1 */} - <Route exact path="/courses/:coursesId/common_homeworks/:workId/:pageType" - render={ - (props) => (<NewWork {...this.props} {...props} {...this.state} />) - } - ></Route> - <Route exact path="/courses/:coursesId/common_homeworks/:categroy_id/new" - render={ - (props) => (<NewWork {...this.props} {...props} {...this.state} />) - } - ></Route> - - - - {/* 作业列表 */} - <Route path="/courses/:coursesId/common_homeworks" - render={ - (props) => (<ListPageIndex {...this.props} {...props} {...this.state} />) - } - ></Route> - - {/* --------------------------------------------------------------------- */} - - - - </Switch> + <Switch {...this.props}> + + {/* --------------------------------------------------------------------- */} + + {/* 作业设置 */} + {/* http://localhost:3007/classrooms/1309/homework/9300/setting */} + <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/setting" + render={ + (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + <Route exact path="/classrooms/:coursesId/common_homework/:workId/setting" + render={ + (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + + + {/* 作品列表 */} + <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/list" + render={ + (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + {/* 作品列表 */} + <Route exact path="/classrooms/:coursesId/common_homework/:workId/list" + render={ + (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + + {/* 作业问答 */} + <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/question" + render={ + (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + <Route exact path="/classrooms/:coursesId/common_homework/:workId/question" + render={ + (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + + <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/answer" + render={ + (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + <Route exact path="/classrooms/:coursesId/common_homework/:workId/answer" + render={ + (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + + + {/* 评阅 */} + <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/:studentWorkId/appraise" + render={ + (props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />) + } + ></Route> + <Route exact path="/classrooms/:coursesId/common_homework/:workId/:studentWorkId/appraise" + render={ + (props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />) + } + ></Route> + + + {/* 提交作品 */} + <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/post" + render={ + (props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) + } + ></Route> + <Route exact path="/classrooms/:coursesId/common_homework/:workId/post" + render={ + (props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) + } + ></Route> + + <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/:studentWorkId/post_edit" + render={ + (props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) + } + ></Route> + <Route exact path="/classrooms/:coursesId/common_homework/:workId/:studentWorkId/post_edit" + render={ + (props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) + } + ></Route> + + + {/* 新建 */} + {/* http://localhost:3007/classrooms/1309/common_homeworks/9299/edit/1 */} + <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/:pageType" + render={ + (props) => (<NewWork {...this.props} {...props} {...this.state} />) + } + ></Route> + <Route exact path="/classrooms/:coursesId/common_homework/:workId/:pageType" + render={ + (props) => (<NewWork {...this.props} {...props} {...this.state} />) + } + ></Route> + + <Route exact path="/classrooms/:coursesId/common_homeworks/:categroy_id/new" + render={ + (props) => (<NewWork {...this.props} {...props} {...this.state} />) + } + ></Route> + + <Route exact path="/classrooms/:coursesId/common_homework/:categroy_id/new" + render={ + (props) => (<NewWork {...this.props} {...props} {...this.state} />) + } + ></Route> + + + {/* 作业列表 */} + <Route path="/classrooms/:coursesId/common_homeworks" + render={ + (props) => (<ListPageIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + <Route path="/classrooms/:coursesId/common_homework" + render={ + (props) => (<ListPageIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + + {/* --------------------------------------------------------------------- */} + + + + </Switch> </div> ) } diff --git a/public/react/src/modules/courses/busyWork/IndexGroup.js b/public/react/src/modules/courses/busyWork/IndexGroup.js index e111bcae3..d9345dea9 100644 --- a/public/react/src/modules/courses/busyWork/IndexGroup.js +++ b/public/react/src/modules/courses/busyWork/IndexGroup.js @@ -58,80 +58,131 @@ class CoursesWorkIndex extends Component { render() { return ( <div> - <Switch {...this.props}> - - - {/* --------------------------------------------------------------------- */} - - {/* --------------------------------------------------------------------- */} - - {/* 作业设置 */} - <Route exact path="/courses/:coursesId/group_homeworks/:workId/setting" - render={ - (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) - } - ></Route> - - {/* 作品列表 */} - <Route exact path="/courses/:coursesId/group_homeworks/:workId/list" - render={ - (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) - } - ></Route> - - {/* 作业问答 */} - <Route exact path="/courses/:coursesId/group_homeworks/:workId/question" - render={ - (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) - } - ></Route> - {/* 参考答案 */} - <Route exact path="/courses/:coursesId/group_homeworks/:workId/answer" - render={ - (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) - } - ></Route> - {/* 评阅 */} - <Route exact path="/courses/:coursesId/group_homeworks/:workId/:studentWorkId/appraise" - render={ - (props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />) - } - ></Route> - - - <Route exact path="/courses/:coursesId/group_homeworks/:workId/post" - render={ - (props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) - } - ></Route> - <Route exact path="/courses/:coursesId/group_homeworks/:workId/:studentWorkId/post_edit" - render={ - (props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) - } - ></Route> - - {/* 新建 */} - {/* http://localhost:3007/courses/1309/group_homeworks/9299/edit/1 */} - <Route exact path="/courses/:coursesId/group_homeworks/:workId/:pageType" - render={ - (props) => (<NewWork {...this.props} {...props} {...this.state} />) - } - ></Route> - <Route exact path="/courses/:coursesId/group_homeworks/:categroy_id/new" - render={ - (props) => (<NewWork {...this.props} {...props} {...this.state} />) - } - ></Route> - - {/* 作业列表 */} - <Route path="/courses/:coursesId/group_homeworks" - render={ - (props) => (<ListPageIndex {...this.props} {...props} {...this.state} />) - } - ></Route> - - - </Switch> + <Switch {...this.props}> + + + {/* --------------------------------------------------------------------- */} + + {/* --------------------------------------------------------------------- */} + + {/* 作业设置 */} + <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/setting" + render={ + (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + <Route exact path="/classrooms/:coursesId/group_homework/:workId/setting" + render={ + (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + + {/* 作品列表 */} + <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/list" + render={ + (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + <Route exact path="/classrooms/:coursesId/group_homework/:workId/list" + render={ + (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + + {/* 作业问答 */} + <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/question" + render={ + (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + <Route exact path="/classrooms/:coursesId/group_homework/:workId/question" + render={ + (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + {/* 参考答案 */} + <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/answer" + render={ + (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + <Route exact path="/classrooms/:coursesId/group_homework/:workId/answer" + render={ + (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + {/* 评阅 */} + <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/:studentWorkId/appraise" + render={ + (props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />) + } + ></Route> + <Route exact path="/classrooms/:coursesId/group_homework/:workId/:studentWorkId/appraise" + render={ + (props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />) + } + ></Route> + + <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/post" + render={ + (props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) + } + ></Route> + + <Route exact path="/classrooms/:coursesId/group_homework/:workId/post" + render={ + (props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) + } + ></Route> + + <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/:studentWorkId/post_edit" + render={ + (props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) + } + ></Route> + <Route exact path="/classrooms/:coursesId/group_homework/:workId/:studentWorkId/post_edit" + render={ + (props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) + } + ></Route> + {/* 新建 */} + {/* http://localhost:3007/classrooms/1309/group_homeworks/9299/edit/1 */} + <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/:pageType" + render={ + (props) => (<NewWork {...this.props} {...props} {...this.state} />) + } + ></Route> + <Route exact path="/classrooms/:coursesId/group_homework/:workId/:pageType" + render={ + (props) => (<NewWork {...this.props} {...props} {...this.state} />) + } + ></Route> + <Route exact path="/classrooms/:coursesId/group_homeworks/:categroy_id/new" + render={ + (props) => (<NewWork {...this.props} {...props} {...this.state} />) + } + ></Route> + <Route exact path="/classrooms/:coursesId/group_homework/:categroy_id/new" + render={ + (props) => (<NewWork {...this.props} {...props} {...this.state} />) + } + ></Route> + + {/* 作业列表 */} + <Route path="/classrooms/:coursesId/group_homeworks" + render={ + (props) => (<ListPageIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + {/* 作业列表 */} + <Route path="/classrooms/:coursesId/group_homework" + render={ + (props) => (<ListPageIndex {...this.props} {...props} {...this.state} />) + } + ></Route> + + + </Switch> </div> ) } diff --git a/public/react/src/modules/courses/busyWork/NewWork.js b/public/react/src/modules/courses/busyWork/NewWork.js index 79beb9620..edf22a37f 100644 --- a/public/react/src/modules/courses/busyWork/NewWork.js +++ b/public/react/src/modules/courses/busyWork/NewWork.js @@ -29,8 +29,17 @@ class NewWork extends Component { } } fetchCourseData = (courseId) => { + let newcategory=undefined; + if(this.props.match.path==="/classrooms/:coursesId/common_homework/:workId/:pageType"){ + newcategory=this.props.match.params.workId + } const isGroup = this.props.isGroup() - const url = `/courses/${courseId}/homework_commons/new.json?type=${isGroup ? 3 : 1}` + let url="" + if(newcategory){ + url = `/courses/${courseId}/homework_commons/new.json?type=${isGroup ? 3 : 1}&category=${newcategory}`; + }else{ + url = `/courses/${courseId}/homework_commons/new.json?type=${isGroup ? 3 : 1}` + } axios.get(url, { }) .then((response) => { @@ -49,7 +58,17 @@ class NewWork extends Component { }); } fetchWork = (workId) => { - const url = `/homework_commons/${workId}/edit.json` + let newcategory=undefined; + if(this.props.match.path==="/classrooms/:coursesId/common_homework/:workId/:pageType"){ + newcategory=this.props.match.params.workId + } + let url="" + if(newcategory){ + url = `/homework_commons/${workId}/edit.json?category=${newcategory}`; + }else{ + url = `/homework_commons/${workId}/edit.json` + } + axios.get(url, { }) .then((response) => { @@ -91,6 +110,9 @@ class NewWork extends Component { doNew = (params) => { const coursesId = this.props.match.params.coursesId const newUrl = `/courses/${coursesId}/homework_commons.json` + if(this.props.match.path==="/classrooms/:coursesId/common_homework/:workId/:pageType"){ + params.category=this.props.match.params.workId + } axios.post(newUrl, params) .then((response) => { diff --git a/public/react/src/modules/courses/busyWork/UseBank.js b/public/react/src/modules/courses/busyWork/UseBank.js index 6c98695ba..b31412470 100644 --- a/public/react/src/modules/courses/busyWork/UseBank.js +++ b/public/react/src/modules/courses/busyWork/UseBank.js @@ -132,7 +132,7 @@ class UseBank extends Component{ onSave = () => { debugger const { checkBoxValues } = this.state; - const { object_type } = this.props + const { object_type,category_id } = this.props if(checkBoxValues.length==0){ this.setState({ isChecked:"请先选择"+engNameMap[object_type] @@ -149,7 +149,8 @@ class UseBank extends Component{ , { "object_type": object_type, "bank_id": checkBoxValues, - "course_id": courseId + "course_id": courseId, + "category":category_id } ) .then((response) => { diff --git a/public/react/src/modules/courses/busyWork/common.js b/public/react/src/modules/courses/busyWork/common.js index ebcce2c12..b413f2c53 100644 --- a/public/react/src/modules/courses/busyWork/common.js +++ b/public/react/src/modules/courses/busyWork/common.js @@ -39,8 +39,23 @@ export function RouteHOC(options = {}) { let chName = isGroup ? '分组作业' : '普通作业' return chName; } - const secondName = isGroup ? 'group_homeworks' : 'common_homeworks' - return secondName; + + if(window.location.pathname.indexOf('group_homeworks') != -1){ + const secondName ='group_homeworks'; + return secondName; + } + + if(window.location.pathname.indexOf('common_homeworks') != -1){ + const secondName ='common_homeworks'; + return secondName; + } + + if(window.location.pathname.indexOf('common_homework') != -1){ + const secondName ='common_homework'; + return secondName; + } + + } getModuleType = () => { const isGroup = this.isGroup() diff --git a/public/react/src/modules/courses/busyWork/commonWork.js b/public/react/src/modules/courses/busyWork/commonWork.js index 8ba6303fc..d4b097cec 100644 --- a/public/react/src/modules/courses/busyWork/commonWork.js +++ b/public/react/src/modules/courses/busyWork/commonWork.js @@ -6,7 +6,7 @@ import '../css/busyWork.css' import CommonWorkItem from './CommonWorkItem' import PublishRightnow from './PublishRightnow' import ConnectProject from './ConnectProject' -import { WordsBtn, on, off } from 'educoder' +import { WordsBtn, on, off ,trigger} from 'educoder' import Modals from '../../modals/Modals' import NoneData from "../coursesPublic/NoneData" import Titlesearchsection from '../common/titleSearch/TitleSearchSection'; @@ -34,7 +34,8 @@ class commonWork extends Component{ totalCount:0, checkAll:false, checkBoxValues:[], - isSpin:false + isSpin:false, + category_id:undefined } } //输入搜索条件 @@ -45,8 +46,8 @@ class commonWork extends Component{ } //搜索查询 searchStudent=()=>{ - let {page,search,order}=this.state; - this.getList(1,search,order); + let {category_id,search,order}=this.state; + this.getList(1,search,order,category_id); } openConnectionProject = (work) => { this.refs['connectProject'].openConnectionProject(work) @@ -54,7 +55,7 @@ class commonWork extends Component{ // 新建 createCommonWork=(type)=>{ - this.props.toNewPage(this.props.match.params) + this.props.toNewPage(this.props.match.params) } cancelDelClasses=()=>{ @@ -69,23 +70,60 @@ class commonWork extends Component{ } componentDidUpdate(prevProps, prevState) { - if (prevProps.match.path != this.props.match.path) { - this.clearSelection() - this.setState({ selectedKeys: 'all', order: '' }, () => { - this._getList() - }) + console.log(this.props) + if (prevProps.coursesidtype != this.props.coursesidtype) { + if (this.props.match.path === "/classrooms/:coursesId/common_homeworks/:category_id" || this.props.match.path === "/classrooms/:coursesId/common_homework/:category_id") { + + if (this.props.coursesidtype === "node" && this.props.match.path === "/classrooms/:coursesId/common_homeworks/:category_id") { + this.clearSelection() + this.setState({selectedKeys: 'all', order: ''}, () => { + this._getList() + }) + } + if (this.props.coursesidtype === "child" && this.props.match.path === "/classrooms/:coursesId/common_homework/:category_id") { + this.clearSelection() + this.setState({selectedKeys: 'all', order: ''}, () => { + this._getList(this.props.match.params.category_id) + }) + } + } } + // + // if(this.props.match.path==="/classrooms/:coursesId/common_homeworks/:category_id"||this.props.match.path==="/classrooms/:coursesId/common_homework/:category_id"){ + // + // + // if(this.props.coursesidtype==="node"&&this.props.match.path==="/classrooms/:coursesId/common_homeworks/:category_id"){ + // this.clearSelection() + // this.setState({ selectedKeys: 'all', order: '' }, () => { + // this._getList() + // }) + // } + // if(this.props.coursesidtype==="child"&&this.props.match.path==="/classrooms/:coursesId/common_homework/:category_id"){ + // this.clearSelection() + // this.setState({ selectedKeys: 'all', order: '' }, () => { + // this._getList(this.props.match.params.category_id) + // }) + // } + // + // } + } - - _getList = () => { + + _getList = (id) => { this.setState({ - isSpin:true + isSpin:true, + category_id:id }) let {page,search,order}=this.state; - this.getList(page,search,order); + this.getList(page,search,order,id); } componentDidMount(){ - this._getList() + if(this.props.coursesidtype==="node"){ + this._getList() + }else{ + this._getList(this.props.match.params.category_id) + } + on('updateNavSuccess', this.updateNavSuccess) } @@ -93,9 +131,13 @@ class commonWork extends Component{ off('updateNavSuccess', this.updateNavSuccess) } updateNavSuccess = () => { - this._getList() + if(this.props.coursesidtype==="node"){ + this._getList() + }else{ + this._getList(this.props.match.params.category_id) + } } - + useBankSuccess = (checkBoxValues, newWorkIdArray) => { this.setState({ page:1, @@ -103,12 +145,14 @@ class commonWork extends Component{ }, () => { this.refs['publishModalRef'].open() }) - - let {search, order}=this.state; - this.getList(1, search, order); + + let {search, order,category_id}=this.state; + this.getList(1, search, order,category_id); } - getList=(page,search,order)=>{ + getList=(page,search,order,category_id)=>{ + console.log(category_id) + this.setState({ isSpin:true }) @@ -121,6 +165,9 @@ class commonWork extends Component{ if(search!=""){ url+="&search="+search; } + if(category_id){ + url+="&category="+category_id; + } axios.get(encodeURI(url)).then((result)=>{ if(result.status==200){ this.setState({ @@ -148,8 +195,8 @@ class commonWork extends Component{ checkBoxValues:[], checkAll:false }) - let {search}=this.state; - this.getList(1,search,e.key==="all"?"":e.key); + let {search,category_id}=this.state; + this.getList(1,search,e.key==="all"?"":e.key,category_id); } onPageChange=(pageNumber)=>{ @@ -157,8 +204,8 @@ class commonWork extends Component{ page:pageNumber, checkBoxValues:[] }) - let {search,order}=this.state; - this.getList(pageNumber,search,order); + let {search,order,category_id}=this.state; + this.getList(pageNumber,search,order,category_id); } // 全选和反选 @@ -191,7 +238,7 @@ class commonWork extends Component{ } onWorkDelete = () => { - const { checkBoxValues } = this.state; + const { checkBoxValues,category_id} = this.state; const len = checkBoxValues.length; if (len == 0) { this.props.showNotification('请先选择要删除的作业') @@ -209,13 +256,14 @@ class commonWork extends Component{ axios.post(url, { homework_ids: checkBoxValues, all_check: 0, + // category:category_id // group_ids }).then((response) => { - if (response.data.status == 0) { + if (response.data.status == 0) { this.props.showNotification('删除成功') this.clearSelection() let {search,order}=this.state; - this.getList(1,search,order); + this.getList(1,search,order,category_id); this.props.updataleftNavfun() } @@ -224,12 +272,12 @@ class commonWork extends Component{ }) } }) - + } clearSelection = () => { this.setState({ checkBoxValues: [], checkAll: false }) } - // + // onSetPublic = () => { const { checkBoxValues } = this.state; const len = checkBoxValues.length; @@ -249,10 +297,10 @@ class commonWork extends Component{ homework_ids: checkBoxValues, all_check: 0 }).then((response) => { - if (response.data.status == 0) { + if (response.data.status == 0) { this.props.showNotification('设为公开操作成功') let {search,order, page}=this.state; - this.getList(page,search,order); + this.getList(page,search,order,category_id); } }).catch((error) => { @@ -262,8 +310,8 @@ class commonWork extends Component{ }) } doWhenSuccess = () => { - let {search,order, page}=this.state; - this.getList(page,search,order); + let {search,order, page,category_id}=this.state; + this.getList(page,search,order,category_id); this.setState({ checkBoxValues:[] }) @@ -279,7 +327,7 @@ class commonWork extends Component{ this.onChangeSelect(checkBoxValues) } addToBank = () => { - const { checkBoxValues } = this.state; + const { checkBoxValues,category_id } = this.state; const len = checkBoxValues.length; if (len == 0) { this.props.showNotification('请先选择要加入题库的作业') @@ -291,10 +339,10 @@ class commonWork extends Component{ homework_ids: checkBoxValues, all_check: 0 }).then((response) => { - if (response.data.status == 0) { + if (response.data.status == 0) { this.props.showNotification('加入成功') let {search,order}=this.state; - this.getList(1,search,order); + this.getList(1,search,order,category_id); } }).catch((error) => { @@ -302,27 +350,36 @@ class commonWork extends Component{ }) } connectSuccess = () => { - let {page,search,order}=this.state; - this.getList(page,search,order); + let {page,search,order,category_id}=this.state; + this.getList(page,search,order,category_id); } cancelConnectionProject = (work) => { let workId=this.props.match.params.workId; let courseId=this.props.match.params.coursesId; - + let {page,search,order,category_id}=this.state; const url = `/homework_commons/${work.homework_id}/student_works/cancel_relate_project.json` axios.get(url).then((response)=> { if (response.data.status == 0) { - let {page,search,order}=this.state; - this.getList(page,search,order); + + this.getList(page,search,order,category_id); this.props.showNotification('取消关联成功') } }).catch((error)=>{ console.log(error) }) } + addDir = (id) => { + + if(!id){ + trigger('addcommon_homeworks', parseInt(this.props.match.params.category_id)) + }else{ + let data={id:parseInt(id),name:name} + trigger('editcommon_homeworks', data) + } + + } - render(){ let { search, @@ -339,6 +396,8 @@ class commonWork extends Component{ published_count, unpublished_count, main_category_name, + category_name, + category_id }=this.state; const { coursedata } = this.props; if (!coursedata) { @@ -354,12 +413,12 @@ class commonWork extends Component{ // <CourseLayoutcomponent {...this.props}> // </CourseLayoutcomponent> return( - + <div> {/* <div className="edu-back-white"> <p className="clearfix padding30 bor-bottom-greyE"> <span className="font-18 fl color-dark-21">{moduleChineseName}</span> - + </p> <div className="clearfix pl30 pr30"> <div className="fl mt6 task_menu_ul"> @@ -374,7 +433,7 @@ class commonWork extends Component{ </Menu> </div> <div className="fr mt16 mb16 searchView"> - <Search + <Search value={search} placeholder="请输入姓名进行搜索" onInput={this.inputStudent} @@ -387,7 +446,7 @@ class commonWork extends Component{ <Titlesearchsection - title={main_category_name} + title={!category_id?main_category_name:category_name} searchValue={ search } // searchtype={this.props.isAdmin||this.props.isStudent ?true:false} onInputSearchChange={this.inputStudent} @@ -399,6 +458,9 @@ class commonWork extends Component{ { isAdmin && <li className="fr"> <UseBank {...this.props} {...this.state} object_type={isGroup ? "group" : "normal"} useBankSuccess={this.useBankSuccess}></UseBank> </li> } + { isAdmin && <li className="fr mr40"> + <WordsBtn style="blue" className="fr" onClick={()=>this.addDir(category_id)}>{!category_id?"新建目录":"目录重命名"}</WordsBtn> + </li> } </React.Fragment> } secondRowBotton={ @@ -425,7 +487,7 @@ class commonWork extends Component{ searchPlaceholder={"请输入名称进行搜索"} showSearchInput={true} ></Titlesearchsection> - <PublishRightnow ref="publishModalRef" showActionButton={true} {...this.props} checkBoxValues={checkBoxValues} + <PublishRightnow ref="publishModalRef" showActionButton={true} {...this.props} checkBoxValues={checkBoxValues} showActionButton={false} isPublish={true} islist={true} @@ -445,10 +507,10 @@ class commonWork extends Component{ <a href="javascript:void(0)" className="color-grey-9" onClick={() => this.refs['publishModalRef'].homeworkstart()}>{ "立即发布" }</a> </li> <li className="li_line"> - <PublishRightnow showActionButton={true} {...this.props} checkBoxValues={checkBoxValues} + <PublishRightnow showActionButton={true} {...this.props} checkBoxValues={checkBoxValues} isPublish={false} doWhenSuccess={this.doWhenSuccess} fromListPage={true}></PublishRightnow> </li> - + { !!course_public && <li className="li_line"><a href="javascript:void(0)" onClick={this.onSetPublic} className="color-grey-9">设为公开</a></li>} {this.props.user&&this.props.user.main_site===true?<li><a href="javascript:void(0)" className="color-grey-9" onClick={this.addToBank} @@ -483,7 +545,7 @@ class commonWork extends Component{ { !!totalCount && totalCount > 15 && - <div className="edu-txt-center pt30 pb10 clearfix"> + <div className="edu-txt-center pt30 pb10 clearfix"> <Pagination current={page} showQuickJumper pageSize={15} total={totalCount} onChange={this.onPageChange}></Pagination> </div> } diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js index a9495e78d..f7aef34c7 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js @@ -142,6 +142,8 @@ class Coursesleftnav extends Component{ off('editshixunmainname',this.editshixunmainname) off('videoAdd',this.addVideo) off('editVideo',this.editVideo) + off('addcommon_homeworks',this.addcommon_homeworks) + off('editcommon_homeworks',this.editcommon_homeworks) } addshixunchild=(e, data)=>{ this.Navmodalnames(e,1,"shixun_homework",data); @@ -149,6 +151,12 @@ class Coursesleftnav extends Component{ editshixunchild=(e, data)=>{ this.Navmodalnames(e,4,"editSecondname",data.id,data.name); } + addcommon_homeworks=(e, data)=>{ + this.Navmodalnames(e,1,"common_homework",data); + } + editcommon_homeworks=(e, data)=>{ + this.Navmodalnames(e,4,"editSecondname",data.id,data.name); + } editshixunmainname=(e, data)=>{ this.Navmodalnames(e,3,"editname",data.id,data.name); } @@ -196,7 +204,8 @@ class Coursesleftnav extends Component{ on('editshixunmainname',this.editshixunmainname); on('videoAdd',this.addVideo); on('editVideo',this.editVideo) - + on('addcommon_homeworks',this.addcommon_homeworks) + on('editcommon_homeworks',this.editcommon_homeworks) let courstype=this.props.match.url; @@ -537,7 +546,7 @@ class Coursesleftnav extends Component{ } saveNavmodapost=(url,value,positiontype,coursesId,type)=>{ - + console.log(positiontype) axios.post(url, {name:value}).then((result)=>{ if(result!=undefined){ @@ -548,6 +557,23 @@ class Coursesleftnav extends Component{ description:result.data.message }); + if(positiontype==="common_homeworks"||positiontype==="common_homework"||positiontype==="group_homeworks"||positiontype==="group_homework"){ + if(type===true){ + this.updasaveNavmoda() + trigger('updateNavSuccess') + }else{ + this.updasaveNavmoda() + if(positiontype==="common_homeworks"){ + this.props.history.push(`/classrooms/${coursesId}/common_homework/${result.data.category_id}`); + } + if(positiontype==="group_homeworks"){ + this.props.history.push(`/classrooms/${coursesId}/group_homework/${result.data.category_id}`); + } + + } + return + } + if(positiontype==="shixun_homeworks"||positiontype==="shixun_homework"){ if(type===true){ this.updasaveNavmoda() @@ -557,6 +583,7 @@ class Coursesleftnav extends Component{ this.props.history.push(`/classrooms/${coursesId}/shixun_homework/${result.data.category_id}`); } + return } if(positiontype==="files"||positiontype==="file"){ @@ -569,22 +596,25 @@ class Coursesleftnav extends Component{ this.updasaveNavmoda() this.props.history.push(`/classrooms/${coursesId}/file/${result.data.category_id}`); } - + return } if(positiontype==="boards"){ this.updasaveNavmoda() trigger('updateNavSuccess') this.props.history.push(`/classrooms/${coursesId}/boards/${result.data.category_id}`); + return } if(positiontype!="course_groups"&&positiontype!="shixun_homeworks"&&positiontype!="shixun_homework"){ this.updasaveNavmoda() + return } if(positiontype==="course_groups"){ this.props.updataleftNavfun(); this.props.history.push(`/classrooms/${coursesId}/course_groups/${result.data.group_id}`); + return } } @@ -863,6 +893,10 @@ class Coursesleftnav extends Component{ {/*公告栏*/} {/*作业*/} {item.type==="shixun_homework"?<div onClick={e=>this.Navmodalnames(e,1,"shixun_homework",item.id)}>新建目录</div>:""} + {/* 普通作业 */} + {item.type==="common_homework"?<div onClick={e=>this.Navmodalnames(e,1,"common_homeworks",item.id)}>新建目录</div>:""} + {/*/!* 分组作业 *!/*/} + {item.type==="group_homework"?<div onClick={e=>this.Navmodalnames(e,1,"group_homeworks",item.id)}>新建目录</div>:""} {/*资源*/} {item.type==="attachment"?<div onClick={e=>this.Navmodalnames(e,1,"attachment",item.id)}>新建目录</div>:""} {/* 视频 */} @@ -893,8 +927,8 @@ class Coursesleftnav extends Component{ let {twosandiantypes,twosandiantypenum}=this.state; return (item.type==="graduation"?"": <div className={item.type===twosandiantypes&&twosandiantypenum===index?"sandianboxs":"sandianboxs"} > {/*作业/资源*/} - {item.type==="shixun_homework"||item.type==="attachment"||item.type==="graduation"?<div onClick={e=>this.Navmodalnames(e,4,"editSecondname",iem.category_id,iem.category_name)}>重命名</div>:""} - {item.type==="shixun_homework"||item.type==="attachment"?<div onClick={e=>this.deleteSecondary(e,1,iem.category_id)}>删除</div>:""} + {item.type==="shixun_homework"||item.type==="attachment"||item.type==="graduation"||item.type==="common_homework"||item.type==="group_homework"?<div onClick={e=>this.Navmodalnames(e,4,"editSecondname",iem.category_id,iem.category_name)}>重命名</div>:""} + {item.type==="shixun_homework"||item.type==="attachment"||item.type==="common_homework"||item.type==="group_homework"?<div onClick={e=>this.deleteSecondary(e,1,iem.category_id)}>删除</div>:""} {/*分班*/} {item.type==="course_group"?<div onClick={e=>this.Navmodalnames(e,5,"editSecondname",iem.category_id,iem.category_name)}>重命名</div>:""} {item.type==="course_group"?<div onClick={e=>this.deleteSecondary(e,2,iem.category_id)}>删除</div>:""} diff --git a/public/react/src/modules/user/usersInfo/banks/NewGtaskForm.js b/public/react/src/modules/user/usersInfo/banks/NewGtaskForm.js index 0e60ddcc5..1394ac2f9 100644 --- a/public/react/src/modules/user/usersInfo/banks/NewGtaskForm.js +++ b/public/react/src/modules/user/usersInfo/banks/NewGtaskForm.js @@ -110,11 +110,11 @@ class NewGtaskForms extends Component { } handleSubmit = () => { - - let { contentFileList, min_num, max_num, base_on_project } = this.state; - let { data } = this.props; - let task_type = data.task_type - let topicId = this.props.topicId + console.log(this.props) + let {contentFileList,min_num,max_num,base_on_project}=this.state; + let {data}=this.props; + let task_type=data.task_type + let topicId=this.props.topicId let attachment_ids = contentFileList.map(item => { return item.response ? item.response.id : item.id })