hjm 5 years ago
commit 4b2e91d0e8

@ -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<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
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 = <Icon type="loading" style={{ fontSize: 24 }} spin />;
return(
@ -164,7 +238,7 @@ class PathModal extends Component{
<span className="fl color-grey-9 font-16 mt3">
<span></span>
<span className="color-orange-tip">{shixunmodallist === undefined ? "":shixunmodallist.subjects_count}</span>
<span>个实</span>
<span>个实践课程</span>
</span>
<div className="fr search-new">
<Search
@ -200,6 +274,7 @@ class PathModal extends Component{
style={{"Height":"204px"}}>
<Checkbox.Group style={{ width: '100%' }} onChange={this.shixunhomeworkedit}>
{
newshixunmodallist&&newshixunmodallist.map((item,key)=>{
return(
<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 Search = Input.Search;
class ShixunModal extends Component{
constructor(props){
super(props);
@ -13,12 +14,68 @@ 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<shixun_list.length;i++){
newshixunmodallists.push(shixun_list[i])
}
this.setState({
shixunmodallist:result.data,
newshixunmodallist:newshixunmodallists,
hometypepvisible:false
})
}
}).catch((error)=>{
console.log(error);
})
}
//勾选实训
@ -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.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 = <Icon type="loading" style={{ fontSize: 24 }} spin />;
// console.log(patheditarry)
return(
@ -205,7 +269,7 @@ class ShixunModal extends Component{
`
}
</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">
<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%;
box-sizing: border-box;
}
.pl12{
padding-left: 12px;
}
`
}
</style>
@ -298,7 +365,7 @@ class ShixunModal extends Component{
</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 color-orange-tip paddingl10">{item.level}</li>
<li className="fl with11 color-orange-tip paddingl10 pl12">{item.level}</li>
<Tooltip title="新窗口查看详情">
<li className="fl with11"><a className="color-blue" href={"/shixuns/"+item.identifier+"/challenges"} target="_blank">详情</a></li>
</Tooltip>

@ -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<shixun_list.length;i++){
newshixunmodallists.push(shixun_list[i])
}
this.setState({
shixunmodal:true,
shixunmodallist:result.data,
newshixunmodallist: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;
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);
})
}
// 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<shixun_list.length;i++){
// newshixunmodallists.push(shixun_list[i])
// }
// this.setState({
// shixunmodal:true,
// shixunmodallist:result.data,
// newshixunmodallist: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;
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;
// 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)=>{
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?<ShixunModal
{...this.props}
{...this.state}
datas={datas}
category_id={this.props.match.params.category_id}
visible={shixunmodal}
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}
hidecouseShixunModal={this.hidecouseShixunModal}
newshixunmodallist={newshixunmodallist}
@ -1027,6 +966,7 @@ class ShixunHomework extends Component{
funpatheditarry={(patheditarry)=>this.funpatheditarry(patheditarry)}
patheditarry={patheditarry}
/>:""}
{shixunmodal===true||shixunpath===true?<style>
{
`
@ -1038,11 +978,13 @@ class ShixunHomework extends Component{
</style>:""}
{/*选择实训路径*/}
{shixunpath===true? <PathModal
{...this.props}
{...this.state}
datas={datas}
visible={shixunpath}
shixunmodallist={this.state.shixunpathlist}
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}
hidecouseShixunModal={this.hidecouseShixunModal}
coursesId={this.props.match.params.coursesId}

Loading…
Cancel
Save