From d79067b3e68dc8af8cbb4ef32eeeaae93f71e643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 8 Jan 2020 19:26:47 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/shixunHomework/Trainingjobsetting.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index b0c20198d..97ac1a3ea 100644 --- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js +++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js @@ -555,11 +555,7 @@ class Trainingjobsetting extends Component { }) if(result.validate==false){ - - this.scrollToAnchor("publishtimeid"); - - this.props.showNotification(`分班发布设置不能为空`); return false; } let rulesdata = this.state.rulesdata; From f521ba53909c683b9044f164f39a90f822c7d5d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 8 Jan 2020 19:32:00 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tasks/GraduationTaskssettinglist.js | 49 ++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index 9fa993ea6..12c64adeb 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -51,6 +51,7 @@ class GraduationTaskssettinglist extends Component{ visibles:false, DownloadType:false, DownloadMessageval:undefined, + commentstate:null } } @@ -247,17 +248,21 @@ class GraduationTaskssettinglist extends Component{ if(listype===false){ this.setState({ teacher_comment:null, - loadingstate:true + loadingstate:true, + commentstate:null }) }else{ this.setState({ teacher_comment:list, - loadingstate:true + loadingstate:true, + commentstate:list.length===0?undefined:parseInt(list[0]), }) } - let newvalue=list.length===0?undefined:parseInt(list[0]) + let newvalue=list.length===0?undefined:parseInt(list[0]); + + this.seacthdata(newvalue, task_status, course_group, cross_comment, order, b_order, search,this.state.page); this.props.getsonar(newvalue, task_status, course_group, cross_comment, search) // if(list.length===key){ @@ -275,14 +280,14 @@ class GraduationTaskssettinglist extends Component{ funcross_comment=(e)=>{ - let {teacher_comment, task_status, course_group, order, b_order, search} = this.state; + let {teacher_comment, task_status, course_group, order, b_order, search,commentstate} = this.state; this.setState({ cross_comment:e.target.value===undefined||e.target.value===false?null:e.target.value, loadingstate:true }) this.seacthdata(teacher_comment, task_status, course_group, e.target.value===undefined||e.target.value===false?"":e.target.value, order, b_order, search,this.state.page); - this.props.getsonar(teacher_comment, task_status, course_group, e.target.value===undefined||e.target.value===false?"":e.target.value, search) + this.props.getsonar(commentstate, task_status, course_group, e.target.value===undefined||e.target.value===false?"":e.target.value, search) } inputSearchValue=(e)=>{ @@ -302,24 +307,24 @@ class GraduationTaskssettinglist extends Component{ searchValue=()=>{ - let {teacher_comment, task_status, course_group, cross_comment, order, b_order,search} = this.state; + let {teacher_comment, task_status, course_group, cross_comment, order, b_order,search,commentstate} = this.state; this.setState({ loadingstate:true }) this.seacthdata(teacher_comment, task_status, course_group, cross_comment, order, b_order, search,this.state.page); - this.props.getsonar(teacher_comment, task_status, course_group, cross_comment, search) + this.props.getsonar(commentstate, task_status, course_group, cross_comment, search) } funorder = (value, newb_order) => { - let {teacher_comment, task_status, course_group, cross_comment, b_order, search,order} = this.state; + let {teacher_comment, task_status, course_group, cross_comment, b_order, search,commentstate} = this.state; this.setState({ order: value, b_order: newb_order, loadingstate: true }) this.seacthdata(teacher_comment, task_status, course_group, cross_comment, value, newb_order, search,this.state.page); - this.props.getsonar(teacher_comment, task_status, course_group, cross_comment, search) + this.props.getsonar(commentstate, task_status, course_group, cross_comment, search) } @@ -327,7 +332,7 @@ class GraduationTaskssettinglist extends Component{ funtaskstatus=(checkedValues,key)=>{ // console.log(checkedValues) - let {teacher_comment, course_group, cross_comment, order, b_order, search} = this.state; + let {teacher_comment, course_group, cross_comment, order, b_order, search,commentstate} = this.state; @@ -340,7 +345,7 @@ class GraduationTaskssettinglist extends Component{ loadingstate:true }) this.seacthdata(teacher_comment, null, course_group, cross_comment, order, b_order, search,this.state.page); - this.props.getsonar(teacher_comment, null, course_group, cross_comment, search) + this.props.getsonar(commentstate, null, course_group, cross_comment, search) } // else if(checkedValues.length ===key){ // // 全部抖选中 自然就是查找全部 就是空 @@ -357,7 +362,7 @@ class GraduationTaskssettinglist extends Component{ loadingstate:true }) this.seacthdata(teacher_comment, checkedValues===key?undefined:checkedValues, course_group, cross_comment, order, b_order, search,this.state.page); - this.props.getsonar(teacher_comment, checkedValues===key?undefined:checkedValues, course_group, cross_comment, search) + this.props.getsonar(commentstate, checkedValues===key?undefined:checkedValues, course_group, cross_comment, search) } @@ -366,7 +371,7 @@ class GraduationTaskssettinglist extends Component{ // console.log(checkedValues); // console.log(key); - let {teacher_comment, task_status, cross_comment, order,b_order, search} = this.state; + let {teacher_comment, task_status, cross_comment, order,b_order, search,commentstate} = this.state; if(JSON.stringify(checkedValues) === "[]"){ // console.log(checkedValues); @@ -376,7 +381,7 @@ class GraduationTaskssettinglist extends Component{ loadingstate:true }) this.seacthdata(teacher_comment, task_status, null, cross_comment, order, b_order, search,this.state.page); - this.props.getsonar(teacher_comment,task_status, null, cross_comment, search) + this.props.getsonar(commentstate,task_status, null, cross_comment, search) } // else if(checkedValues.length ===key){ // // 全部抖选中 自然就是查找全部 就是空 @@ -394,7 +399,7 @@ class GraduationTaskssettinglist extends Component{ loadingstate:true }) this.seacthdata(teacher_comment, task_status, checkedValues===key?undefined:checkedValues, cross_comment, order, b_order, search,this.state.page); - this.props.getsonar(teacher_comment,task_status, checkedValues===key?undefined:checkedValues, cross_comment, search) + this.props.getsonar(commentstate,task_status, checkedValues===key?undefined:checkedValues, cross_comment, search) } @@ -575,7 +580,7 @@ class GraduationTaskssettinglist extends Component{ saveModulationModal=(value,num)=>{ - let{teacher_comment,task_status,course_group,cross_comment,order,b_order,search}=this.state; + let{teacher_comment,task_status,course_group,cross_comment,order,b_order,search,commentstate}=this.state; let {operationId}=this.state; // console.log(value,num) @@ -587,7 +592,7 @@ class GraduationTaskssettinglist extends Component{ // console.log(result) if(result.data.status===0){ this.seacthdata(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,this.state.page); - this.props.getsonar(teacher_comment,task_status, course_group, cross_comment, search) + this.props.getsonar(commentstate,task_status, course_group, cross_comment, search) this.props.showNotification(result.data.message); this.cancelmodel(); this.setState({ @@ -703,15 +708,15 @@ class GraduationTaskssettinglist extends Component{ this.setState({ page: pageNumber, }) - let{teacher_comment,task_status,course_group,cross_comment,order,b_order,search}=this.state; + let{teacher_comment,task_status,course_group,cross_comment,order,b_order,search,commentstate}=this.state; this.seacthdata(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,pageNumber); - this.props.getsonar(teacher_comment,task_status, course_group, cross_comment, search) + this.props.getsonar(commentstate,task_status, course_group, cross_comment, search) } /// 确认是否下载 confirmysl(url){ - let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search,page} =this.state; + let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search,commentstate} =this.state; let params ={ teacher_comment:teacher_comment, @@ -764,8 +769,8 @@ class GraduationTaskssettinglist extends Component{ } render(){ - let {coursename,coursesearch,taskname,taskid,taskslistdata,data,page,limit,teacher_comment,task_status,cross_comment,search,loadingstate, - order, course_group,Modalstype,Modalstopval,ModalCancel,ModalSave,modalname,Modulationtype,operationId,Allocationtype,visibles, + let { taskslistdata,data,page,limit,teacher_comment,task_status,cross_comment,search,loadingstate, + course_group,Modalstype,Modalstopval,ModalCancel,ModalSave,modalname,Modulationtype,Allocationtype,visibles, visible, Topval, Topvalright, From 9bc4c9bc8a68dd1763ace8726118d5ebbfe4c8b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 8 Jan 2020 19:58:41 +0800 Subject: [PATCH 03/17] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tasks/GraduationTaskssettinglist.js | 52 ++++++++++++------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index 12c64adeb..75d2a4481 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -89,13 +89,13 @@ class GraduationTaskssettinglist extends Component{ course_groupslist:[], checkAllValue:false }) - let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search} = this.state; - this.seacthdata(teacher_comment, task_status, course_group, cross_comment, order, b_order, search,this.state.page); + let {commentstate, task_status, course_group, cross_comment, order, b_order, search} = this.state; + this.seacthdata(commentstate, task_status, course_group, cross_comment, order, b_order, search,this.state.page); - this.props.getsonar(teacher_comment, task_status, course_group, cross_comment, search) + this.props.getsonar(commentstate, task_status, course_group, cross_comment, search) } - seacthdata=(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,pages)=>{ + seacthdata=(commentstate,task_status,course_group,cross_comment,order,b_order,search,pages)=>{ let{page,limit}=this.state; // console.log(teacher_comment,task_status,course_group,cross_comment,order,b_order,search) @@ -105,7 +105,7 @@ class GraduationTaskssettinglist extends Component{ //get 数组 axios.get(url,{ params: { - teacher_comment:teacher_comment===null?undefined:teacher_comment, + teacher_comment:commentstate===null||commentstate===undefined?undefined:commentstate, task_status:task_status===null?undefined:task_status, course_group:course_group===null?undefined:course_group, cross_comment:cross_comment===null?undefined:cross_comment, @@ -230,7 +230,8 @@ class GraduationTaskssettinglist extends Component{ } funteachercomment=(list,key)=> { - // console.log(e.target.value) + + let asum=undefined let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search} = this.state; if(this.state.teacher_comment!=null&&list.length>0){ if(this.state.teacher_comment.length>0){ @@ -252,19 +253,30 @@ class GraduationTaskssettinglist extends Component{ commentstate:null }) }else{ + + if(list.length>0){ + list.map((item,key)=>{ + if(key===0){ + asum=item; + } + }) + }else{ + asum=undefined + } this.setState({ teacher_comment:list, loadingstate:true, - commentstate:list.length===0?undefined:parseInt(list[0]), + commentstate:asum, }) } - let newvalue=list.length===0?undefined:parseInt(list[0]); + console.log(list) + console.log(asum) - this.seacthdata(newvalue, task_status, course_group, cross_comment, order, b_order, search,this.state.page); - this.props.getsonar(newvalue, task_status, course_group, cross_comment, search) + this.seacthdata(asum, task_status, course_group, cross_comment, order, b_order, search,this.state.page); + this.props.getsonar(asum, task_status, course_group, cross_comment, search) // if(list.length===key){ // this.seacthdata(undefined, task_status, course_group, cross_comment, order, b_order, search,this.state.page); // this.props.getsonar(undefined, task_status, course_group, cross_comment, search) @@ -286,7 +298,7 @@ class GraduationTaskssettinglist extends Component{ cross_comment:e.target.value===undefined||e.target.value===false?null:e.target.value, loadingstate:true }) - this.seacthdata(teacher_comment, task_status, course_group, e.target.value===undefined||e.target.value===false?"":e.target.value, order, b_order, search,this.state.page); + this.seacthdata(commentstate, task_status, course_group, e.target.value===undefined||e.target.value===false?"":e.target.value, order, b_order, search,this.state.page); this.props.getsonar(commentstate, task_status, course_group, e.target.value===undefined||e.target.value===false?"":e.target.value, search) } @@ -311,7 +323,7 @@ class GraduationTaskssettinglist extends Component{ this.setState({ loadingstate:true }) - this.seacthdata(teacher_comment, task_status, course_group, cross_comment, order, b_order, search,this.state.page); + this.seacthdata(commentstate, task_status, course_group, cross_comment, order, b_order, search,this.state.page); this.props.getsonar(commentstate, task_status, course_group, cross_comment, search) } @@ -323,7 +335,7 @@ class GraduationTaskssettinglist extends Component{ b_order: newb_order, loadingstate: true }) - this.seacthdata(teacher_comment, task_status, course_group, cross_comment, value, newb_order, search,this.state.page); + this.seacthdata(commentstate, task_status, course_group, cross_comment, value, newb_order, search,this.state.page); this.props.getsonar(commentstate, task_status, course_group, cross_comment, search) } @@ -344,7 +356,7 @@ class GraduationTaskssettinglist extends Component{ task_status:undefined, loadingstate:true }) - this.seacthdata(teacher_comment, null, course_group, cross_comment, order, b_order, search,this.state.page); + this.seacthdata(commentstate, null, course_group, cross_comment, order, b_order, search,this.state.page); this.props.getsonar(commentstate, null, course_group, cross_comment, search) } // else if(checkedValues.length ===key){ @@ -361,7 +373,7 @@ class GraduationTaskssettinglist extends Component{ task_status:checkedValues===key?null:checkedValues, loadingstate:true }) - this.seacthdata(teacher_comment, checkedValues===key?undefined:checkedValues, course_group, cross_comment, order, b_order, search,this.state.page); + this.seacthdata(commentstate, checkedValues===key?undefined:checkedValues, course_group, cross_comment, order, b_order, search,this.state.page); this.props.getsonar(commentstate, checkedValues===key?undefined:checkedValues, course_group, cross_comment, search) } @@ -380,7 +392,7 @@ class GraduationTaskssettinglist extends Component{ course_group:undefined, loadingstate:true }) - this.seacthdata(teacher_comment, task_status, null, cross_comment, order, b_order, search,this.state.page); + this.seacthdata(commentstate, task_status, null, cross_comment, order, b_order, search,this.state.page); this.props.getsonar(commentstate,task_status, null, cross_comment, search) } // else if(checkedValues.length ===key){ @@ -398,7 +410,7 @@ class GraduationTaskssettinglist extends Component{ course_group:checkedValues===key?null:checkedValues, loadingstate:true }) - this.seacthdata(teacher_comment, task_status, checkedValues===key?undefined:checkedValues, cross_comment, order, b_order, search,this.state.page); + this.seacthdata(commentstate, task_status, checkedValues===key?undefined:checkedValues, cross_comment, order, b_order, search,this.state.page); this.props.getsonar(commentstate,task_status, checkedValues===key?undefined:checkedValues, cross_comment, search) } @@ -591,7 +603,7 @@ class GraduationTaskssettinglist extends Component{ }).then((result)=>{ // console.log(result) if(result.data.status===0){ - this.seacthdata(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,this.state.page); + this.seacthdata(commentstate,task_status,course_group,cross_comment,order,b_order,search,this.state.page); this.props.getsonar(commentstate,task_status, course_group, cross_comment, search) this.props.showNotification(result.data.message); this.cancelmodel(); @@ -709,7 +721,7 @@ class GraduationTaskssettinglist extends Component{ page: pageNumber, }) let{teacher_comment,task_status,course_group,cross_comment,order,b_order,search,commentstate}=this.state; - this.seacthdata(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,pageNumber); + this.seacthdata(commentstate,task_status,course_group,cross_comment,order,b_order,search,pageNumber); this.props.getsonar(commentstate,task_status, course_group, cross_comment, search) } @@ -719,7 +731,7 @@ class GraduationTaskssettinglist extends Component{ let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search,commentstate} =this.state; let params ={ - teacher_comment:teacher_comment, + teacher_comment:commentstate, task_status:task_status, course_group:course_group, cross_comment:cross_comment, From 78f68f89553d8f58b9f37f08b10f4b33faf18f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 8 Jan 2020 20:05:54 +0800 Subject: [PATCH 04/17] =?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/graduation/tasks/GraduationTaskssettinglist.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index 75d2a4481..c00542233 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -270,11 +270,6 @@ class GraduationTaskssettinglist extends Component{ }) } - - - console.log(list) - console.log(asum) - this.seacthdata(asum, task_status, course_group, cross_comment, order, b_order, search,this.state.page); this.props.getsonar(asum, task_status, course_group, cross_comment, search) // if(list.length===key){ From b3d970cfaf1a2ac9416d0c5cedee126505e62bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 8 Jan 2020 20:29:00 +0800 Subject: [PATCH 05/17] =?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/coursesDetail/CoursesLeftNav.js | 10 ++++++---- .../modules/courses/exercise/Exercisesetting.js | 17 ++++++++++------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js index 16e8a1576..c37b45c84 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js @@ -530,20 +530,22 @@ class Coursesleftnav extends Component{ {name:value}).then((result)=>{ if(result!=undefined){ if(result.data.status===0){ - // window.location.reload() - // this.updasaveNavmoda() - // + notification.open({ message:"提示", description:result.data.message }); - trigger('updateNavSuccess') + if(positiontype==="files"){ + this.updasaveNavmoda() + trigger('updateNavSuccess') window.location.href=`/courses/${coursesId}/file/${result.data.category_id}`; } if(positiontype==="boards"){ + this.updasaveNavmoda() + trigger('updateNavSuccess') window.location.href=`/courses/${coursesId}/boards/${result.data.category_id}`; } diff --git a/public/react/src/modules/courses/exercise/Exercisesetting.js b/public/react/src/modules/courses/exercise/Exercisesetting.js index b58f1c4e5..0230c9bc7 100644 --- a/public/react/src/modules/courses/exercise/Exercisesetting.js +++ b/public/react/src/modules/courses/exercise/Exercisesetting.js @@ -131,8 +131,11 @@ class Exercisesetting extends Component{ // } // 已有设置数据的查询 - getSettingInfo=()=>{ - this.props.Commonheadofthetestpapers() + getSettingInfo=(type)=>{ + if(type!=1){ + this.props.Commonheadofthetestpapers() + } + let Id=this.props.match.params.Id; let url=`/exercises/${Id}/exercise_setting.json`; axios.get(url).then((result)=>{ @@ -241,10 +244,10 @@ class Exercisesetting extends Component{ let{unified_setting}=this.state if(unified_setting==true){ console.log("统一设置"); - this.UnifiedSetting(); + this.UnifiedSetting( ); }else{ console.log("非统一设置"); - this.NotUnifiedSetting(); + this.NotUnifiedSetting( ); } } }) @@ -347,7 +350,7 @@ class Exercisesetting extends Component{ console.log(result) if(result.status==200){ this.props.showNotification(`${result.data.message}`); - this.getSettingInfo(); + this.getSettingInfo(1); this.cancelEdit(); } }) @@ -367,7 +370,7 @@ class Exercisesetting extends Component{ if(result.status==200){ this.props.showNotification(`${result.data.message}`); this.cancelEdit(); - this.getSettingInfo(); + this.getSettingInfo(1); } }); @@ -559,7 +562,7 @@ class Exercisesetting extends Component{ } //取消编辑 cancelEdit=()=>{ - this.getSettingInfo(); + this.getSettingInfo(1); this.setState({ flagPageEdit:false }) From 4ab06d8083beb5c215866b191949d1d6ed746ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 8 Jan 2020 20:38:21 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/exercise/ExerciseListItem.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/courses/exercise/ExerciseListItem.js b/public/react/src/modules/courses/exercise/ExerciseListItem.js index 72b5e579f..8bb42b042 100644 --- a/public/react/src/modules/courses/exercise/ExerciseListItem.js +++ b/public/react/src/modules/courses/exercise/ExerciseListItem.js @@ -188,7 +188,7 @@ class ExerciseListItem extends Component{ - { IsAdmin &&
+ { IsAdmin &&
this.toDetailPage(`/courses/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情 编辑 设置 @@ -215,18 +215,18 @@ class ExerciseListItem extends Component{ { IsStudent && -
+
  • this.toDetailPage(`/courses/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情
  • {item.current_status ===0&&item.exercise_status>1?
  • 继续答题
  • : item.current_status ===1&&item.exercise_status>1?
  • 查看答题
  • : - item.current_status ===2&&item.exercise_status>1?
  • this.setgameexercise(`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`)}>开始答题
  • :""} + item.current_status ===2&&item.exercise_status>1?
  • this.setgameexercise(`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`)}>开始答题
  • :""}
    } { this.props.isNotMember()? item.lock_status === 0 ? "" - :
    + :
  • this.toDetailPage(`/courses/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情
  • :"" } From 5d9552ec9802fe5b4ff61b48102e59b51d854869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 9 Jan 2020 10:08:32 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E9=A2=98=E7=9B=AE=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E9=9D=9E=E5=BF=85=E5=A1=AB=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../question/component/ChoquesEditor.js | 8 ++-- .../question/component/Itembankstop.js | 42 +++++++++++++------ .../question/component/JudquestionEditor.js | 10 ++--- .../question/component/SingleEditor.js | 8 ++-- 4 files changed, 43 insertions(+), 25 deletions(-) diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index 383ad1a86..e1b1183f0 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -149,10 +149,10 @@ class ChoquesEditor extends Component{ this.props.showNotification('多选题最小正确选项为2个'); return editordata; } - if(!question_titlesysl) { - this.props.showNotification('请您输入题目解析'); - return editordata; - } + // if(!question_titlesysl) { + // this.props.showNotification('请您输入题目解析'); + // return editordata; + // } /** { "question_title":"同学朋友间常用的沟通工具是什么?", diff --git a/public/react/src/modules/question/component/Itembankstop.js b/public/react/src/modules/question/component/Itembankstop.js index 576dbb42d..c0cf0055b 100644 --- a/public/react/src/modules/question/component/Itembankstop.js +++ b/public/react/src/modules/question/component/Itembankstop.js @@ -556,19 +556,37 @@ class Itembankstop extends Component { id: result.data.tag_discipline_id, name:value, } - this.state.knowledgepoints.push(leydata); - const _result =[]; - this.state.knowledgepoints.filter(item => { - if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) { - _result.push(item); - } - }); - this.setState({ - Knowpoints: this.state.Knowpoints, - knowledgepoints: this.state.knowledgepoints, - knowledgepoints2: _result, - }) + if(this.state.Knowpoints.length>=5){ + this.state.knowledgepoints.push(leydata); + const _result =[]; + this.state.knowledgepoints.filter(item => { + if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) { + _result.push(item); + } + }); + + this.setState({ + Knowpoints: this.state.Knowpoints, + knowledgepoints: this.state.knowledgepoints, + knowledgepoints2: _result, + }) + }else{ + this.state.Knowpoints.push(leydata); + this.state.knowledgepoints.push(leydata); + const _result =[]; + this.state.knowledgepoints.filter(item => { + if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) { + _result.push(item); + } + }); + this.setState({ + Knowpoints: this.state.Knowpoints, + knowledgepoints: this.state.knowledgepoints, + knowledgepoints2: _result, + }) + } + } }).catch((error) => { //console.log(error); diff --git a/public/react/src/modules/question/component/JudquestionEditor.js b/public/react/src/modules/question/component/JudquestionEditor.js index 951b37894..56c1f5017 100644 --- a/public/react/src/modules/question/component/JudquestionEditor.js +++ b/public/react/src/modules/question/component/JudquestionEditor.js @@ -119,11 +119,11 @@ class JudquestionEditor extends Component{ - - if(!question_titlesysl) { - this.props.showNotification('请您输入题目解析'); - return editordata; - } + // + // if(!question_titlesysl) { + // this.props.showNotification('请您输入题目解析'); + // return editordata; + // } /** { "question_title":"同学朋友间常用的沟通工具是什么?", diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index cdb2ef9b6..f050488bf 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -157,10 +157,10 @@ class SingleEditor extends Component{ - if(!question_titlesysl) { - this.props.showNotification('请您输入题目解析'); - return editordata; - } + // if(!question_titlesysl) { + // this.props.showNotification('请您输入题目解析'); + // return editordata; + // } /** { "question_title":"同学朋友间常用的沟通工具是什么?", From 8ad855a80d08b16c05a53f16e88994dd4922b9be Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 9 Jan 2020 10:16:54 +0800 Subject: [PATCH 08/17] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=99=BA=E8=83=BD?= =?UTF-8?q?=E7=BB=84=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ination_intelligent_settings_controller.rb | 15 +++++++- .../save_exam_form.rb | 12 ++++++ .../save_examination_service.rb | 38 +++++++++++++++++++ config/routes.rb | 1 + .../20200109021528_add_intelligent_to_exam.rb | 5 +++ 5 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 app/forms/examination_intelligent_settings/save_exam_form.rb create mode 100644 app/services/examination_intelligent_settings/save_examination_service.rb create mode 100644 db/migrate/20200109021528_add_intelligent_to_exam.rb diff --git a/app/controllers/examination_intelligent_settings_controller.rb b/app/controllers/examination_intelligent_settings_controller.rb index 13d412da8..f4dcc1535 100644 --- a/app/controllers/examination_intelligent_settings_controller.rb +++ b/app/controllers/examination_intelligent_settings_controller.rb @@ -1,6 +1,6 @@ class ExaminationIntelligentSettingsController < ApplicationController before_action :require_login - before_action :find_exam, only: [:exchange_one_item, :exchange_items] + before_action :find_exam, only: [:exchange_one_item, :exchange_items, :save_exam] def optinal_items sub_discipline_id = params[:sub_discipline_id] @@ -26,6 +26,15 @@ class ExaminationIntelligentSettingsController < ApplicationController render_error(ex.message) end + def save_exam + new_exam = ExaminationBank.new(user: current_user) + # 保存试卷基础信息 + ExaminationIntelligentSettings::SaveExaminationService.call(new_exam, save_params, @exam) + render_ok + rescue ApplicationService::Error => ex + render_error(ex.message) + end + def exchange_one_item item = @exam.item_baskets.find_by!(id: params[:item_id]) exam_type_setting = @exam.examination_type_settings.find_by!(item_type: item.item_type) @@ -86,4 +95,8 @@ class ExaminationIntelligentSettingsController < ApplicationController def form_params params.permit(:discipline_id, :sub_discipline_id, :difficulty, :source, tag_discipline_id: [], question_settings: %i[item_type count]) end + + def save_params + params.permit(:name, :duration) + end end \ No newline at end of file diff --git a/app/forms/examination_intelligent_settings/save_exam_form.rb b/app/forms/examination_intelligent_settings/save_exam_form.rb new file mode 100644 index 000000000..ec4f17ad7 --- /dev/null +++ b/app/forms/examination_intelligent_settings/save_exam_form.rb @@ -0,0 +1,12 @@ +class ExaminationIntelligentSettings::SaveExamForm + include ActiveModel::Model + + attr_accessor :name, :duration + + validates :name, presence: true, length: { maximum: 60 } + validate :validate_duration + + def validate_duration + raise '时长应为大于0的整数' if duration.present? && duration.to_i < 1 + end +end \ No newline at end of file diff --git a/app/services/examination_intelligent_settings/save_examination_service.rb b/app/services/examination_intelligent_settings/save_examination_service.rb new file mode 100644 index 000000000..d6f5e7406 --- /dev/null +++ b/app/services/examination_intelligent_settings/save_examination_service.rb @@ -0,0 +1,38 @@ +class ExaminationIntelligentSettings::SaveExaminationService < ApplicationService + attr_reader :exam, :params, :exam_setting + + def initialize(exam, params, exam_setting) + @exam = exam + @params = params + @exam_setting = exam_setting + end + + def call + ExaminationIntelligentSettings::SaveExamForm.new(params).validate! + + ActiveRecord::Base.transaction do + exam.name = params[:name].to_s.strip + exam.difficulty = exam_setting.difficulty + exam.duration = params[:duration].present? ? params[:duration].to_i : nil + exam.sub_discipline_id = exam_setting.sub_discipline_id + exam.intelligent = 1 + exam.save! + + # 知识点的创建 + exam_setting.tag_discipline_containers.each do |tag| + exam.tag_discipline_containers << TagDisciplineContainer.new(tag_discipline_id: tag.tag_discipline_id) + end + + # 试题的复制 + exam_setting.item_baskets.includes(:item_bank).each do |basket| + item = basket.item_bank + if item.present? + new_item = ExaminationItem.new + new_item.new_item(item, exam, basket.score, basket.position) + end + end + + exam_setting.destroy! + end + end +end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 225909f8e..a63776d44 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -102,6 +102,7 @@ Rails.application.routes.draw do end member do + post :save_exam post :exchange_one_item post :exchange_items end diff --git a/db/migrate/20200109021528_add_intelligent_to_exam.rb b/db/migrate/20200109021528_add_intelligent_to_exam.rb new file mode 100644 index 000000000..fa4b16dd1 --- /dev/null +++ b/db/migrate/20200109021528_add_intelligent_to_exam.rb @@ -0,0 +1,5 @@ +class AddIntelligentToExam < ActiveRecord::Migration[5.2] + def change + add_column :examination_banks, :intelligent, :boolean, default: false + end +end From 32e6ff7f23e9e979ec54aba873e2e0572d0b8f2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 9 Jan 2020 10:56:46 +0800 Subject: [PATCH 09/17] =?UTF-8?q?=E9=A2=98=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../question/component/ChoquesEditor.js | 4 + .../question/component/Itembankstop.js | 32 +- .../question/component/JudquestionEditor.js | 2 + .../question/component/Newknledpots.js | 12 +- .../question/component/SingleEditor.js | 4 + .../comthetestpaper/Comthetestpapers.js | 656 ------------------ .../comthetestpaper/Comthetestpaperst.js | 66 +- .../question/questioncss/questioncom.css | 5 + 8 files changed, 107 insertions(+), 674 deletions(-) delete mode 100644 public/react/src/modules/question/comthetestpaper/Comthetestpapers.js diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index e1b1183f0..8f07937ae 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -365,6 +365,7 @@ class ChoquesEditor extends Component{

    :
    { + this.setState({ + boolred:bool + }) + + } + //初始化 componentDidMount() { @@ -532,14 +541,31 @@ class Itembankstop extends Component { } NewknTypedeltyoedel=(value)=>{ + var knowledgepointmys= this.state.knowledgepoints; + var konwbool=null; + for(let myda of knowledgepointmys) { + if(myda.name===value){ + konwbool="yes" + break; + } + } + if(konwbool!=null){ + this.props.showNotification(`重复的知识点`); + this.setboolred(true); + return + } + + if(value===null||value===""){ this.props.showNotification(`请输入知识点`); + this.setboolred(true); return } if(value.length===0){ this.props.showNotification(`请输入知识点`); + this.setboolred(true); return } @@ -643,6 +669,8 @@ class Itembankstop extends Component { { NewknTypedel? this.setboolred(bool)} NewknTypedeldel={(bool)=>this.NewknTypedeldel(bool)} NewknTypedeltyoedel={(value)=>this.NewknTypedeltyoedel(value)} > diff --git a/public/react/src/modules/question/component/JudquestionEditor.js b/public/react/src/modules/question/component/JudquestionEditor.js index 56c1f5017..a48bef60a 100644 --- a/public/react/src/modules/question/component/JudquestionEditor.js +++ b/public/react/src/modules/question/component/JudquestionEditor.js @@ -377,6 +377,7 @@ class JudquestionEditor extends Component{

    { + console.log("失去焦点了"); + } + + inputOnFocus=(e)=>{ + console.log("获取焦点"); + } render() { @@ -51,8 +59,8 @@ class PaperDeletModel extends Component { width="442px" >
    -
    - +
    +
    this.props.NewknTypedeldel(false)}>取消 diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index f050488bf..591646aad 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -389,6 +389,7 @@ class SingleEditor extends Component{

    :
    { - this.setState({ - rbkc:[name.id,title.id] - }) - this.props.form.setFieldsValue({ - rbkc: [name.id,title.id], - }); - - if(this.props.item_banksedit.tag_disciplines.length===0){ - const didata = this.props.disciplinesdata; - const knowledgepointsdata = []; - - for (var i = 0; i < didata.length; i++) { - //方向 - if (name.id === didata[i].id) { - const fxdidata = didata[i].sub_disciplines; - for (var j = 0; j < fxdidata.length; j++) { - //课程 - if (title.id === fxdidata[j].id) { - const zsddata = fxdidata[j].tag_disciplines; - for (var k = 0; k < zsddata.length; k++) { - //知识点 - knowledgepointsdata.push(zsddata[k]); - - - } - - } - - } - } - - - } - - this.setState({ - Knowpoints: [], - knowledgepoints: knowledgepointsdata, - }) - - } - - - - - - - - - - - } - handletag_disciplinesChange = (data) => { - try { - var sju=data[data.length-1].name; - this.setState({ - rbzsd:sju, - Knowpoints:data, - }) - this.props.form.setFieldsValue({ - rbzsd: sju, - }); - }catch (e) { - - } - } - onChange = (e) => { - - } - Getdatas = () => { - return this.handleSubmits(); - } - handleSubmits = () => { - var data = []; - this.props.form.validateFields((err, values) => { - data = []; - if (!err) { - data.push({ - rbnd: parseInt(values.rbnd) - }) - data.push({ - rbtx: values.rbtx - }) - data.push({ - rbzsd: this.state.Knowpoints - }) - data.push({ - rbkc: values.rbkc - }) - data.push({ - classroom:values.classroom - }) - data.push({ - kssc:values.kssc - }) - - } - }); - - return data; - - } - handleSubmit = (e) => { - e.preventDefault(); - this.props.form.validateFields((err, values) => { - if (!err) { - ////console.log("获取的form 数据"); - ////console.log(values); - - } - - - }); - } - - handleFormLayoutChange = (value) => { - //难度塞选 - ////console.log("难度塞选"); - ////console.log(value); - this.props.form.setFieldsValue({ - rbnd: value + "", - }); - this.setState({ - rbnd: value + "", - }) - - } - handleFormkechen = (value) => { - //课程 - ////console.log("课程"); - ////console.log(value); - var valuename = undefined; - this.props.form.setFieldsValue({ - rbzsd: value, - }); - - var arr = this.state.knowledgepoints; - for (let data of arr) { - if (data.id === value) { - this.state.Knowpoints.push(data); - valuename = data.name; - } - } - - var tmp = JSON.parse(JSON.stringify(this.state.knowledgepoints)); - for (var i = 0; i < tmp.length; i++) { - if (tmp[i].id === value) { - this.state.knowledgepoints.splice(i, 1); - } - } - - this.setState({ - rbzsd: valuename, - Knowpoints: this.state.Knowpoints, - knowledgepoints: this.state.knowledgepoints, - }) - - } - - handleFormzhishidian = (value) => { - console.log("handleFormzhishidian 课程"); - console.log(value); - - //课程 - this.props.form.setFieldsValue({ - rbkc: value, - }); - this.setState({ - rbkc:value, - }) - // console.log("handleFormzhishidian"); - // console.log(this.props.disciplinesdata); - - const didata = this.props.disciplinesdata; - const knowledgepointsdata = []; - - for (var i = 0; i < didata.length; i++) { - //方向 - if (value[0] === didata[i].id) { - const fxdidata = didata[i].sub_disciplines; - for (var j = 0; j < fxdidata.length; j++) { - //课程 - if (value[1] === fxdidata[j].id) { - const zsddata = fxdidata[j].tag_disciplines; - for (var k = 0; k < zsddata.length; k++) { - //知识点 - knowledgepointsdata.push(zsddata[k]); - - - } - - } - - } - } - - - } - - this.setState({ - Knowpoints: [], - knowledgepoints: knowledgepointsdata, - }) - - this.props.form.setFieldsValue({ - rbzsd: undefined, - }); - this.setState({ - rbzsd: undefined, - }) - } - - handleFormtixing = (value) => { - //题型 - //console.log("题型"); - //console.log(value); - this.setState({ - rbtx: value + "", - }) - this.props.form.setFieldsValue({ - rbtx: value + "", - }); - this.props.setitem_type(value); - } - preventDefault = (e) => { - e.preventDefault(); - ////console.log('Clicked! But prevent default.'); - } - deletesobject = (item, index) => { - var arr = this.state.Knowpoints; - for (let data of arr) { - if (data.id === item.id) { - this.state.knowledgepoints.push(data); - } - } - - - var tmp = JSON.parse(JSON.stringify(this.state.Knowpoints)); - for (var i = 0; i < tmp.length; i++) { - if (i >= index) { - var pos = this.state.Knowpoints.indexOf(tmp[i]); - this.state.Knowpoints.splice(pos, 1); - } - } - - this.props.form.setFieldsValue({ - rbzsd: this.state.Knowpoints, - }); - - - this.setState({ - Knowpoints: this.state.Knowpoints, - }) - - if (this.state.Knowpoints.length === 0) { - this.setState({ - rbzsd: undefined, - }) - } else if (this.state.Knowpoints.length > 0) { - try { - const myknowda = this.state.Knowpoints; - this.setState({ - rbzsd: myknowda[this.state.Knowpoints.length - 1].name, - }) - } catch (e) { - - } - - } - - } - handleSearch=(value)=>{ - - - if(value!=""){ - this.props.form.setFieldsValue({ - classroom:value, - // course:value - }); - // this.Searchvalue(value) - } - - }; - - handleChange=(e)=>{ - console.log(e); - this.props.form.setFieldsValue({ - // course:value, - classroom:e.target.value, - }) - if(e.target.value){ - if(e.target.value.length>60){ - this.setState({ - bordebool:true, - }) - }else if(e.target.value.length===0){ - this.setState({ - bordebool:true, - }) - }else{ - this.setState({ - bordebool:false, - }) - } - }else{ - this.setState({ - bordebool:true - }) - - } - - }; - - render() { - let {page,options} = this.state; - const {getFieldDecorator} = this.props.form; - const optionss = this.state.searchlist && this.state.searchlist.map(d => ); - var addonAfterthree=this.props.form&&this.props.form.getFieldValue('classroom'); - var addonAfteronelens3=0; - if(addonAfterthree){ - addonAfteronelens3=String(addonAfterthree).length; - } - - return ( - -
    - -
    -
    -
    - - {getFieldDecorator("rbkc", - { - rules: [{required: true, message: '请选择课程'}], - } - )( -
    - - - -
    - )} -
    -
    - -
    - - {getFieldDecorator("rbzsd" - )( -
    - - - -
    - - {this.state.Knowpoints === undefined ? "" : this.state.Knowpoints.map((object, index) => { - return ( -
    -

    {object.name}

    - this.deletesobject(object, index)}> -
    - ) - })} - -
    -
    - )} -
    -
    - -
    - -
    - - {getFieldDecorator('classroom', { - rules: [{required: true, message: "不能为空"}], - })( - - - - - )} -
    -
    -
    - -
    - -
    - - - {getFieldDecorator('kssc')()} - 分钟 - -
    - {/*
    */} - {/**/} - {/* {getFieldDecorator("rbtx",*/} - {/* {*/} - {/* rules: [{required: true, message: '请选择题型'}],*/} - {/* }*/} - {/* )(*/} - {/* */} - {/* */} - {/* */} - {/* )}*/} - {/**/} - {/*
    */} - - -
    - - {getFieldDecorator('rbnd', - { - rules: [{required: true, message: '请选择难度'}], - } - )( - - 简单 - 适中 - 困难 - , - )} - -
    - -
    -
    -
    - ) - - } - - -} - -const Comthetestpaperss = Form.create({name: 'Itembankstops'})(Comthetestpapers); -export default Comthetestpaperss; diff --git a/public/react/src/modules/question/comthetestpaper/Comthetestpaperst.js b/public/react/src/modules/question/comthetestpaper/Comthetestpaperst.js index 88d5b9725..e6aa5f987 100644 --- a/public/react/src/modules/question/comthetestpaper/Comthetestpaperst.js +++ b/public/react/src/modules/question/comthetestpaper/Comthetestpaperst.js @@ -41,7 +41,7 @@ const options = [ ], }, ]; - +//Itembankstop 题库的 class Comthetestpaperst extends Component { constructor(props) { super(props); @@ -54,10 +54,16 @@ class Comthetestpaperst extends Component { knowledgepoints: [], knowledgepoints2:[], options: [], - NewknTypedel:false + NewknTypedel:false, + boolred:false, } } + setboolred=(bool)=>{ + this.setState({ + boolred:bool + }) + } //初始化 componentDidMount() { try { @@ -495,19 +501,32 @@ class Comthetestpaperst extends Component { } NewknTypedeltyoedel=(value)=>{ + var knowledgepointmys= this.state.knowledgepoints; + for(let myda of knowledgepointmys) { + if(myda.name===value){ + this.props.showNotification(`重复的知识点`); + this.setboolred(true); + break; + } + } if(value===null||value===""){ this.props.showNotification(`请输入知识点`); + this.setboolred(true); + return } if(value.length===0){ this.props.showNotification(`请输入知识点`); + this.setboolred(true); + return } if(this.state.rbkc===undefined || this.state.rbkc===null || this.state.rbkc===""){ this.props.showNotification(`请选择课程方向`); + this.setboolred(true); return; } var data={ @@ -523,19 +542,36 @@ class Comthetestpaperst extends Component { id: result.data.tag_discipline_id, name:value, } - this.state.knowledgepoints.push(leydata); - const _result =[]; - this.state.knowledgepoints.filter(item => { - if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) { - _result.push(item); - } - }); - this.setState({ - Knowpoints: this.state.Knowpoints, - knowledgepoints: this.state.knowledgepoints, - knowledgepoints2: _result, - }) + if(this.state.Knowpoints.length>=5){ + this.state.knowledgepoints.push(leydata); + const _result =[]; + this.state.knowledgepoints.filter(item => { + if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) { + _result.push(item); + } + }); + + this.setState({ + Knowpoints: this.state.Knowpoints, + knowledgepoints: this.state.knowledgepoints, + knowledgepoints2: _result, + }) + }else{ + this.state.Knowpoints.push(leydata); + this.state.knowledgepoints.push(leydata); + const _result =[]; + this.state.knowledgepoints.filter(item => { + if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) { + _result.push(item); + } + }); + this.setState({ + Knowpoints: this.state.Knowpoints, + knowledgepoints: this.state.knowledgepoints, + knowledgepoints2: _result, + }) + } } }).catch((error) => { //console.log(error); @@ -609,6 +645,8 @@ class Comthetestpaperst extends Component { { NewknTypedel? this.setboolred(bool)} NewknTypedeldel={(bool)=>this.NewknTypedeldel(bool)} NewknTypedeltyoedel={(value)=>this.NewknTypedeltyoedel(value)} > diff --git a/public/react/src/modules/question/questioncss/questioncom.css b/public/react/src/modules/question/questioncss/questioncom.css index 0326f25fd..d792453d3 100644 --- a/public/react/src/modules/question/questioncss/questioncom.css +++ b/public/react/src/modules/question/questioncss/questioncom.css @@ -961,3 +961,8 @@ .mb20{ margin-bottom: 20px; } + +.inpustred .ant-input{ + border: 1px solid #f30707; + border-radius: 5px; +} From 22fbb8089b47137bbeeb8f197449bd9eeb8b5453 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 9 Jan 2020 10:57:36 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=E8=AF=95=E9=A2=98=E5=92=8C=E8=AF=95?= =?UTF-8?q?=E5=8D=B7=E5=88=A0=E9=99=A4=E6=97=B6=E5=88=A0=E6=8E=89=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/examination_banks_controller.rb | 7 +++++-- app/controllers/item_banks_controller.rb | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/controllers/examination_banks_controller.rb b/app/controllers/examination_banks_controller.rb index ef545e06e..7c1f950f3 100644 --- a/app/controllers/examination_banks_controller.rb +++ b/app/controllers/examination_banks_controller.rb @@ -50,8 +50,11 @@ class ExaminationBanksController < ApplicationController end def destroy - @exam.destroy! - render_ok + ActiveRecord::Base.transaction do + ApplyAction.where(container_type: "ExaminationBank", container_id: @exam.id).destroy_all + @exam.destroy! + render_ok + end end def set_public diff --git a/app/controllers/item_banks_controller.rb b/app/controllers/item_banks_controller.rb index 8b77e3e9a..221e754a4 100644 --- a/app/controllers/item_banks_controller.rb +++ b/app/controllers/item_banks_controller.rb @@ -31,8 +31,11 @@ class ItemBanksController < ApplicationController end def destroy - @item.destroy! - render_ok + ActiveRecord::Base.transaction do + ApplyAction.where(container_type: "ItemBank", container_id: @item.id).destroy_all + @item.destroy! + render_ok + end end def set_public From 25cfbf41f6d80adbdd498d3fc601f610e5ebe661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 9 Jan 2020 11:02:40 +0800 Subject: [PATCH 11/17] =?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/question/component/SingleEditor.js | 1 - 1 file changed, 1 deletion(-) diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index 591646aad..fc8549a7b 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -396,7 +396,6 @@ class SingleEditor extends Component{ options={['code-block', 'image', 'formula']} value={question_title} onContentChange={this.onContentChange} - />
    From 9d7b1aaf6c18aa61b56b435bbe3bb9564429bd4e Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Thu, 9 Jan 2020 11:05:06 +0800 Subject: [PATCH 12/17] update quill --- .../react/src/common/quillForEditor/README.md | 4 +- .../react/src/common/quillForEditor/index.js | 57 +++++++++++++++++-- .../newOrEditTask/leftpane/editorTab/index.js | 4 +- 3 files changed, 58 insertions(+), 7 deletions(-) diff --git a/public/react/src/common/quillForEditor/README.md b/public/react/src/common/quillForEditor/README.md index 0369164c7..75b403590 100644 --- a/public/react/src/common/quillForEditor/README.md +++ b/public/react/src/common/quillForEditor/README.md @@ -4,7 +4,7 @@ * @Github: * @Date: 2020-01-06 16:20:03 * @LastEditors : tangjiang - * @LastEditTime : 2020-01-06 17:13:19 + * @LastEditTime : 2020-01-09 09:45:29 --> ## QuillForEditor 使用 [https://quilljs.com/] @@ -21,7 +21,7 @@ | autoFocus | 自动获得焦点 | | options | 配置参数, 指定工具栏内容 | | value | 文本编辑器内容 | - | imgAttrs | 指定上传图片的尺寸 | + | imgAttrs | 指定上传图片的尺寸 { width: 'xxpx}, height: 'xxpx'| | style | 指定quill容器样式 | | wrapStyle | 指定包裹quill容器的样式| | onContentChange | 当编辑器内容变化时调用此回调函数(注: 此时返回的内容为对象,提交到后台时需要格式成 JSON 字符串: JSON.stringify(xx)) | diff --git a/public/react/src/common/quillForEditor/index.js b/public/react/src/common/quillForEditor/index.js index 326ca21ae..2cded3fc3 100644 --- a/public/react/src/common/quillForEditor/index.js +++ b/public/react/src/common/quillForEditor/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-12-18 08:49:30 * @LastEditors : tangjiang - * @LastEditTime : 2020-01-06 16:45:50 + * @LastEditTime : 2020-01-09 11:01:51 */ import './index.scss'; import 'quill/dist/quill.core.css'; // 核心样式 @@ -18,11 +18,12 @@ import deepEqual from './deepEqual.js' import { fetchUploadImage } from '../../services/ojService.js'; import { getImageUrl } from 'educoder' import ImageBlot from './ImageBlot'; +import { Modal } from 'antd'; // import Toolbar from 'quill/modules/toolbar'; import FillBlot from './FillBlot'; const Size = Quill.import('attributors/style/size'); const Font = Quill.import('formats/font'); - +const { confirm } = Modal; // const Color = Quill.import('attributes/style/color'); Size.whitelist = ['12px', '14px', '16px', '18px', '20px', false]; Font.whitelist = ['SimSun', 'SimHei','Microsoft-YaHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif']; @@ -36,6 +37,7 @@ Quill.register(Font, true); Quill.register(FillBlot); // Quill.register(Color); + function QuillForEditor ({ placeholder, readOnly, @@ -79,10 +81,44 @@ function QuillForEditor ({ const renderOptions = options || defaultConfig; + const bindings = { + tab: { + key: 9, + handler: function () { + console.log('调用了tab=====>>>>'); + } + }, + enter: { + key: 'Enter', + handler: function () { + console.log('enter====>>>>>>'); + } + }, + backspace: { + key: 'Backspace', + handler: function (range, context) { + console.log('调用了删除按钮', range, context); + // 1. 获取删除的文件 + // 2. 判断删除的文件中包含空格的个数 + // 3. 循环调用删除方法 + const r = window.confirm('确定要删除吗?') + console.log('+++++', quill); + if (r) { + // 调用传入的删除事件 + return true + } else { + return false; + } + } + } + }; // quill 配置信息 const quillOption = { modules: { - toolbar: renderOptions + toolbar: renderOptions, + keyboard: { + bindings: bindings + } // toolbar: { // container: renderOptions // } @@ -98,8 +134,14 @@ function QuillForEditor ({ const quillNode = document.createElement('div'); editorRef.current.appendChild(quillNode); const _quill = new Quill(editorRef.current, quillOption); - setQuill(_quill); + // _quill.keyboard.addBinding({ + // key: 'tab' + // }, function (range, context) { + // console.log('点击了键盘的删除按钮: ', range, context); + // }); + + setQuill(_quill); // 处理图片上传功能 _quill.getModule('toolbar').addHandler('image', (e) => { const input = document.createElement('input'); @@ -142,6 +184,12 @@ function QuillForEditor ({ // 点击填空图标时,插入一个下划线 // 1. 获取编辑器内容 }); + + // TODO + /** + * 1.获取键盘删除事件 + * 2.点击时获取删除的叶子节点 getLeaf(range.index) + */ }, []); // 设置值 @@ -232,6 +280,7 @@ function QuillForEditor ({ }, [quill, handleOnChange]); useEffect(() => { + if (!quill) return; if (autoFocus) { quill.focus(); } diff --git a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js index 395809901..4784b553a 100644 --- a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js +++ b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-20 10:35:40 * @LastEditors : tangjiang - * @LastEditTime : 2020-01-07 15:29:18 + * @LastEditTime : 2020-01-09 11:04:44 */ import './index.scss'; // import 'katex/dist/katex.css'; @@ -291,6 +291,7 @@ class EditTab extends React.Component { // {font: []}, 'image', 'formula', // 数学公式、图片、视频 'clean', // 清除格式 + // 'fill', ]; const renderCourseQuestion = (arrs) => { @@ -452,6 +453,7 @@ class EditTab extends React.Component { colon={ false } > Date: Thu, 9 Jan 2020 11:11:08 +0800 Subject: [PATCH 13/17] =?UTF-8?q?=E8=AF=95=E9=A2=98=E5=92=8C=E8=AF=95?= =?UTF-8?q?=E5=8D=B7=E7=9A=84=E5=AE=A1=E6=89=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admins/examination_authentications_controller.rb | 2 +- app/controllers/admins/item_authentications_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/admins/examination_authentications_controller.rb b/app/controllers/admins/examination_authentications_controller.rb index 8045644e1..c68c062b6 100644 --- a/app/controllers/admins/examination_authentications_controller.rb +++ b/app/controllers/admins/examination_authentications_controller.rb @@ -12,7 +12,7 @@ class Admins::ExaminationAuthenticationsController < Admins::BaseController ActiveRecord::Base.transaction do exam = ExaminationBank.find current_apply.container_id current_apply.update!(status: 1) - exam.update!(public: 0) + exam.update!(public: 1) end render_success_js end diff --git a/app/controllers/admins/item_authentications_controller.rb b/app/controllers/admins/item_authentications_controller.rb index 88d833ee9..8da9b232f 100644 --- a/app/controllers/admins/item_authentications_controller.rb +++ b/app/controllers/admins/item_authentications_controller.rb @@ -16,7 +16,7 @@ class Admins::ItemAuthenticationsController < Admins::BaseController ActiveRecord::Base.transaction do item = ItemBank.find current_apply.container_id current_apply.update!(status: 1) - item.update!(public: 0) + item.update!(public: 1) end render_success_js end From 802876d0c7c0306cd348ae2235aa4a07e7777e8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 9 Jan 2020 11:13:02 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A2=98=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/component/ChoquesEditor.js | 4 ++-- .../react/src/modules/question/component/JudquestionEditor.js | 4 ++-- public/react/src/modules/question/component/SingleEditor.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index 8f07937ae..93283c307 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -378,7 +378,7 @@ class ChoquesEditor extends Component{
    {/* {!question_id ? '新建' : '编辑'} */} * - 答案选项:点击答案可设置正确答案 + 答案选项:点击选项可设置正确答案
    {question_choices.map( (item, index) => { @@ -443,7 +443,7 @@ class ChoquesEditor extends Component{

    {/* {!question_id ? '新建' : '编辑'} */} - * + 题目解析:

    diff --git a/public/react/src/modules/question/component/JudquestionEditor.js b/public/react/src/modules/question/component/JudquestionEditor.js index a48bef60a..b1dc1fb45 100644 --- a/public/react/src/modules/question/component/JudquestionEditor.js +++ b/public/react/src/modules/question/component/JudquestionEditor.js @@ -390,7 +390,7 @@ class JudquestionEditor extends Component{
    {/* {!question_id ? '新建' : '编辑'} */} * - 答案选项:点击答案可设置正确答案 + 答案选项:点击选项可设置正确答案