Auto Submit

dev_local_v9_haijunshiguan_net
autosubmit 2 years ago
parent a970e8c7fe
commit 816846f75b

@ -27,7 +27,7 @@
display: block !important;
}
</style><script>if(document.domain !== "www.educoder.net") document.title = '';</script>
<script src="/react/build/umi.75373c12.js"></script>
<script src="/react/build/umi.1843a9f4.js"></script>
<script src="/react/build/js/public.js"></script>
</body>
</html>

@ -3100,6 +3100,7 @@ var _excluded = ["globalSetting", "loading", "user", "exercise", "dispatch"];
var Countdown = statistic/* default */.Z.Countdown;
@ -3559,6 +3560,13 @@ var Answer = function Answer(_ref) {
return regeneratorRuntime_default()().wrap(function _callee8$(_context8) {
while (1) switch (_context8.prev = _context8.next) {
case 0:
if (!(item.question_type == 'SINGLE')) {
_context8.next = 3;
break;
}
updateSuggestAnswer(value, id);
return _context8.abrupt("return");
case 3:
//答题卡选中
answerData.question_status.find(function (item) {
return item.ques_id === id;
@ -3566,7 +3574,8 @@ var Answer = function Answer(_ref) {
item.user_answer = [];
item.user_answer.push(value);
setAnswerData(objectSpread2_default()({}, answerData));
case 4:
setShowConfirm(true);
case 8:
case "end":
return _context8.stop();
}
@ -3719,6 +3728,15 @@ var Answer = function Answer(_ref) {
setShowConfirm(true);
signConfigFuc();
};
var updateSuggestAnswer = function updateSuggestAnswer(value, id) {
setItemBankData(function (e) {
if ((e === null || e === void 0 ? void 0 : e.question_id) == id) {
e.user_answer = [];
e.user_answer.push(value);
}
return e;
});
};
var renderSingle = function renderSingle(item, key) {
var _item$question_choice, _item$standard_answer, _item$question_choice2;
var userAnswer = (item === null || item === void 0 || (_item$question_choice = item.question_choices) === null || _item$question_choice === void 0 ? void 0 : _item$question_choice.filter(function (choice) {
@ -3735,7 +3753,6 @@ var Answer = function Answer(_ref) {
defaultValue: userAnswer === null || userAnswer === void 0 ? void 0 : userAnswer[0],
onChange: function onChange(e) {
handleChangeSingle(e.target.value, item === null || item === void 0 ? void 0 : item.question_id, key, item);
setShowConfirm(true);
},
className: item.user_score && "edu-radio-".concat(item.user_score === item.question_score ? "green" : "red"),
children: item === null || item === void 0 || (_item$question_choice2 = item.question_choices) === null || _item$question_choice2 === void 0 ? void 0 : _item$question_choice2.map(function (answer, index) {
@ -4260,8 +4277,7 @@ var Answer = function Answer(_ref) {
}, key)]
});
};
var renderQuestion = function renderQuestion(item, i) {
var show = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
var renderQuestion = function renderQuestion(item, i, show) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Answermodules.questionItem,
id: "Anchor_".concat(item === null || item === void 0 ? void 0 : item.question_type, "_").concat(i),
@ -4544,25 +4560,10 @@ var Answer = function Answer(_ref) {
children: "\u6CE8\u610F\uFF1A\u8BE5\u9898\u4F5C\u7B54\u4E4B\u540E\u4E0D\u5141\u8BB8\u4FEE\u6539\u7B54\u6848\u3002"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(_react_17_0_2_react.Fragment, {
children: renderQuestion(currentItem, twoindex)
children: renderQuestion(currentItem, twoindex, true)
}, twoindex)]
}, oneindex);
};
// const getKnowledge = async () => {
// const currentItem = answerData?.exercise_question_types?.[oneindex].items?.[twoindex]
// const res = await Fetch(`/api/subject_exercises/${params.exerciseId}/answer.json`, {
// method: 'post',
// body: {
// exercise_question_id: params.question_id,
// item_banks: {
// item_bank_id: currentItem?.question_id,
// choice_id: [0, 1, 2].includes(currentItem.question_type) ? currentItem.user_answer : null
// }
// }
// })
// }
var submitAnswer = /*#__PURE__*/function () {
var _ref14 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee15() {
var _answerData$exercise_16;
@ -4617,6 +4618,39 @@ var Answer = function Answer(_ref) {
return _ref14.apply(this, arguments);
};
}();
var submitAnswer2 = /*#__PURE__*/function () {
var _ref15 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee16(item) {
return regeneratorRuntime_default()().wrap(function _callee16$(_context16) {
while (1) switch (_context16.prev = _context16.next) {
case 0:
// console.log("item", item);
itemBankData.forEach(function (val) {
if (val.question_id === (item === null || item === void 0 ? void 0 : item.question_id)) {
console.log('val', val);
}
});
// const currentItem = answerData?.exercise_question_types?.[oneindex].items?.[twoindex]
// const res = await Fetch(`/api/subject_exercises/${params.exerciseId}/answer.json`, {
// method: 'post',
// body: {
// exercise_question_id: params.question_id,
// item_banks: {
// item_bank_id: currentItem?.question_id,
// choice_id: [0, 1, 2].includes(currentItem.question_type) ? currentItem.user_answer : null
// }
// }
// })
case 1:
case "end":
return _context16.stop();
}
}, _callee16);
}));
return function submitAnswer2(_x29) {
return _ref15.apply(this, arguments);
};
}();
return /*#__PURE__*/(0,jsx_runtime.jsxs)(spin/* default */.Z, {
size: 'middle',
spinning: isSpin,
@ -4858,26 +4892,26 @@ var Answer = function Answer(_ref) {
}
}),
className: Answermodules.markBtn,
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee16() {
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee17() {
var _answerData$exercise_25;
var res;
return regeneratorRuntime_default()().wrap(function _callee16$(_context16) {
while (1) switch (_context16.prev = _context16.next) {
return regeneratorRuntime_default()().wrap(function _callee17$(_context17) {
while (1) switch (_context17.prev = _context17.next) {
case 0:
_context16.next = 2;
_context17.next = 2;
return (0,service_exercise/* markQuestion */.sS)(params.categoryId, {
exercise_question_id: (_answerData$exercise_25 = answerData.exercise_question_types[oneindex].items[twoindex]) === null || _answerData$exercise_25 === void 0 ? void 0 : _answerData$exercise_25.question_id
});
case 2:
res = _context16.sent;
res = _context17.sent;
if (res.status === 0) {
initData();
}
case 4:
case "end":
return _context16.stop();
return _context17.stop();
}
}, _callee16);
}, _callee17);
})),
children: (_answerData$exercise_26 = answerData.exercise_question_types) !== null && _answerData$exercise_26 !== void 0 && (_answerData$exercise_26 = _answerData$exercise_26[oneindex].items[twoindex]) !== null && _answerData$exercise_26 !== void 0 && _answerData$exercise_26.is_marked ? '取消标记' : '标记该题'
})
@ -4907,16 +4941,16 @@ var Answer = function Answer(_ref) {
}), showConfirm && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: "".concat(Answermodules.changeButton, " ml20"),
type: "primary",
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee17() {
return regeneratorRuntime_default()().wrap(function _callee17$(_context17) {
while (1) switch (_context17.prev = _context17.next) {
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee18() {
return regeneratorRuntime_default()().wrap(function _callee18$(_context18) {
while (1) switch (_context18.prev = _context18.next) {
case 0:
submitAnswer();
case 1:
case "end":
return _context17.stop();
return _context18.stop();
}
}, _callee17);
}, _callee18);
})),
children: "\u786E\u5B9A"
})]
@ -4929,27 +4963,56 @@ var Answer = function Answer(_ref) {
width: 900,
centered: true,
keyboard: false,
closable: false,
zIndex: 6666,
title: "\u540C\u77E5\u8BC6\u70B9\u9898\u76EE\u63A8\u8350",
open: knowledgeDialog,
okText: "\u786E\u5B9A",
cancelText: "\u53D6\u6D88",
footer: null,
onOk: function onOk() {},
onCancel: function onCancel() {
_setKnowledgeDialog(false);
},
children: itemBankData.length > 0 ? /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: renderQuestion(itemBankData[0], 0, false)
children: itemBankData.length > 0 ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [" ", itemBankData.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [renderQuestion(item, index, false), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
height: 50,
width: '100%'
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AsyncButton/* AsyncButton */.Z, {
type: "primary",
className: Answermodules.toIframeBtn,
style: {
"float": 'right'
},
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee19() {
return regeneratorRuntime_default()().wrap(function _callee19$(_context19) {
while (1) switch (_context19.prev = _context19.next) {
case 0:
_context19.next = 2;
return submitAnswer2(item);
case 2:
return _context19.abrupt("return", _context19.sent);
case 3:
case "end":
return _context19.stop();
}
}, _callee19);
})),
children: "\u786E\u5B9A"
})
})]
});
}), " "]
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(NoData/* default */.Z, {})
})]
});
};
/* harmony default export */ var Detail_Answer = ((0,_umi_production_exports.connect)(function (_ref17) {
var loading = _ref17.loading,
user = _ref17.user,
exercise = _ref17.exercise,
globalSetting = _ref17.globalSetting;
/* harmony default export */ var Detail_Answer = ((0,_umi_production_exports.connect)(function (_ref19) {
var loading = _ref19.loading,
user = _ref19.user,
exercise = _ref19.exercise,
globalSetting = _ref19.globalSetting;
return {
globalSetting: globalSetting,
user: user,

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save