diff --git a/public/react/src/modules/courses/signin/model/Createsignmodel.js b/public/react/src/modules/courses/signin/model/Createsignmodel.js index 99f616204..111e029c4 100644 --- a/public/react/src/modules/courses/signin/model/Createsignmodel.js +++ b/public/react/src/modules/courses/signin/model/Createsignmodel.js @@ -36,7 +36,8 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })( start_time:"", end_time:"", attendance_date:"", - newmode:null + newmode:null, + groupstype:false } } @@ -54,7 +55,8 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })( end_time: date }); } - componentDidMount() { + getgroup_idss=(course_groups)=>{ + let newcourse_groups=course_groups; if(this.props.type==="edit"){ let newlist=[] if(this.props.attendancesdata.groups.length>0){ @@ -63,15 +65,26 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })( }) } - console.log(this.props.attendancesdata.start_time) - // console.log() + newlist.map((item,key)=>{ + newcourse_groups.map((i,k)=>{ + if(i.id===item){ + i.disabled=true + } + }) + }) + // console.log(newlist) + // this.setState({ + // + // }) this.setState({ attendance_date: this.props.attendancesdata.attendance_date, start_time:new Date(this.props.attendancesdata.start_time), end_time:new Date(this.props.attendancesdata.end_time), newmode:this.props.attendancesdata.mode, + course_groups:newcourse_groups, + groupstype:newlist.length===0?true:false }) @@ -85,6 +98,8 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })( }else{ this.setState({ start_time: new Date("2000-01-01T09:00:00.000+08:00"), + course_groups:newcourse_groups, + groupstype:false }) this.props.form.setFieldsValue({ @@ -92,15 +107,15 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })( }); } + } + componentDidMount() { const coursesId=this.props.match.params.coursesId; let newurl=`/courses/${coursesId}/all_course_groups.json`; axios.get(newurl).then((response) => { + this.getgroup_idss(response.data.course_groups) + }) - this.setState({ - course_groups:response.data.course_groups - }) - }) } @@ -226,7 +241,7 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })( } render() { const { visible,form ,setRadio,Radiolist,hideCreatesign,editvisible} = this.props; - let {course_groups,newmode}=this.state; + let {course_groups,newmode,groupstype}=this.state; const { getFieldDecorator } = form; const { Option } = Select; const formItemLayout = { @@ -268,13 +283,13 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })( {getFieldDecorator('group_ids')( - 0?"不选择分班时默认选择全部学生":'暂无分班,将默认选择课堂全部学生'} getPopupContainer={trigger => trigger.parentNode} + disabled={this.props&&this.props.type==="edit"&&this.state.groupstype===true?true:false} > {course_groups.map((item,key)=>{ return( - + ) })} diff --git a/public/react/src/modules/paths/PathDetail/DetailTop.js b/public/react/src/modules/paths/PathDetail/DetailTop.js index bf43c0759..b72edfc81 100644 --- a/public/react/src/modules/paths/PathDetail/DetailTop.js +++ b/public/react/src/modules/paths/PathDetail/DetailTop.js @@ -441,6 +441,40 @@ class DetailTop extends Component{ }) } + setCollect=()=>{ + let pathid=this.props.match.params.pathId; + let url ="/collections.json"; + axios.post(url,{ + container_id:pathid, + container_type:"Subject" + }).then((result)=>{ + const status = result.data.status + if(status===0){ + this.props.getlistdatas() + this.props.showNotification(result.data.message); + } + }).catch((error)=>{ + console.log(error); + }) + } + + cancelCollect=()=>{ + let pathid=this.props.match.params.pathId; + let url=`/collections/cancel.json`; + axios.delete(url,{ data:{ + container_id:pathid, + container_type:"Subject" + }}).then((response) => { + const status = response.data.status + if(status===0){ + this.props.getlistdatas() + this.props.showNotification(response.data.message); + } + }).catch((error) => { + console.log(error) + }) + } + render(){ let{detailInfoList}=this.props; let{Modalstype,Modalstopval,cardsModalcancel,putappointmenttype,Modalsbottomval,cardsModalsavetype,loadtype,getappointmenttype,openpathss,cancel_publics,cancel_has_publics,applyissuePaths}=this.state; @@ -628,6 +662,8 @@ class DetailTop extends Component{ style={{'width':'65px'}} >删除:""} + + {detailInfoList===undefined?"":detailInfoList.allow_statistics===true? :"" } + + {this.props&&this.props.user.login=== ""?"":detailInfoList&&detailInfoList.is_collect===false?this.setCollect()} + style={{'width':'65px'}} + className="fr font-18 color-white kaike mr20 kkbths" > + 收藏 + :""} + + { + this.props&&this.props.user.login=== ""?"":detailInfoList&&detailInfoList.is_collect===true? + this.cancelCollect()}> 取消收藏 + :"" + } + + diff --git a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js index 03f3b9652..99fd08aa9 100644 --- a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js +++ b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js @@ -116,9 +116,9 @@ class PathDetailIndex extends Component{ members:items, items }); - console.log(this.state.members) - console.log("items 数组数组数组数组") - console.log(items) + // console.log(this.state.members) + // console.log("items 数组数组数组数组") + // console.log(items) } cardsModalcancel=()=>{ this.setState({ diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index 7527357c0..25dcd3bd9 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -806,6 +806,43 @@ class TPMBanner extends Component { } } + + setCollect=()=>{ + let id = this.props.match.params.shixunId; + let url ="/collections.json"; + axios.post(url,{ + container_id:id, + container_type:"Shixun" + }).then((result)=>{ + const status = result.data.status + if(status===0){ + debugger + this.props.getcomponentdidmount() + this.props.showNotification(result.data.message); + } + }).catch((error)=>{ + console.log(error); + }) + } + + cancelCollect=()=>{ + let id = this.props.match.params.shixunId; + let url=`/collections/cancel.json`; + axios.delete(url,{ data:{ + container_id:id, + container_type:"Shixun" + }}).then((response) => { + const status = response.data.status + if(status===0){ + debugger + this.props.getcomponentdidmount() + this.props.showNotification(response.data.message); + } + }).catch((error) => { + console.log(error) + }) + } + render() { let { Forkvisible, @@ -1235,6 +1272,23 @@ class TPMBanner extends Component { } + {console.log(this.props)} + {this.props&&this.props.user&&this.props.user.login=== ""?"":shixunsDetails&&shixunsDetails.is_collect===false? + this.setCollect()} + className="fr kaike kkbths mr20 font-18" + // style={{'width':'65px'}} + > + 收藏 + :"" + } + + {this.props&&this.props.user&&this.props.user.login=== ""?"":shixunsDetails&&shixunsDetails.is_collect===true? + this.cancelCollect()} + className="fr kaike kkbths mr20 font-18" + > + 取消收藏 + :"" + } - Fork + 复制实训 @@ -1357,7 +1411,7 @@ class TPMBanner extends Component { } {Forkvisible===true? {!!shixunsDetails.fork_num && - + {shixunsDetails.fork_num} } diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index 3e8dc1cd8..674d2eef0 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -192,6 +192,7 @@ class TPMIndex extends Component { } getcomponentdidmount=()=>{ + let userid=this.props.user&&this.props.user.user_id; let getnewTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings'; let newTPMsettings=window.localStorage.getItem(getnewTPMsettings) diff --git a/public/react/src/modules/user/usersInfo/InfosPath.js b/public/react/src/modules/user/usersInfo/InfosPath.js index c3a1aaa23..c03c7541f 100644 --- a/public/react/src/modules/user/usersInfo/InfosPath.js +++ b/public/react/src/modules/user/usersInfo/InfosPath.js @@ -222,6 +222,9 @@ class InfosPath extends Component{
  • this.changeCategory("study")} className={is_current ? "font-16 w66" : "font-16 w80"}>{is_current ? "我" : "TA"}学习的
  • +
  • this.changeCategory("collect")} + className={is_current ? "font-16 w66" : "font-16 w80"}>{is_current ? "我" : "TA"}收藏的