From 251f2a0bfab2794adc28aec06e54fbd7f579e3a7 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, 20 Aug 2019 18:09:19 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesPublic/SelectSetting.js | 344 +++---- .../courses/coursesPublic/sendResource.js | 922 +++++++++--------- 2 files changed, 633 insertions(+), 633 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/SelectSetting.js b/public/react/src/modules/courses/coursesPublic/SelectSetting.js index 557cec972..b453d0075 100644 --- a/public/react/src/modules/courses/coursesPublic/SelectSetting.js +++ b/public/react/src/modules/courses/coursesPublic/SelectSetting.js @@ -7,7 +7,7 @@ import moment from 'moment'; import Modals from '../../modals/Modals'; const Option = Select.Option; - + const dateFormat ="YYYY-MM-DD HH:mm" function range(start, end) { const result = []; @@ -131,7 +131,7 @@ class Selectsetting extends Component{ - getalldata=()=>{ + getalldata=()=>{ } componentDidUpdate = (prevProps) => { @@ -139,9 +139,9 @@ class Selectsetting extends Component{ if ( prevProps.visible != this.props.visible ) { console.log(prevProps) console.log(this.props) - this.setState({ - visible:this.props.visible - }) + this.setState({ + visible:this.props.visible + }) this.getalldata() } @@ -205,23 +205,23 @@ class Selectsetting extends Component{ // } // }) - // if(unified_setting===false){ - // - // course_groups.forEach((item,key)=>{ - // if(item.course_group_id===undefined){ - // this.setState({ - // course_group_idtypes:true - // }) - // return - // } - // }) - // - // } + // if(unified_setting===false){ + // + // course_groups.forEach((item,key)=>{ + // if(item.course_group_id===undefined){ + // this.setState({ + // course_group_idtypes:true + // }) + // return + // } + // }) + // + // } let coursesId=this.props.match.params.coursesId; let attachmentId=this.props.attachmentId; - let url="/files/"+this.props.discussMessageid+".json"; + let url="/files/"+this.props.discussMessageid+".json"; // axios.put(url,{ course_id:coursesId, @@ -298,7 +298,7 @@ class Selectsetting extends Component{ onAttachmentRemove = (file) => { // const url = `/attachments/${file.response ? file.response.id : file.uid}.json` - const url = `/attachments/${file.response ? file.response.id : file.uid}.json` + const url = `/attachments/${file.response ? file.response.id : file.uid}.json` axios.delete(url, { }) .then((response) => { @@ -368,7 +368,7 @@ class Selectsetting extends Component{ newlist.push( { course_group_id : undefined, publish_time :"" - // moment(new Date()).format('YYYY-MM-DD HH:mm') + // moment(new Date()).format('YYYY-MM-DD HH:mm') }) this.setState({ course_groups:newlist @@ -381,7 +381,7 @@ class Selectsetting extends Component{ width: 600, // https://github.com/ant-design/ant-design/issues/15505 // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 - // showUploadList: false, + // showUploadList: false, action: `${getUrl()}/api/attachments.json`, onChange: this.handleChange, onRemove: this.onAttachmentRemove, @@ -463,7 +463,7 @@ class Selectsetting extends Component{
+ style={{"Height":"204px"}}> */} {/*{this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{*/} - {/*return(*/} - {/*

*/} - {/**/} - {/**/} - {/**/} - {/**/} - {/*{item.name}*/} - {/**/} - {/**/} - {/*{item.response===undefined?"":isNaN(bytesToSize(item.filesize))?"123":bytesToSize(item.filesize)}*/} - {/**/} - {/*this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}>*/} - {/*

*/} - {/*)*/} + {/*return(*/} + {/*

*/} + {/**/} + {/**/} + {/**/} + {/**/} + {/*{item.name}*/} + {/**/} + {/**/} + {/*{item.response===undefined?"":isNaN(bytesToSize(item.filesize))?"123":bytesToSize(item.filesize)}*/} + {/**/} + {/*this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}>*/} + {/*

*/} + {/*)*/} {/*})}*/} {this.state.newfileListtypes===true?

请先上传资源

:""} - {/*

*/} - {/**/} - - {/*

*/} - {/**/} - {/*勾选后所有用户可见,否则仅课堂成员可见*/} - {/**/} - {/*
*/} - {/*/!*{this.props.has_course_groups&&this.props.has_course_groups===true?:""}*!/*/} - {/*/!*{this.state.course_groupss&&this.state.course_groupss.length>0?*!/*/} - {/*/!*统一设置(选中则所有分班使用相同的发布设置,否则各个单独设置)*!/*/} - {/*/!*:""}*!/*/} - - {/**/} - - - {/*/!*this.props.has_course_groups&&this.props.has_course_groups===true?:""*!/*/} - {/*
*/} - {/*{unified_setting===false?*/} - {/*this.state.course_groups&&this.state.course_groups.map((item,key)=>{*/} - {/*return(*/} - {/*
*/} - - - {/**/} - - - {/*this.onChangeTimepublishs(e,index,key)}*/} - {/*// onChange={ this.onChangeTimepublish }*/} - {/*disabledTime={disabledDateTime}*/} - {/*disabledDate={disabledDate}*/} - {/*/>*/} - - {/*{key!=0?this.deletegrouppublish(key)}>:""}*/} - {/*{key===course_groups.length-1?:""}*/} - {/*
*/} - {/*)*/} - {/*}):""}*/} - {/*
*/} +

+ - {/*

*/} +
+ + 勾选后所有用户可见,否则仅课堂成员可见 + +
+ {/*{this.props.has_course_groups&&this.props.has_course_groups===true?:""}*/} + {/*{this.state.course_groupss&&this.state.course_groupss.length>0?*/} + {/*统一设置(选中则所有分班使用相同的发布设置,否则各个单独设置)*/} + {/*:""}*/} + + + + + {/*this.props.has_course_groups&&this.props.has_course_groups===true?:""*/} +
+ {unified_setting===false? + this.state.course_groups&&this.state.course_groups.map((item,key)=>{ + return( +
+ + + + + + this.onChangeTimepublishs(e,index,key)} + // onChange={ this.onChangeTimepublish } + disabledTime={disabledDateTime} + disabledDate={disabledDate} + /> + + {key!=0?this.deletegrouppublish(key)}>:""} + {key===course_groups.length-1?:""} +
+ ) + }):""} +
+ +

{unified_setting===true? -

+

+ />

:""} {/*{this.state.course_group_idtypes===true?

请选择分班

:""}*/} diff --git a/public/react/src/modules/courses/coursesPublic/sendResource.js b/public/react/src/modules/courses/coursesPublic/sendResource.js index 20f22b119..576c9b514 100644 --- a/public/react/src/modules/courses/coursesPublic/sendResource.js +++ b/public/react/src/modules/courses/coursesPublic/sendResource.js @@ -8,18 +8,18 @@ import moment from 'moment'; const CheckboxGroup = Checkbox.Group; const Option = Select.Option; function range(start, end) { - const result = []; - for (let i = start; i < end; i++) { - result.push(i); - } - return result; + const result = []; + for (let i = start; i < end; i++) { + result.push(i); + } + return result; } function disabledDateTime() { - return { - // disabledHours: () => range(0, 24).splice(4, 20), - disabledMinutes: () => range(1, 30).concat(range(31, 60)), - // disabledSeconds: () => [0, 60], - }; + return { + // disabledHours: () => range(0, 24).splice(4, 20), + disabledMinutes: () => range(1, 30).concat(range(31, 60)), + // disabledSeconds: () => [0, 60], + }; } function disabledDate(current) { @@ -29,63 +29,63 @@ function disabledDate(current) { const dateFormat="YYYY-MM-DD HH:mm"; class Sendresource extends Component{ - constructor(props){ - super(props); - this.state={ - group_ids:[], - fileList:[], - Modalstype:false, - Modalstopval:"", - ModalCancel:"", - ModalSave:"", + constructor(props){ + super(props); + this.state={ + group_ids:[], + fileList:[], + Modalstype:false, + Modalstopval:"", + ModalCancel:"", + ModalSave:"", fileListtype:false, - loadtype:false, - is_unified_setting:true, - is_public:false, - datatime:undefined, - // moment(new Date()).format('YYYY-MM-DD HH:mm:ss'), - course_group_publish_times:[ - { - course_group_id : undefined, - publish_time :"" - }], - course_groups:undefined, - course_groups_count:undefined - } - } - - - 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); - }); - } - - } - - //勾选实训 - shixunhomeworkedit=(list)=>{ - - this.setState({ - group_ids:list - }) - - } - // 附件相关 START - handleChange = (info) => { + loadtype:false, + is_unified_setting:true, + is_public:false, + datatime:undefined, + // moment(new Date()).format('YYYY-MM-DD HH:mm:ss'), + course_group_publish_times:[ + { + course_group_id : undefined, + publish_time :"" + }], + course_groups:undefined, + course_groups_count:undefined + } + } + + + 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); + }); + } + + } + + //勾选实训 + shixunhomeworkedit=(list)=>{ + + this.setState({ + group_ids:list + }) + + } + // 附件相关 START + handleChange = (info) => { let fileList = info.fileList; if(info.file.status!="removed"){ @@ -98,280 +98,280 @@ class Sendresource extends Component{ fileList: appendFileSizeToUploadFileAll(fileList), }); } - } + } - // onAttachmentRemove = (file) => { - // + // onAttachmentRemove = (file) => { + // // this.setState({ // fileListtype:false, // }) - // // confirm({ - // // title: '确定要删除这个附件吗?', - // // okText: '确定', - // // cancelText: '取消', - // // // content: 'Some descriptions', - // // onOk: () => { - // // this.deleteAttachment(file) - // // }, - // // onCancel() { - // // console.log('Cancel'); - // // }, - // // }); - // // return false; + // // confirm({ + // // title: '确定要删除这个附件吗?', + // // okText: '确定', + // // cancelText: '取消', + // // // content: 'Some descriptions', + // // onOk: () => { + // // this.deleteAttachment(file) + // // }, + // // onCancel() { + // // console.log('Cancel'); + // // }, + // // }); + // // return false; // - // // this.setState({ - // // Modalstype:true, - // // Modalstopval:'确定要删除这个附件吗?', - // // ModalSave: ()=>this.deleteAttachment(file), - // // ModalCancel:this.cancelAttachment - // // }) - // // return false; + // // this.setState({ + // // Modalstype:true, + // // Modalstopval:'确定要删除这个附件吗?', + // // ModalSave: ()=>this.deleteAttachment(file), + // // ModalCancel:this.cancelAttachment + // // }) + // // return false; // - // this.deleteAttachment(file); - // } + // this.deleteAttachment(file); + // } onAttachmentRemove = (file) => { - const url = `/attachments/${file.response ? file.response.id : file.uid}.json` - axios.delete(url, { - }) - .then((response) => { - if (response.data) { - const { status } = response.data; - if (status == 0) { + const url = `/attachments/${file.response ? file.response.id : file.uid}.json` + axios.delete(url, { + }) + .then((response) => { + if (response.data) { + const { status } = response.data; + if (status == 0) { this.setState({ fileListtype:false, fileList:[] }) - } + } - } - }) - .catch(function (error) { - console.log(error); - }); + } + }) + .catch(function (error) { + console.log(error); + }); + this.setState({ + fileListtype:false, + }) + } + + ModalCancelModalCancel=()=>{ + this.setState({ + Modalstype:false, + Modalstopval:"", + ModalSave:this.ModalCancelModalCancel, + loadtype:false + }) + this.props.Cancel() + } + Saves=()=>{ + + let id=this.props.categoryid; + let {fileList,description,is_public,is_unified_setting,datatime,course_group_publish_times} =this.state; + + let newfileList=[]; + for(var list of fileList){ + newfileList.push(list.response.id) + } + + if(newfileList.length===0){ this.setState({ - fileListtype:false, + newfileListtype:true }) - } - - ModalCancelModalCancel=()=>{ - this.setState({ - Modalstype:false, - Modalstopval:"", - ModalSave:this.ModalCancelModalCancel, - loadtype:false - }) - this.props.Cancel() - } - Saves=()=>{ - - let id=this.props.categoryid; - let {fileList,description,is_public,is_unified_setting,datatime,course_group_publish_times} =this.state; - - let newfileList=[]; - for(var list of fileList){ - newfileList.push(list.response.id) - } - - if(newfileList.length===0){ - this.setState({ - newfileListtype:true - }) - return - } - // if(is_unified_setting===false){ - // course_group_publish_times.forEach((item,key)=>{ - // if(item.course_group_id===undefined||item.publish_time===undefined){ - // this.setState({ - // course_group_publish_timestype:true - // }) - // return - // } - // }) - // - // } - - - - if(description===undefined){ - - }else if(description.length>100){ - - this.setState({ - descriptiontype:true - }) - return - } - - let coursesId=this.props.match.params.coursesId; - let attachmentId=this.props.attachmentId; - let url="/files/upload.json"; - - - axios.post(url,{ - course_id:coursesId, - course_second_category_id:this.props.coursesidtype===undefined||this.props.coursesidtype==="node"?0:attachmentId, - attachment_ids:newfileList, - is_public:is_public, - is_unified_setting:is_unified_setting, - publish_time:is_unified_setting===true?datatime===undefined? moment(new Date()).format('YYYY-MM-DD HH:mm'):datatime:undefined, - description:description, - course_group_publish_times:is_unified_setting===false?course_group_publish_times:undefined - }).then((result)=>{ - - if(result.data.status===0){ - // this.setState({ - // Modalstype:true, - // Modalstopval:result.data.message, - // ModalSave:this.ModalCancelModalCancel, - // loadtype:true - // }) - this.ModalCancelModalCancel(); - this.props.updataleftNavfun(); - // this.props.showNotification(result.data.message); - this.props.showNotification("上传资源成功"); - this.props.setupdate(this.props.attachmentId) - } - }) - - - - } - - settextarea=(e)=>{ - this.setState({ - description:e.target.value - }) - } - - onChangesetting=(e)=>{ - - this.setState({ - is_unified_setting:e.target.checked - }) - - } - - onChangepublic=(e)=>{ - - this.setState({ - is_public:e.target.checked - }) - - } - - 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 {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.splice(key,1); - this.setState({ - course_group_publish_times:newlist - }) - } - - addgrouppublish=()=>{ - let newlist=this.state.course_group_publish_times; - newlist.push( { - course_group_id : undefined, - publish_time :undefined - }) - this.setState({ - course_group_publish_times:newlist - }) - } - - render(){ - let {settextarea,newfileListtype,descriptiontype, - course_group_publish_timestype, - Modalstopval, - ModalCancel, - ModalSave, - loadtype, - is_unified_setting, - is_public, - datatime, - course_group_publish_times, - course_groups - }=this.state; - - const uploadProps = { - width: 600, - // showUploadList:false, - action: `${getUrl()}/api/attachments.json`, - onChange: this.handleChange, - onRemove: this.onAttachmentRemove, - beforeUpload: (file) => { - // console.log('beforeUpload', file.name); - const isLt150M = file.size / 1024 / 1024 < 150; - if (!isLt150M) { - message.error('文件大小必须小于150MB!'); - } - return isLt150M; - }, - }; - - return( -
- {/*提示*/} - - - -
-

- - -

- - } -

+

{ @@ -433,152 +433,152 @@ class Sendresource extends Component{ (单个文件最大150M) :""} -

+

{/**/} {/*{this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{*/} - {/*debugger*/} - {/*return(*/} - {/*

*/} - {/**/} - {/**/} - {/**/} - {/**/} - {/*{item.name}*/} - {/**/} - {/**/} - {/*{item.response===undefined?"":isNaN(bytesToSize(item.filesize))?"":bytesToSize(item.filesize)}*/} - {/**/} - {/*this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}>*/} - {/*

*/} - {/*)*/} + {/*debugger*/} + {/*return(*/} + {/*

*/} + {/**/} + {/**/} + {/**/} + {/**/} + {/*{item.name}*/} + {/**/} + {/**/} + {/*{item.response===undefined?"":isNaN(bytesToSize(item.filesize))?"":bytesToSize(item.filesize)}*/} + {/**/} + {/*this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}>*/} + {/*

*/} + {/*)*/} {/*})}*/} - {newfileListtype===true&&this.state.fileListtype===false?

请先上传资源

:""} - - {/*

*/} - {/**/} - - {/*

*/} - {/*勾选后所有用户可见,否则仅课堂成员可见*/} - {/**/} - - {/*/!*{this.state.course_groups_count&&this.state.course_groups_count>0?*!/*/} - {/*/!*统一设置(选中则所有分班使用相同的发布设置,否则各个单独设置)*!/*/} - {/*/!*:""}*!/*/} - {/**/} - {/*
*/} - {/*{is_unified_setting===false?*/} - {/*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===course_group_publish_times.length-1&&key:""}*/} - {/*
*/} - {/*)*/} - {/*})*/} - - {/*:""}*/} - {/*
*/} - - {/*

*/} - - {is_unified_setting===true?

+ {newfileListtype===true&&this.state.fileListtype===false?

请先上传资源

:""} + +

+ + +

+ 勾选后所有用户可见,否则仅课堂成员可见 + + + {/*{this.state.course_groups_count&&this.state.course_groups_count>0?*/} + {/*统一设置(选中则所有分班使用相同的发布设置,否则各个单独设置)*/} + {/*:""}*/} + +
+ {is_unified_setting===false? + 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===course_group_publish_times.length-1&&key:""} +
+ ) + }) + + :""} +
+ +

+ + {is_unified_setting===true?

this.onChangeTimepublish(e,index,undefined,1)} - disabledTime={disabledDateTime} + dropdownClassName="hideDisable" + showTime={{ format: 'HH:mm' }} + locale={locale} + format={dateFormat} + placeholder="请选择发布时间" + id={"startime"} + showToday={false} + width={"210px"} + value={datatime===undefined||datatime===""?undefined:moment(datatime, dateFormat)} + onChange={(e,index)=>this.onChangeTimepublish(e,index,undefined,1)} + disabledTime={disabledDateTime} disabledDate={disabledDate} - /> + /> -

:""} - - {/*{course_group_publish_timestype===true?

请填写完整

:""}*/} - - {descriptiontype===true?

请输入资源描述,最大限制100个字符

:""} - - -
-
-
- ) - } +

:""} + + {/*{course_group_publish_timestype===true?

请填写完整

:""}*/} + + {descriptiontype===true?

请输入资源描述,最大限制100个字符

:""} + + +
+ + + ) + } } export default Sendresource; \ No newline at end of file From b335b20c483ca65932a1bc5b2ff1186377ec2856 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, 20 Aug 2019 18:19:07 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMIndexHOC.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index af3e228cd..1a6c38639 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -35,14 +35,14 @@ if (!window['indexHOCLoaded']) { // $('head').append($('') // .attr('href', `${_url_origin}/stylesheets/educoder/antd.min.css?1525440977`)); $('head').append($('') - .attr('href', `${_url_origin}/stylesheets/css/edu-common.css?8`)); + .attr('href', `${_url_origin}/stylesheets/css/edu-common.css?9`)); $('head').append($('') - .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?8`)); + .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?9`)); // index.html有加载 $('head').append($('') - .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?8`)); + .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?9`)); // $('head').append($('')