资源模块调整

dev_auth
杨树明 5 years ago
parent e1f8763bc7
commit 09dba25a82

@ -78,11 +78,10 @@ class Selectsetting extends Component{
this.setState({
datalist:response.data,
description: response.data.description,
is_public: response.data.is_public,
is_public:response.data.is_public,
datatime:response.data.publish_time,
// is_public:response.data.course_groups,
Radiovalue:response.data.delay_publish===false?0:1,
//attachment_histories:response.data.attachment_histories
course_groups:newcourse_groups
})
}
@ -92,23 +91,6 @@ class Selectsetting extends Component{
});
let coursesId=this.props.match.params.coursesId;
if(this.props.isAdmin()){
let url = `/courses/${coursesId}/all_course_groups.json`
axios.get(url, {
})
.then((response) => {
this.setState({
course_groupss: response.data.course_groups,
})
})
.catch(function (error) {
console.log(error);
});
}
}
@ -147,7 +129,7 @@ class Selectsetting extends Component{
}
savecouseShixunModal=()=>{
let {fileList,is_public,description,datatime,course_groups}=this.state;
let {fileList,is_public,description,datatime,Radiovalue}=this.state;
let newfileList=[];
for(var list of fileList){
@ -183,13 +165,12 @@ class Selectsetting extends Component{
axios.put(url,{
course_id:coursesId,
new_attachment_id:newfileList.length===0?undefined:newfileList,
course_second_category_id:this.props.coursesidtype===undefined||this.props.coursesidtype==="node"?0:attachmentId,
// course_second_category_id:this.props.coursesidtype===undefined||this.props.coursesidtype==="node"?0:attachmentId,
is_public:is_public,
publish_time:unified_setting===true?datatime===undefined?moment(new Date()).format('YYYY-MM-DD HH'):datatime:undefined,
publish_time:Radiovalue===0?undefined:datatime===undefined?moment(new Date()).format('YYYY-MM-DD HH'):datatime,
description:description,
course_group_publish_times:unified_setting===false?course_groups:undefined
delay_publish:Radiovalue
}).then((result)=>{
if(result.data.status===0){
this.props.setupdate(attachmentId)
this.props.showNotification("设置资源成功");
@ -263,6 +244,11 @@ class Selectsetting extends Component{
})
}
RadioonChange=(e)=>{
if(e.target.value===0){
this.setState({
datatime:undefined
})
}
this.setState({
Radiovalue: e.target.value,
});
@ -289,6 +275,8 @@ class Selectsetting extends Component{
height: '30px',
lineHeight: '30px',
};
console.log(this.state.datatime)
return(
<div>
<style>
@ -515,7 +503,7 @@ class Selectsetting extends Component{
`}
</style>
{this.props.course_is_public===true?<div>
<span className={"color-ooo"}>公开</span><Checkbox checked={this.state.is_public} onChange={this.onChangepublic}>
<span className={"color-ooo"}>公开</span><Checkbox checked={this.state.is_public} onChange={(e)=>this.onChangepublic(e)}>
<span className={"font-14 color-ooo"}>选中所有用户可见否则课堂成员可见</span>
</Checkbox>
</div>:""}
@ -530,13 +518,14 @@ class Selectsetting extends Component{
<div className={this.props.course_is_public===true?"mt10":""}>
<span className={"color-ooo fl mt6"}>发布设置</span>
<Radio.Group onChange={this.RadioonChange} value={this.state.Radiovalue} style={{'width': '460px'}}>
<Radio.Group onChange={(e)=>this.RadioonChange(e)} value={this.state.Radiovalue} style={{'width': '460px'}}>
<Radio style={radioStyle} value={0}>
立即发布
</Radio>
<Radio style={radioStyle} value={1} className={"fl"}>
<span className={"mr5"}>延迟发布</span>
<DatePicker
showToday={false}
dropdownClassName="hideDisable"
showTime={{ format: 'HH:mm' }}

@ -58,23 +58,6 @@ class Sendresource extends Component{
componentDidMount() {
let coursesId=this.props.match.params.coursesId;
if(this.props.isAdmin()){
let url = `/courses/${coursesId}/all_course_groups.json`
axios.get(url, {
})
.then((response) => {
this.setState({
course_groups: response.data.course_groups,
course_groups_count:response.data.course_groups_count
})
})
.catch(function (error) {
console.log(error);
});
}
}
//勾选实训
@ -245,6 +228,11 @@ class Sendresource extends Component{
}
RadioonChange=(e)=>{
if(e.target.value===0){
this.setState({
datatime:undefined
})
}
this.setState({
Radiovalue: e.target.value,
});
@ -411,6 +399,7 @@ class Sendresource extends Component{
<Radio style={radioStyle} value={1} className={"fl"}>
<span className={"mr5"}>延迟发布</span>
<DatePicker
dropdownClassName="hideDisable"
showTime={{ format: 'HH:mm' }}
locale={locale}

Loading…
Cancel
Save