diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js index f335f1705..4acbb35a7 100644 --- a/public/react/config/webpack.config.dev.js +++ b/public/react/config/webpack.config.dev.js @@ -32,7 +32,7 @@ module.exports = { // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s // devtool: "cheap-module-eval-source-map", // 开启调试 - devtool: "source-map", // 开启调试 + //devtool: "source-map", // 开启调试 // These are the "entry points" to our application. // This means they will be the "root" imports that are included in JS bundle. // The first two entry points enable "hot" CSS and auto-refreshes for JS. diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js index 102962dc3..a1a43602b 100644 --- a/public/react/src/modules/courses/Resource/index.js +++ b/public/react/src/modules/courses/Resource/index.js @@ -734,7 +734,7 @@ class Fileslists extends Component{ let category_id= this.props.match.params.category_id; - console.log(this.state.course_groups) + // console.log(this.state.course_groups) return( diff --git a/public/react/src/modules/courses/coursesPublic/SelectResource.js b/public/react/src/modules/courses/coursesPublic/SelectResource.js index 13c201cd0..16e52182f 100644 --- a/public/react/src/modules/courses/coursesPublic/SelectResource.js +++ b/public/react/src/modules/courses/coursesPublic/SelectResource.js @@ -42,7 +42,13 @@ class Selectresource extends Component{ getallfiles:false, searchtype:'getallfiles', Radiovalue:0, - datatime:undefined + datatime:undefined, + course_group_publish_times:[ + { + group_id : undefined, + publish_time :undefined, + course_group_name:undefined + }], } } componentDidMount() { @@ -212,7 +218,7 @@ class Selectresource extends Component{ savecouseShixunModal=()=>{ - let {patheditarry,datatime,Radiovalue}=this.state; + let {patheditarry,datatime,Radiovalue,course_group_publish_times}=this.state; let {coursesId,attachmentId}=this.props; let url="/files/import.json"; @@ -227,7 +233,7 @@ class Selectresource extends Component{ }) } - if(this.state.Radiovalue===1){ + if(this.state.Radiovalue===1&&this.props.course_groups.length===0){ if(datatime===undefined||datatime===null||datatime=== ""){ this.setState({ Radiovaluetype:true @@ -245,7 +251,8 @@ class Selectresource extends Component{ attachment_ids:patheditarry, course_second_category_id:this.props.coursesidtype===undefined||this.props.coursesidtype==="node"?0:attachmentId, delay_publish:Radiovalue, - publish_time:Radiovalue===1?datatime:undefined + publish_time:this.props.course_groups.length===0?Radiovalue===1?datatime===undefined? undefined:datatime:undefined:undefined, + group_settings:this.props.course_groups.length===0?undefined:course_group_publish_times } ).then((response) => { if(response.data.status===0){ @@ -271,15 +278,59 @@ class Selectresource extends Component{ }); } - onChangeTimepublish= (date, dateString) => { + onChangeTimepublish= (date, dateString,key,type) => { + if(type===1){ + this.setState({ + datatime:handleDateString(dateString), + }) + }else if(type===2){ + let {course_group_publish_times}=this.state; + let newgroup_publish=course_group_publish_times; + for(var i=0; i{ + let newlist=this.state.course_group_publish_times; + newlist.push( { + group_id : undefined, + publish_time :undefined, + course_group_name:undefined + }) this.setState({ - datatime:handleDateString(dateString), + course_group_publish_times:newlist }) - } + deletegrouppublish=(key)=>{ + let newlist=this.state.course_group_publish_times; + newlist.splice(key,1); + this.setState({ + course_group_publish_times:newlist + }) + } + selectassigngroups=(e,index,key)=>{ + let {course_group_publish_times}=this.state; + let newgroup_publish=course_group_publish_times; + for(var i=0; i; const radioStyle = { @@ -287,6 +338,8 @@ class Selectresource extends Component{ height: '30px', lineHeight: '30px', }; + + console.log(course_group_publish_times) return(
{/*提示*/} @@ -325,12 +378,12 @@ class Selectresource extends Component{ } #shixun_tab_div{ padding: 0 30px; - padding-top:30px; + padding-top:15px; } .search-news{ width: 237px!important; height: 30px; - margin-bottom: 30px; + margin-bottom: 15px; } `} @@ -373,7 +426,7 @@ class Selectresource extends Component{ height: 37px; } .scrollbox{ - height:250px !important; + height:145px !important; } .selectfilsbox{ height: 50px; @@ -424,7 +477,7 @@ class Selectresource extends Component{ 延期发布 - 0?"": + />} (按照设置的时间定时发布) + + + {this.props.course_groups.length>0?this.props.isStudent()===true?"":
+ {this.state.Radiovalue===1?:""} + { + course_group_publish_times.map((item,key)=>{ + return( +
+ + + this.onChangeTimepublish(e,index,key,2)} + // onChange={ this.onChangeTimepublish } + disabledTime={disabledDateTime} + disabledDate={disabledDate} + /> + {key!=0?this.deletegrouppublish(key)}>:""} + {key+1===this.props.course_groups.length?"":} +
+ ) + }) + + } +
:""}
{this.state.patheditarrytype===true?

请选择资源

:""} diff --git a/public/react/src/modules/courses/coursesPublic/sendResource.js b/public/react/src/modules/courses/coursesPublic/sendResource.js index b266767ff..83c774ae3 100644 --- a/public/react/src/modules/courses/coursesPublic/sendResource.js +++ b/public/react/src/modules/courses/coursesPublic/sendResource.js @@ -14,12 +14,12 @@ function range(start, end) { } return result; } + function disabledDateTime() { return { - // disabledHours: () => range(0, 24).splice(4, 20), disabledMinutes: () => range(1, 30).concat(range(31, 60)), - // disabledSeconds: () => [0, 60], - }; + // disabledSeconds: () => range(0,60) + } } function disabledDate(current) { @@ -45,8 +45,9 @@ class Sendresource extends Component{ // moment(new Date()).format('YYYY-MM-DD HH:mm:ss'), course_group_publish_times:[ { - course_group_id : undefined, - publish_time :"" + group_id : undefined, + publish_time :undefined, + course_group_name:undefined }], course_groups:undefined, course_groups_count:undefined, @@ -127,7 +128,7 @@ class Sendresource extends Component{ } Saves=()=>{ - let {fileList,description,is_public,datatime,Radiovalue} =this.state; + let {fileList,description,is_public,datatime,Radiovalue,course_group_publish_times} =this.state; let newfileList=[]; for(var list of fileList){ @@ -141,7 +142,7 @@ class Sendresource extends Component{ return } - if(this.state.Radiovalue===1){ + if(this.state.Radiovalue===1&&this.props.course_groups.length===0){ if(datatime===undefined||datatime===null||datatime=== ""){ this.setState({ Radiovaluetype:true @@ -156,6 +157,7 @@ class Sendresource extends Component{ + if(description===undefined){ }else if(description.length>100){ @@ -176,9 +178,10 @@ class Sendresource extends Component{ course_second_category_id:this.props.coursesidtype===undefined||this.props.coursesidtype==="node"?0:attachmentId, attachment_ids:newfileList, is_public:is_public, - publish_time:Radiovalue===1?datatime===undefined? undefined:datatime:undefined, + publish_time:this.props.course_groups.length===0?Radiovalue===1?datatime===undefined? undefined:datatime:undefined:"", description:description, delay_publish:Radiovalue, + group_settings:this.props.course_groups.length===0?"":course_group_publish_times }).then((result)=>{ if(result.data.status===0){ @@ -237,10 +240,44 @@ class Sendresource extends Component{ Radiovalue: e.target.value, }); } + + addgrouppublish=()=>{ + let newlist=this.state.course_group_publish_times; + newlist.push( { + group_id : undefined, + publish_time :undefined, + course_group_name:undefined + }) + this.setState({ + course_group_publish_times:newlist + }) + } + deletegrouppublish=(key)=>{ + let newlist=this.state.course_group_publish_times; + newlist.splice(key,1); + this.setState({ + course_group_publish_times:newlist + }) + } + selectassigngroups=(e,index,key)=>{ + let {course_group_publish_times}=this.state; + let newgroup_publish=course_group_publish_times; + for(var i=0; i {/*提示*/} @@ -421,10 +458,88 @@ class Sendresource extends Component{ (按照设置的时间定时发布) + + + {this.props.course_groups.length>0?this.props.isStudent()===true?"":
+ {this.state.Radiovalue===1?:""} + { + course_group_publish_times.map((item,key)=>{ + return( +
+ + + this.onChangeTimepublish(e,index,key,2)} + // onChange={ this.onChangeTimepublish } + disabledTime={disabledDateTime} + disabledDate={disabledDate} + /> + {key!=0?this.deletegrouppublish(key)}>:""} + {key+1===this.props.course_groups.length?"":} +
+ ) + }) - + } +
:""}