|
|
|
|
@ -4831,26 +4831,40 @@ var Answer = function Answer(_ref) {
|
|
|
|
|
currentInfo = (_answerData$exercise_28 = answerData.exercise_question_types) === null || _answerData$exercise_28 === void 0 || (_answerData$exercise_28 = _answerData$exercise_28[oneindex]) === null || _answerData$exercise_28 === void 0 || (_answerData$exercise_28 = _answerData$exercise_28.items) === null || _answerData$exercise_28 === void 0 ? void 0 : _answerData$exercise_28[twoindex];
|
|
|
|
|
query = {
|
|
|
|
|
questionId: currentInfo.question_id,
|
|
|
|
|
exercise_choice_id: [0, 1].includes(currentInfo.question_type) ? currentInfo.user_answer : null,
|
|
|
|
|
answers: [3].includes(currentInfo.question_type) ? currentInfo.user_answer : null
|
|
|
|
|
exercise_choice_id: [0, 1, 2].includes(currentInfo.question_type) ? currentInfo.user_answer : null
|
|
|
|
|
};
|
|
|
|
|
if (currentInfo.question_type == 2) {
|
|
|
|
|
query.answer_text = currentInfo.user_answer;
|
|
|
|
|
} else if (currentInfo.question_type == 4) {
|
|
|
|
|
query.answer_text = currentInfo.user_answer[0];
|
|
|
|
|
if (currentInfo.question_type == 3) {
|
|
|
|
|
// 填空题
|
|
|
|
|
query.answers = currentInfo.user_answer.map(function (item) {
|
|
|
|
|
return {
|
|
|
|
|
exercise_choice_id: item === null || item === void 0 ? void 0 : item.choice_id,
|
|
|
|
|
answer_text: item === null || item === void 0 ? void 0 : item.answer_text
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
} else if (currentInfo.question_type == 7) {
|
|
|
|
|
//组合题
|
|
|
|
|
query.answers = currentInfo.sub_exercise_questions.map(function (item) {
|
|
|
|
|
return {
|
|
|
|
|
exercise_choice_id: item === null || item === void 0 ? void 0 : item.question_id,
|
|
|
|
|
answer_text: item === null || item === void 0 ? void 0 : item.user_answer
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
_context16.next = 5;
|
|
|
|
|
console.log("currentInfo", currentInfo);
|
|
|
|
|
|
|
|
|
|
// return;
|
|
|
|
|
_context16.next = 6;
|
|
|
|
|
return (0,fetch/* default */.ZP)("/api/exercise_questions/".concat(currentInfo.question_id, "/exercise_answers/subject_exercise_answer.json"), {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
body: query
|
|
|
|
|
});
|
|
|
|
|
case 5:
|
|
|
|
|
case 6:
|
|
|
|
|
res = _context16.sent;
|
|
|
|
|
if (res.status == 0) {
|
|
|
|
|
setShowConfirm(false);
|
|
|
|
|
initData();
|
|
|
|
|
}
|
|
|
|
|
case 7:
|
|
|
|
|
case 8:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context16.stop();
|
|
|
|
|
}
|