"use strict"; (self["webpackChunk"] = self["webpackChunk"] || []).push([[38897],{ /***/ 56549: /*!***********************************************************************************!*\ !*** ./src/pages/Classrooms/Lists/Polls/Edit/components/MultipleEditor/index.tsx ***! \***********************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js */ 7557); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/toConsumableArray.js */ 37205); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js */ 82242); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js */ 41498); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js */ 79800); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectWithoutProperties.js */ 39647); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_5__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react */ 59301); /* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! umi */ 2133); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! antd */ 8591); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! antd */ 43418); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! antd */ 6848); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! antd */ 95237); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! antd */ 43604); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! antd */ 24905); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! antd */ 78673); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! antd */ 36920); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! antd */ 57809); /* harmony import */ var _service_polls__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/service/polls */ 86127); /* harmony import */ var _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../editor.less?modules */ 56826); /* harmony import */ var _components_ui_customization__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/components/ui-customization */ 32359); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! react/jsx-runtime */ 37712); var _excluded = ["problemset", "globalSetting", "loading", "dispatch", "onRef", "editData", "editKey", "callback", "polls_status", "isadd"]; var tagList = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; var SingleEditor = function SingleEditor(_ref, ref) { var problemset = _ref.problemset, globalSetting = _ref.globalSetting, loading = _ref.loading, dispatch = _ref.dispatch, _ref$onRef = _ref.onRef, onRef = _ref$onRef === void 0 ? function () {} : _ref$onRef, editData = _ref.editData, editKey = _ref.editKey, callback = _ref.callback, polls_status = _ref.polls_status, isadd = _ref.isadd, props = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_5___default()(_ref, _excluded); var _useState = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)([]), _useState2 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_useState, 2), questionChoiceList = _useState2[0], setQuestionChoiceList = _useState2[1]; var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)(''), _useState4 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_useState3, 2), title = _useState4[0], setTitle = _useState4[1]; var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)(true), _useState6 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_useState5, 2), isNecessary = _useState6[0], setIsNecessary = _useState6[1]; var _useState7 = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)(false), _useState8 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_useState7, 2), other = _useState8[0], setOther = _useState8[1]; var params = (0,umi__WEBPACK_IMPORTED_MODULE_7__.useParams)(); var _useState9 = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)(''), _useState10 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_useState9, 2), maxChoices = _useState10[0], setMaxChoices = _useState10[1]; var _useState11 = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)(''), _useState12 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_useState11, 2), minChoices = _useState12[0], setMinChoices = _useState12[1]; (0,react__WEBPACK_IMPORTED_MODULE_6__.useEffect)(function () { var _editData$question, _editData$question2, _editData$question3, _editData$question4, _editData$question5, _editData$question8; if (!(editData !== null && editData !== void 0 && (_editData$question = editData.question) !== null && _editData$question !== void 0 && _editData$question.question_title)) { setQuestionChoiceList([{ disabled: false, value: "" }, { disabled: false, value: "" }, { disabled: false, value: "" }, { disabled: false, value: "" }]); setIsNecessary(true); setTitle(''); setOther(false); return; } setMaxChoices(editData === null || editData === void 0 || (_editData$question2 = editData.question) === null || _editData$question2 === void 0 ? void 0 : _editData$question2.max_choices); setMinChoices(editData === null || editData === void 0 || (_editData$question3 = editData.question) === null || _editData$question3 === void 0 ? void 0 : _editData$question3.min_choices); setTitle(editData === null || editData === void 0 || (_editData$question4 = editData.question) === null || _editData$question4 === void 0 ? void 0 : _editData$question4.question_title); setIsNecessary(!!(editData !== null && editData !== void 0 && (_editData$question5 = editData.question) !== null && _editData$question5 !== void 0 && _editData$question5.is_necessary)); if (!isadd) { var _editData$question6; setQuestionChoiceList(editData === null || editData === void 0 || (_editData$question6 = editData.question) === null || _editData$question6 === void 0 ? void 0 : _editData$question6.answers.map(function (item) { return { value: item.answer_text, disabled: item.answer_text === '其它' ? true : false, placeholder: item.answer_text === '其它' ? '无法编辑,将由参与答题的人手动编辑' : '' }; })); } else { var _editData$question7; setQuestionChoiceList(editData === null || editData === void 0 || (_editData$question7 = editData.question) === null || _editData$question7 === void 0 ? void 0 : _editData$question7.question_answers.map(function (item) { return { value: item, disabled: item === '其它' ? true : false, placeholder: item === '其它' ? '无法编辑,将由参与答题的人手动编辑' : '' }; })); } setOther(!!(editData !== null && editData !== void 0 && (_editData$question8 = editData.question) !== null && _editData$question8 !== void 0 && (_editData$question8 = _editData$question8.answers) !== null && _editData$question8 !== void 0 && _editData$question8.find(function (item) { return item.answer_text === '其它'; }))); }, [editData]); (0,react__WEBPACK_IMPORTED_MODULE_6__.useImperativeHandle)(ref, function () { return { onSave: onSave }; }); var onSave = /*#__PURE__*/function () { var _ref2 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee(status) { var _editData$question9; var findNotAnswerIndex, res, bodyData, _res, d; return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: if (!(maxChoices && !minChoices || !maxChoices && minChoices)) { _context.next = 3; break; } antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.info('可选:最小和最大限制须同时为数值或者“--"'); return _context.abrupt("return"); case 3: if (!(minChoices > maxChoices)) { _context.next = 6; break; } antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.info('可选的最大限制不能小于最小限制'); return _context.abrupt("return"); case 6: if (title) { _context.next = 9; break; } antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.info("请您输入题目"); return _context.abrupt("return", false); case 9: if (other) { questionChoiceList[questionChoiceList.length - 1].value = '其它'; } findNotAnswerIndex = questionChoiceList.findIndex(function (item) { return !item.value; }); if (!(findNotAnswerIndex > -1)) { _context.next = 14; break; } antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.info("\u8BF7\u5148\u8F93\u5165 ".concat(tagList[findNotAnswerIndex], " \u9009\u9879\u7684\u5185\u5BB9")); return _context.abrupt("return", false); case 14: bodyData = { "question_title": title, "question_type": 2, "insert_id": editData.insert_id, "is_necessary": Math.ceil(isNecessary), "max_choices": maxChoices, "min_choices": minChoices, "question_answers": questionChoiceList.map(function (item) { return item.value; }) }; if (!((_editData$question9 = editData.question) !== null && _editData$question9 !== void 0 && _editData$question9.id)) { _context.next = 21; break; } _context.next = 18; return (0,_service_polls__WEBPACK_IMPORTED_MODULE_8__/* .editPollsQuestion */ .IU)(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({ "pollsId": editData.question.id }, bodyData)); case 18: res = _context.sent; _context.next = 28; break; case 21: if (!isadd) { _context.next = 25; break; } // callback('edit', -1) if (status) { callback('isadd', bodyData, 2); } else { callback('isadd', bodyData); } _context.next = 28; break; case 25: _context.next = 27; return (0,_service_polls__WEBPACK_IMPORTED_MODULE_8__/* .addExerciseQuestion */ .MK)(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({ "pollsId": params.categoryId }, bodyData)); case 27: res = _context.sent; case 28: if (isadd) { _context.next = 36; break; } if (!(res.status === 0)) { _context.next = 36; break; } antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.success("保存成功"); callback('edit', -1); _context.next = 34; return dispatch({ type: "polls/editPolls", payload: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({}, params) }); case 34: _res = _context.sent; if (status) { // bodyData.answers = bodyData.question_answers.map(item => { return { answer_text: item } }) // const callbackEditData = [ // ...editRes?.poll_questions, // { question: { type: 2, insert_id: editData.question.id, key: editData.key, question_type: 2, ...bodyData } } // ] // callback('addContinue', { editData: callbackEditData }) bodyData.answers = bodyData.question_answers.map(function (item) { return { answer_text: item }; }); d = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_res.poll_questions); d.splice(editData === null || editData === void 0 ? void 0 : editData.key, 0, { insert_id: editData === null || editData === void 0 ? void 0 : editData.insert_id, question: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({}, bodyData) }).slice(); callback('addContinue', _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1___default()(d)); callback('edit', editData.key + 1); } case 36: case "end": return _context.stop(); } }, _callee); })); return function onSave(_x) { return _ref2.apply(this, arguments); }; }(); var actionArr = [{ name: "删除", icon: "iconfont c-red ml30 icon-shanchutimu current font20", id: "del" }, { name: "上移", icon: "iconfont c-green ml30 icon-xiangshangyi current font20", id: "up" }, { name: "下移", icon: "iconfont c-green ml30 icon-xiangxiayi current font20", id: "down" }, { name: "复制题型", icon: "iconfont c-green ml30 icon-tianjia2 current font20", id: "add" }, { name: "编辑", icon: "iconfont c-green ml30 icon-bianji-moren current font20", id: "edit" }]; var actionArradd = [{ name: "删除", icon: "iconfont c-red ml30 icon-shanchutimu current font20", id: "del" }, { name: "复制题型", icon: "iconfont c-green ml30 icon-tianjia2 current font20", id: "add" }, { name: "编辑", icon: "iconfont c-green ml30 icon-bianji-moren current font20", id: "edit" }]; var actionClick = /*#__PURE__*/function () { var _ref3 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee3(item) { var _editData$question11, _editData$question12; return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: _context3.t0 = item.id; _context3.next = _context3.t0 === "del" ? 3 : _context3.t0 === "up" ? 5 : _context3.t0 === "down" ? 5 : _context3.t0 === "edit" ? 9 : _context3.t0 === "add" ? 11 : 13; break; case 3: antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.confirm({ centered: true, okText: '确定', cancelText: '取消', title: '确认要删除这个问题吗?', onOk: function onOk() { return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee2() { var _editData$question10; return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: if (!isadd) { _context2.next = 4; break; } // console.log('---',editData.key); callback('del', editData.key); _context2.next = 7; break; case 4: _context2.next = 6; return (0,_service_polls__WEBPACK_IMPORTED_MODULE_8__/* .deletePollsQuestion */ .jy)({ pollsId: editData === null || editData === void 0 || (_editData$question10 = editData.question) === null || _editData$question10 === void 0 ? void 0 : _editData$question10.id }); case 6: dispatch({ type: "polls/editPolls", payload: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({}, params) }); case 7: case "end": return _context2.stop(); } }, _callee2); }))(); } }); return _context3.abrupt("break", 13); case 5: _context3.next = 7; return (0,_service_polls__WEBPACK_IMPORTED_MODULE_8__/* .pollsMoveUpDown */ .wh)({ pollsId: editData === null || editData === void 0 || (_editData$question11 = editData.question) === null || _editData$question11 === void 0 ? void 0 : _editData$question11.id, opr: item.id }); case 7: dispatch({ type: "polls/editPolls", payload: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({}, params) }); return _context3.abrupt("break", 13); case 9: callback('edit', editData.key); return _context3.abrupt("break", 13); case 11: callback('add', { type: 2, key: editData.key, insert_id: editData === null || editData === void 0 || (_editData$question12 = editData.question) === null || _editData$question12 === void 0 ? void 0 : _editData$question12.id, question_type: 2 }); return _context3.abrupt("break", 13); case 13: case "end": return _context3.stop(); } }, _callee3); })); return function actionClick(_x2) { return _ref3.apply(this, arguments); }; }(); var showList = function showList() { var _editData$question13, _editData$question14, _editData$question15, _editData$question$an, _editData$question$qu; var hasChooseChoices = (_editData$question13 = editData.question) === null || _editData$question13 === void 0 ? void 0 : _editData$question13.min_choices; return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("aside", { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.questionType, children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", { children: [editData.question.is_necessary > 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { style: { color: 'red', fontSize: '14px' }, children: "*" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { className: "font16", style: { color: '#3061D0' }, children: "\u3010\u591A\u9009\u3011" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.can_select_count, children: !hasChooseChoices ? null : "\u53EF\u9009".concat(editData === null || editData === void 0 || (_editData$question14 = editData.question) === null || _editData$question14 === void 0 ? void 0 : _editData$question14.min_choices, "-").concat(editData === null || editData === void 0 || (_editData$question15 = editData.question) === null || _editData$question15 === void 0 ? void 0 : _editData$question15.max_choices, "\u9879") }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("span", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.edit_title, children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("span", { style: { marginRight: '10px' }, children: ["\u7B2C", editData.key, "\u9898"] }), editData.question.question_title] })] }), !isadd && actionArr.map(function (item, index) { if (item.id === "up" && editData.key === 1) return null; if (item.id === "down" && editData.key === editData.len) return null; return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, { placement: "bottom", title: item.name, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { onClick: function onClick() { return actionClick(item); }, className: item.icon }) }, index); }), isadd && actionArradd.map(function (item, index) { if (item.id === "up" && editData.key === 1) return null; if (item.id === "down" && editData.key === editData.len) return null; return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, { placement: "bottom", title: item.name, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { onClick: function onClick() { return actionClick(item); }, className: item.icon }) }, index); })] }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.questionChoices, children: [!isadd && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.questionChoices, children: editData === null || editData === void 0 || (_editData$question$an = editData.question.answers) === null || _editData$question$an === void 0 ? void 0 : _editData$question$an.map(function (item, index) { return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { disabled: true }, index) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { flex: "1", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { className: "c-black font14 ml10", children: item.answer_text }) })] }); }) }), isadd && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.questionChoices, children: editData === null || editData === void 0 || (_editData$question$qu = editData.question.question_answers) === null || _editData$question$qu === void 0 ? void 0 : _editData$question$qu.map(function (item, index) { return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { disabled: true }, index) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { flex: "1", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { className: "c-black font14 ml10", children: item }) })] }); }) })] })] }); }; var showEdit = function showEdit() { return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("aside", { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.questionType, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { className: "font16 c-blue", children: "\u3010\u591A\u9009\u3011" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { className: "font16", style: { color: '#666666' }, children: "\u5FC5\u7B54" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_18__/* ["default"] */ .Z, { checked: isNecessary ? true : false, onChange: function onChange(e) { return setIsNecessary(e); }, className: "ml10" })] }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("p", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.titleWrap, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.choiceWrap, gutter: [12, 12], children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { children: "\u6807\u9898" }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.editorWrap, flex: "1", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_19__/* ["default"] */ .Z, { style: { width: '1000px', height: '40px' }, value: title, placeholder: "\u8BF7\u8F93\u5165\u9898\u76EE", onChange: function onChange(e) { return setTitle(e.target.value); } }) })] }) }), questionChoiceList.map(function (item, index) { var _item$placeholder; var lastIndex = questionChoiceList.length - 1; return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.choiceWrap, gutter: [12, 12], children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { children: other && index === lastIndex ? '其它' : "选项" }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.editorWrap, flex: "1", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_19__/* ["default"] */ .Z, { style: { width: '1000px', height: '40px' }, placeholder: (_item$placeholder = item.placeholder) !== null && _item$placeholder !== void 0 ? _item$placeholder : '', value: other && index === lastIndex ? '' : questionChoiceList[index]['value'], disabled: item.disabled ? true : false, onChange: function onChange(e) { questionChoiceList[index]['value'] = e.target.value; setQuestionChoiceList(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1___default()(questionChoiceList)); } }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { children: index > 1 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, { title: "\u5220\u9664", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("i", { className: "".concat(_editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.deleteIcon, " iconfont icon-yichu1"), onClick: function onClick() { setQuestionChoiceList(questionChoiceList.filter(function (_, key) { return key !== index; })); if (item.disabled) setOther(false); } }) }) })] }, index); }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("p", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.titleWrap, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.choiceWrap, gutter: [12, 12], children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { children: "\u53EF\u9009" }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_20__["default"], { value: minChoices || '', style: { width: 183, height: '40px' }, onChange: function onChange(value) { return setMinChoices(value); }, children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_20__["default"].Option, { value: "", children: "--" }), questionChoiceList.map(function (item, index) { return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_20__["default"].Option, { value: String(index + 1), children: index + 1 }); })] }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { className: "ml10 mr10", children: "-" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_20__["default"], { style: { width: 183, height: '40px' }, value: maxChoices || '', onChange: function onChange(value) { return setMaxChoices(value); }, children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_20__["default"].Option, { value: "", children: "--" }), questionChoiceList.map(function (item, index) { return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_20__["default"].Option, { value: String(index + 1), children: index + 1 }); })] }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, { title: "\u5B66\u751F\u7B54\u9898\u65F6\uFF0C\u7CFB\u7EDF\u5BF9\u5176\u9009\u62E9\u7684\u9009\u9879\u4E2A\u6570\u8FDB\u884C\u9650\u5236\uFF0C--\u8868\u793A\u4E0D\u9650\u5236", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("i", { className: "iconfont icon-xiaowenhao1 font14", style: { marginLeft: '10px', color: '#3061D0', cursor: 'pointer' } }) })] })] }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", { style: { display: 'flex', width: '1000px', margin: "20px 0 0 40px" }, children: [polls_status === 1 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.Fragment, { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_ui_customization__WEBPACK_IMPORTED_MODULE_10__/* .CustomButton */ .op, { style: { height: '38px' }, onClick: function onClick() { var rs = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1___default()(questionChoiceList); if (other) { rs.splice(rs.length - 1, 0, { value: '' }); } else { rs.push({ value: '' }); } setQuestionChoiceList(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1___default()(rs)); }, children: "\u65B0\u589E\u9009\u9879" }), !other && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_ui_customization__WEBPACK_IMPORTED_MODULE_10__/* .CustomButton */ .op, { style: { height: '38px', marginLeft: '20px' }, onClick: function onClick() { setQuestionChoiceList([].concat(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1___default()(questionChoiceList), [{ disabled: true, value: "", placeholder: '无法编辑!将由参与答题的人手动录入' }])); setOther(true); }, children: "\u65B0\u589E\u5176\u5B83\u9009\u9879" })] }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.close_style, onClick: function onClick() { var _editData$question16; if ((_editData$question16 = editData.question) !== null && _editData$question16 !== void 0 && _editData$question16.id) { var findNotAnswerIndex = questionChoiceList.findIndex(function (item) { return !item.value; }); // if (findNotAnswerIndex > -1) { // message.info(`请先输入 ${tagList[findNotAnswerIndex]} 选项的内容`) // return false // } if (isadd) { if (findNotAnswerIndex > -1) { callback('del', editData.key); } else { callback('edit', -1); } } else { callback('edit', -1); } } else { callback('del', editData.key); } }, children: "\u53D6\u6D88" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.save_style, onClick: function onClick() { return onSave(); }, children: "\u4FDD\u5B58" })] })] }); }; return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("section", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.wrap, children: [editKey !== editData.key && showList(), editKey === editData.key && showEdit()] }); }; /* harmony default export */ __webpack_exports__.Z = ((0,umi__WEBPACK_IMPORTED_MODULE_7__.connect)(function (_ref4) { var problemset = _ref4.problemset, loading = _ref4.loading, globalSetting = _ref4.globalSetting; return { problemset: problemset, globalSetting: globalSetting, loading: loading.effects }; }, null, null, { forwardRef: true })( /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_6__.forwardRef)(SingleEditor))); /***/ }), /***/ 28794: /*!*********************************************************************************!*\ !*** ./src/pages/Classrooms/Lists/Polls/Edit/components/SingleEditor/index.tsx ***! \*********************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js */ 7557); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/toConsumableArray.js */ 37205); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js */ 82242); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js */ 41498); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js */ 79800); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectWithoutProperties.js */ 39647); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_5__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react */ 59301); /* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! umi */ 2133); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! antd */ 8591); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! antd */ 43418); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! antd */ 6848); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! antd */ 95237); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! antd */ 43604); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! antd */ 5112); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! antd */ 78673); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! antd */ 36920); /* harmony import */ var _service_polls__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/service/polls */ 86127); /* harmony import */ var _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../editor.less?modules */ 56826); /* harmony import */ var _components_ui_customization__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/components/ui-customization */ 32359); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! react/jsx-runtime */ 37712); var _excluded = ["problemset", "globalSetting", "loading", "dispatch", "onRef", "editData", "editKey", "callback", "isadd", "polls_status"]; var tagList = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; var SingleEditor = function SingleEditor(_ref, ref) { var problemset = _ref.problemset, globalSetting = _ref.globalSetting, loading = _ref.loading, dispatch = _ref.dispatch, _ref$onRef = _ref.onRef, onRef = _ref$onRef === void 0 ? function () {} : _ref$onRef, editData = _ref.editData, editKey = _ref.editKey, callback = _ref.callback, isadd = _ref.isadd, polls_status = _ref.polls_status, props = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_5___default()(_ref, _excluded); var _useState = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)([]), _useState2 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_useState, 2), questionChoiceList = _useState2[0], setQuestionChoiceList = _useState2[1]; var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)(''), _useState4 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_useState3, 2), title = _useState4[0], setTitle = _useState4[1]; var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)(true), _useState6 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_useState5, 2), isNecessary = _useState6[0], setIsNecessary = _useState6[1]; var _useState7 = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)(false), _useState8 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_useState7, 2), other = _useState8[0], setOther = _useState8[1]; var params = (0,umi__WEBPACK_IMPORTED_MODULE_7__.useParams)(); (0,react__WEBPACK_IMPORTED_MODULE_6__.useEffect)(function () { var _editData$question, _editData$question2, _editData$question3, _editData$question6; if (!(editData !== null && editData !== void 0 && (_editData$question = editData.question) !== null && _editData$question !== void 0 && _editData$question.question_title)) { setQuestionChoiceList([{ disabled: false, value: "" }, { disabled: false, value: "" }, { disabled: false, value: "" }, { disabled: false, value: "" }]); setIsNecessary(true); setTitle(''); setOther(false); return; } setTitle(editData === null || editData === void 0 || (_editData$question2 = editData.question) === null || _editData$question2 === void 0 ? void 0 : _editData$question2.question_title); setIsNecessary(!!(editData !== null && editData !== void 0 && (_editData$question3 = editData.question) !== null && _editData$question3 !== void 0 && _editData$question3.is_necessary)); if (!isadd) { var _editData$question4; setQuestionChoiceList(editData === null || editData === void 0 || (_editData$question4 = editData.question) === null || _editData$question4 === void 0 ? void 0 : _editData$question4.answers.map(function (item) { return { value: item.answer_text, disabled: item.answer_text === '其它' ? true : false, placeholder: item.answer_text === '其它' ? '无法编辑,将由参与答题的人手动编辑' : '' }; })); } else { var _editData$question5; setQuestionChoiceList(editData === null || editData === void 0 || (_editData$question5 = editData.question) === null || _editData$question5 === void 0 ? void 0 : _editData$question5.question_answers.map(function (item) { return { value: item, disabled: item === '其它' ? true : false, placeholder: item === '其它' ? '无法编辑,将由参与答题的人手动编辑' : '' }; })); } setOther(!!(editData !== null && editData !== void 0 && (_editData$question6 = editData.question) !== null && _editData$question6 !== void 0 && (_editData$question6 = _editData$question6.answers) !== null && _editData$question6 !== void 0 && _editData$question6.find(function (item) { return item.answer_text === '其它'; }))); }, [editData]); (0,react__WEBPACK_IMPORTED_MODULE_6__.useImperativeHandle)(ref, function () { return { onSave: onSave }; }); var onSave = /*#__PURE__*/function () { var _ref2 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee(status) { var _editData$question7; var findNotAnswerIndex, res, bodyData, _res, d; return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: if (title) { _context.next = 3; break; } antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.info("请您输入题目"); return _context.abrupt("return", false); case 3: if (other) { questionChoiceList[questionChoiceList.length - 1].value = '其它'; } findNotAnswerIndex = questionChoiceList.findIndex(function (item) { return !item.value; }); if (!(findNotAnswerIndex > -1)) { _context.next = 8; break; } antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.info("\u8BF7\u5148\u8F93\u5165 ".concat(tagList[findNotAnswerIndex], " \u9009\u9879\u7684\u5185\u5BB9")); return _context.abrupt("return", false); case 8: bodyData = { "question_title": title, "question_type": 1, "insert_id": editData.insert_id, "is_necessary": Math.ceil(isNecessary), "question_answers": questionChoiceList.map(function (item) { return item.value; }) }; if (!((_editData$question7 = editData.question) !== null && _editData$question7 !== void 0 && _editData$question7.id)) { _context.next = 16; break; } callback('edit', -1); _context.next = 13; return (0,_service_polls__WEBPACK_IMPORTED_MODULE_8__/* .editPollsQuestion */ .IU)(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({ "pollsId": editData.question.id }, bodyData)); case 13: res = _context.sent; _context.next = 23; break; case 16: if (!isadd) { _context.next = 20; break; } // callback('edit', -1) if (status) { callback('isadd', bodyData, 1); } else { callback('isadd', bodyData); } _context.next = 23; break; case 20: _context.next = 22; return (0,_service_polls__WEBPACK_IMPORTED_MODULE_8__/* .addExerciseQuestion */ .MK)(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({ "pollsId": params.categoryId }, bodyData)); case 22: res = _context.sent; case 23: if (!isadd) { _context.next = 26; break; } _context.next = 33; break; case 26: if (!(res.status === 0)) { _context.next = 33; break; } callback('edit', -1); antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.success("保存成功"); _context.next = 31; return dispatch({ type: "polls/editPolls", payload: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({}, params) }); case 31: _res = _context.sent; if (status) { bodyData.answers = bodyData.question_answers.map(function (item) { return { answer_text: item }; }); d = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_res.poll_questions); d.splice(editData === null || editData === void 0 ? void 0 : editData.key, 0, { insert_id: editData === null || editData === void 0 ? void 0 : editData.insert_id, question: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({}, bodyData) }).slice(); callback('addContinue', _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1___default()(d)); callback('edit', editData.key + 1); } case 33: case "end": return _context.stop(); } }, _callee); })); return function onSave(_x) { return _ref2.apply(this, arguments); }; }(); var actionArr = [{ name: "删除", icon: "iconfont c-red ml30 icon-shanchutimu current font20", id: "del" }, { name: "上移", icon: "iconfont c-green ml30 icon-xiangshangyi current font20", id: "up" }, { name: "下移", icon: "iconfont c-green ml30 icon-xiangxiayi current font20", id: "down" }, { name: "复制题型", icon: "iconfont c-green ml30 icon-tianjia2 current font20", id: "add" }, { name: "编辑", icon: "iconfont c-green ml30 icon-bianji-moren current font20", id: "edit" }]; var actionArradd = [{ name: "删除", icon: "iconfont c-red ml30 icon-shanchutimu current font20", id: "del" }, { name: "复制题型", icon: "iconfont c-green ml30 icon-tianjia2 current font20", id: "add" }, { name: "编辑", icon: "iconfont c-green ml30 icon-bianji-moren current font20", id: "edit" }]; var actionClick = /*#__PURE__*/function () { var _ref3 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee3(item) { var _editData$question9, _editData$question10; return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: _context3.t0 = item.id; _context3.next = _context3.t0 === "del" ? 3 : _context3.t0 === "up" ? 5 : _context3.t0 === "down" ? 5 : _context3.t0 === "edit" ? 9 : _context3.t0 === "add" ? 11 : 13; break; case 3: antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.confirm({ centered: true, okText: '确定', cancelText: '取消', title: '确认要删除这个问题吗?', onOk: function onOk() { return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee2() { var _editData$question8; return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: if (!isadd) { _context2.next = 4; break; } // console.log('---',editData.key); callback('del', editData.key); _context2.next = 7; break; case 4: _context2.next = 6; return (0,_service_polls__WEBPACK_IMPORTED_MODULE_8__/* .deletePollsQuestion */ .jy)({ pollsId: editData === null || editData === void 0 || (_editData$question8 = editData.question) === null || _editData$question8 === void 0 ? void 0 : _editData$question8.id }); case 6: dispatch({ type: "polls/editPolls", payload: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({}, params) }); case 7: case "end": return _context2.stop(); } }, _callee2); }))(); } }); return _context3.abrupt("break", 13); case 5: _context3.next = 7; return (0,_service_polls__WEBPACK_IMPORTED_MODULE_8__/* .pollsMoveUpDown */ .wh)({ pollsId: editData === null || editData === void 0 || (_editData$question9 = editData.question) === null || _editData$question9 === void 0 ? void 0 : _editData$question9.id, opr: item.id }); case 7: dispatch({ type: "polls/editPolls", payload: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({}, params) }); return _context3.abrupt("break", 13); case 9: callback('edit', editData.key); return _context3.abrupt("break", 13); case 11: callback('add', { type: 1, key: editData.key, insert_id: editData === null || editData === void 0 || (_editData$question10 = editData.question) === null || _editData$question10 === void 0 ? void 0 : _editData$question10.id, question_type: 1 }); return _context3.abrupt("break", 13); case 13: case "end": return _context3.stop(); } }, _callee3); })); return function actionClick(_x2) { return _ref3.apply(this, arguments); }; }(); var showList = function showList() { var _editData$question$an, _editData$question$qu; return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("aside", { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.questionType, children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", { children: [editData.question.is_necessary > 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { style: { color: 'red', fontSize: '14px' }, children: "*" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { className: "font16", style: { color: '#3061D0' }, children: "\u3010\u5355\u9009\u3011" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("span", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.edit_title, children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("span", { style: { marginRight: '10px' }, children: ["\u7B2C", editData.key, "\u9898"] }), editData.question.question_title] })] }), !isadd && actionArr.map(function (item, index) { if (item.id === "up" && editData.key === 1) return null; if (item.id === "down" && editData.key === editData.len) return null; return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, { placement: "bottom", title: item.name, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { onClick: function onClick() { return actionClick(item); }, className: item.icon }) }, index); }), isadd && actionArradd.map(function (item, index) { if (item.id === "up" && editData.key === 1) return null; if (item.id === "down" && editData.key === editData.len) return null; return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, { placement: "bottom", title: item.name, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { onClick: function onClick() { return actionClick(item); }, className: item.icon }) }, index); })] }), !isadd && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.questionChoices, children: editData === null || editData === void 0 || (_editData$question$an = editData.question.answers) === null || _editData$question$an === void 0 ? void 0 : _editData$question$an.map(function (item, index) { return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .ZP, { disabled: true }, index) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { flex: "1", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { className: "c-black font14", children: item.answer_text }) })] }); }) }), isadd && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.questionChoices, children: editData === null || editData === void 0 || (_editData$question$qu = editData.question.question_answers) === null || _editData$question$qu === void 0 ? void 0 : _editData$question$qu.map(function (item, index) { return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .ZP, { disabled: true }, index) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { flex: "1", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { className: "c-black font14", children: item }) })] }); }) })] }); }; var showEdit = function showEdit() { return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("aside", { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.questionType, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { className: "font16 c-blue", children: "\u3010\u5355\u9009\u3011" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { className: "font16", style: { color: '#666666' }, children: "\u5FC5\u7B54" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_18__/* ["default"] */ .Z, { checked: isNecessary ? true : false, onChange: function onChange(e) { return setIsNecessary(e); }, className: "ml10" })] }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("p", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.titleWrap, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.choiceWrap, gutter: [12, 12], children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { children: "\u6807\u9898" }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.editorWrap, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_19__/* ["default"] */ .Z, { style: { width: '1000px', height: '40px' }, value: title, placeholder: "\u8BF7\u8F93\u5165\u9898\u76EE", onChange: function onChange(e) { return setTitle(e.target.value); } }) })] }) }), questionChoiceList.map(function (item, index) { var _item$placeholder; var lastIndex = questionChoiceList.length - 1; return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.choiceWrap, gutter: [12, 12], children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { children: other && index === lastIndex ? '其它' : "选项" }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.editorWrap, flex: "1", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_19__/* ["default"] */ .Z, { style: { width: '1000px', height: '40px' }, placeholder: (_item$placeholder = item.placeholder) !== null && _item$placeholder !== void 0 ? _item$placeholder : '', value: other && index === lastIndex ? '' : questionChoiceList[index]['value'], disabled: item.disabled ? true : false, onChange: function onChange(e) { questionChoiceList[index]['value'] = e.target.value; setQuestionChoiceList(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1___default()(questionChoiceList)); } }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { children: index > 1 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, { title: "\u5220\u9664", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("i", { className: "".concat(_editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.deleteIcon, " iconfont icon-yichu1"), onClick: function onClick() { setQuestionChoiceList(questionChoiceList.filter(function (_, key) { return key !== index; })); if (item.disabled) setOther(false); } }) }) })] }, index); }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", { style: { display: 'flex', width: '1000px', margin: "20px 0 0 40px" }, children: [polls_status === 1 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.Fragment, { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_ui_customization__WEBPACK_IMPORTED_MODULE_10__/* .CustomButton */ .op, { style: { height: '38px' }, onClick: function onClick() { var rs = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1___default()(questionChoiceList); if (other) { rs.splice(rs.length - 1, 0, { value: '' }); } else { rs.push({ value: '' }); } setQuestionChoiceList(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1___default()(rs)); }, children: "\u65B0\u589E\u9009\u9879" }), !other && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_ui_customization__WEBPACK_IMPORTED_MODULE_10__/* .CustomButton */ .op, { style: { height: '38px', marginLeft: '20px' }, onClick: function onClick() { setQuestionChoiceList([].concat(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1___default()(questionChoiceList), [{ disabled: true, value: "", placeholder: '无法编辑!将由参与答题的人手动录入' }])); setOther(true); }, children: "\u65B0\u589E\u5176\u5B83\u9009\u9879" })] }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.close_style, onClick: function onClick() { var _editData$question11; if ((_editData$question11 = editData.question) !== null && _editData$question11 !== void 0 && _editData$question11.id) { var findNotAnswerIndex = questionChoiceList.findIndex(function (item) { return !item.value; }); // if (findNotAnswerIndex > -1) { // message.info(`请先输入 ${tagList[findNotAnswerIndex]} 选项的内容`) // return false // } if (isadd) { if (findNotAnswerIndex > -1) { callback('del', editData.key); } else { callback('edit', -1); } } else { callback('edit', -1); } } else { callback('del', editData.key); } }, children: "\u53D6\u6D88" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.save_style, onClick: function onClick() { return onSave(); }, children: "\u4FDD\u5B58" })] })] }); }; return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("section", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z.wrap, children: [editKey !== editData.key && showList(), editKey === editData.key && showEdit()] }); }; /* harmony default export */ __webpack_exports__.Z = ((0,umi__WEBPACK_IMPORTED_MODULE_7__.connect)(function (_ref4) { var problemset = _ref4.problemset, loading = _ref4.loading, globalSetting = _ref4.globalSetting; return { problemset: problemset, globalSetting: globalSetting, loading: loading.effects }; }, null, null, { forwardRef: true })( /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_6__.forwardRef)(SingleEditor))); /***/ }), /***/ 64550: /*!*************************************************************************************!*\ !*** ./src/pages/Classrooms/Lists/Polls/Edit/components/SubjectiveEditor/index.tsx ***! \*************************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js */ 7557); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/toConsumableArray.js */ 37205); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js */ 82242); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js */ 41498); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js */ 79800); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react */ 59301); /* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! umi */ 2133); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! antd */ 8591); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! antd */ 43418); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! antd */ 6848); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! antd */ 95237); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! antd */ 43604); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! antd */ 24905); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! antd */ 78673); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! antd */ 36920); /* harmony import */ var _service_polls__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/service/polls */ 86127); /* harmony import */ var _editor_less_modules__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../editor.less?modules */ 56826); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! react/jsx-runtime */ 37712); var SingleEditor = function SingleEditor(_ref, ref) { var problemset = _ref.problemset, globalSetting = _ref.globalSetting, loading = _ref.loading, dispatch = _ref.dispatch, _ref$onRef = _ref.onRef, onRef = _ref$onRef === void 0 ? function () {} : _ref$onRef, editData = _ref.editData, polls_status = _ref.polls_status, editKey = _ref.editKey, isadd = _ref.isadd, callback = _ref.callback; var _useState = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(''), _useState2 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_useState, 2), title = _useState2[0], setTitle = _useState2[1]; var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(true), _useState4 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_useState3, 2), isNecessary = _useState4[0], setIsNecessary = _useState4[1]; var params = (0,umi__WEBPACK_IMPORTED_MODULE_6__.useParams)(); (0,react__WEBPACK_IMPORTED_MODULE_5__.useEffect)(function () { var _editData$question, _editData$question2, _editData$question3; if (!(editData !== null && editData !== void 0 && (_editData$question = editData.question) !== null && _editData$question !== void 0 && _editData$question.question_title)) { setIsNecessary(true); setTitle(''); return; } setTitle(editData === null || editData === void 0 || (_editData$question2 = editData.question) === null || _editData$question2 === void 0 ? void 0 : _editData$question2.question_title); setIsNecessary(!!(editData !== null && editData !== void 0 && (_editData$question3 = editData.question) !== null && _editData$question3 !== void 0 && _editData$question3.is_necessary)); }, [editData]); (0,react__WEBPACK_IMPORTED_MODULE_5__.useImperativeHandle)(ref, function () { return { onSave: onSave }; }); var onSave = /*#__PURE__*/function () { var _ref2 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee(status) { var _editData$question4; var res, bodyData, _res, d; return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: if (title) { _context.next = 3; break; } antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .ZP.info("请您输入题目"); return _context.abrupt("return", false); case 3: bodyData = { "question_title": title, "question_type": 3, "insert_id": editData.insert_id, "is_necessary": Math.ceil(isNecessary) }; if (!((_editData$question4 = editData.question) !== null && _editData$question4 !== void 0 && _editData$question4.id)) { _context.next = 10; break; } _context.next = 7; return (0,_service_polls__WEBPACK_IMPORTED_MODULE_7__/* .editPollsQuestion */ .IU)(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({ "pollsId": editData.question.id }, bodyData)); case 7: res = _context.sent; _context.next = 17; break; case 10: if (!isadd) { _context.next = 14; break; } if (status) { callback('isadd', bodyData, 3); } else { callback('isadd', bodyData); } _context.next = 17; break; case 14: _context.next = 16; return (0,_service_polls__WEBPACK_IMPORTED_MODULE_7__/* .addExerciseQuestion */ .MK)(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({ "pollsId": params.categoryId }, bodyData)); case 16: res = _context.sent; case 17: if (isadd) { _context.next = 25; break; } if (!(res.status === 0)) { _context.next = 25; break; } antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .ZP.success("保存成功"); callback('edit', -1); _context.next = 23; return dispatch({ type: "polls/editPolls", payload: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({}, params) }); case 23: _res = _context.sent; if (status) { // const callbackEditData = [ // ...editRes?.poll_questions, // { question: { type: 3, insert_id: editData.question.id, key: editData.key, question_type: 3, ...bodyData } } // ]; // callback('addContinue', { editData: callbackEditData }); // bodyData.answers = bodyData.question_answers.map(item => { return { answer_text: item } }) d = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_res.poll_questions); d.splice(editData === null || editData === void 0 ? void 0 : editData.key, 0, { insert_id: editData === null || editData === void 0 ? void 0 : editData.insert_id, question: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({}, bodyData) }).slice(); callback('addContinue', _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1___default()(d)); callback('edit', editData.key + 1); } case 25: case "end": return _context.stop(); } }, _callee); })); return function onSave(_x) { return _ref2.apply(this, arguments); }; }(); var actionArr = [{ name: "删除", icon: "iconfont c-red ml30 icon-shanchutimu current font20", id: "del" }, { name: "上移", icon: "iconfont c-green ml30 icon-xiangshangyi current font20", id: "up" }, { name: "下移", icon: "iconfont c-green ml30 icon-xiangxiayi current font20", id: "down" }, { name: "复制题型", icon: "iconfont c-green ml30 icon-tianjia2 current font20", id: "add" }, { name: "编辑", icon: "iconfont c-green ml30 icon-bianji-moren current font20", id: "edit" }]; var actionArradd = [{ name: "删除", icon: "iconfont c-red ml30 icon-shanchutimu current font20", id: "del" }, { name: "复制题型", icon: "iconfont c-green ml30 icon-tianjia2 current font20", id: "add" }, { name: "编辑", icon: "iconfont c-green ml30 icon-bianji-moren current font20", id: "edit" }]; var actionClick = /*#__PURE__*/function () { var _ref3 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee3(item) { var _editData$question6, _editData$question7; return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: _context3.t0 = item.id; _context3.next = _context3.t0 === "del" ? 3 : _context3.t0 === "up" ? 5 : _context3.t0 === "down" ? 5 : _context3.t0 === "edit" ? 9 : _context3.t0 === "add" ? 11 : 13; break; case 3: antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.confirm({ centered: true, okText: '确定', cancelText: '取消', title: '确认要删除这个问题吗?', onOk: function onOk() { return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee2() { var _editData$question5; return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: if (!isadd) { _context2.next = 4; break; } // console.log('---',editData.key); callback('del', editData.key); _context2.next = 7; break; case 4: _context2.next = 6; return (0,_service_polls__WEBPACK_IMPORTED_MODULE_7__/* .deletePollsQuestion */ .jy)({ pollsId: editData === null || editData === void 0 || (_editData$question5 = editData.question) === null || _editData$question5 === void 0 ? void 0 : _editData$question5.id }); case 6: dispatch({ type: "polls/editPolls", payload: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({}, params) }); case 7: case "end": return _context2.stop(); } }, _callee2); }))(); } }); return _context3.abrupt("break", 13); case 5: _context3.next = 7; return (0,_service_polls__WEBPACK_IMPORTED_MODULE_7__/* .pollsMoveUpDown */ .wh)({ pollsId: editData === null || editData === void 0 || (_editData$question6 = editData.question) === null || _editData$question6 === void 0 ? void 0 : _editData$question6.id, opr: item.id }); case 7: dispatch({ type: "polls/editPolls", payload: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({}, params) }); return _context3.abrupt("break", 13); case 9: callback('edit', editData.key); return _context3.abrupt("break", 13); case 11: callback('add', { type: 3, key: editData.key, insert_id: editData === null || editData === void 0 || (_editData$question7 = editData.question) === null || _editData$question7 === void 0 ? void 0 : _editData$question7.id, question_type: 3 }); return _context3.abrupt("break", 13); case 13: case "end": return _context3.stop(); } }, _callee3); })); return function actionClick(_x2) { return _ref3.apply(this, arguments); }; }(); var showList = function showList() { var _editData$question$an; return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("aside", { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.questionType, children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("div", { children: [editData.question.is_necessary > 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("span", { style: { color: 'red', fontSize: '14px' }, children: "*" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("span", { className: "font16", style: { color: '#3061D0' }, children: "\u3010\u95EE\u7B54\u3011" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("span", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.edit_title, children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("span", { style: { marginRight: '10px' }, children: ["\u7B2C", editData.key, "\u9898"] }), editData.question.question_title] })] }), !isadd && actionArr.map(function (item, index) { if (item.id === "up" && editData.key === 1) return null; if (item.id === "down" && editData.key === editData.len) return null; return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, { placement: "bottom", title: item.name, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("span", { onClick: function onClick() { return actionClick(item); }, className: item.icon }) }, index); }), isadd && actionArradd.map(function (item, index) { if (item.id === "up" && editData.key === 1) return null; if (item.id === "down" && editData.key === editData.len) return null; return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, { placement: "bottom", title: item.name, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("span", { onClick: function onClick() { return actionClick(item); }, className: item.icon }) }, index); })] }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.questionChoices, children: editData === null || editData === void 0 || (_editData$question$an = editData.question.answers) === null || _editData$question$an === void 0 ? void 0 : _editData$question$an.map(function (item, index) { return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { disabled: true, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("span", { className: "c-black font14", children: item.answer_text }) }, index) }) }); }) })] }); }; var showEdit = function showEdit() { return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("aside", { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.questionType, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("div", { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("span", { className: "font16 c-blue", children: "\u3010\u95EE\u7B54\u3011" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("span", { className: "font16", style: { color: '#666666' }, children: "\u5FC5\u7B54" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { checked: isNecessary ? true : false, onChange: function onChange(e) { return setIsNecessary(e); }, className: "ml10" })] }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("p", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.titleWrap, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z, { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.choiceWrap, gutter: [12, 12], children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("span", { children: "\u6807\u9898" }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.editorWrap, flex: "1", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { style: { width: '1000px', height: '40px' }, value: title, placeholder: "\u8BF7\u8F93\u5165\u9898\u76EE", onChange: function onChange(e) { return setTitle(e.target.value); } }) })] }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("div", { style: { display: 'flex', width: '1000px', margin: "20px 0 0 40px" }, children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.close_style, onClick: function onClick() { var _editData$question8; if ((_editData$question8 = editData.question) !== null && _editData$question8 !== void 0 && _editData$question8.id) { // if (findNotAnswerIndex > -1) { // message.info(`请先输入 ${tagList[findNotAnswerIndex]} 选项的内容`) // return false // } if (isadd) { if (!title) { callback('del', editData.key); } else { callback('edit', -1); } } else { callback('edit', -1); } } else { callback('del', editData.key); } }, children: "\u53D6\u6D88" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.save_style, onClick: function onClick() { return onSave(); }, children: "\u4FDD\u5B58" })] })] }); }; return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("section", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.wrap, children: [editKey !== editData.key && showList(), editKey === editData.key && showEdit()] }); }; /* harmony default export */ __webpack_exports__.Z = ((0,umi__WEBPACK_IMPORTED_MODULE_6__.connect)(function (_ref4) { var problemset = _ref4.problemset, loading = _ref4.loading, globalSetting = _ref4.globalSetting; return { problemset: problemset, globalSetting: globalSetting, loading: loading.effects }; }, null, null, { forwardRef: true })( /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_5__.forwardRef)(SingleEditor))); /***/ }), /***/ 56826: /*!******************************************************************************!*\ !*** ./src/pages/Classrooms/Lists/Polls/Edit/components/editor.less?modules ***! \******************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__) { // extracted by mini-css-extract-plugin /* harmony default export */ __webpack_exports__.Z = ({"flex_box_center":"flex_box_center___JbEg0","flex_space_between":"flex_space_between___Kf6pN","flex_box_vertical_center":"flex_box_vertical_center___e4qgM","flex_box_center_end":"flex_box_center_end___p8QnY","flex_box_column":"flex_box_column___qCilW","wrap":"wrap___Gdnjm","modal":"modal___nL9rn","titleWrap":"titleWrap___ezuXc","required":"required___i8a7H","title":"title___FaxQL","colorGray":"colorGray___CO5Es","choiceWrap":"choiceWrap___pj0lT","answer":"answer___Aq1c0","activeAnswer":"activeAnswer___VIsVw","deleteIcon":"deleteIcon___Gsa5a","addIcon":"addIcon___Yr5Ku","editorWrap":"editorWrap____aGAd","htmlWrap":"htmlWrap___SKYBF","radio":"radio___wvdFS","color333":"color333___uuN3O","color999":"color999___prp8g","questionType":"questionType___FKxwP","questionChoices":"questionChoices___c0OQa","close_style":"close_style___NQVEE","save_style":"save_style___kq8NC","edit_title":"edit_title___W3elv","can_select_count":"can_select_count___F11WF"}); /***/ }) }]);