普通作业、分组作业增加二级目录

dev_aliyun2
杨树明 5 years ago committed by harry
parent 225fb9f13c
commit 0ce17259f9

@ -726,12 +726,24 @@ class CoursesIndex extends Component {
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>) (props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
} }
></Route> ></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 <Route path="/classrooms/:coursesId/group_homeworks/:category_id" exact
render={ render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>) (props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
} }
></Route> ></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 <Route path="/classrooms/:coursesId/common_homeworks/" strict
@ -739,6 +751,12 @@ class CoursesIndex extends Component {
(props) => (<CommonWork {...this.props} {...props} {...this.state} {...common}/>) (props) => (<CommonWork {...this.props} {...props} {...this.state} {...common}/>)
} }
></Route> ></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 <Route path="/classrooms/:coursesId/group_homeworks/" strict
@ -747,7 +765,15 @@ class CoursesIndex extends Component {
} }
></Route> ></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" <Route path="/classrooms/:coursesId/polls/:pollId/users/:login"
render={ render={
(props) => (<PollInfo {...this.props} {...props} {...this.state} {...common}/>) (props) => (<PollInfo {...this.props} {...props} {...this.state} {...common}/>)

@ -230,6 +230,12 @@ class ListPageIndex extends Component {
(props) => (<CommonWork {...this.props} {...props} {...this.state} />) (props) => (<CommonWork {...this.props} {...props} {...this.state} />)
} }
></Route> ></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" <Route path="/classrooms/:coursesId/group_homeworks/:category_id"
@ -237,6 +243,12 @@ class ListPageIndex extends Component {
(props) => (<CommonWork {...this.props} {...props} {...this.state} />) (props) => (<CommonWork {...this.props} {...props} {...this.state} />)
} }
></Route> ></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" <Route exact path="/classrooms/:coursesId/boards/:boardId"
render={ render={

@ -179,7 +179,9 @@ class CommonWorkDetailIndex extends Component {
} }
let exportUrl = `/homework_commons/${workId}/works_list.zip?${queryString.stringify(params)}` let exportUrl = `/homework_commons/${workId}/works_list.zip?${queryString.stringify(params)}`
let exportResultUrl = `/homework_commons/${workId}/works_list.xlsx?${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 ( return (
<div> <div>
<PublishRightnow showActionButton={false} {...this.props} checkBoxValues={[workId]} <PublishRightnow showActionButton={false} {...this.props} checkBoxValues={[workId]}
@ -375,6 +377,12 @@ class CommonWorkDetailIndex extends Component {
} }
></Route> ></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" <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/list"
render={ render={
@ -382,17 +390,35 @@ class CommonWorkDetailIndex extends Component {
} }
></Route> ></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" <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/question"
render={ render={
(props) => (<CommonWorkQuestion {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkQuestion {...this.props} {...props} {...this.state} {...commonHandler}/>)
} }
></Route> ></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" <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/answer"
render={ render={
(props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler}/>)
} }
></Route> ></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" <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}/>) (props) => (<CommonWorkSetting {...this.props} {...props} {...this.state} {...commonHandler}/>)
} }
></Route> ></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" <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/list"
render={ render={
(props) => (<CommonWorkList triggerRef={this.bindRef} {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkList triggerRef={this.bindRef} {...this.props} {...props} {...this.state} {...commonHandler}/>)
} }
></Route> ></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" <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/question"
render={ render={
(props) => (<CommonWorkQuestion {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkQuestion {...this.props} {...props} {...this.state} {...commonHandler}/>)
} }
></Route> ></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" <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/answer"
render={ render={
(props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler}/>)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/group_homework/:workId/answer"
render={
(props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler}/>)
}
></Route>
</Switch> </Switch>
</div> </div>
</div> </div>

@ -57,83 +57,141 @@ class CoursesWorkIndex extends Component {
render() { render() {
return ( return (
<div> <div>
<Switch {...this.props}> <Switch {...this.props}>
{/* --------------------------------------------------------------------- */} {/* --------------------------------------------------------------------- */}
{/* 作业设置 */} {/* 作业设置 */}
{/* http://localhost:3007/courses/1309/homework/9300/setting */} {/* http://localhost:3007/classrooms/1309/homework/9300/setting */}
<Route exact path="/courses/:coursesId/common_homeworks/:workId/setting" <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/setting"
render={ render={
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/common_homework/:workId/setting"
{/* 作品列表 */} render={
<Route exact path="/courses/:coursesId/common_homeworks/:workId/list" (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
render={ }
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) ></Route>
}
></Route>
{/* 作业问答 */} {/* 作品列表 */}
<Route exact path="/courses/:coursesId/common_homeworks/:workId/question" <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/list"
render={ render={
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/courses/:coursesId/common_homeworks/:workId/answer" {/* 作品列表 */}
render={ <Route exact path="/classrooms/:coursesId/common_homework/:workId/list"
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) render={
} (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
></Route> }
></Route>
{/* 评阅 */}
<Route exact path="/courses/:coursesId/common_homeworks/:workId/:studentWorkId/appraise" {/* 作业问答 */}
render={ <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/question"
(props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />) render={
} (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
></Route> }
></Route>
{/* 提交作品 */} <Route exact path="/classrooms/:coursesId/common_homework/:workId/question"
<Route exact path="/courses/:coursesId/common_homeworks/:workId/post" render={
render={ (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
(props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) }
} ></Route>
></Route>
<Route exact path="/courses/:coursesId/common_homeworks/:workId/:studentWorkId/post_edit" <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/answer"
render={ render={
(props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/common_homework/:workId/answer"
render={
{/* 新建 */} (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
{/* http://localhost:3007/courses/1309/common_homeworks/9299/edit/1 */} }
<Route exact path="/courses/:coursesId/common_homeworks/:workId/:pageType" ></Route>
render={
(props) => (<NewWork {...this.props} {...props} {...this.state} />)
} {/* 评阅 */}
></Route> <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/:studentWorkId/appraise"
<Route exact path="/courses/:coursesId/common_homeworks/:categroy_id/new" render={
render={ (props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />)
(props) => (<NewWork {...this.props} {...props} {...this.state} />) }
} ></Route>
></Route> <Route exact path="/classrooms/:coursesId/common_homework/:workId/:studentWorkId/appraise"
render={
(props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />)
}
{/* 作业列表 */} ></Route>
<Route path="/courses/:coursesId/common_homeworks"
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />) {/* 提交作品 */}
} <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/post"
></Route> render={
(props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />)
{/* --------------------------------------------------------------------- */} }
></Route>
<Route exact path="/classrooms/:coursesId/common_homework/:workId/post"
render={
</Switch> (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> </div>
) )
} }

@ -58,80 +58,131 @@ class CoursesWorkIndex extends Component {
render() { render() {
return ( return (
<div> <div>
<Switch {...this.props}> <Switch {...this.props}>
{/* --------------------------------------------------------------------- */} {/* --------------------------------------------------------------------- */}
{/* --------------------------------------------------------------------- */} {/* --------------------------------------------------------------------- */}
{/* 作业设置 */} {/* 作业设置 */}
<Route exact path="/courses/:coursesId/group_homeworks/:workId/setting" <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/setting"
render={ render={
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/group_homework/:workId/setting"
{/* 作品列表 */} render={
<Route exact path="/courses/:coursesId/group_homeworks/:workId/list" (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
render={ }
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) ></Route>
}
></Route> {/* 作品列表 */}
<Route exact path="/classrooms/:coursesId/group_homeworks/:workId/list"
{/* 作业问答 */} render={
<Route exact path="/courses/:coursesId/group_homeworks/:workId/question" (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
render={ }
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) ></Route>
} <Route exact path="/classrooms/:coursesId/group_homework/:workId/list"
></Route> render={
{/* 参考答案 */} (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
<Route exact path="/courses/:coursesId/group_homeworks/:workId/answer" }
render={ ></Route>
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
} {/* 作业问答 */}
></Route> <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/question"
{/* 评阅 */} render={
<Route exact path="/courses/:coursesId/group_homeworks/:workId/:studentWorkId/appraise" (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
render={ }
(props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />) ></Route>
} <Route exact path="/classrooms/:coursesId/group_homework/:workId/question"
></Route> render={
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
}
<Route exact path="/courses/:coursesId/group_homeworks/:workId/post" ></Route>
render={ {/* 参考答案 */}
(props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/answer"
} render={
></Route> (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
<Route exact path="/courses/:coursesId/group_homeworks/:workId/:studentWorkId/post_edit" }
render={ ></Route>
(props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) <Route exact path="/classrooms/:coursesId/group_homework/:workId/answer"
} render={
></Route> (props) => (<CommonWorkDetailIndex {...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" <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/:studentWorkId/appraise"
render={ render={
(props) => (<NewWork {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/courses/:coursesId/group_homeworks/:categroy_id/new" <Route exact path="/classrooms/:coursesId/group_homework/:workId/:studentWorkId/appraise"
render={ render={
(props) => (<NewWork {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
{/* 作业列表 */} <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/post"
<Route path="/courses/:coursesId/group_homeworks" render={
render={ (props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />)
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />) }
} ></Route>
></Route>
<Route exact path="/classrooms/:coursesId/group_homework/:workId/post"
render={
</Switch> (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> </div>
) )
} }

@ -29,8 +29,17 @@ class NewWork extends Component {
} }
} }
fetchCourseData = (courseId) => { 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 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, { axios.get(url, {
}) })
.then((response) => { .then((response) => {
@ -49,7 +58,17 @@ class NewWork extends Component {
}); });
} }
fetchWork = (workId) => { 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, { axios.get(url, {
}) })
.then((response) => { .then((response) => {
@ -91,6 +110,9 @@ class NewWork extends Component {
doNew = (params) => { doNew = (params) => {
const coursesId = this.props.match.params.coursesId const coursesId = this.props.match.params.coursesId
const newUrl = `/courses/${coursesId}/homework_commons.json` 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) axios.post(newUrl, params)
.then((response) => { .then((response) => {

@ -132,7 +132,7 @@ class UseBank extends Component{
onSave = () => { onSave = () => {
debugger debugger
const { checkBoxValues } = this.state; const { checkBoxValues } = this.state;
const { object_type } = this.props const { object_type,category_id } = this.props
if(checkBoxValues.length==0){ if(checkBoxValues.length==0){
this.setState({ this.setState({
isChecked:"请先选择"+engNameMap[object_type] isChecked:"请先选择"+engNameMap[object_type]
@ -149,7 +149,8 @@ class UseBank extends Component{
, { , {
"object_type": object_type, "object_type": object_type,
"bank_id": checkBoxValues, "bank_id": checkBoxValues,
"course_id": courseId "course_id": courseId,
"category":category_id
} }
) )
.then((response) => { .then((response) => {

@ -39,8 +39,23 @@ export function RouteHOC(options = {}) {
let chName = isGroup ? '分组作业' : '普通作业' let chName = isGroup ? '分组作业' : '普通作业'
return chName; 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 = () => { getModuleType = () => {
const isGroup = this.isGroup() const isGroup = this.isGroup()

@ -6,7 +6,7 @@ import '../css/busyWork.css'
import CommonWorkItem from './CommonWorkItem' import CommonWorkItem from './CommonWorkItem'
import PublishRightnow from './PublishRightnow' import PublishRightnow from './PublishRightnow'
import ConnectProject from './ConnectProject' import ConnectProject from './ConnectProject'
import { WordsBtn, on, off } from 'educoder' import { WordsBtn, on, off ,trigger} from 'educoder'
import Modals from '../../modals/Modals' import Modals from '../../modals/Modals'
import NoneData from "../coursesPublic/NoneData" import NoneData from "../coursesPublic/NoneData"
import Titlesearchsection from '../common/titleSearch/TitleSearchSection'; import Titlesearchsection from '../common/titleSearch/TitleSearchSection';
@ -34,7 +34,8 @@ class commonWork extends Component{
totalCount:0, totalCount:0,
checkAll:false, checkAll:false,
checkBoxValues:[], checkBoxValues:[],
isSpin:false isSpin:false,
category_id:undefined
} }
} }
//输入搜索条件 //输入搜索条件
@ -45,8 +46,8 @@ class commonWork extends Component{
} }
//搜索查询 //搜索查询
searchStudent=()=>{ searchStudent=()=>{
let {page,search,order}=this.state; let {category_id,search,order}=this.state;
this.getList(1,search,order); this.getList(1,search,order,category_id);
} }
openConnectionProject = (work) => { openConnectionProject = (work) => {
this.refs['connectProject'].openConnectionProject(work) this.refs['connectProject'].openConnectionProject(work)
@ -69,23 +70,60 @@ class commonWork extends Component{
} }
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
if (prevProps.match.path != this.props.match.path) { console.log(this.props)
this.clearSelection() if (prevProps.coursesidtype != this.props.coursesidtype) {
this.setState({ selectedKeys: 'all', order: '' }, () => { if (this.props.match.path === "/classrooms/:coursesId/common_homeworks/:category_id" || this.props.match.path === "/classrooms/:coursesId/common_homework/:category_id") {
this._getList()
}) 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({ this.setState({
isSpin:true isSpin:true,
category_id:id
}) })
let {page,search,order}=this.state; let {page,search,order}=this.state;
this.getList(page,search,order); this.getList(page,search,order,id);
} }
componentDidMount(){ componentDidMount(){
this._getList() if(this.props.coursesidtype==="node"){
this._getList()
}else{
this._getList(this.props.match.params.category_id)
}
on('updateNavSuccess', this.updateNavSuccess) on('updateNavSuccess', this.updateNavSuccess)
} }
@ -93,7 +131,11 @@ class commonWork extends Component{
off('updateNavSuccess', this.updateNavSuccess) off('updateNavSuccess', this.updateNavSuccess)
} }
updateNavSuccess = () => { updateNavSuccess = () => {
this._getList() if(this.props.coursesidtype==="node"){
this._getList()
}else{
this._getList(this.props.match.params.category_id)
}
} }
useBankSuccess = (checkBoxValues, newWorkIdArray) => { useBankSuccess = (checkBoxValues, newWorkIdArray) => {
@ -104,11 +146,13 @@ class commonWork extends Component{
this.refs['publishModalRef'].open() this.refs['publishModalRef'].open()
}) })
let {search, order}=this.state; let {search, order,category_id}=this.state;
this.getList(1, search, order); this.getList(1, search, order,category_id);
} }
getList=(page,search,order)=>{ getList=(page,search,order,category_id)=>{
console.log(category_id)
this.setState({ this.setState({
isSpin:true isSpin:true
}) })
@ -121,6 +165,9 @@ class commonWork extends Component{
if(search!=""){ if(search!=""){
url+="&search="+search; url+="&search="+search;
} }
if(category_id){
url+="&category="+category_id;
}
axios.get(encodeURI(url)).then((result)=>{ axios.get(encodeURI(url)).then((result)=>{
if(result.status==200){ if(result.status==200){
this.setState({ this.setState({
@ -148,8 +195,8 @@ class commonWork extends Component{
checkBoxValues:[], checkBoxValues:[],
checkAll:false checkAll:false
}) })
let {search}=this.state; let {search,category_id}=this.state;
this.getList(1,search,e.key==="all"?"":e.key); this.getList(1,search,e.key==="all"?"":e.key,category_id);
} }
onPageChange=(pageNumber)=>{ onPageChange=(pageNumber)=>{
@ -157,8 +204,8 @@ class commonWork extends Component{
page:pageNumber, page:pageNumber,
checkBoxValues:[] checkBoxValues:[]
}) })
let {search,order}=this.state; let {search,order,category_id}=this.state;
this.getList(pageNumber,search,order); this.getList(pageNumber,search,order,category_id);
} }
// 全选和反选 // 全选和反选
@ -191,7 +238,7 @@ class commonWork extends Component{
} }
onWorkDelete = () => { onWorkDelete = () => {
const { checkBoxValues } = this.state; const { checkBoxValues,category_id} = this.state;
const len = checkBoxValues.length; const len = checkBoxValues.length;
if (len == 0) { if (len == 0) {
this.props.showNotification('请先选择要删除的作业') this.props.showNotification('请先选择要删除的作业')
@ -209,13 +256,14 @@ class commonWork extends Component{
axios.post(url, { axios.post(url, {
homework_ids: checkBoxValues, homework_ids: checkBoxValues,
all_check: 0, all_check: 0,
// category:category_id
// group_ids // group_ids
}).then((response) => { }).then((response) => {
if (response.data.status == 0) { if (response.data.status == 0) {
this.props.showNotification('删除成功') this.props.showNotification('删除成功')
this.clearSelection() this.clearSelection()
let {search,order}=this.state; let {search,order}=this.state;
this.getList(1,search,order); this.getList(1,search,order,category_id);
this.props.updataleftNavfun() this.props.updataleftNavfun()
} }
@ -252,7 +300,7 @@ class commonWork extends Component{
if (response.data.status == 0) { if (response.data.status == 0) {
this.props.showNotification('设为公开操作成功') this.props.showNotification('设为公开操作成功')
let {search,order, page}=this.state; let {search,order, page}=this.state;
this.getList(page,search,order); this.getList(page,search,order,category_id);
} }
}).catch((error) => { }).catch((error) => {
@ -262,8 +310,8 @@ class commonWork extends Component{
}) })
} }
doWhenSuccess = () => { doWhenSuccess = () => {
let {search,order, page}=this.state; let {search,order, page,category_id}=this.state;
this.getList(page,search,order); this.getList(page,search,order,category_id);
this.setState({ this.setState({
checkBoxValues:[] checkBoxValues:[]
}) })
@ -279,7 +327,7 @@ class commonWork extends Component{
this.onChangeSelect(checkBoxValues) this.onChangeSelect(checkBoxValues)
} }
addToBank = () => { addToBank = () => {
const { checkBoxValues } = this.state; const { checkBoxValues,category_id } = this.state;
const len = checkBoxValues.length; const len = checkBoxValues.length;
if (len == 0) { if (len == 0) {
this.props.showNotification('请先选择要加入题库的作业') this.props.showNotification('请先选择要加入题库的作业')
@ -294,7 +342,7 @@ class commonWork extends Component{
if (response.data.status == 0) { if (response.data.status == 0) {
this.props.showNotification('加入成功') this.props.showNotification('加入成功')
let {search,order}=this.state; let {search,order}=this.state;
this.getList(1,search,order); this.getList(1,search,order,category_id);
} }
}).catch((error) => { }).catch((error) => {
@ -302,26 +350,35 @@ class commonWork extends Component{
}) })
} }
connectSuccess = () => { connectSuccess = () => {
let {page,search,order}=this.state; let {page,search,order,category_id}=this.state;
this.getList(page,search,order); this.getList(page,search,order,category_id);
} }
cancelConnectionProject = (work) => { cancelConnectionProject = (work) => {
let workId=this.props.match.params.workId; let workId=this.props.match.params.workId;
let courseId=this.props.match.params.coursesId; 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` const url = `/homework_commons/${work.homework_id}/student_works/cancel_relate_project.json`
axios.get(url).then((response)=> { axios.get(url).then((response)=> {
if (response.data.status == 0) { 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('取消关联成功') this.props.showNotification('取消关联成功')
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(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(){ render(){
let { let {
@ -339,6 +396,8 @@ class commonWork extends Component{
published_count, published_count,
unpublished_count, unpublished_count,
main_category_name, main_category_name,
category_name,
category_id
}=this.state; }=this.state;
const { coursedata } = this.props; const { coursedata } = this.props;
if (!coursedata) { if (!coursedata) {
@ -387,7 +446,7 @@ class commonWork extends Component{
<Titlesearchsection <Titlesearchsection
title={main_category_name} title={!category_id?main_category_name:category_name}
searchValue={ search } searchValue={ search }
// searchtype={this.props.isAdmin||this.props.isStudent ?true:false} // searchtype={this.props.isAdmin||this.props.isStudent ?true:false}
onInputSearchChange={this.inputStudent} onInputSearchChange={this.inputStudent}
@ -399,6 +458,9 @@ class commonWork extends Component{
{ isAdmin && <li className="fr"> { isAdmin && <li className="fr">
<UseBank {...this.props} {...this.state} object_type={isGroup ? "group" : "normal"} useBankSuccess={this.useBankSuccess}></UseBank> <UseBank {...this.props} {...this.state} object_type={isGroup ? "group" : "normal"} useBankSuccess={this.useBankSuccess}></UseBank>
</li> } </li> }
{ isAdmin && <li className="fr mr40">
<WordsBtn style="blue" className="fr" onClick={()=>this.addDir(category_id)}>{!category_id?"新建目录":"目录重命名"}</WordsBtn>
</li> }
</React.Fragment> </React.Fragment>
} }
secondRowBotton={ secondRowBotton={

@ -142,6 +142,8 @@ class Coursesleftnav extends Component{
off('editshixunmainname',this.editshixunmainname) off('editshixunmainname',this.editshixunmainname)
off('videoAdd',this.addVideo) off('videoAdd',this.addVideo)
off('editVideo',this.editVideo) off('editVideo',this.editVideo)
off('addcommon_homeworks',this.addcommon_homeworks)
off('editcommon_homeworks',this.editcommon_homeworks)
} }
addshixunchild=(e, data)=>{ addshixunchild=(e, data)=>{
this.Navmodalnames(e,1,"shixun_homework",data); this.Navmodalnames(e,1,"shixun_homework",data);
@ -149,6 +151,12 @@ class Coursesleftnav extends Component{
editshixunchild=(e, data)=>{ editshixunchild=(e, data)=>{
this.Navmodalnames(e,4,"editSecondname",data.id,data.name); 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)=>{ editshixunmainname=(e, data)=>{
this.Navmodalnames(e,3,"editname",data.id,data.name); this.Navmodalnames(e,3,"editname",data.id,data.name);
} }
@ -196,7 +204,8 @@ class Coursesleftnav extends Component{
on('editshixunmainname',this.editshixunmainname); on('editshixunmainname',this.editshixunmainname);
on('videoAdd',this.addVideo); on('videoAdd',this.addVideo);
on('editVideo',this.editVideo) on('editVideo',this.editVideo)
on('addcommon_homeworks',this.addcommon_homeworks)
on('editcommon_homeworks',this.editcommon_homeworks)
let courstype=this.props.match.url; let courstype=this.props.match.url;
@ -537,7 +546,7 @@ class Coursesleftnav extends Component{
} }
saveNavmodapost=(url,value,positiontype,coursesId,type)=>{ saveNavmodapost=(url,value,positiontype,coursesId,type)=>{
console.log(positiontype)
axios.post(url, axios.post(url,
{name:value}).then((result)=>{ {name:value}).then((result)=>{
if(result!=undefined){ if(result!=undefined){
@ -548,6 +557,23 @@ class Coursesleftnav extends Component{
description:result.data.message 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(positiontype==="shixun_homeworks"||positiontype==="shixun_homework"){
if(type===true){ if(type===true){
this.updasaveNavmoda() this.updasaveNavmoda()
@ -557,6 +583,7 @@ class Coursesleftnav extends Component{
this.props.history.push(`/classrooms/${coursesId}/shixun_homework/${result.data.category_id}`); this.props.history.push(`/classrooms/${coursesId}/shixun_homework/${result.data.category_id}`);
} }
return
} }
if(positiontype==="files"||positiontype==="file"){ if(positiontype==="files"||positiontype==="file"){
@ -569,22 +596,25 @@ class Coursesleftnav extends Component{
this.updasaveNavmoda() this.updasaveNavmoda()
this.props.history.push(`/classrooms/${coursesId}/file/${result.data.category_id}`); this.props.history.push(`/classrooms/${coursesId}/file/${result.data.category_id}`);
} }
return
} }
if(positiontype==="boards"){ if(positiontype==="boards"){
this.updasaveNavmoda() this.updasaveNavmoda()
trigger('updateNavSuccess') trigger('updateNavSuccess')
this.props.history.push(`/classrooms/${coursesId}/boards/${result.data.category_id}`); this.props.history.push(`/classrooms/${coursesId}/boards/${result.data.category_id}`);
return
} }
if(positiontype!="course_groups"&&positiontype!="shixun_homeworks"&&positiontype!="shixun_homework"){ if(positiontype!="course_groups"&&positiontype!="shixun_homeworks"&&positiontype!="shixun_homework"){
this.updasaveNavmoda() this.updasaveNavmoda()
return
} }
if(positiontype==="course_groups"){ if(positiontype==="course_groups"){
this.props.updataleftNavfun(); this.props.updataleftNavfun();
this.props.history.push(`/classrooms/${coursesId}/course_groups/${result.data.group_id}`); 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==="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>:""} {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; let {twosandiantypes,twosandiantypenum}=this.state;
return (item.type==="graduation"?"": <div className={item.type===twosandiantypes&&twosandiantypenum===index?"sandianboxs":"sandianboxs"} > 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"||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"?<div onClick={e=>this.deleteSecondary(e,1,iem.category_id)}>删除</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.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>:""} {item.type==="course_group"?<div onClick={e=>this.deleteSecondary(e,2,iem.category_id)}>删除</div>:""}

@ -110,11 +110,11 @@ class NewGtaskForms extends Component {
} }
handleSubmit = () => { handleSubmit = () => {
console.log(this.props)
let { contentFileList, min_num, max_num, base_on_project } = this.state; let {contentFileList,min_num,max_num,base_on_project}=this.state;
let { data } = this.props; let {data}=this.props;
let task_type = data.task_type let task_type=data.task_type
let topicId = this.props.topicId let topicId=this.props.topicId
let attachment_ids = contentFileList.map(item => { let attachment_ids = contentFileList.map(item => {
return item.response ? item.response.id : item.id return item.response ? item.response.id : item.id
}) })

Loading…
Cancel
Save