diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index c1ae69cc1..d364f7ada 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -275,18 +275,19 @@ class Fileslistitem extends Component{ ` } - {discussMessage.course_groups.length===0?"": -

- {discussMessage.course_groups.map((item,key)=>{ - return( -

- {item.course_group_name} - 将发布于 { moment(item.course_group_publish_time).format('YYYY-MM-DD HH:mm')} -
- ) - })} - -

} + {/*资源分班*/} + {/*{discussMessage.course_groups.length===0?"":*/} + {/*

*/} + {/*{discussMessage.course_groups.map((item,key)=>{*/} + {/*return(*/} + {/*

*/} + {/*{item.course_group_name}*/} + {/*将发布于 { moment(item.course_group_publish_time).format('YYYY-MM-DD HH:mm')}*/} + {/*
*/} + {/*)*/} + {/*})}*/} + + {/*

}*/}

diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js index a9aa79f53..03627a59f 100644 --- a/public/react/src/modules/courses/Resource/index.js +++ b/public/react/src/modules/courses/Resource/index.js @@ -181,23 +181,27 @@ class Fileslists extends Component{ course_second_category_id:id } }).then((result)=>{ - // console.log(result) - - if(result.status===200){ - if(result.data.status===0){ - let list=result.data.data; - this.setState({ - total_count:list.total_count, - publish_count:list.publish_count, - unpublish_count:list.unpublish_count, - files:list.files, - filesId:list.id, - name:list.name, - course_is_public:result.data.data.course_is_public, - isSpin:false - }) - } - } + if(result!=undefined){ + if(result.status===200){ + if(result.data.status===0){ + let list=result.data.data; + this.setState({ + total_count:list.total_count, + publish_count:list.publish_count, + unpublish_count:list.unpublish_count, + files:list.files, + filesId:list.id, + name:list.name, + course_is_public:result.data.data.course_is_public, + isSpin:false + }) + } + } + }else{ + this.setState({ + isSpin:false + }) + } }).catch((error)=>{ console.log(error) this.setState({ diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index 0168d3e27..8cd56e413 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -400,11 +400,13 @@ class CoursesBanner extends Component { if(sum===1){ let url =`/courses/${id}/switch_to_student.json`; axios.post(url).then((response) => { - if(response.data.status===0){ - // window.location.href = "/users/" + this.props.current_user.login; - // this.props.history.replace(newurl); - window.location.href=newurl - } + if(response!=undefined){ + if(response.data.status===0){ + // window.location.href = "/users/" + this.props.current_user.login; + // this.props.history.replace(newurl); + window.location.href=newurl + } + } }) } @@ -412,11 +414,13 @@ class CoursesBanner extends Component { if(sum===2){ let url =`/courses/${id}/switch_to_teacher.json`; axios.post(url).then((response) => { - if(response.data.status===0){ - // window.location.href = "/users/" + this.props.current_user.login; - // this.props.history.replace(newurl); - window.location.href=newurl - } + if(response!=undefined){ + if(response.data.status===0){ + // window.location.href = "/users/" + this.props.current_user.login; + // this.props.history.replace(newurl); + window.location.href=newurl + } + } }) } diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js index 489f01447..fff535c51 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js @@ -238,6 +238,37 @@ class Coursesleftnav extends Component{ this.props.updataleftNavfun() } + componentDidUpdate=(prevProps)=>{ + if(prevProps!=this.props){ + let courstype=this.props.match.url; + courstype = courstype.split('/'); + courstype=courstype[3]; + const query =this.props.location.search; + let category_id; + if(courstype==="board"){ + category_id=parseInt(this.props.match.params.boardId); + }else{ + category_id=parseInt(this.props.match.params.category_id); + } + if(query===""){ + this.setState({ + positiontype:courstype, + }) + }else{ + if(isNaN(category_id)){ + this.setState({ + positiontype:courstype, + }) + }else{ + this.setState({ + positiontype:courstype, + }) + } + + } + } + } + setnavid=(e,key,id,type,url)=>{ // this.props.getleftNavid && this.props.getleftNavid(key,type); // let {selectnavid,navid}=this.state; @@ -493,7 +524,8 @@ class Coursesleftnav extends Component{ navidtype=true } - saveNavmodapost=(url,value)=>{ + saveNavmodapost=(url,value,positiontype,coursesId)=>{ + axios.post(url, {name:value}).then((result)=>{ if(result.data.status===0){ @@ -505,6 +537,10 @@ class Coursesleftnav extends Component{ description:result.data.message }); trigger('updateNavSuccess') + if(positiontype==="files"){ + window.location.href=`/courses/${coursesId}/file/${result.data.category_id}`; + // this.props.history.push(`/courses/${coursesId}/file/${result.data.category_id}`) + } } }).catch((error)=>{ console.log(error) @@ -556,9 +592,8 @@ class Coursesleftnav extends Component{ } if(Navmodaltypename===1){ - let url="/course_modules/"+id+"/add_second_category.json" - this.saveNavmodapost(url,NavmodalValue) + this.saveNavmodapost(url,NavmodalValue,this.state.positiontype,this.props.match.params.coursesId) } else if(Navmodaltypename===2){ diff --git a/public/react/src/modules/courses/shixunHomework/CommitSummary.js b/public/react/src/modules/courses/shixunHomework/CommitSummary.js index 129e020e9..5d48f11d9 100644 --- a/public/react/src/modules/courses/shixunHomework/CommitSummary.js +++ b/public/react/src/modules/courses/shixunHomework/CommitSummary.js @@ -121,6 +121,7 @@ class CommitSummary extends Component{ const {getFieldDecorator} = this.props.form; let {contents,data}=this.state; // console.log(this.props); + document.title=data === undefined ? "" :data.course_name===undefined?"": data.course_name; return (

diff --git a/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js b/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js index 32dd3a4ee..0983e0fa6 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js @@ -182,6 +182,7 @@ class ShixunHomeworkPage extends Component { const isAdmin = this.props.isAdmin(); // console.log(119) // console.log(jobsettingsdatapage); + document.title=jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.course_name; return (
{ - this.setState({ - isSpin:false, - datas:result.data, - }) + if(result!=undefined){ + this.setState({ + isSpin:false, + datas:result.data, + }) + }else{ + this.setState({ + isSpin:false, + }) + } }).catch((error)=>{ console.log(error); }) @@ -188,19 +194,18 @@ class ShixunHomework extends Component{ category: category_id===undefined?undefined:category_id } }).then((result)=>{ - if(result.status===200){ - // if(checkedtype===true&&page>1){ - // for(var value of result.data.homeworks){ - // checkBoxValues.push(value.homework_id) - // } - // } - this.setState({ - datas:result.data, - isSpin:false - }) - - - } + if(result!=undefined){ + if(result.status===200){ + this.setState({ + datas:result.data, + isSpin:false + }) + } + }else{ + this.setState({ + isSpin:false + }) + } }).catch((error)=>{ console.log(error); })