From 168994cfb3bc2cc9d9f71631135cf5824ae3331d Mon Sep 17 00:00:00 2001
From: harry
Date: Sat, 14 Mar 2020 20:29:48 +0800
Subject: [PATCH] fix
---
.../exercise/ExerciseReviewAndAnswer.js | 372 +++++++++++++++++-
.../src/modules/courses/poll/PollInfo.js | 166 ++++----
.../components/controlSetting/index.js | 20 -
.../leftpane/editorTab/AddTestDemo.js | 15 +-
4 files changed, 455 insertions(+), 118 deletions(-)
diff --git a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js
index bf5552b32..dbd0a0b5d 100644
--- a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js
+++ b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js
@@ -644,7 +644,377 @@ class ExerciseReviewAndAnswer extends Component {
// console.log(data&&data.exercise.user_name)
document.title = courseName && courseName;
- return (
+ return (
+
+
+ {/**/}
+
+
+
+ {courseName}
+ >
+ {data && data.left_banner_name}
+ >
+ {data && data.left_banner_name}详情>
+ {exercise_answer_user && exercise_answer_user.user_name}{data && data.exercise.user_name}
+
+
+ {exercise && exercise.exercise_name}
+
+
+
+
+ {
+ (isAdmin || (isStudent && exercise && user_exercise_status == 1)) ?
+ 返回
+ :
+ time && time != 0 ?
+
+
+
+ : ""
+ }
+ {/*
*/}
+ {/*
{ hour >= 10 ? hour : '0'+hour}*/}
+ {/* :*/}
+ {/* { minute >= 10 ? minute : '0'+minute}*/}
+ {/* :*/}
+ {/* { second >= 10 ? second : '0'+second}*/}
+ {/**/}
+ {
+ isAdmin &&
打回重做
+ }
+
+ {
+ exercise && exercise.exercise_description &&
+
{exercise.exercise_description}
+ }
+
+ {
+ exercise_types && exercise_types.q_singles > 0 &&
+ 单选题 {exercise_types.q_singles} 题,共 {exercise_types && exercise_types.q_singles_scores} 分
+ }
+ {
+ exercise_types && exercise_types.q_doubles > 0 &&
+ 多选题 {exercise_types.q_doubles} 题,共 {exercise_types && exercise_types.q_doubles_scores} 分
+ }
+ {
+ exercise_types && exercise_types.q_judges > 0 &&
+ 判断题 {exercise_types.q_judges} 题,共 {exercise_types && exercise_types.q_judges_scores} 分
+ }
+ {
+ exercise_types && exercise_types.q_nulls > 0 &&
+ 填空题 {exercise_types.q_nulls} 题,共 {exercise_types && exercise_types.q_nulls_scores} 分
+ }
+ {
+ exercise_types && exercise_types.q_mains > 0 &&
+ 简答题 {exercise_types.q_mains} 题,共 {exercise_types && exercise_types.q_mains_scores} 分
+ }
+ {
+ exercise_types && exercise_types.q_shixuns > 0 &&
+ 实训题 {exercise_types.q_shixuns} 题,共 {exercise_types && exercise_types.q_shixuns_scores} 分
+ }
+ 共 {exercise_types && exercise_types.q_scores} 分
+ 合计 {exercise_types && exercise_types.q_counts} 题:
+
+
+
+
+
+ {
+ exercise_start_at && 开始答题时间:{exercise_start_at && moment(exercise_start_at).format(format)}
+ }
+ {
+ (isAdmin || (isStudent && exercise && exercise.exercise_status == 3)) && exerciseTotalScore &&
+ 总分: {exerciseTotalScore} 分
+ }
+
+ {
+ // 老师身份 || 学生身份且试卷已经截止
+ (isAdmin || (isStudent && exercise && exercise.exercise_status == 3)) &&
+
+ {
+ exercise_scores && exercise_scores.objective_scores && exercise_scores.objective_scores.length > 0 &&
+
+
+ 客观题
+ 正确
+ 错误
+ 部分得分
+
+
+
+ }
+ {
+ exercise_scores && exercise_scores.subjective_scores.length > 0 &&
+
+ }
+
+ }
+
+ {
+ //学生身份 且试卷还未截止
+ isStudent && exercise && exercise.exercise_status == 2 ?
+
: ""
+ }
+
+ {/* 试卷题目 */}
+
+ {
+ exercise_questions && exercise_questions.map((item, key) => {
+ let list = ajustSore && ajustSore.filter(obj => obj.id === item.question_id);
+ return (
+
+
+ {item.q_position}、{type[item.question_type]}({item.question_score}分)
+
+ {
+ // 填空(一直都有调分),和简答题调分:老师身份 已经评分的才能出现调分按钮
+ isAdmin && ((parseInt(item.answer_status) != 0 && item.question_type == 4) || item.question_type == 3 || item.question_type == 1) ?
+ this.showSetScore(key, item.setScore, item.q_position, item.question_type, item.question_id)}>调分 : ""
+ }
+ {
+ // 简答题,未评分的显示未批
+ isAdmin && parseInt(item.answer_status) == 0 && item.question_type == 4 ?
+ 未批 : ""
+ }
+ {
+ // 客观题:老师||学生(试卷已截止且答案公开)显示正确答案
+ item.question_type < 3 && item.standard_answer_show ?
+
+ 正确答案:{item.standard_answer_show}
+ : ""
+ }
+ {
+ //(老师身份且除实训题外) || (学生身份且试卷已经截止)就显示用户当前题目所得分数
+ (isAdmin || (isStudent && exercise.exercise_status == 3)) && item.question_type != 5 && item.user_score ?
+
+ {item.user_score} 分
+ : ""
+ }
+ {
+ //实训题 ,答题
+ item.question_type == 5 &&
+ 实训详情
+ }
+
+
+
+ {/* */}
+
+
+ {
+ // 选择题和判断题共用
+ (item.question_type == 0 || item.question_type == 2) &&
+
this.changeOption(index, ids)}
+ changeQuestionStatus={(No, flag) => this.changeQuestionStatus(No, flag)}
+ index={key}
+ >
+ }
+ {
+ // 多选题
+ item.question_type == 1 &&
+
this.changeOption(index, ids)}
+ changeQuestionStatus={(No, flag) => this.changeQuestionStatus(No, flag)}
+ index={key}
+
+ >
+ }
+ {
+ // 填空题
+ item.question_type == 3 &&
+
this.changeQuestionStatus(No, flag)}
+ index={key}
+
+ >
+ }
+ {
+ // 简答题
+ item.question_type == 4 &&
+
this.changeQuestionStatus(No, flag)}
+ changeA_flag={(index, status) => this.changeA_flag(index, status)}
+ index={key}
+ >
+ }
+ {
+ // 实训题
+ item.question_type == 5 &&
+
+ }
+
+ {
+ //调分理由部分
+ item.question_comments && item.question_comments.comment && (item.question_type == 3 || item.question_type == 4 || item.question_type == 1) &&
+
+
})
+
+
+ {item.question_comments.user_name}
+ {moment(item.question_comments.updated_at).format(format)}
+
+ {item.question_comments.comment}
+
+
+ }
+ {
+ // 调分输入部分
+ isAdmin && ((item.setScore && item.question_type == 3) || (item.setScore && item.question_type == 1) || ((item.setScore || parseInt(item.answer_status) == 0) && item.question_type == 4)) ?
+
+
+
*调分:
+
+
+ 0 && list[0].inputSore}
+ step={0.1}
+ precision={1}
+ className={list && list.length > 0 && list[0].setTip != "" ? "edu-txt-center winput-115-40 fl mt3 noticeTip inputNumber30" : "edu-txt-center winput-115-40 fl mt3 inputNumber30"}
+ onChange={(value) => this.inputScore(value, item.question_id)}
+ id={`${"input_" + item.q_position + "_" + item.question_type}`}
+ >
+ 分
+ {
+ parseInt(item.answer_status) == 0 && item.question_type == 4 ? 未评分 : ''
+ }
+ this.setAction(key, item.question_id, item.question_score, item.user_score)}>确认
+
+ {
+ list && list.length > 0 && list[0].setTip != "" ? {list[0].setTip}
: ""
+ }
+
+
+
+
: ""
+ }
+
+ )
+ })
+ }
+
+
+ {
+ isStudent && user_exercise_status == 0 ?
+
+ 交卷
+ 保存
+ {
+ exercise && time != null ?
+ 保存或者离开页面后,系统将持续计时,到达时长系统将自动交卷
+ : ""
+ }
+
: ""
+ }
+
+
+
)
}
}
diff --git a/public/react/src/modules/courses/poll/PollInfo.js b/public/react/src/modules/courses/poll/PollInfo.js
index 4e8ed341e..fae6deaa0 100644
--- a/public/react/src/modules/courses/poll/PollInfo.js
+++ b/public/react/src/modules/courses/poll/PollInfo.js
@@ -40,8 +40,8 @@ class PollInfo extends Component {
}
- componentDidMount(){
- if(this.props.current_user){
+ componentDidMount() {
+ if (this.props.current_user) {
this.getInfo();
}
@@ -107,19 +107,19 @@ class PollInfo extends Component {
}
//选中选择题(单选题)选项保存
- ChangeOptionSingle=(item)=>{
- let arr=item.target.name
- let txt=Object.assign({}, this.state.inputArray[parseInt(arr[1])]);
- let ids=item.target.value;
- let list=txt.answersList.filter(element => element.answer_id == ids);
+ ChangeOptionSingle = (item) => {
+ let arr = item.target.name
+ let txt = Object.assign({}, this.state.inputArray[parseInt(arr[1])]);
+ let ids = item.target.value;
+ let list = txt.answersList.filter(element => element.answer_id == ids);
- this.postAnswer(arr[0],ids,list[0].answer_text=="其他"?txt.text:"",arr[1]);
+ this.postAnswer(arr[0], ids, list[0].answer_text == "其他" ? txt.text : "", arr[1]);
}
//选中选择题(多选题)选项保存
- ChangeOptionMuntil=(a_id,q_id,key)=>{
- let ind=Object.assign({}, this.state.inputArray[parseInt(key)]);
- let count=0;
+ ChangeOptionMuntil = (a_id, q_id, key) => {
+ let ind = Object.assign({}, this.state.inputArray[parseInt(key)]);
+ let count = 0;
a_id.forEach(element => {
let list = ind.answersList.filter(item => item.answer_id == element);
if (list[0].answer_text == "其他") {
@@ -192,11 +192,7 @@ class PollInfo extends Component {
//提交主观题
commitText = (key, q_id) => {
const text = Object.assign({}, this.state.inputArray[key]).text;
-
- let url='/poll_questions/'+q_id+'/poll_votes.json?';
-
let url = '/poll_questions/' + q_id + '/poll_votes.json?';
-
const ans = Object.assign({}, this.state.question_answered[key]);
ans.ques_status = text ? 1 : 0;
const questionAnswered = this.state.question_answered;
@@ -261,7 +257,7 @@ class PollInfo extends Component {
}
- cancelSubmit=()=>{
+ cancelSubmit = () => {
this.setState({
modalsType: false,
modalsTopval: "",
@@ -270,18 +266,18 @@ class PollInfo extends Component {
}
- sureSubmit=()=>{
- let pollId=this.props.match.params.pollId;
- let url=`/polls/${pollId}/commit_poll.json`
- axios.post(url).then((result)=>{
- if(result.status == 200){
+ sureSubmit = () => {
+ let pollId = this.props.match.params.pollId;
+ let url = `/polls/${pollId}/commit_poll.json`
+ axios.post(url).then((result) => {
+ if (result.status == 200) {
this.props.showNotification(result.data.message)
this.setState({
modalsType: false,
modalsTopval: "",
modalsBottomval: ""
})
- window.location.href=`/classrooms/${this.props.match.params.coursesId}/polls/${pollId}/detail`
+ window.location.href = `/classrooms/${this.props.match.params.coursesId}/polls/${pollId}/detail`
}
}).catch((error) => {
console.log(error);
@@ -321,13 +317,13 @@ class PollInfo extends Component {
问卷
>
问卷详情>
- {question_types&&question_types.user_name}
+ {question_types && question_types.user_name}
{poll && poll.polls_name}
{
- isAdmin || (poll && poll.user_poll_status == 1) ? 返回 :''
+ isAdmin || (poll && poll.user_poll_status == 1) ? 返回 : ''
}
@@ -355,7 +351,7 @@ class PollInfo extends Component {
}
-
+
已答
未答
@@ -383,8 +379,8 @@ class PollInfo extends Component {
{item.question.question_number}、{map[item.question.question_type]}
- { item.question.is_necessary==1 ?
必答:
选答 }
- { item.question.question_type == 2 && item.question.min_choices && item.question.max_choices ?
+ {item.question.is_necessary == 1 ?
必答 :
选答}
+ {item.question.question_type == 2 && item.question.min_choices && item.question.max_choices ?
{
item.question.min_choices == item.question.max_choices ? "可选" + item.question.max_choices + "项" :
@@ -400,8 +396,8 @@ class PollInfo extends Component {
}}>{item.question.question_title}
{
//单选
- item.question.question_type==1 &&
-
+ item.question.question_type == 1 &&
+
{
item.question.answers && item.question.answers.map((i, k) => {
return (
@@ -409,26 +405,26 @@ class PollInfo extends Component {
{i.answer_text}
{
- i.answer_text=="其他" ?
-
- {
- inputArray && inputArray.map((j,k)=>{
- return(
-
- {
- j.id == item.question.id ?
- this.saveInputAndAnswer(e,i.answer_id,item.question.id,key,item.question.question_type)}
- />
- : ""
- }
-
- )
- })
- }
-
- : ""
+ i.answer_text == "其他" ?
+
+ {
+ inputArray && inputArray.map((j, k) => {
+ return (
+
+ {
+ j.id == item.question.id ?
+ this.saveInputAndAnswer(e, i.answer_id, item.question.id, key, item.question.question_type)}
+ />
+ : ""
+ }
+
+ )
+ })
+ }
+
+ : ""
}
)
@@ -438,13 +434,13 @@ class PollInfo extends Component {
}
{
//多选
- item.question.question_type==2 &&
+ item.question.question_type == 2 &&
this.ChangeOptionMuntil(value,item.question.id,key)}
- disabled={isAdmin || (isStudent && poll && poll.user_poll_status == 1)?true:false}
- defaultValue={item.question.poll_answer_ids}
- className="answerList"
- name={key}>
+ onChange={(value) => this.ChangeOptionMuntil(value, item.question.id, key)}
+ disabled={isAdmin || (isStudent && poll && poll.user_poll_status == 1) ? true : false}
+ defaultValue={item.question.poll_answer_ids}
+ className="answerList"
+ name={key}>
{
item.question.answers && item.question.answers.map((i, k) => {
return (
@@ -452,26 +448,26 @@ class PollInfo extends Component {
{i.answer_text}
{
- i.answer_text=="其他"?
-
- {
- inputArray && inputArray.map((j,k)=>{
- return(
-
- {
- j.id == item.question.id ?
- this.saveInputAndAnswer(e,i.answer_id,item.question.id,key,item.question.question_type)}
- />
- : ""
- }
-
- )
- })
- }
-
- :""
+ i.answer_text == "其他" ?
+
+ {
+ inputArray && inputArray.map((j, k) => {
+ return (
+
+ {
+ j.id == item.question.id ?
+ this.saveInputAndAnswer(e, i.answer_id, item.question.id, key, item.question.question_type)}
+ />
+ : ""
+ }
+
+ )
+ })
+ }
+
+ : ""
}
)
@@ -481,17 +477,17 @@ class PollInfo extends Component {
}
{
//主观题
- item.question.question_type==3 &&
+ item.question.question_type == 3 &&
{
inputArray && inputArray.map((j, k) => {
return (
- {
- j.id == item.question.id ?
-
- : ""
- }
+ {
+ j.id == item.question.id ?
+
+ : ""
+ }
)
})
@@ -507,10 +503,10 @@ class PollInfo extends Component {
{
isStudent && poll && poll.user_poll_status == 0 ?
-
- :""
+
+ : ""
}
diff --git a/public/react/src/modules/developer/components/controlSetting/index.js b/public/react/src/modules/developer/components/controlSetting/index.js
index 9fd0cb67b..03f69e434 100644
--- a/public/react/src/modules/developer/components/controlSetting/index.js
+++ b/public/react/src/modules/developer/components/controlSetting/index.js
@@ -92,10 +92,6 @@ const ControlSetting = (props) => {
const handleDebuggerCode = (values) => {
// 改变状态值
changeLoadingState(true);
- // 调用代码保存接口, 成功后再调用调试接口
- // updateCode(identifier, values, 'debug');
- // 调用调试接口
- // debuggerCode(identifier, values);
onDebuggerCode(values);
}
// icon-shangjiantou
@@ -133,17 +129,9 @@ const ControlSetting = (props) => {
-=======
>
控制台
->>>>>>> 1b23635... fix 提交代码与编辑代码不一致情况
@@ -171,11 +155,7 @@ const ControlSetting = (props) => {
const mapStateToProps = (state) => {
const { commonReducer, ojForUserReducer } = state;
const { loading, excuteState, submitLoading, showOrHideControl } = commonReducer;
-<<<<<<< HEAD
- const { commitTestRecordDetail, hack, userCode } = ojForUserReducer;
-=======
const { commitTestRecordDetail, hack, editor_code } = ojForUserReducer;
->>>>>>> 1b23635... fix 提交代码与编辑代码不一致情况
return {
hack,
editor_code,
diff --git a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/AddTestDemo.js b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/AddTestDemo.js
index 84c24e6a8..6936d752d 100644
--- a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/AddTestDemo.js
+++ b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/AddTestDemo.js
@@ -146,12 +146,12 @@ const AddTestDemo = (props) => {
}
return (
-
handleChangeCollapse()}>
-
+ handleChangeCollapse()}>
+