hjm 5 years ago
commit 4b2e91d0e8

@ -11,7 +11,10 @@ class PathModal extends Component{
Searchvalue:undefined, Searchvalue:undefined,
type:'all', type:'all',
page:1, page:1,
patheditarry:undefined patheditarry:undefined,
newshixunmodallist:undefined,
hometypepvisible: false,
shixunmodallist:undefined,
} }
} }
@ -19,14 +22,78 @@ class PathModal extends Component{
this.props.hidecouseShixunModal() 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<shixun_list.length;i++){
newshixunmodallists.push(shixun_list[i])
}
this.setState({
shixunpath:true,
shixunmodallist:result.data,
newshixunmodallist:newshixunmodallists,
hometypepvisible:false
})
}
}).catch((error)=>{
console.log(error);
})
}
//tag //tag
changeTag=(types)=>{ changeTag=(types)=>{
let {Searchvalue}=this.state; let {Searchvalue}=this.state;
this.setState({ this.setState({
type:types, type:types,
page:1, 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({ this.setState({
page:1, 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 {Searchvalue,type,page,shixunpathlist}=this.state;
let newpage=page+1 let newpage=page+1
this.props.funshixunpathlist(Searchvalue,type,true,newpage) this.funshixunpathlist(Searchvalue,type,true,newpage)
this.setState({ this.setState({
page:newpage page:newpage
}) })
@ -69,19 +136,24 @@ class PathModal extends Component{
} }
//提交 //提交
savecouseShixunModal=()=>{ savecouseShixunModal=()=>{
this.setState({
hometypepvisible:true
})
let {patheditarry}=this.state; 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"; let url="/courses/"+coursesId+"/homework_commons/create_subject_homework.json";
if(patheditarry===undefined){ if(patheditarry===undefined){
this.setState({ this.setState({
patheditarrytype:true, patheditarrytype:true,
patheditarryvalue:"请先选择实践课程" patheditarryvalue:"请先选择实践课程",
hometypepvisible:false
}) })
return return
}else if(patheditarry.length===0){ }else if(patheditarry.length===0){
this.setState({ this.setState({
patheditarrytype:true, patheditarrytype:true,
patheditarryvalue:"请先选择实践课程" patheditarryvalue:"请先选择实践课程",
hometypepvisible:false
}) })
return return
} }
@ -114,14 +186,16 @@ class PathModal extends Component{
// this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) // this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
// } // }
this.setState({
hometypepvisible:false
})
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}) })
} }
render(){ render(){
let {Searchvalue,type,Modalstype}=this.state; let {Searchvalue,type,Modalstype,newshixunmodallist,hometypepvisible,shixunmodallist}=this.state;
let {visible,shixunmodallist,hometypepvisible,newshixunmodallist}=this.props; let {visible}=this.props;
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />; const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
return( return(
@ -164,7 +238,7 @@ class PathModal extends Component{
<span className="fl color-grey-9 font-16 mt3"> <span className="fl color-grey-9 font-16 mt3">
<span></span> <span></span>
<span className="color-orange-tip">{shixunmodallist === undefined ? "":shixunmodallist.subjects_count}</span> <span className="color-orange-tip">{shixunmodallist === undefined ? "":shixunmodallist.subjects_count}</span>
<span>个实</span> <span>个实践课程</span>
</span> </span>
<div className="fr search-new"> <div className="fr search-new">
<Search <Search
@ -200,6 +274,7 @@ class PathModal extends Component{
style={{"Height":"204px"}}> style={{"Height":"204px"}}>
<Checkbox.Group style={{ width: '100%' }} onChange={this.shixunhomeworkedit}> <Checkbox.Group style={{ width: '100%' }} onChange={this.shixunhomeworkedit}>
{ {
newshixunmodallist&&newshixunmodallist.map((item,key)=>{ newshixunmodallist&&newshixunmodallist.map((item,key)=>{
return( return(
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}> <div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}>

@ -6,6 +6,7 @@ import axios from'axios';
const Option = Select.Option; const Option = Select.Option;
const Search = Input.Search; const Search = Input.Search;
class ShixunModal extends Component{ class ShixunModal extends Component{
constructor(props){ constructor(props){
super(props); super(props);
@ -13,13 +14,69 @@ class ShixunModal extends Component{
Searchvalue:undefined, Searchvalue:undefined,
type:'all', type:'all',
category_id:0, category_id:0,
page:1 page:1,
shixunmodallist:undefined,
hometypepvisible:false,
newshixunmodallist:undefined,
} }
} }
componentDidMount() { 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<shixun_list.length;i++){
newshixunmodallists.push(shixun_list[i])
}
this.setState({
shixunmodallist:result.data,
newshixunmodallist:newshixunmodallists,
hometypepvisible:false
})
}
}).catch((error)=>{
console.log(error);
})
}
//勾选实训 //勾选实训
shixunhomeworkedit=(list)=>{ shixunhomeworkedit=(list)=>{
@ -43,16 +100,13 @@ class ShixunModal extends Component{
contentViewScrolledit=(e)=>{ contentViewScrolledit=(e)=>{
//滑动到底判断 //滑动到底判断
if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){ if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){
let {Searchvalue,type,page}=this.state;
let {Searchvalue,type,page}=this.state; let newpage=page+1
let newpage=page+1 this.setupdatalist(Searchvalue,type,true,newpage)
this.props.funshixunmodallist(Searchvalue,type,true,newpage) this.setState({
this.setState({ page:newpage
page:newpage })
})
} }
} }
@ -69,7 +123,7 @@ class ShixunModal extends Component{
page:1, page:1,
}) })
this.props.funshixunmodallist(value,type,true,1) this.setupdatalist(value,type,true,1)
this.props.funpatheditarry([]) this.props.funpatheditarry([])
} }
@ -79,9 +133,10 @@ class ShixunModal extends Component{
this.setState({ this.setState({
type:types, type:types,
page:1, page:1,
newshixunmodallist:undefined
}) })
this.props.funshixunmodallist(Searchvalue,types,true,1) this.setupdatalist(Searchvalue,types,true,1)
this.props.funpatheditarry([]) this.props.funpatheditarry([])
} }
@ -91,17 +146,24 @@ class ShixunModal extends Component{
} }
savecouseShixunModal=()=>{ savecouseShixunModal=()=>{
this.setState({
hometypepvisible:true
})
let {coursesId,patheditarry,datas}=this.props; let {coursesId,patheditarry,datas}=this.props;
let{category_id}=this.state; let{category_id}=this.state;
if (this.props.chooseShixun) { if (this.props.chooseShixun) {
this.props.chooseShixun(patheditarry) this.props.chooseShixun(patheditarry)
this.setState({
hometypepvisible:false
})
return; return;
} }
if(patheditarry.length===0){ if(patheditarry.length===0){
this.setState({ this.setState({
shixunmodelchke:true, shixunmodelchke:true,
chekicmessage:"请先选择实训" chekicmessage:"请先选择实训",
hometypepvisible:false
}) })
return return
@ -119,7 +181,9 @@ class ShixunModal extends Component{
this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
this.props.hidecouseShixunModal() this.props.hidecouseShixunModal()
} }
this.setState({
hometypepvisible:false
})
// category_id: 3 // category_id: 3
// homework_ids: (5) [9171, 9172, 9173, 9174, 9175] // homework_ids: (5) [9171, 9172, 9173, 9174, 9175]
}).catch((error) => { }).catch((error) => {
@ -133,8 +197,8 @@ class ShixunModal extends Component{
}) })
} }
render(){ render(){
let {Searchvalue,type,category_id}=this.state; let {Searchvalue,type,hometypepvisible,shixunmodallist,newshixunmodallist,}=this.state;
let {visible,shixunmodallist,hometypepvisible,newshixunmodallist,patheditarry}=this.props; let {visible,patheditarry}=this.props;
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />; const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
// console.log(patheditarry) // console.log(patheditarry)
return( return(
@ -205,7 +269,7 @@ class ShixunModal extends Component{
` `
} }
</style> </style>
<div className="clearfix mb10 shixun_work_div newshixun_tab_div cdefault" style={{"marginRight":"4px"}} id="shixun_tab_div"> <div className="clearfix mb10 shixun_work_div newshixun_tab_div cdefault" id="shixun_tab_div">
<li className="fl mr5 mt5"> <li className="fl mr5 mt5">
<a onClick={()=>this.changeTag("all")} className={ type==="all" ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>全部</a> <a onClick={()=>this.changeTag("all")} className={ type==="all" ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>全部</a>
@ -277,6 +341,9 @@ class ShixunModal extends Component{
width: 11%; width: 11%;
box-sizing: border-box; box-sizing: border-box;
} }
.pl12{
padding-left: 12px;
}
` `
} }
</style> </style>
@ -298,7 +365,7 @@ class ShixunModal extends Component{
</li> </li>
<li className="fl with25 edu-txt-left task-hide paddingl5">{item.school}</li> <li className="fl with25 edu-txt-left task-hide paddingl5">{item.school}</li>
<li className="fl with11 paddingl10">{item.myshixuns_count}</li> <li className="fl with11 paddingl10">{item.myshixuns_count}</li>
<li className="fl with11 color-orange-tip paddingl10">{item.level}</li> <li className="fl with11 color-orange-tip paddingl10 pl12">{item.level}</li>
<Tooltip title="新窗口查看详情"> <Tooltip title="新窗口查看详情">
<li className="fl with11"><a className="color-blue" href={"/shixuns/"+item.identifier+"/challenges"} target="_blank">详情</a></li> <li className="fl with11"><a className="color-blue" href={"/shixuns/"+item.identifier+"/challenges"} target="_blank">详情</a></li>
</Tooltip> </Tooltip>

@ -454,20 +454,6 @@ class ShixunHomework extends Component{
checkBoxValues:[] 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({ this.setState({
hometypepvisible:true, hometypepvisible:true,
patheditarry:[], 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)=>{ // funshixunmodallist=(search,type,loading,page)=>{
let{newshixunmodallist}=this.state; // let{newshixunmodallist}=this.state;
let newshixunmodallists=[] // let newshixunmodallists=[]
if(page>1){ // if(page>1){
newshixunmodallists=newshixunmodallist; // newshixunmodallists=newshixunmodallist;
} // }
this.setState({ // this.setState({
hometypepvisible:loading // hometypepvisible:loading
}) // })
let coursesId=this.props.match.params.coursesId; // let coursesId=this.props.match.params.coursesId;
let url ="/courses/"+coursesId+"/homework_commons/shixuns.json"; // let url ="/courses/"+coursesId+"/homework_commons/shixuns.json";
//
axios.get(url, { // axios.get(url, {
params: { // params: {
search: search, // search: search,
type:type, // type:type,
page:page // page:page
} // }
}).then((result)=>{ // }).then((result)=>{
if(result.status===200){ // if(result.status===200){
//
let shixun_list=result.data.shixun_list; // let shixun_list=result.data.shixun_list;
for(var i=0; i<shixun_list.length;i++){ // for(var i=0; i<shixun_list.length;i++){
newshixunmodallists.push(shixun_list[i]) // newshixunmodallists.push(shixun_list[i])
} // }
this.setState({ // this.setState({
shixunmodal:true, // shixunmodal:true,
shixunmodallist:result.data, // shixunmodallist:result.data,
newshixunmodallist:newshixunmodallists, // newshixunmodallist:newshixunmodallists,
hometypepvisible:false // hometypepvisible:false
}) // })
} // }
}).catch((error)=>{ // }).catch((error)=>{
console.log(error); // 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<shixun_list.length;i++){
newshixunmodallists.push(shixun_list[i])
}
this.setState({
shixunpath:true,
shixunpathlist:result.data,
newshixunpathlist:newshixunmodallists,
hometypepvisible:false
})
}
}).catch((error)=>{
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; // funshixunpathlist=(search,type,loading,page)=>{
for(var i=0; i<shixun_list.length;i++){ // let{newshixunpathlist}=this.state;
newshixunmodallists.push(shixun_list[i]) // let newshixunmodallists=[]
} // if(page>1){
this.setState({ // newshixunmodallists=newshixunpathlist;
shixunpath:true, // }
shixunpathlist:result.data, // this.setState({
newshixunpathlist:newshixunmodallists, // hometypepvisible:loading
hometypepvisible:false // })
}) // let coursesId=this.props.match.params.coursesId;
} // let url ="/courses/"+coursesId+"/homework_commons/subjects.json";
}).catch((error)=>{ //
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<shixun_list.length;i++){
// newshixunmodallists.push(shixun_list[i])
// }
// this.setState({
// shixunpath:true,
// shixunpathlist:result.data,
// newshixunpathlist:newshixunmodallists,
// hometypepvisible:false
// })
// }
// }).catch((error)=>{
// console.log(error);
// })
// }
PaginationCourse=(pageNumber)=>{ PaginationCourse=(pageNumber)=>{
let {Coursename,order}=this.state; let {Coursename,order}=this.state;
@ -1012,13 +948,16 @@ class ShixunHomework extends Component{
course_groups={course_groups} course_groups={course_groups}
getcourse_groupslist={(id)=>this.getcourse_groupslist(id)} getcourse_groupslist={(id)=>this.getcourse_groupslist(id)}
/>:""} />:""}
{/*选择实训*/} {/*选择实训*/}
{shixunmodal===true?<ShixunModal {shixunmodal===true?<ShixunModal
{...this.props}
{...this.state}
datas={datas} datas={datas}
category_id={this.props.match.params.category_id} category_id={this.props.match.params.category_id}
visible={shixunmodal} visible={shixunmodal}
shixunmodallist={shixunmodallist} shixunmodallist={shixunmodallist}
funshixunmodallist={(search,type,loading,page)=>this.funshixunmodallist(search,type,loading,page)} // funshixunmodallist={(search,type,loading,page)=>this.funshixunmodallist(search,type,loading,page)}
hometypepvisible={hometypepvisible} hometypepvisible={hometypepvisible}
hidecouseShixunModal={this.hidecouseShixunModal} hidecouseShixunModal={this.hidecouseShixunModal}
newshixunmodallist={newshixunmodallist} newshixunmodallist={newshixunmodallist}
@ -1027,6 +966,7 @@ class ShixunHomework extends Component{
funpatheditarry={(patheditarry)=>this.funpatheditarry(patheditarry)} funpatheditarry={(patheditarry)=>this.funpatheditarry(patheditarry)}
patheditarry={patheditarry} patheditarry={patheditarry}
/>:""} />:""}
{shixunmodal===true||shixunpath===true?<style> {shixunmodal===true||shixunpath===true?<style>
{ {
` `
@ -1038,11 +978,13 @@ class ShixunHomework extends Component{
</style>:""} </style>:""}
{/*选择实训路径*/} {/*选择实训路径*/}
{shixunpath===true? <PathModal {shixunpath===true? <PathModal
{...this.props}
{...this.state}
datas={datas} datas={datas}
visible={shixunpath} visible={shixunpath}
shixunmodallist={this.state.shixunpathlist} shixunmodallist={this.state.shixunpathlist}
newshixunmodallist={this.state.newshixunpathlist} newshixunmodallist={this.state.newshixunpathlist}
funshixunpathlist={(search,type,loading,page)=>this.funshixunpathlist(search,type,loading,page)} // funshixunpathlist={(search,type,loading,page)=>this.funshixunpathlist(search,type,loading,page)}
hometypepvisible={hometypepvisible} hometypepvisible={hometypepvisible}
hidecouseShixunModal={this.hidecouseShixunModal} hidecouseShixunModal={this.hidecouseShixunModal}
coursesId={this.props.match.params.coursesId} coursesId={this.props.match.params.coursesId}

Loading…
Cancel
Save