From 09dba25a82ab1ed8cc4ade4c111d79e95e63a7de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 15 Oct 2019 14:58:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=A8=A1=E5=9D=97=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesPublic/SelectSetting.js | 43 +++++++------------ .../courses/coursesPublic/sendResource.js | 23 +++------- 2 files changed, 22 insertions(+), 44 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/SelectSetting.js b/public/react/src/modules/courses/coursesPublic/SelectSetting.js index 72a10e639..eae1f4e3b 100644 --- a/public/react/src/modules/courses/coursesPublic/SelectSetting.js +++ b/public/react/src/modules/courses/coursesPublic/SelectSetting.js @@ -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(