parent
d11bf3da9d
commit
db663faa64
File diff suppressed because it is too large
Load Diff
@ -1,702 +0,0 @@
|
||||
"use strict";
|
||||
(self["webpackChunk"] = self["webpackChunk"] || []).push([[65148],{
|
||||
|
||||
/***/ 43016:
|
||||
/*!***********************************************************************!*\
|
||||
!*** ./src/pages/Classrooms/Lists/Polls/Answer/index.tsx + 4 modules ***!
|
||||
\***********************************************************************/
|
||||
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
// ESM COMPAT FLAG
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
|
||||
// EXPORTS
|
||||
__webpack_require__.d(__webpack_exports__, {
|
||||
checkedOtherName: function() { return /* binding */ checkedOtherName; },
|
||||
"default": function() { return /* binding */ Polls_Answer; }
|
||||
});
|
||||
|
||||
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
|
||||
var regeneratorRuntime = __webpack_require__(7557);
|
||||
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
||||
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
|
||||
var objectSpread2 = __webpack_require__(82242);
|
||||
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
||||
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
|
||||
var asyncToGenerator = __webpack_require__(41498);
|
||||
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
||||
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
|
||||
var slicedToArray = __webpack_require__(79800);
|
||||
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
||||
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectWithoutProperties.js
|
||||
var objectWithoutProperties = __webpack_require__(39647);
|
||||
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
|
||||
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
||||
var _react_17_0_2_react = __webpack_require__(59301);
|
||||
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
|
||||
var _umi_production_exports = __webpack_require__(44743);
|
||||
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/menu/index.js + 11 modules
|
||||
var menu = __webpack_require__(20834);
|
||||
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/layout/index.js
|
||||
var layout = __webpack_require__(44000);
|
||||
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
|
||||
var modal = __webpack_require__(43418);
|
||||
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
|
||||
var message = __webpack_require__(8591);
|
||||
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/breadcrumb/index.js + 6 modules
|
||||
var breadcrumb = __webpack_require__(66104);
|
||||
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/row/index.js
|
||||
var row = __webpack_require__(95237);
|
||||
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/col/index.js
|
||||
var col = __webpack_require__(43604);
|
||||
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/anchor/index.js + 4 modules
|
||||
var es_anchor = __webpack_require__(79817);
|
||||
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
||||
var es_button = __webpack_require__(3113);
|
||||
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.5.1@@ant-design/icons/es/icons/ArrowLeftOutlined.js + 1 modules
|
||||
var ArrowLeftOutlined = __webpack_require__(28563);
|
||||
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Polls/Answer/index.less?modules
|
||||
// extracted by mini-css-extract-plugin
|
||||
/* harmony default export */ var Answermodules = ({"flex_box_center":"flex_box_center___iNvBA","flex_space_between":"flex_space_between___btrNY","flex_box_vertical_center":"flex_box_vertical_center___jNwqd","flex_box_center_end":"flex_box_center_end___yhhzS","flex_box_column":"flex_box_column___XCG9Z","bg":"bg___pkT5R","title":"title___txwwg","questionIcons":"questionIcons___bUmrp","green":"green___pU_n6","orange":"orange___WqPTj","greenTip":"greenTip___xA46L","redTip":"redTip___cLZrd","orangeTip":"orangeTip___IYw_9","pollDesc":"pollDesc___k8j8U","answered":"answered___Wv6LV","unanswer":"unanswer___HFr5V","anchor":"anchor___wiaGO","answerFlag":"answerFlag___Son3q","answerActive":"answerActive___vadIk","redactivie":"redactivie___lv5Yx","questionItem":"questionItem___eheF5","itemType":"itemType___cTyzU","itemFlag":"itemFlag____JLv3","answerWrap":"answerWrap___q0vMa","answerSubjective":"answerSubjective___g0GxR","otherInput":"otherInput___lNi1t","submitButton":"submitButton___Kwl_S","flexRow":"flexRow___CzS9_"});
|
||||
// EXTERNAL MODULE: ./src/utils/util.tsx
|
||||
var util = __webpack_require__(99144);
|
||||
// EXTERNAL MODULE: ./src/service/classrooms.ts
|
||||
var classrooms = __webpack_require__(77540);
|
||||
// EXTERNAL MODULE: ./src/utils/authority.ts
|
||||
var authority = __webpack_require__(79905);
|
||||
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/radio/index.js + 5 modules
|
||||
var es_radio = __webpack_require__(5112);
|
||||
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
|
||||
var input = __webpack_require__(73782);
|
||||
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
||||
var jsx_runtime = __webpack_require__(37712);
|
||||
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Polls/Answer/components/Single.tsx
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var Single = function Single(_ref) {
|
||||
var _itemData$question2, _itemData$question4, _itemData$question6, _answerData$poll;
|
||||
var itemData = _ref.itemData,
|
||||
answerData = _ref.answerData,
|
||||
_ref$onSave = _ref.onSave,
|
||||
onSave = _ref$onSave === void 0 ? function () {} : _ref$onSave;
|
||||
var _useState = (0,_react_17_0_2_react.useState)([]),
|
||||
_useState2 = slicedToArray_default()(_useState, 2),
|
||||
data = _useState2[0],
|
||||
setData = _useState2[1];
|
||||
var _useState3 = (0,_react_17_0_2_react.useState)(),
|
||||
_useState4 = slicedToArray_default()(_useState3, 2),
|
||||
checkedData = _useState4[0],
|
||||
setCheckedData = _useState4[1];
|
||||
var _useState5 = (0,_react_17_0_2_react.useState)(),
|
||||
_useState6 = slicedToArray_default()(_useState5, 2),
|
||||
otherData = _useState6[0],
|
||||
setOtherData = _useState6[1];
|
||||
(0,_react_17_0_2_react.useEffect)(function () {
|
||||
var _itemData$question;
|
||||
setData((itemData === null || itemData === void 0 || (_itemData$question = itemData.question) === null || _itemData$question === void 0 ? void 0 : _itemData$question.answers) || []);
|
||||
}, [itemData === null || itemData === void 0 || (_itemData$question2 = itemData.question) === null || _itemData$question2 === void 0 ? void 0 : _itemData$question2.answers]);
|
||||
(0,_react_17_0_2_react.useEffect)(function () {
|
||||
var _itemData$question3;
|
||||
setCheckedData(itemData === null || itemData === void 0 || (_itemData$question3 = itemData.question) === null || _itemData$question3 === void 0 || (_itemData$question3 = _itemData$question3.poll_answer_ids) === null || _itemData$question3 === void 0 ? void 0 : _itemData$question3[0]);
|
||||
}, [itemData === null || itemData === void 0 || (_itemData$question4 = itemData.question) === null || _itemData$question4 === void 0 ? void 0 : _itemData$question4.poll_answer_ids]);
|
||||
(0,_react_17_0_2_react.useEffect)(function () {
|
||||
var _itemData$question5;
|
||||
setOtherData(itemData === null || itemData === void 0 || (_itemData$question5 = itemData.question) === null || _itemData$question5 === void 0 ? void 0 : _itemData$question5.poll_vote_texts);
|
||||
}, [itemData === null || itemData === void 0 || (_itemData$question6 = itemData.question) === null || _itemData$question6 === void 0 ? void 0 : _itemData$question6.poll_vote_texts]);
|
||||
var handerChangeSingle = function handerChangeSingle(value, id) {
|
||||
var _data$find;
|
||||
setCheckedData(value);
|
||||
var findOtherId = (_data$find = data.find(function (item) {
|
||||
return checkedOtherName(item.answer_text);
|
||||
})) === null || _data$find === void 0 ? void 0 : _data$find.answer_id;
|
||||
if (value === findOtherId) {
|
||||
onSave(id, value, otherData);
|
||||
} else {
|
||||
onSave(id, value, '');
|
||||
}
|
||||
};
|
||||
var handleBlurOhter = function handleBlurOhter(id) {
|
||||
var _data$find2;
|
||||
if (!checkedData) {
|
||||
return;
|
||||
}
|
||||
var findOtherId = (_data$find2 = data.find(function (item) {
|
||||
return checkedOtherName(item.answer_text);
|
||||
})) === null || _data$find2 === void 0 ? void 0 : _data$find2.answer_id;
|
||||
if (checkedData === findOtherId) {
|
||||
onSave(id, checkedData, otherData);
|
||||
} else {
|
||||
onSave(id, checkedData, '');
|
||||
}
|
||||
};
|
||||
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Group */.ZP.Group, {
|
||||
disabled: (0,authority/* isAdmin */.GJ)() || (0,authority/* isStudent */.dE)() && (answerData === null || answerData === void 0 || (_answerData$poll = answerData.poll) === null || _answerData$poll === void 0 ? void 0 : _answerData$poll.user_poll_status) === 1,
|
||||
value: checkedData,
|
||||
onChange: function onChange(e) {
|
||||
var _itemData$question7;
|
||||
handerChangeSingle(e.target.value, itemData === null || itemData === void 0 || (_itemData$question7 = itemData.question) === null || _itemData$question7 === void 0 ? void 0 : _itemData$question7.id);
|
||||
},
|
||||
children: data.map(function (answer, index) {
|
||||
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
||||
className: "".concat(Answermodules.answerWrap, " ").concat(Answermodules.flexRow),
|
||||
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
|
||||
value: answer === null || answer === void 0 ? void 0 : answer.answer_id
|
||||
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
||||
className: "font14",
|
||||
children: answer === null || answer === void 0 ? void 0 : answer.answer_text
|
||||
}), checkedOtherName(answer === null || answer === void 0 ? void 0 : answer.answer_text) && /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
||||
className: Answermodules.otherInput,
|
||||
value: otherData,
|
||||
onChange: function onChange(e) {
|
||||
return setOtherData(e.target.value);
|
||||
},
|
||||
onBlur: function onBlur(e) {
|
||||
var _itemData$question8;
|
||||
return handleBlurOhter(itemData === null || itemData === void 0 || (_itemData$question8 = itemData.question) === null || _itemData$question8 === void 0 ? void 0 : _itemData$question8.id);
|
||||
}
|
||||
})]
|
||||
}, index);
|
||||
})
|
||||
});
|
||||
};
|
||||
/* harmony default export */ var components_Single = (Single);
|
||||
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/checkbox/index.js + 3 modules
|
||||
var es_checkbox = __webpack_require__(24905);
|
||||
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Polls/Answer/components/Multiple.tsx
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var Multiple = function Multiple(_ref) {
|
||||
var _itemData$question2, _itemData$question4, _itemData$question6, _answerData$poll;
|
||||
var itemData = _ref.itemData,
|
||||
answerData = _ref.answerData,
|
||||
_ref$onSave = _ref.onSave,
|
||||
onSave = _ref$onSave === void 0 ? function () {} : _ref$onSave;
|
||||
var _useState = (0,_react_17_0_2_react.useState)([]),
|
||||
_useState2 = slicedToArray_default()(_useState, 2),
|
||||
data = _useState2[0],
|
||||
setData = _useState2[1];
|
||||
var _useState3 = (0,_react_17_0_2_react.useState)(),
|
||||
_useState4 = slicedToArray_default()(_useState3, 2),
|
||||
checkedData = _useState4[0],
|
||||
setCheckedData = _useState4[1];
|
||||
var _useState5 = (0,_react_17_0_2_react.useState)(),
|
||||
_useState6 = slicedToArray_default()(_useState5, 2),
|
||||
otherData = _useState6[0],
|
||||
setOtherData = _useState6[1];
|
||||
(0,_react_17_0_2_react.useEffect)(function () {
|
||||
var _itemData$question;
|
||||
setData((itemData === null || itemData === void 0 || (_itemData$question = itemData.question) === null || _itemData$question === void 0 ? void 0 : _itemData$question.answers) || []);
|
||||
}, [itemData === null || itemData === void 0 || (_itemData$question2 = itemData.question) === null || _itemData$question2 === void 0 ? void 0 : _itemData$question2.answers]);
|
||||
(0,_react_17_0_2_react.useEffect)(function () {
|
||||
var _itemData$question3;
|
||||
setCheckedData(itemData === null || itemData === void 0 || (_itemData$question3 = itemData.question) === null || _itemData$question3 === void 0 ? void 0 : _itemData$question3.poll_answer_ids);
|
||||
}, [itemData === null || itemData === void 0 || (_itemData$question4 = itemData.question) === null || _itemData$question4 === void 0 ? void 0 : _itemData$question4.poll_answer_ids]);
|
||||
(0,_react_17_0_2_react.useEffect)(function () {
|
||||
var _itemData$question5;
|
||||
setOtherData(itemData === null || itemData === void 0 || (_itemData$question5 = itemData.question) === null || _itemData$question5 === void 0 ? void 0 : _itemData$question5.poll_vote_texts);
|
||||
}, [itemData === null || itemData === void 0 || (_itemData$question6 = itemData.question) === null || _itemData$question6 === void 0 ? void 0 : _itemData$question6.poll_vote_texts]);
|
||||
var handerChangeMultiple = function handerChangeMultiple(value, id) {
|
||||
var _data$find;
|
||||
setCheckedData(value);
|
||||
var findOtherId = (_data$find = data.find(function (item) {
|
||||
return checkedOtherName(item.answer_text);
|
||||
})) === null || _data$find === void 0 ? void 0 : _data$find.answer_id;
|
||||
if (value.includes(findOtherId)) {
|
||||
onSave(id, value, otherData);
|
||||
} else {
|
||||
onSave(id, value, '');
|
||||
}
|
||||
};
|
||||
var handleBlurOhter = function handleBlurOhter(id) {
|
||||
var _data$find2;
|
||||
if (!(checkedData !== null && checkedData !== void 0 && checkedData.length)) {
|
||||
return;
|
||||
}
|
||||
var findOtherId = (_data$find2 = data.find(function (item) {
|
||||
return checkedOtherName(item.answer_text);
|
||||
})) === null || _data$find2 === void 0 ? void 0 : _data$find2.answer_id;
|
||||
if (checkedData.includes(findOtherId)) {
|
||||
onSave(id, checkedData, otherData);
|
||||
} else {
|
||||
onSave(id, checkedData, '');
|
||||
}
|
||||
};
|
||||
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z.Group, {
|
||||
disabled: (0,authority/* isAdmin */.GJ)() || (0,authority/* isStudent */.dE)() && (answerData === null || answerData === void 0 || (_answerData$poll = answerData.poll) === null || _answerData$poll === void 0 ? void 0 : _answerData$poll.user_poll_status) === 1,
|
||||
value: checkedData,
|
||||
onChange: function onChange(value) {
|
||||
var _itemData$question7;
|
||||
handerChangeMultiple(value, itemData === null || itemData === void 0 || (_itemData$question7 = itemData.question) === null || _itemData$question7 === void 0 ? void 0 : _itemData$question7.id);
|
||||
},
|
||||
children: data === null || data === void 0 ? void 0 : data.map(function (answer, index) {
|
||||
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
||||
className: "".concat(Answermodules.answerWrap, " ").concat(Answermodules.flexRow),
|
||||
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
||||
value: answer === null || answer === void 0 ? void 0 : answer.answer_id
|
||||
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
||||
className: "font14",
|
||||
children: answer === null || answer === void 0 ? void 0 : answer.answer_text
|
||||
}), checkedOtherName(answer === null || answer === void 0 ? void 0 : answer.answer_text) && /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
||||
className: Answermodules.otherInput,
|
||||
value: otherData,
|
||||
onChange: function onChange(e) {
|
||||
return setOtherData(e.target.value);
|
||||
},
|
||||
onBlur: function onBlur(e) {
|
||||
var _itemData$question8;
|
||||
return handleBlurOhter(itemData === null || itemData === void 0 || (_itemData$question8 = itemData.question) === null || _itemData$question8 === void 0 ? void 0 : _itemData$question8.id);
|
||||
}
|
||||
})]
|
||||
});
|
||||
})
|
||||
});
|
||||
};
|
||||
/* harmony default export */ var components_Multiple = (Multiple);
|
||||
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Polls/Answer/components/Subjective.tsx
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var Subjective = function Subjective(_ref) {
|
||||
var _itemData$question2, _answerData$poll;
|
||||
var itemData = _ref.itemData,
|
||||
answerData = _ref.answerData,
|
||||
_ref$onSave = _ref.onSave,
|
||||
onSave = _ref$onSave === void 0 ? function () {} : _ref$onSave;
|
||||
var _useState = (0,_react_17_0_2_react.useState)(),
|
||||
_useState2 = slicedToArray_default()(_useState, 2),
|
||||
otherData = _useState2[0],
|
||||
setOtherData = _useState2[1];
|
||||
(0,_react_17_0_2_react.useEffect)(function () {
|
||||
var _itemData$question;
|
||||
setOtherData(itemData === null || itemData === void 0 || (_itemData$question = itemData.question) === null || _itemData$question === void 0 ? void 0 : _itemData$question.poll_vote_texts);
|
||||
}, [itemData === null || itemData === void 0 || (_itemData$question2 = itemData.question) === null || _itemData$question2 === void 0 ? void 0 : _itemData$question2.poll_vote_texts]);
|
||||
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
||||
children: /*#__PURE__*/(0,jsx_runtime.jsx)("textarea", {
|
||||
className: Answermodules.answerSubjective,
|
||||
placeholder: "\u5728\u6B64\u586B\u5165\u7B54\u6848",
|
||||
disabled: (0,authority/* isAdmin */.GJ)() || (0,authority/* isStudent */.dE)() && (answerData === null || answerData === void 0 || (_answerData$poll = answerData.poll) === null || _answerData$poll === void 0 ? void 0 : _answerData$poll.user_poll_status) === 1,
|
||||
value: otherData,
|
||||
onChange: function onChange(e) {
|
||||
return setOtherData(e.target.value);
|
||||
},
|
||||
onBlur: function onBlur(e) {
|
||||
var _itemData$question3;
|
||||
return onSave(itemData === null || itemData === void 0 || (_itemData$question3 = itemData.question) === null || _itemData$question3 === void 0 ? void 0 : _itemData$question3.id, null, otherData);
|
||||
}
|
||||
})
|
||||
});
|
||||
};
|
||||
/* harmony default export */ var components_Subjective = (Subjective);
|
||||
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 2 modules
|
||||
var RenderHtml = __webpack_require__(11167);
|
||||
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Polls/Answer/index.tsx
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var _excluded = ["globalSetting", "loading", "user", "dispatch"];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var SubMenu = menu/* default */.Z.SubMenu;
|
||||
var Content = layout/* default */.Z.Content,
|
||||
Sider = layout/* default */.Z.Sider;
|
||||
var checkedOtherName = function checkedOtherName(naem) {
|
||||
return naem === '其他' || naem === '其它';
|
||||
};
|
||||
var mapping = {
|
||||
1: "单选题",
|
||||
2: "多选题",
|
||||
3: "主观题"
|
||||
};
|
||||
var Answer = function Answer(_ref) {
|
||||
var _answerData$course, _user$userInfo, _answerData$poll, _answerData$poll2, _answerData$poll3, _answerData$poll4, _answerData$questions2, _answerData$question_2, _answerData$question_3, _answerData$question_4, _answerData$question_5, _answerData$question_6, _answerData$question_7, _answerData$question_8, _answerData$question_9, _answerData$poll5;
|
||||
var globalSetting = _ref.globalSetting,
|
||||
loading = _ref.loading,
|
||||
user = _ref.user,
|
||||
dispatch = _ref.dispatch,
|
||||
props = objectWithoutProperties_default()(_ref, _excluded);
|
||||
var params = (0,_umi_production_exports.useParams)();
|
||||
var _useState = (0,_react_17_0_2_react.useState)({}),
|
||||
_useState2 = slicedToArray_default()(_useState, 2),
|
||||
answerData = _useState2[0],
|
||||
setAnswerData = _useState2[1];
|
||||
var _useState3 = (0,_react_17_0_2_react.useState)(false),
|
||||
_useState4 = slicedToArray_default()(_useState3, 2),
|
||||
isclick = _useState4[0],
|
||||
setisclick = _useState4[1];
|
||||
(0,_react_17_0_2_react.useEffect)(function () {
|
||||
initData();
|
||||
}, [params.categoryId]);
|
||||
var initData = /*#__PURE__*/function () {
|
||||
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
||||
var res;
|
||||
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
||||
while (1) switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
_context.next = 2;
|
||||
return (0,classrooms/* getPollStartAnswer */.i7)(objectSpread2_default()({}, params));
|
||||
case 2:
|
||||
res = _context.sent;
|
||||
if (res) {
|
||||
setAnswerData(res);
|
||||
}
|
||||
case 4:
|
||||
case "end":
|
||||
return _context.stop();
|
||||
}
|
||||
}, _callee);
|
||||
}));
|
||||
return function initData() {
|
||||
return _ref2.apply(this, arguments);
|
||||
};
|
||||
}();
|
||||
var handleSave = /*#__PURE__*/function () {
|
||||
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(questionId, poll_answer_id, vote_text) {
|
||||
var res;
|
||||
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
||||
while (1) switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
if (questionId) {
|
||||
_context2.next = 3;
|
||||
break;
|
||||
}
|
||||
console.error("handleSave no questionId params");
|
||||
return _context2.abrupt("return");
|
||||
case 3:
|
||||
_context2.next = 5;
|
||||
return (0,classrooms/* updatePollVotes */.ID)({
|
||||
questionId: questionId,
|
||||
poll_answer_id: poll_answer_id,
|
||||
vote_text: vote_text
|
||||
});
|
||||
case 5:
|
||||
res = _context2.sent;
|
||||
if (res !== null && res !== void 0 && res.poll_vote) {
|
||||
answerData.question_answered.find(function (item) {
|
||||
return item.ques_id === questionId;
|
||||
}).ques_status = res.poll_vote.question_status;
|
||||
setAnswerData(objectSpread2_default()({}, answerData));
|
||||
}
|
||||
case 7:
|
||||
case "end":
|
||||
return _context2.stop();
|
||||
}
|
||||
}, _callee2);
|
||||
}));
|
||||
return function handleSave(_x, _x2, _x3) {
|
||||
return _ref3.apply(this, arguments);
|
||||
};
|
||||
}();
|
||||
var handleVerifySubmit = function handleVerifySubmit() {
|
||||
var _answerData$question_;
|
||||
var requiredCount = 0;
|
||||
var optionalCount = 0;
|
||||
answerData === null || answerData === void 0 || (_answerData$question_ = answerData.question_answered) === null || _answerData$question_ === void 0 || _answerData$question_.map(function (item) {
|
||||
if ((item === null || item === void 0 ? void 0 : item.ques_status) === 0) {
|
||||
var _answerData$questions;
|
||||
var is_necessary = answerData === null || answerData === void 0 || (_answerData$questions = answerData.questions) === null || _answerData$questions === void 0 || (_answerData$questions = _answerData$questions.find(function (que) {
|
||||
var _que$question;
|
||||
return (que === null || que === void 0 || (_que$question = que.question) === null || _que$question === void 0 ? void 0 : _que$question.id) === item.ques_id;
|
||||
})) === null || _answerData$questions === void 0 || (_answerData$questions = _answerData$questions.question) === null || _answerData$questions === void 0 ? void 0 : _answerData$questions.is_necessary;
|
||||
if (is_necessary === 1) {
|
||||
requiredCount++;
|
||||
} else {
|
||||
optionalCount++;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (requiredCount > 0) {
|
||||
modal/* default */.Z.info({
|
||||
width: 530,
|
||||
title: '提示',
|
||||
centered: true,
|
||||
okText: '知道啦',
|
||||
onOk: function onOk() {
|
||||
setisclick(true);
|
||||
},
|
||||
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
||||
className: "tc font16 c-black-333",
|
||||
children: ["\u6709 ", requiredCount, " \u9898\u5FC5\u7B54\u9898\u672A\u7B54\uFF0C\u65E0\u6CD5\u63D0\u4EA4 ", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u8BF7\u5B8C\u6210\u5168\u90E8\u5FC5\u7B54\u9898\u540E\u518D\u63D0\u4EA4"]
|
||||
})
|
||||
});
|
||||
return;
|
||||
}
|
||||
modal/* default */.Z.confirm({
|
||||
width: 530,
|
||||
title: '提示',
|
||||
centered: true,
|
||||
okText: '确定',
|
||||
cancelText: '取消',
|
||||
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
||||
className: "tc font16 c-black-333",
|
||||
children: [optionalCount > 0 && /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
||||
children: ["\u6709 ", optionalCount, " \u9898\u672A\u7B54 ", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {})]
|
||||
}), "\u63D0\u4EA4\u540E\u65E0\u6CD5\u518D\u4FEE\u6539\u7B54\u9898\uFF0C\u662F\u5426\u786E\u8BA4\u63D0\u4EA4\uFF1F"]
|
||||
}),
|
||||
onOk: function onOk() {
|
||||
handleSubmit();
|
||||
}
|
||||
});
|
||||
};
|
||||
var handleSubmit = /*#__PURE__*/function () {
|
||||
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
||||
var res;
|
||||
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
||||
while (1) switch (_context3.prev = _context3.next) {
|
||||
case 0:
|
||||
_context3.next = 2;
|
||||
return (0,classrooms/* submitPollAnswer */.Ns)({
|
||||
categoryId: params.categoryId
|
||||
});
|
||||
case 2:
|
||||
res = _context3.sent;
|
||||
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
||||
message/* default */.ZP.success(res === null || res === void 0 ? void 0 : res.message);
|
||||
_umi_production_exports.history.push("/classrooms/".concat(params.coursesId, "/poll/").concat(params.categoryId, "/detail"));
|
||||
}
|
||||
case 4:
|
||||
case "end":
|
||||
return _context3.stop();
|
||||
}
|
||||
}, _callee3);
|
||||
}));
|
||||
return function handleSubmit() {
|
||||
return _ref4.apply(this, arguments);
|
||||
};
|
||||
}();
|
||||
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
||||
className: "edu-container",
|
||||
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
||||
className: "animated fadeIn",
|
||||
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
||||
className: "mt10",
|
||||
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(breadcrumb/* default */.Z, {
|
||||
separator: ">",
|
||||
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, {
|
||||
children: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
||||
to: "/classrooms/".concat(params.coursesId, "/poll"),
|
||||
children: answerData === null || answerData === void 0 || (_answerData$course = answerData.course) === null || _answerData$course === void 0 ? void 0 : _answerData$course.name
|
||||
})
|
||||
}), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, {
|
||||
children: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
||||
to: "/classrooms/".concat(params.coursesId, "/poll"),
|
||||
children: "\u95EE\u5377"
|
||||
})
|
||||
}), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, {
|
||||
children: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
||||
to: "/classrooms/".concat(params.coursesId, "/poll/").concat(params.categoryId, "/detail"),
|
||||
children: "\u95EE\u5377\u8BE6\u60C5"
|
||||
})
|
||||
}), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, {
|
||||
children: (_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.real_name
|
||||
})]
|
||||
})
|
||||
}), /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
||||
className: [Answermodules.title, 'mt20'].join(' '),
|
||||
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
||||
style: {
|
||||
width: "100%"
|
||||
},
|
||||
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
||||
flex: "1",
|
||||
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
||||
to: "/classrooms/".concat(params.coursesId, "/poll/").concat(params.categoryId, "/detail"),
|
||||
children: /*#__PURE__*/(0,jsx_runtime.jsx)(ArrowLeftOutlined/* default */.Z, {
|
||||
className: "font16 c-black"
|
||||
})
|
||||
}), /*#__PURE__*/(0,jsx_runtime.jsx)("strong", {
|
||||
className: "font24 ml5",
|
||||
children: answerData === null || answerData === void 0 || (_answerData$poll = answerData.poll) === null || _answerData$poll === void 0 ? void 0 : _answerData$poll.polls_name
|
||||
}), /*#__PURE__*/(0,jsx_runtime.jsx)(util/* StatusClassroomsTags */.VV, {
|
||||
status: [util/* PollsStatus */.L4[answerData === null || answerData === void 0 || (_answerData$poll2 = answerData.poll) === null || _answerData$poll2 === void 0 ? void 0 : _answerData$poll2.poll_status]]
|
||||
})]
|
||||
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {})]
|
||||
})
|
||||
}), (answerData === null || answerData === void 0 || (_answerData$poll3 = answerData.poll) === null || _answerData$poll3 === void 0 ? void 0 : _answerData$poll3.polls_description) && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
||||
className: Answermodules.pollDesc,
|
||||
value: answerData === null || answerData === void 0 || (_answerData$poll4 = answerData.poll) === null || _answerData$poll4 === void 0 ? void 0 : _answerData$poll4.polls_description
|
||||
})
|
||||
// <p className={styles.pollDesc}>{answerData?.poll?.polls_description}</p>
|
||||
]
|
||||
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
||||
style: {
|
||||
display: 'flex',
|
||||
alignItems: 'flex-start'
|
||||
},
|
||||
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
||||
style: {
|
||||
width: 900
|
||||
},
|
||||
className: [Answermodules.bg, 'pt30', 'pl30', 'pr30', 'pb30', 'mt20', 'mb50'].join(' '),
|
||||
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
||||
children: answerData === null || answerData === void 0 || (_answerData$questions2 = answerData.questions) === null || _answerData$questions2 === void 0 ? void 0 : _answerData$questions2.map(function (item, key) {
|
||||
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
||||
className: Answermodules.questionItem,
|
||||
id: "Anchor_".concat(key),
|
||||
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
||||
className: Answermodules.itemType,
|
||||
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
||||
className: "font16 c-blue mr5",
|
||||
children: [item.question.question_number, "\u3001", mapping[item.question.question_type]]
|
||||
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
||||
className: Answermodules.itemFlag,
|
||||
children: item.question.is_necessary == 1 ? '必答' : '选答'
|
||||
}), item.question.question_type == 2 && item.question.min_choices && item.question.max_choices && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
||||
children: item.question.min_choices == item.question.max_choices ? "可选" + item.question.max_choices + "项" : "可选" + item.question.min_choices + "-" + item.question.max_choices + "项"
|
||||
})]
|
||||
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
||||
children: item.question.question_title
|
||||
}),
|
||||
// 单选项
|
||||
item.question.question_type == 1 && /*#__PURE__*/(0,jsx_runtime.jsx)(components_Single, {
|
||||
answerData: answerData,
|
||||
itemData: item,
|
||||
onSave: handleSave
|
||||
}),
|
||||
// 多选项
|
||||
item.question.question_type == 2 && /*#__PURE__*/(0,jsx_runtime.jsx)(components_Multiple, {
|
||||
answerData: answerData,
|
||||
itemData: item,
|
||||
onSave: handleSave
|
||||
}),
|
||||
//主观题
|
||||
item.question.question_type == 3 && /*#__PURE__*/(0,jsx_runtime.jsx)(components_Subjective, {
|
||||
answerData: answerData,
|
||||
itemData: item,
|
||||
onSave: handleSave
|
||||
})]
|
||||
});
|
||||
})
|
||||
})
|
||||
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
||||
style: {
|
||||
margin: 20,
|
||||
width: 280,
|
||||
background: '#fff',
|
||||
maxHeight: '60%',
|
||||
padding: '20px'
|
||||
},
|
||||
children: ["\u5171", answerData === null || answerData === void 0 || (_answerData$question_2 = answerData.question_types) === null || _answerData$question_2 === void 0 ? void 0 : _answerData$question_2.q_counts, "\u9053\u9898\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
||||
style: {
|
||||
display: 'flex',
|
||||
margin: '5px 0px'
|
||||
},
|
||||
children: [(answerData === null || answerData === void 0 || (_answerData$question_3 = answerData.question_types) === null || _answerData$question_3 === void 0 ? void 0 : _answerData$question_3.q_singles) > 0 && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
||||
className: " c-grey-999",
|
||||
children: ["\u5355\u9009\u9898 ", answerData === null || answerData === void 0 || (_answerData$question_4 = answerData.question_types) === null || _answerData$question_4 === void 0 ? void 0 : _answerData$question_4.q_singles, "\u9898"]
|
||||
}), (answerData === null || answerData === void 0 || (_answerData$question_5 = answerData.question_types) === null || _answerData$question_5 === void 0 ? void 0 : _answerData$question_5.q_doubles) > 0 && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
||||
style: {
|
||||
margin: '0px 5px'
|
||||
},
|
||||
className: " c-grey-999",
|
||||
children: ["\u591A\u9009\u9898 ", answerData === null || answerData === void 0 || (_answerData$question_6 = answerData.question_types) === null || _answerData$question_6 === void 0 ? void 0 : _answerData$question_6.q_doubles, "\u9898"]
|
||||
}), (answerData === null || answerData === void 0 || (_answerData$question_7 = answerData.question_types) === null || _answerData$question_7 === void 0 ? void 0 : _answerData$question_7.q_mains) > 0 && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
||||
className: " c-grey-999",
|
||||
children: ["\u4E3B\u89C2\u9898 ", answerData === null || answerData === void 0 || (_answerData$question_8 = answerData.question_types) === null || _answerData$question_8 === void 0 ? void 0 : _answerData$question_8.q_mains, "\u9898"]
|
||||
})]
|
||||
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
||||
style: {
|
||||
display: 'flex'
|
||||
},
|
||||
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
||||
style: {
|
||||
display: 'flex',
|
||||
alignItems: 'center'
|
||||
},
|
||||
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
||||
style: {
|
||||
background: '#0045d3',
|
||||
width: 15,
|
||||
height: 15,
|
||||
borderRadius: '50%',
|
||||
marginRight: 10
|
||||
}
|
||||
}), " \u5DF2\u7B54"]
|
||||
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
||||
style: {
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
marginLeft: 20
|
||||
},
|
||||
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
||||
style: {
|
||||
border: "1px solid #cbcbcb",
|
||||
width: 15,
|
||||
height: 15,
|
||||
borderRadius: '50%',
|
||||
marginRight: 10
|
||||
}
|
||||
}), " \u672A\u7B54"]
|
||||
})]
|
||||
}), /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
|
||||
gutter: [30, 0],
|
||||
className: "mt10",
|
||||
children: /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
||||
flex: "1",
|
||||
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_anchor/* default */.Z, {
|
||||
affix: false,
|
||||
className: Answermodules.anchor,
|
||||
children: answerData === null || answerData === void 0 || (_answerData$question_9 = answerData.question_answered) === null || _answerData$question_9 === void 0 ? void 0 : _answerData$question_9.map(function (item, key) {
|
||||
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_anchor/* default */.Z.Link, {
|
||||
className: "".concat(Answermodules.answerFlag, " ").concat(item.ques_status == 1 ? Answermodules.answerActive : isclick && item.is_necessary === 1 ? Answermodules.redactivie : ''),
|
||||
href: "#Anchor_".concat(key),
|
||||
title: item.ques_number
|
||||
});
|
||||
})
|
||||
})
|
||||
})
|
||||
}), (0,authority/* isStudent */.dE)() && (answerData === null || answerData === void 0 || (_answerData$poll5 = answerData.poll) === null || _answerData$poll5 === void 0 ? void 0 : _answerData$poll5.user_poll_status) === 0 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
||||
className: "mt30 mb50",
|
||||
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
||||
className: Answermodules.submitButton,
|
||||
type: "primary",
|
||||
onClick: handleVerifySubmit,
|
||||
children: "\u63D0\u4EA4"
|
||||
})
|
||||
})]
|
||||
})]
|
||||
})]
|
||||
});
|
||||
};
|
||||
/* harmony default export */ var Polls_Answer = ((0,_umi_production_exports.connect)(function (_ref5) {
|
||||
var loading = _ref5.loading,
|
||||
user = _ref5.user,
|
||||
globalSetting = _ref5.globalSetting;
|
||||
return {
|
||||
globalSetting: globalSetting,
|
||||
user: user,
|
||||
loading: loading.effects
|
||||
};
|
||||
})(Answer));
|
||||
|
||||
/***/ })
|
||||
|
||||
}]);
|
||||
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue