课程、课堂收藏功能、实训复制可选班级功能调整

schedule_job
杨树明 5 years ago
parent 4caad4af6d
commit 4aa70fc370

@ -54,7 +54,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 +64,25 @@ 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
})
@ -85,6 +96,7 @@ 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
})
this.props.form.setFieldsValue({
@ -92,15 +104,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
})
})
}
@ -269,12 +281,12 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
<Form.Item label="签到班级:">
{getFieldDecorator('group_ids')(
<Select mode="multiple" placeholder={course_groups.length>0?"不选择分班时默认选择全部学生":'暂无分班,将默认选择课堂全部学生'} getPopupContainer={trigger => trigger.parentNode}
disabled={this.props&&this.props.type==="edit"?true:false}
// disabled={this.props&&this.props.type==="edit"?true:false}
>
{course_groups.map((item,key)=>{
return(
<Option value={item.id} key={key}>{item.name}</Option>
<Option value={item.id} key={key} disabled={item.disabled?item.disabled:false}>{item.name}</Option>
)
})}

@ -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'}}
>删除</a>:""}
{detailInfoList===undefined?"":detailInfoList.allow_statistics===true?
<Link to={"/paths/"+this.props.match.params.pathId+"/edit"}
style={{'width':'65px'}}
@ -636,6 +672,20 @@ class DetailTop extends Component{
</Link>
:""
}
{this.props&&this.props.user.login=== ""?"":detailInfoList&&detailInfoList.is_collect===false?<a onClick={()=>this.setCollect()}
style={{'width':'65px'}}
className="fr font-18 color-white kaike mr20 kkbths" >
收藏
</a>:""}
{
this.props&&this.props.user.login=== ""?"":detailInfoList&&detailInfoList.is_collect===true?
<a className="fr font-18 color-white kaike mr20 kkbths" onClick={()=>this.cancelCollect()}> 取消收藏
</a>:""
}
</div>

@ -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({

@ -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 {
</Tooltip>
</a>
}
{console.log(this.props)}
{this.props&&this.props.user&&this.props.user.login=== ""?"":shixunsDetails&&shixunsDetails.is_collect===false?
<a onClick={()=>this.setCollect()}
className="fr kaike kkbths mr20 font-18"
// style={{'width':'65px'}}
>
收藏
</a>:""
}
{this.props&&this.props.user&&this.props.user.login=== ""?"":shixunsDetails&&shixunsDetails.is_collect===true?
<a onClick={()=>this.cancelCollect()}
className="fr kaike kkbths mr20 font-18"
>
取消收藏
</a>:""
}
<Modal
keyboard={false}
@ -1326,7 +1380,7 @@ class TPMBanner extends Component {
onClick={this.copyForkvisible}
style={{display: shixunsDetails.can_copy === false || shixunsDetails.can_copy === null ? "none" : "inline-block"}}
>
Fork
复制实训
</span>
</Tooltip>
@ -1357,7 +1411,7 @@ class TPMBanner extends Component {
}
{Forkvisible===true?<Modal
keyboard={false}
title="Fork原因"
title="复制原因"
visible={Forkvisible}
closable={false}
footer={null}
@ -1420,7 +1474,7 @@ class TPMBanner extends Component {
</div>
</Modal>
{!!shixunsDetails.fork_num &&
<Link to={"/shixuns/" + shixunId + "/fork_list"} className="forkNumst" data-tip-down="Fork实训列表">
<Link to={"/shixuns/" + shixunId + "/fork_list"} className="forkNumst" data-tip-down="复制实训列表">
{shixunsDetails.fork_num}
</Link>
}

@ -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)

Loading…
Cancel
Save