diff --git a/public/react/src/modules/courses/busyWork/NewWork.js b/public/react/src/modules/courses/busyWork/NewWork.js
index 1bd79d93e..4bee890d8 100644
--- a/public/react/src/modules/courses/busyWork/NewWork.js
+++ b/public/react/src/modules/courses/busyWork/NewWork.js
@@ -35,7 +35,7 @@ class NewWork extends Component{
}
fetchCourseData = (courseId) => {
let newcategory=undefined;
- if(this.props.match.path==="/classrooms/:coursesId/common_homework/:workId/:pageType"){
+ if(this.props.match.path==="/classrooms/:coursesId/common_homework/:workId/:pageType"||this.props.match.path==="/classrooms/:coursesId/group_homework/:workId/:pageType"){
newcategory=this.props.match.params.workId
}
const isGroup = this.props.isGroup()
@@ -64,7 +64,7 @@ class NewWork extends Component{
}
fetchWork = (workId) => {
let newcategory=undefined;
- if(this.props.match.path==="/classrooms/:coursesId/common_homework/:workId/:pageType"){
+ if(this.props.match.path==="/classrooms/:coursesId/common_homework/:workId/:pageType"||this.props.match.path==="/classrooms/:coursesId/group_homework/:workId/:pageType"){
newcategory=this.props.match.params.workId
}
let url=""
@@ -115,7 +115,7 @@ 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"){
+ if(this.props.match.path==="/classrooms/:coursesId/common_homework/:workId/:pageType"||this.props.match.path==="/classrooms/:coursesId/group_homework/:workId/:pageType"){
params.category=this.props.match.params.workId
}
diff --git a/public/react/src/modules/courses/busyWork/common.js b/public/react/src/modules/courses/busyWork/common.js
index b413f2c53..f738af2b4 100644
--- a/public/react/src/modules/courses/busyWork/common.js
+++ b/public/react/src/modules/courses/busyWork/common.js
@@ -31,7 +31,7 @@ export function RouteHOC(options = {}) {
// common_homework group_homework
// 是否是分组作业
isGroup = () => {
- return window.location.pathname.indexOf('group_homeworks') != -1
+ return window.location.pathname.indexOf('group_homeworks') != -1||window.location.pathname.indexOf('group_homework') != -1
}
getModuleName = (isChinese) => {
const isGroup = this.isGroup()
@@ -45,6 +45,12 @@ export function RouteHOC(options = {}) {
return secondName;
}
+
+ if(window.location.pathname.indexOf('group_homework') != -1){
+ const secondName ='group_homework';
+ return secondName;
+ }
+
if(window.location.pathname.indexOf('common_homeworks') != -1){
const secondName ='common_homeworks';
return secondName;
diff --git a/public/react/src/modules/courses/busyWork/commonWork.js b/public/react/src/modules/courses/busyWork/commonWork.js
index d4b097cec..6a7e3c878 100644
--- a/public/react/src/modules/courses/busyWork/commonWork.js
+++ b/public/react/src/modules/courses/busyWork/commonWork.js
@@ -35,7 +35,8 @@ class commonWork extends Component{
checkAll:false,
checkBoxValues:[],
isSpin:false,
- category_id:undefined
+ category_id:undefined,
+ course_module:[]
}
}
//输入搜索条件
@@ -70,42 +71,34 @@ class commonWork extends Component{
}
componentDidUpdate(prevProps, prevState) {
- 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") {
+ if (prevProps.coursesidtype != this.props.coursesidtype||prevProps.match.params.category_id!=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"||
+ this.props.match.path === "/classrooms/:coursesId/group_homeworks/:category_id" || this.props.match.path === "/classrooms/:coursesId/group_homework/:category_id"
+ ) {
+
+ if (this.props.coursesidtype === "node" && this.props.match.path === "/classrooms/:coursesId/common_homeworks/:category_id"||
+ this.props.coursesidtype === "node" && this.props.match.path === "/classrooms/:coursesId/group_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") {
+
+ if (this.props.coursesidtype === "child" && this.props.match.path === "/classrooms/:coursesId/common_homework/:category_id"||
+ this.props.coursesidtype === "child" && this.props.match.path === "/classrooms/:coursesId/group_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)
- // })
- // }
- //
- // }
}
@@ -118,22 +111,24 @@ class commonWork extends Component{
this.getList(page,search,order,id);
}
componentDidMount(){
- if(this.props.coursesidtype==="node"){
+
+ if(this.props.match.path === "/classrooms/:coursesId/common_homeworks/:category_id"||this.props.match.path === "/classrooms/:coursesId/group_homeworks/:category_id"){
this._getList()
- }else{
+ }
+ if(this.props.match.path === "/classrooms/:coursesId/common_homework/:category_id"||this.props.match.path === "/classrooms/:coursesId/group_homework/:category_id") {
this._getList(this.props.match.params.category_id)
}
-
on('updateNavSuccess', this.updateNavSuccess)
}
componentWillUnmount() {
off('updateNavSuccess', this.updateNavSuccess)
}
updateNavSuccess = () => {
- if(this.props.coursesidtype==="node"){
+ if(this.props.match.path === "/classrooms/:coursesId/common_homeworks/:category_id"||this.props.match.path === "/classrooms/:coursesId/group_homeworks/:category_id"){
this._getList()
- }else{
+ }
+ if(this.props.match.path === "/classrooms/:coursesId/common_homework/:category_id"||this.props.match.path === "/classrooms/:coursesId/group_homework/:category_id") {
this._getList(this.props.match.params.category_id)
}
}
@@ -151,7 +146,6 @@ class commonWork extends Component{
}
getList=(page,search,order,category_id)=>{
- console.log(category_id)
this.setState({
isSpin:true
@@ -177,6 +171,32 @@ class commonWork extends Component{
page:page,
...result.data
})
+ this.getdatas(result.data.main_category_id)
+ }
+ }).catch((error)=>{
+ this.setState({
+ isSpin:false
+ })
+ })
+ }
+ getdatas=(main_category_id)=>{
+ let newcourse_module=[]
+
+ let urls=`/course_modules/${main_category_id}.json`
+ axios.get(encodeURI(urls)).then((result)=>{
+ if(result.status==200){
+
+ newcourse_module.push({name:result.data.course_module.module_name,id:result.data.course_module.id})
+ if(result.data.course_module.course_second_categories.length>0){
+
+ result.data.course_module.course_second_categories.map((item,key)=>{
+ newcourse_module.push(item)
+ })
+ }
+
+ this.setState({
+ course_module:newcourse_module
+ })
}
}).catch((error)=>{
this.setState({
@@ -279,7 +299,7 @@ class commonWork extends Component{
}
//
onSetPublic = () => {
- const { checkBoxValues } = this.state;
+ const { checkBoxValues,category_id } = this.state;
const len = checkBoxValues.length;
if (len == 0) {
this.props.showNotification('请先选择要公开的作业')
@@ -374,11 +394,41 @@ class commonWork extends Component{
if(!id){
trigger('addcommon_homeworks', parseInt(this.props.match.params.category_id))
}else{
- let data={id:parseInt(id),name:name}
+ let data={id:parseInt(id),name:this.state.category_name}
trigger('editcommon_homeworks', data)
}
}
+ moveTo = (item) => {
+ const len = this.state.checkBoxValues.length
+ if (len == 0) {
+ this.props.showNotification('请先在列表中选择要移动的作业')
+ return;
+ }
+ const checkBoxValues = this.state.checkBoxValues;
+ const coursesId= this.props.match.params.coursesId;
+ const category_id=this.state.category_id;
+ const url = `/courses/${coursesId}/homework_commons/move_to_category.json`
+ axios.post(url, {
+ homework_ids: checkBoxValues,
+ new_category_id: item.id,
+ category_id:!category_id?undefined:category_id
+ })
+ .then((response) => {
+ if (response.data.status == 0) {
+ console.log('--- 成功')
+ this.props.showNotification('作业移动成功')
+ this.props.updataleftNavfun()
+ this.setState({
+ checkBoxValues:[]
+ })
+ this.updateNavSuccess()
+ }
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
+ }
render(){
let {
@@ -391,7 +441,7 @@ class commonWork extends Component{
totalCount,
checkAll,
checkBoxValues,
-
+ course_module,
task_count,
published_count,
unpublished_count,
@@ -409,9 +459,8 @@ class commonWork extends Component{
const isGroup = this.props.isGroup()
const isAdmin = this.props.isAdmin()
+ const bid = this.props.match.params.category_id
- //
+ {this.setState({dirSearchValue: e.target.value})}}/> +
} + { + course_module && course_module.filter((item)=> { + return item.id != bid && (!this.state.dirSearchValue || item.name.indexOf(this.state.dirSearchValue) != -1) + }).map( (item, index) => { + return