diff --git a/public/react/src/modules/courses/coursesPublic/PathModal.js b/public/react/src/modules/courses/coursesPublic/PathModal.js index fc6747e08..824c50c78 100644 --- a/public/react/src/modules/courses/coursesPublic/PathModal.js +++ b/public/react/src/modules/courses/coursesPublic/PathModal.js @@ -11,7 +11,10 @@ class PathModal extends Component{ Searchvalue:undefined, type:'all', page:1, - patheditarry:undefined + patheditarry:undefined, + newshixunmodallist:undefined, + hometypepvisible: false, + shixunmodallist:undefined, } } @@ -19,14 +22,78 @@ class PathModal extends Component{ this.props.hidecouseShixunModal() } + componentDidMount(){ + this.setState({ + hometypepvisible: true, + patheditarry: [], + checkBoxValues: [], + + }) + + let coursesId = this.props.match.params.coursesId; + let url = "/courses/" + coursesId + "/homework_commons/subjects.json"; + + axios.get(url).then((result) => { + if (result.status === 200) { + this.setState({ + shixunpath: true, + shixunmodallist: result.data, + hometypepvisible: false, + newshixunmodallist: result.data.subject_list, + }) + } + }).catch((error) => { + console.log(error); + }) + } + funshixunpathlist=(search,type,loading,page)=>{ + let{newshixunmodallist}=this.state; + let newshixunmodallists=[] + if(page>1){ + newshixunmodallists=newshixunmodallist; + } + this.setState({ + hometypepvisible:loading + }) + let coursesId=this.props.match.params.coursesId; + let url ="/courses/"+coursesId+"/homework_commons/subjects.json"; + + axios.get(url, { + params: { + search: search, + type:type, + page:page + } + }).then((result)=>{ + if(result.status===200){ + + let shixun_list=result.data.subject_list; + + for(var i=0; i{ + console.log(error); + }) + } + //tag changeTag=(types)=>{ let {Searchvalue}=this.state; this.setState({ type:types, page:1, + newshixunmodallist:undefined }) - this.props.funshixunpathlist(Searchvalue,types,true,1) + this.funshixunpathlist(Searchvalue,types,true,1) } //搜索 @@ -40,7 +107,7 @@ class PathModal extends Component{ this.setState({ page:1, }) - this.props.funshixunpathlist(value,type,true,1) + this.funshixunpathlist(value,type,true,1) } @@ -59,7 +126,7 @@ class PathModal extends Component{ let {Searchvalue,type,page,shixunpathlist}=this.state; let newpage=page+1 - this.props.funshixunpathlist(Searchvalue,type,true,newpage) + this.funshixunpathlist(Searchvalue,type,true,newpage) this.setState({ page:newpage }) @@ -69,19 +136,24 @@ class PathModal extends Component{ } //提交 savecouseShixunModal=()=>{ + this.setState({ + hometypepvisible:true + }) let {patheditarry}=this.state; - let {coursesId,Coursename,page,order,category_id,datas}=this.props; + let {coursesId}=this.props; let url="/courses/"+coursesId+"/homework_commons/create_subject_homework.json"; if(patheditarry===undefined){ this.setState({ patheditarrytype:true, - patheditarryvalue:"请先选择实践课程" + patheditarryvalue:"请先选择实践课程", + hometypepvisible:false }) return }else if(patheditarry.length===0){ this.setState({ patheditarrytype:true, - patheditarryvalue:"请先选择实践课程" + patheditarryvalue:"请先选择实践课程", + hometypepvisible:false }) return } @@ -114,14 +186,16 @@ class PathModal extends Component{ // this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) // } - + this.setState({ + hometypepvisible:false + }) }).catch((error) => { console.log(error) }) } render(){ - let {Searchvalue,type,Modalstype}=this.state; - let {visible,shixunmodallist,hometypepvisible,newshixunmodallist}=this.props; + let {Searchvalue,type,Modalstype,newshixunmodallist,hometypepvisible,shixunmodallist}=this.state; + let {visible}=this.props; const antIcon = ; return( @@ -164,7 +238,7 @@ class PathModal extends Component{ {shixunmodallist === undefined ? "":shixunmodallist.subjects_count} - 个实训 + 个实践课程
{ + newshixunmodallist&&newshixunmodallist.map((item,key)=>{ return(
@@ -236,4 +311,4 @@ class PathModal extends Component{ ) } } -export default PathModal; \ No newline at end of file +export default PathModal; diff --git a/public/react/src/modules/courses/coursesPublic/ShixunModal.js b/public/react/src/modules/courses/coursesPublic/ShixunModal.js index 2d43439c4..4046a58a4 100644 --- a/public/react/src/modules/courses/coursesPublic/ShixunModal.js +++ b/public/react/src/modules/courses/coursesPublic/ShixunModal.js @@ -6,6 +6,7 @@ import axios from'axios'; const Option = Select.Option; const Search = Input.Search; + class ShixunModal extends Component{ constructor(props){ super(props); @@ -13,13 +14,69 @@ class ShixunModal extends Component{ Searchvalue:undefined, type:'all', category_id:0, - page:1 + page:1, + shixunmodallist:undefined, + hometypepvisible:false, + newshixunmodallist:undefined, } } componentDidMount() { - - + this.setState({ + hometypepvisible:true, + }) + let coursesId=this.props.match.params.coursesId; + let url ="/courses/"+coursesId+"/homework_commons/shixuns.json"; + + axios.get(url).then((result)=>{ + if(result.status===200){ + this.setState({ + shixunmodallist:result.data, + hometypepvisible:false, + newshixunmodallist:result.data.shixun_list, + }) + } + }).catch((error)=>{ + console.log(error); + }) } + setupdatalist=(search,type,loading,page)=>{ + let{newshixunmodallist}=this.state; + let newshixunmodallists=[] + if(page>1){ + newshixunmodallists=newshixunmodallist; + } + this.setState({ + hometypepvisible:loading + }) + let coursesId=this.props.match.params.coursesId; + let url ="/courses/"+coursesId+"/homework_commons/shixuns.json"; + + axios.get(url, { + params: { + search: search, + type:type, + page:page + } + }).then((result)=>{ + if(result.status===200){ + + let shixun_list=result.data.shixun_list; + for(var i=0; i{ + console.log(error); + }) + } //勾选实训 shixunhomeworkedit=(list)=>{ @@ -43,16 +100,13 @@ class ShixunModal extends Component{ contentViewScrolledit=(e)=>{ //滑动到底判断 - if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){ - - let {Searchvalue,type,page}=this.state; - let newpage=page+1 - this.props.funshixunmodallist(Searchvalue,type,true,newpage) - this.setState({ - page:newpage - }) - + let {Searchvalue,type,page}=this.state; + let newpage=page+1 + this.setupdatalist(Searchvalue,type,true,newpage) + this.setState({ + page:newpage + }) } } @@ -69,7 +123,7 @@ class ShixunModal extends Component{ page:1, }) - this.props.funshixunmodallist(value,type,true,1) + this.setupdatalist(value,type,true,1) this.props.funpatheditarry([]) } @@ -79,9 +133,10 @@ class ShixunModal extends Component{ this.setState({ type:types, page:1, + newshixunmodallist:undefined }) - this.props.funshixunmodallist(Searchvalue,types,true,1) + this.setupdatalist(Searchvalue,types,true,1) this.props.funpatheditarry([]) } @@ -91,17 +146,24 @@ class ShixunModal extends Component{ } savecouseShixunModal=()=>{ + this.setState({ + hometypepvisible:true + }) let {coursesId,patheditarry,datas}=this.props; let{category_id}=this.state; if (this.props.chooseShixun) { this.props.chooseShixun(patheditarry) + this.setState({ + hometypepvisible:false + }) return; } if(patheditarry.length===0){ this.setState({ shixunmodelchke:true, - chekicmessage:"请先选择实训" + chekicmessage:"请先选择实训", + hometypepvisible:false }) return @@ -119,7 +181,9 @@ class ShixunModal extends Component{ this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) this.props.hidecouseShixunModal() } - + this.setState({ + hometypepvisible:false + }) // category_id: 3 // homework_ids: (5) [9171, 9172, 9173, 9174, 9175] }).catch((error) => { @@ -133,8 +197,8 @@ class ShixunModal extends Component{ }) } render(){ - let {Searchvalue,type,category_id}=this.state; - let {visible,shixunmodallist,hometypepvisible,newshixunmodallist,patheditarry}=this.props; + let {Searchvalue,type,hometypepvisible,shixunmodallist,newshixunmodallist,}=this.state; + let {visible,patheditarry}=this.props; const antIcon = ; // console.log(patheditarry) return( @@ -205,7 +269,7 @@ class ShixunModal extends Component{ ` } -
+
  • this.changeTag("all")} className={ type==="all" ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>全部 @@ -277,6 +341,9 @@ class ShixunModal extends Component{ width: 11%; box-sizing: border-box; } + .pl12{ + padding-left: 12px; + } ` } @@ -298,7 +365,7 @@ class ShixunModal extends Component{
  • {item.school}
  • {item.myshixuns_count}
  • -
  • {item.level}
  • +
  • {item.level}
  • 详情
  • diff --git a/public/react/src/modules/courses/shixunHomework/shixunHomework.js b/public/react/src/modules/courses/shixunHomework/shixunHomework.js index 42f5fbf6a..1913b0d2d 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunHomework.js +++ b/public/react/src/modules/courses/shixunHomework/shixunHomework.js @@ -454,20 +454,6 @@ class ShixunHomework extends Component{ checkBoxValues:[] }) - let coursesId=this.props.match.params.coursesId; - let url ="/courses/"+coursesId+"/homework_commons/shixuns.json"; - - axios.get(url).then((result)=>{ - if(result.status===200){ - this.setState({ - shixunmodallist:result.data, - hometypepvisible:false, - newshixunmodallist:result.data.shixun_list, - }) - } - }).catch((error)=>{ - console.log(error); - }) } @@ -477,24 +463,10 @@ class ShixunHomework extends Component{ this.setState({ hometypepvisible:true, patheditarry:[], - checkBoxValues:[] + checkBoxValues:[], + shixunpath: true, }) - let coursesId=this.props.match.params.coursesId; - let url ="/courses/"+coursesId+"/homework_commons/subjects.json"; - - axios.get(url).then((result)=>{ - if(result.status===200){ - this.setState({ - shixunpath:true, - shixunpathlist:result.data, - hometypepvisible:false, - newshixunpathlist:result.data.subject_list, - }) - } - }).catch((error)=>{ - console.log(error); - }) } @@ -508,116 +480,80 @@ class ShixunHomework extends Component{ }) } - funshixunmodallist=(search,type,loading,page)=>{ - let{newshixunmodallist}=this.state; - let newshixunmodallists=[] - if(page>1){ - newshixunmodallists=newshixunmodallist; - } - this.setState({ - hometypepvisible:loading - }) - let coursesId=this.props.match.params.coursesId; - let url ="/courses/"+coursesId+"/homework_commons/shixuns.json"; - - axios.get(url, { - params: { - search: search, - type:type, - page:page - } - }).then((result)=>{ - if(result.status===200){ - - let shixun_list=result.data.shixun_list; - for(var i=0; i{ - console.log(error); - }) - } - - funshixunpathlist=(search,type,loading,page)=>{ - let{newshixunpathlist}=this.state; - let newshixunmodallists=[] - if(page>1){ - newshixunmodallists=newshixunpathlist; - } - this.setState({ - hometypepvisible:loading - }) - let coursesId=this.props.match.params.coursesId; - let url ="/courses/"+coursesId+"/homework_commons/subjects.json"; - - axios.get(url, { - params: { - search: search, - type:type, - page:page - } - }).then((result)=>{ - if(result.status===200){ - - let shixun_list=result.data.subject_list; - for(var i=0; i{ - console.log(error); - }) - } - - funshixunpathlist=(search,type,loading,page)=>{ - let{newshixunpathlist}=this.state; - let newshixunmodallists=[] - if(page>1){ - newshixunmodallists=newshixunpathlist; - } - this.setState({ - hometypepvisible:loading - }) - let coursesId=this.props.match.params.coursesId; - let url ="/courses/"+coursesId+"/homework_commons/subjects.json"; + // funshixunmodallist=(search,type,loading,page)=>{ + // let{newshixunmodallist}=this.state; + // let newshixunmodallists=[] + // if(page>1){ + // newshixunmodallists=newshixunmodallist; + // } + // this.setState({ + // hometypepvisible:loading + // }) + // let coursesId=this.props.match.params.coursesId; + // let url ="/courses/"+coursesId+"/homework_commons/shixuns.json"; + // + // axios.get(url, { + // params: { + // search: search, + // type:type, + // page:page + // } + // }).then((result)=>{ + // if(result.status===200){ + // + // let shixun_list=result.data.shixun_list; + // for(var i=0; i{ + // console.log(error); + // }) + // } - axios.get(url, { - params: { - search: search, - type:type, - page:page - } - }).then((result)=>{ - if(result.status===200){ - let shixun_list=result.data.subject_list; - for(var i=0; i{ - console.log(error); - }) - } + // funshixunpathlist=(search,type,loading,page)=>{ + // let{newshixunpathlist}=this.state; + // let newshixunmodallists=[] + // if(page>1){ + // newshixunmodallists=newshixunpathlist; + // } + // this.setState({ + // hometypepvisible:loading + // }) + // let coursesId=this.props.match.params.coursesId; + // let url ="/courses/"+coursesId+"/homework_commons/subjects.json"; + // + // axios.get(url, { + // params: { + // search: search, + // type:type, + // page:page + // } + // }).then((result)=>{ + // if(result.status===200){ + // + // let shixun_list=result.data.subject_list; + // for(var i=0; i{ + // console.log(error); + // }) + // } PaginationCourse=(pageNumber)=>{ let {Coursename,order}=this.state; @@ -1012,13 +948,16 @@ class ShixunHomework extends Component{ course_groups={course_groups} getcourse_groupslist={(id)=>this.getcourse_groupslist(id)} />:""} + {/*选择实训*/} {shixunmodal===true?this.funshixunmodallist(search,type,loading,page)} + // funshixunmodallist={(search,type,loading,page)=>this.funshixunmodallist(search,type,loading,page)} hometypepvisible={hometypepvisible} hidecouseShixunModal={this.hidecouseShixunModal} newshixunmodallist={newshixunmodallist} @@ -1027,6 +966,7 @@ class ShixunHomework extends Component{ funpatheditarry={(patheditarry)=>this.funpatheditarry(patheditarry)} patheditarry={patheditarry} />:""} + {shixunmodal===true||shixunpath===true?:""} {/*选择实训路径*/} {shixunpath===true? this.funshixunpathlist(search,type,loading,page)} + // funshixunpathlist={(search,type,loading,page)=>this.funshixunpathlist(search,type,loading,page)} hometypepvisible={hometypepvisible} hidecouseShixunModal={this.hidecouseShixunModal} coursesId={this.props.match.params.coursesId}