From 6a73cf516d041e82869abaec5b096607a2c2c57f Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 13 Nov 2019 09:32:52 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=A1=AB=E7=A9=BA=E9=A2=98=E7=9A=84?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E7=8E=87=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/exercises_helper.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 2c1a6f85d..ea58ddb55 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -180,17 +180,19 @@ module ExercisesHelper elsif ex.question_type == Exercise::COMPLETION #填空题 ex_ordered = ex.is_ordered null_standard_answer = ex.exercise_standard_answers - null_stand_choice = null_standard_answer.pluck(:exercise_choice_id) #一个exercise_choice_id可能对应多个answer_text + null_stand_choice = null_standard_answer.pluck(:exercise_choice_id).uniq #一个exercise_choice_id可能对应多个answer_text null_stand_text = null_standard_answer.pluck(:answer_text) standard_answer_count = 0 each_null_score = null_stand_choice.size > 0 ? (ex&.question_score.to_f / null_stand_choice.uniq.size).round(3) : 0.0 all_user_count = 0 null_stand_choice.each_with_index do |s,index| user_count = 0 - s_choice_text = null_stand_text[index] if ex_ordered #有序排列 + s_choice_text = null_stand_text[index] user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size else + null_stand_text = null_stand_text.uniq + s_choice_text = null_stand_text[index] user_count = user_count + effictive_users.select{|answer| answer.answer_text == s_choice_text }.size #回答了标准答案的用户 end @@ -211,7 +213,7 @@ module ExercisesHelper # percent = commit_user_ids > 0 ? (all_user_count / commit_user_ids.to_f).round(3)*100 : 0.0 - user_wrong_count = (effictive_users_count - all_user_count ) + user_wrong_count = (effictive_users_count - all_user_count) if effictive_users_count > 0 && user_wrong_count >= 0 wrong_percent = (user_wrong_count / effictive_users_count.to_f ).round(3) From 6bc07511da13fe3e92c329725b4440c2daebad03 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, 13 Nov 2019 09:34:24 +0800 Subject: [PATCH 2/5] =?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/gradinforms/Bullsubdirectory.js | 360 ++++++++++-------- .../modules/courses/gradinforms/Eduinforms.js | 1 + 2 files changed, 195 insertions(+), 166 deletions(-) diff --git a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js index 729308852..d1859e135 100644 --- a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js +++ b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js @@ -24,25 +24,28 @@ class Bullsubdirectory extends Component{ Modalstopval:"是否确认删除?", ModalCancel:"", ModalSave:"", - + index:0, } + //不能显示数据编辑的时候没有赋值 + //没加initialValue 输入不能赋值到from 上 } componentDidMount() { console.log("获取到数据"); console.log(this.props); - let{id,myname,mydescription} =this.props + let{id,myname,mydescription,index,item} =this.props this.props.form.setFieldsValue({ id:id, - eduintits:myname, - description:mydescription, + eduintits:item.name, + description:item.description, }); + // this.contentMdRef.current.setValue(mydescription); this.setState({ id:id, - eduintits:myname, - description:mydescription, - + eduintits:item.name, + description:item.description, + index:index }) if(myname!=undefined){ this.setState({ @@ -108,10 +111,20 @@ class Bullsubdirectory extends Component{ } - bianji = (bians)=>{ + bianji = (bians,i)=>{ + console.log("bianji"); + console.log(this.props.myname); + console.log(this.props.mydescription); this.setState({ whethertoeditysl:bians, - }) + eduintits:this.props.myname, + description:this.props.mydescription, + index:i + }); + this.props.form.setFieldsValue({ + eduintits:this.props.myname, + description:this.props.mydescription, + }); if(bians===true){ this.props.getyslbooltrue(); }else { @@ -143,6 +156,7 @@ class Bullsubdirectory extends Component{ handleSubmit=(e) => { e.preventDefault(); this.props.form.validateFields((err, values) => { + debugger if (!err) { console.log(values.description); if(values.eduintits === undefined|| values.eduintits === "" || values.eduintits ===null){ @@ -180,11 +194,11 @@ class Bullsubdirectory extends Component{ if(result){ if(result.data){ if(result.data.status === 0){ - this.props.form.setFieldsValue({ - id:this.state.id, - eduintits:titname, - description:values.description, - }); + // this.props.form.setFieldsValue({ + // id:this.state.id, + // eduintits:titname, + // description:values.description, + // }); this.setState({ whethertoeditysl:false, id:this.state.id, @@ -266,111 +280,118 @@ class Bullsubdirectory extends Component{ render(){ - let{description,whethertoeditysl,addonAfter,eduintits,informs,isSpinysl} =this.state; + let{description,whethertoeditysl,addonAfter,eduintits,informs,isSpinysl,index} =this.state; let{myname,mydescription,id}=this.props; const {getFieldDecorator} = this.props.form; // console.log("Bullsubdirectory"); // console.log(this.props.isAdmin()); - // console.log(this.props); + console.log(this.props); + console.log(whethertoeditysl); + console.log(this.state.eduintits); + console.log(this.state.description); + return( - -
- {this.state.Modalstype&&this.state.Modalstype===true?:""} - -
- { - whethertoeditysl === false? -
-
-
-
- {myname} -
-
+ +
+ {this.state.Modalstype&&this.state.Modalstype===true?:""} + +
+ { + whethertoeditysl === false? +
+
+
+
+ {myname} +
+
{ this.props.isAdmin() === true ? (this.props.yslbool===false? - - 编辑 -
}> - this.bianji(true)}> - + + 编辑 +
}> + this.bianji(true,this.props.index)}> + : "" ) :"" } - + { this.props.isAdmin() === true ? (this.props.yslbool===false? - - 删除 -
}> - this.setModeltrue(true)}> - + + 删除 +
}> + this.setModeltrue(true)}> + : "" ) :"" } - { - this.props.length - 1 === this.props.index ? "" : - this.props.isAdmin() === true ? - (this.props.yslbool === false ? - this.Movedown(this.props.id)} - > - : - "" - ) - : "" - } - { - this.props.index === 0 ? "" : - this.props.isAdmin() === true ? - (this.props.yslbool === false ? - this.Moveupward(this.props.id)} - > - : - "" - ) - : "" - } -
-
-
-
+ { + this.props.length - 1 === this.props.index ? "" : + this.props.isAdmin() === true ? + (this.props.yslbool === false ? + this.Movedown(this.props.id)} + > + : + "" + ) + : "" + } + { + this.props.index === 0 ? "" : + this.props.isAdmin() === true ? + (this.props.yslbool === false ? + this.Moveupward(this.props.id)} + > + : + "" + ) + : "" + }
- {parseInt(this.props&&this.props.informs.length)===parseInt(this.props&&this.props.index+1)?"":
} +
- : -
-
- - - {getFieldDecorator('eduintits',{ initialValue: this.state.eduintits }, { - rules: [{ - required: true, message: '请在此输入标题,最多60个字符', - }], - })( -
-
- * -
-
- + + {getFieldDecorator('eduintits', { initialValue: eduintits}, { + rules: [{ + required: true, message: '请在此输入标题,最多60个字符', + }], + })( +
+
+ * +
+
+ - -
- + } +
- )} -
+
+ )} + -
-
- - - {getFieldDecorator('description', { initialValue: this.state.description },{ - rules: [{ - required: true, message: '请在此输入内容,最多5000个字符', - }, { - len: 5000, message: '最大限制为5000个字符', - }], - })( - - )} - -
-
+ } + + + {getFieldDecorator('description', { initialValue: description},{ + rules: [{ + required: true, message: '请在此输入内容,最多5000个字符', + }, { + len: 5000, message: '最大限制为5000个字符', + }], + })( + + + + )} + - -
- this.bianji(false)}>取消 - -
-
- -
-
- } -
- +
+
-
+ + + + +
+
+ :"" + } +
+ + +
) } diff --git a/public/react/src/modules/courses/gradinforms/Eduinforms.js b/public/react/src/modules/courses/gradinforms/Eduinforms.js index 4cb42eff9..5acfeb4fe 100644 --- a/public/react/src/modules/courses/gradinforms/Eduinforms.js +++ b/public/react/src/modules/courses/gradinforms/Eduinforms.js @@ -497,6 +497,7 @@ class Eduinforms extends Component{ this.getyslbooltrue()} getyslboolfalse={()=>this.getyslboolfalse()} getinputdata={()=>this.getinputdata()} > From 06a8f4e28554366747496dbb6fdb3f9db6aa1fb9 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, 13 Nov 2019 09:38:33 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AF=95=E5=8D=B7?= =?UTF-8?q?=E8=B0=83=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/exercise/Studentshavecompletedthelist.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index 6d97a65b6..6155b1bfb 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -1031,8 +1031,8 @@ class Studentshavecompletedthelist extends Component { render: (text, record) => ( {record.finalscore==="--"? - -- + this.Adjustment(record.user_id)}>评阅 : ( {record.finalscore==="--"? - -- + this.Adjustment(record.user_id)}>评阅 : Date: Wed, 13 Nov 2019 11:43:51 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E5=92=8C=E9=97=AE=E5=8D=B7=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/poll/PollDetailTabSecond.js | 6 +- .../courses/poll/PollDetailTabThirdInfo.js | 56 +++++++++++-------- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/public/react/src/modules/courses/poll/PollDetailTabSecond.js b/public/react/src/modules/courses/poll/PollDetailTabSecond.js index c4a743ac6..65a07b2bb 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabSecond.js +++ b/public/react/src/modules/courses/poll/PollDetailTabSecond.js @@ -64,7 +64,7 @@ class PollDetailTabSecond extends Component{ let {page, limit, questions, questionsInfo , isSpin} = this.state; return( -
+ { questions && questions.length>0 && questions.map((item,key)=>{ return( @@ -179,7 +179,7 @@ class PollDetailTabSecond extends Component{ }) } { - questions && questions.length == 0 && + questions && questions.length == 0 &&
} { questionsInfo && questionsInfo.q_counts > limit && @@ -189,7 +189,7 @@ class PollDetailTabSecond extends Component{
} - +
) } diff --git a/public/react/src/modules/courses/poll/PollDetailTabThirdInfo.js b/public/react/src/modules/courses/poll/PollDetailTabThirdInfo.js index 526f32aa9..ed5f21fbb 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabThirdInfo.js +++ b/public/react/src/modules/courses/poll/PollDetailTabThirdInfo.js @@ -1,6 +1,7 @@ import React,{ Component } from "react"; import {Checkbox,Radio} from "antd"; +import NoneData from "../coursesPublic/NoneData" import '../css/members.css' import '../css/busyWork.css' @@ -26,31 +27,34 @@ class PollDetailTabThirdInfo extends Component{ pollDetail !== pollDetail.poll.polls_description &&

{ pollDetail.poll.polls_description }

} -

- { !pollDetail || !pollDetail.question_types || pollDetail.question_types.q_counts===0 ? "" : - - { - pollDetail && pollDetail.question_types && pollDetail.question_types.q_counts > 0 && - 合计{pollDetail.question_types && pollDetail.question_types.q_counts}题: - } - { - pollDetail && pollDetail.question_types.q_singles > 0 && - 单选题{pollDetail.question_types.q_singles}题 - } - { - pollDetail && pollDetail.question_types.q_doubles > 0 && - 多选题{pollDetail.question_types.q_doubles}题 - } - { - pollDetail && pollDetail.question_types.q_mains > 0 && - 主观题{pollDetail.question_types.q_mains}题 - } - - } -

- { - pollDetail && pollDetail.questions && pollDetail.questions.map((item,key)=>{ + pollDetail && pollDetail.questions && pollDetail.questions.length > 0 && +

+ { !pollDetail || !pollDetail.question_types || pollDetail.question_types.q_counts===0 ? "" : + + { + pollDetail && pollDetail.question_types && pollDetail.question_types.q_counts > 0 && + 合计{pollDetail.question_types && pollDetail.question_types.q_counts}题: + } + { + pollDetail && pollDetail.question_types.q_singles > 0 && + 单选题{pollDetail.question_types.q_singles}题 + } + { + pollDetail && pollDetail.question_types.q_doubles > 0 && + 多选题{pollDetail.question_types.q_doubles}题 + } + { + pollDetail && pollDetail.question_types.q_mains > 0 && + 主观题{pollDetail.question_types.q_mains}题 + } + + } +

+ } + + { + pollDetail && pollDetail.questions && pollDetail.questions.length > 0 && pollDetail.questions.map((item,key)=>{ return(

@@ -120,6 +124,10 @@ class PollDetailTabThirdInfo extends Component{ ) }) } + + { + pollDetail && pollDetail.questions && pollDetail.questions.length == 0 && + }

: "" } From 96bb6478aa070e9e2faf2b195d4759c9e8f569a5 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, 13 Nov 2019 15:19:38 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E8=B0=83=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesPublic/ModulationModal_exercise.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js b/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js index ed02b939c..611e06464 100644 --- a/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js +++ b/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js @@ -355,7 +355,9 @@ class ModulationModal_exercise extends Component { "" } -
+

客观题成绩:

{Inputsvaltests}

: "" } + +
+ {this.props.Cancelname || '取消'} + {this.props.Savesname || '保存'} +
: