"use strict"; (self["webpackChunk"] = self["webpackChunk"] || []).push([[70651],{ /***/ 14027: /*!***********************************************************************************!*\ !*** ./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_v10_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_v10_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_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _root_workspace_ppte5yg23_local_v10_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_v10_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_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _root_workspace_ppte5yg23_local_v10_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_v10_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_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _root_workspace_ppte5yg23_local_v10_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_v10_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_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _root_workspace_ppte5yg23_local_v10_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_v10_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_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var _root_workspace_ppte5yg23_local_v10_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_v10_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_v10_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 */ 80184); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! antd */ 8591); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! antd */ 43418); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! antd */ 6848); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! antd */ 95237); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! antd */ 43604); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! antd */ 5112); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! antd */ 24905); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! antd */ 10249); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! antd */ 57809); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! antd */ 3113); /* harmony import */ var _service_polls__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/service/polls */ 6016); /* harmony import */ var _components_RenderHtml__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/components/RenderHtml */ 36707); /* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../index */ 70651); /* harmony import */ var _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../editor.less?modules */ 73702); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__ = __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_v10_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_v10_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_v10_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_v10_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_v10_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_v10_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_v10_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_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v10_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_v10_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_13__/* ["default"] */ .ZP.info('可选:最小和最大限制须同时为数值或者“--"'); return _context.abrupt("return"); case 3: if (!(minChoices > maxChoices)) { _context.next = 6; break; } antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .ZP.info('可选的最大限制不能小于最小限制'); return _context.abrupt("return"); case 6: if (title) { _context.next = 9; break; } antd__WEBPACK_IMPORTED_MODULE_13__/* ["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_13__/* ["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_v10_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_v10_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_13__/* ["default"] */ .ZP.success("保存成功"); callback('edit', -1); _context.next = 34; return dispatch({ type: "polls/editPolls", payload: _root_workspace_ppte5yg23_local_v10_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_v10_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_v10_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_v10_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-light-black ml30 icon-shanchu current", id: "del" }, { name: "上移", icon: "iconfont c-green ml30 icon-xiangshangyi current", id: "up" }, { name: "下移", icon: "iconfont c-green ml30 icon-xiangxiayi current", id: "down" }, { name: "添加", icon: "iconfont c-green ml30 icon-tianjia current", id: "add" }, { name: "编辑", icon: "iconfont c-green ml30 icon-bianjidaibeijing current", id: "edit" }]; var actionArradd = [{ name: "删除", icon: "iconfont c-light-black ml30 icon-shanchu current", id: "del" }, { name: "添加", icon: "iconfont c-green ml30 icon-tianjia current", id: "add" }, { name: "编辑", icon: "iconfont c-green ml30 icon-bianjidaibeijing current", id: "edit" }]; var actionClick = /*#__PURE__*/function () { var _ref3 = _root_workspace_ppte5yg23_local_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v10_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_v10_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_14__/* ["default"] */ .Z.confirm({ centered: true, okText: '确定', cancelText: '取消', title: '确认要删除这个问题吗?', onOk: function onOk() { return _root_workspace_ppte5yg23_local_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v10_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_v10_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_v10_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_v10_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_12__.jsxs)("aside", { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.questionType, children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("div", { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("span", { className: "font16", children: ["\u7B2C", editData.key, "\u9898"] }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("span", { className: "font16 c-light-black ml10 mr20", children: "\u591A\u9009\u9898" }), !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_12__.jsx)(_index__WEBPACK_IMPORTED_MODULE_10__.IsNecessaryLabel, { v: editData.question.is_necessary })] }), !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_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { placement: "bottom", title: item.name, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.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_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { placement: "bottom", title: item.name, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("span", { onClick: function onClick() { return actionClick(item); }, className: item.icon }) }, index); })] }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("div", { className: "mt5", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_components_RenderHtml__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, { value: editData.question.question_title }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.questionChoices, children: [!isadd && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["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_12__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_18__/* ["default"] */ .ZP, { disabled: true }, index) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { flex: "1", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("span", { className: "c-black font14", children: item.answer_text }) })] }); }) }), isadd && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["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_12__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_18__/* ["default"] */ .ZP, { disabled: true }, index) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { flex: "1", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("span", { className: "c-black font14", children: item }) })] }); }) })] })] }); }; var showEdit = function showEdit() { return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("aside", { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.questionType, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("div", { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("span", { className: "font16 c-blue", children: "\u591A\u9009\u9898" }), " ", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_19__/* ["default"] */ .Z, { checked: isNecessary ? true : false, className: "ml10", onChange: function onChange(e) { return setIsNecessary(e.target.checked); }, children: "\u5FC5\u7B54" })] }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("p", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.titleWrap, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_20__/* ["default"] */ .Z.TextArea, { autoSize: { maxRows: 5 }, rows: 1, 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_12__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.choiceWrap, gutter: [12, 12], children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("span", { className: "font16", children: other && index === lastIndex ? '其它' : "选项" }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.editorWrap, flex: "1", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_20__/* ["default"] */ .Z.TextArea, { autoSize: { maxRows: 5 }, value: other && index === lastIndex ? '' : questionChoiceList[index]['value'], placeholder: (_item$placeholder = item.placeholder) !== null && _item$placeholder !== void 0 ? _item$placeholder : '', rows: 1, disabled: item.disabled ? true : false, onChange: function onChange(e) { questionChoiceList[index]['value'] = e.target.value; setQuestionChoiceList(_root_workspace_ppte5yg23_local_v10_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_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { children: index > 1 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { title: "\u5220\u9664", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("i", { className: "".concat(_editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.deleteIcon, " iconfont icon-htmal5icon19"), 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_12__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { gutter: [12, 12], children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { children: "\u53EF\u9009" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_21__["default"], { value: minChoices || '', style: { width: 120 }, onChange: function onChange(value) { return setMinChoices(value); }, children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_21__["default"].Option, { value: "", children: "--" }), questionChoiceList.map(function (item, index) { return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_21__["default"].Option, { value: String(index + 2), children: index + 2 }); })] }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("span", { className: "ml10 mr10", children: "~" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_21__["default"], { style: { width: 120 }, value: maxChoices || '', onChange: function onChange(value) { return setMaxChoices(value); }, children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_21__["default"].Option, { value: "", children: "--" }), questionChoiceList.map(function (item, index) { return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_21__["default"].Option, { value: String(index + 2), children: index + 2 }); })] }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("span", { className: "font14 c-grey-999", children: "\uFF08\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\uFF09" })] })] }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { gutter: [12, 12], children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { flex: "1", children: polls_status === 1 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.Fragment, { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_22__/* ["default"] */ .ZP, { type: "default", onClick: function onClick() { var rs = _root_workspace_ppte5yg23_local_v10_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_v10_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_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_22__/* ["default"] */ .ZP, { type: "default", className: "ml20", onClick: function onClick() { setQuestionChoiceList([].concat(_root_workspace_ppte5yg23_local_v10_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_12__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { className: "tl", style: { marginTop: 15 }, children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_22__/* ["default"] */ .ZP, { type: "default", 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_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_22__/* ["default"] */ .ZP, { className: "ml20", type: "primary", onClick: function onClick() { return onSave(); }, children: "\u4FDD\u5B58" }), polls_status === 1 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_22__/* ["default"] */ .ZP, { className: "ml20", type: "primary", onClick: function onClick() { return onSave(true); }, children: "\u4FDD\u5B58\u5E76\u7EE7\u7EED" })] })] })] }); }; return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("section", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["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))); /***/ }), /***/ 46066: /*!*********************************************************************************!*\ !*** ./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_v10_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_v10_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_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _root_workspace_ppte5yg23_local_v10_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_v10_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_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _root_workspace_ppte5yg23_local_v10_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_v10_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_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _root_workspace_ppte5yg23_local_v10_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_v10_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_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _root_workspace_ppte5yg23_local_v10_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_v10_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_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var _root_workspace_ppte5yg23_local_v10_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_v10_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_v10_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 */ 80184); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! antd */ 8591); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! antd */ 43418); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! antd */ 6848); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! antd */ 95237); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! antd */ 43604); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! antd */ 5112); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! antd */ 24905); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! antd */ 10249); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! antd */ 3113); /* harmony import */ var _service_polls__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/service/polls */ 6016); /* harmony import */ var _components_RenderHtml__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/components/RenderHtml */ 36707); /* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../index */ 70651); /* harmony import */ var _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../editor.less?modules */ 73702); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__ = __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_v10_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_v10_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_v10_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_v10_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_v10_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_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v10_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_v10_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_13__/* ["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_13__/* ["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_v10_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_v10_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_13__/* ["default"] */ .ZP.success("保存成功"); _context.next = 31; return dispatch({ type: "polls/editPolls", payload: _root_workspace_ppte5yg23_local_v10_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_v10_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_v10_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_v10_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-light-black ml30 icon-shanchu current", id: "del" }, { name: "上移", icon: "iconfont c-green ml30 icon-xiangshangyi current", id: "up" }, { name: "下移", icon: "iconfont c-green ml30 icon-xiangxiayi current", id: "down" }, { name: "添加", icon: "iconfont c-green ml30 icon-tianjia current", id: "add" }, { name: "编辑", icon: "iconfont c-green ml30 icon-bianjidaibeijing current", id: "edit" }]; var actionArradd = [{ name: "删除", icon: "iconfont c-light-black ml30 icon-shanchu current", id: "del" }, { name: "添加", icon: "iconfont c-green ml30 icon-tianjia current", id: "add" }, { name: "编辑", icon: "iconfont c-green ml30 icon-bianjidaibeijing current", id: "edit" }]; var actionClick = /*#__PURE__*/function () { var _ref3 = _root_workspace_ppte5yg23_local_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v10_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_v10_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_14__/* ["default"] */ .Z.confirm({ centered: true, okText: '确定', cancelText: '取消', title: '确认要删除这个问题吗?', onOk: function onOk() { return _root_workspace_ppte5yg23_local_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v10_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_v10_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_v10_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_v10_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_12__.jsxs)("aside", { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.questionType, children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("div", { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("span", { className: "font16", children: ["\u7B2C", editData.key, "\u9898"] }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("span", { className: "font16 c-light-black ml10", children: "\u5355\u9009\u9898" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_index__WEBPACK_IMPORTED_MODULE_10__.IsNecessaryLabel, { v: editData.question.is_necessary })] }), !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_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { placement: "bottom", title: item.name, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.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_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { placement: "bottom", title: item.name, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("span", { onClick: function onClick() { return actionClick(item); }, className: item.icon }) }, index); })] }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("div", { className: "mt5", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_components_RenderHtml__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, { value: editData.question.question_title }) }), !isadd && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["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_12__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_18__/* ["default"] */ .ZP, { disabled: true }, index) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { flex: "1", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("span", { className: "c-black font14", children: item.answer_text }) })] }); }) }), isadd && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["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_12__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_18__/* ["default"] */ .ZP, { disabled: true }, index) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { flex: "1", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("span", { className: "c-black font14", children: item }) })] }); }) })] }); }; var showEdit = function showEdit() { return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("aside", { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.questionType, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("div", { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("span", { className: "font16 c-blue", children: "\u5355\u9009\u9898" }), " ", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_19__/* ["default"] */ .Z, { checked: isNecessary ? true : false, className: "ml10", onChange: function onChange(e) { return setIsNecessary(e.target.checked); }, children: "\u5FC5\u7B54" })] }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("p", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.titleWrap, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_20__/* ["default"] */ .Z.TextArea, { autoSize: { maxRows: 5 }, rows: 1, 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_12__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.choiceWrap, gutter: [12, 12], children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("span", { className: "font16", children: other && index === lastIndex ? '其它' : "选项" }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.editorWrap, flex: "1", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_20__/* ["default"] */ .Z.TextArea, { autoSize: { maxRows: 5 }, placeholder: (_item$placeholder = item.placeholder) !== null && _item$placeholder !== void 0 ? _item$placeholder : '', value: other && index === lastIndex ? '' : questionChoiceList[index]['value'], rows: 1, disabled: item.disabled ? true : false, onChange: function onChange(e) { questionChoiceList[index]['value'] = e.target.value; setQuestionChoiceList(_root_workspace_ppte5yg23_local_v10_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_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { children: index > 1 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { title: "\u5220\u9664", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)("i", { className: "".concat(_editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.deleteIcon, " iconfont icon-htmal5icon19"), 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_12__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { gutter: [12, 12], children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { flex: "1", children: polls_status === 1 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.Fragment, { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_21__/* ["default"] */ .ZP, { type: "default", onClick: function onClick() { var rs = _root_workspace_ppte5yg23_local_v10_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_v10_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_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_21__/* ["default"] */ .ZP, { type: "default", className: "ml20", onClick: function onClick() { setQuestionChoiceList([].concat(_root_workspace_ppte5yg23_local_v10_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_12__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { className: "tl", style: { marginTop: 15 }, children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_21__/* ["default"] */ .ZP, { type: "default", 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_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_21__/* ["default"] */ .ZP, { className: "ml20", type: "primary", onClick: function onClick() { return onSave(); }, children: "\u4FDD\u5B58" }), polls_status === 1 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(antd__WEBPACK_IMPORTED_MODULE_21__/* ["default"] */ .ZP, { className: "ml20", type: "primary", onClick: function onClick() { return onSave(true); }, children: " \u4FDD\u5B58\u5E76\u7EE7\u7EED " })] })] })] }); }; return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)("section", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_11__/* ["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))); /***/ }), /***/ 24776: /*!*************************************************************************************!*\ !*** ./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_v10_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_v10_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_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _root_workspace_ppte5yg23_local_v10_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_v10_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_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _root_workspace_ppte5yg23_local_v10_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_v10_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_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _root_workspace_ppte5yg23_local_v10_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_v10_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_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _root_workspace_ppte5yg23_local_v10_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_v10_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_v10_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 */ 80184); /* 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 */ 10249); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! antd */ 3113); /* harmony import */ var _service_polls__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/service/polls */ 6016); /* harmony import */ var _components_RenderHtml__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/components/RenderHtml */ 36707); /* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../index */ 70651); /* harmony import */ var _editor_less_modules__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../editor.less?modules */ 73702); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__ = __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_v10_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_v10_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_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v10_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_v10_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: 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_v10_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_v10_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_12__/* ["default"] */ .ZP.success("保存成功"); callback('edit', -1); _context.next = 23; return dispatch({ type: "polls/editPolls", payload: _root_workspace_ppte5yg23_local_v10_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_v10_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_v10_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_v10_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-light-black ml30 icon-shanchu current", id: "del" }, { name: "上移", icon: "iconfont c-green ml30 icon-xiangshangyi current", id: "up" }, { name: "下移", icon: "iconfont c-green ml30 icon-xiangxiayi current", id: "down" }, { name: "添加", icon: "iconfont c-green ml30 icon-tianjia current", id: "add" }, { name: "编辑", icon: "iconfont c-green ml30 icon-bianjidaibeijing current", id: "edit" }]; var actionArradd = [{ name: "删除", icon: "iconfont c-light-black ml30 icon-shanchu current", id: "del" }, { name: "添加", icon: "iconfont c-green ml30 icon-tianjia current", id: "add" }, { name: "编辑", icon: "iconfont c-green ml30 icon-bianjidaibeijing current", id: "edit" }]; var actionClick = /*#__PURE__*/function () { var _ref3 = _root_workspace_ppte5yg23_local_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v10_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_v10_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_v10_test1_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v10_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_v10_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_v10_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_v10_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_11__.jsxs)("aside", { children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_10__/* ["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__.jsxs)("span", { className: "font16", children: ["\u7B2C", editData.key, "\u9898"] }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { className: "font16 c-light-black ml10 mr20", children: "\u4E3B\u89C2\u9898" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_index__WEBPACK_IMPORTED_MODULE_9__.IsNecessaryLabel, { v: editData.question.is_necessary })] }), !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__.jsx)("div", { className: "mt5", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_RenderHtml__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, { value: editData.question.question_title }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_10__/* ["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__.jsx)(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, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", { className: "c-black font14", children: item.answer_text }) }, index) }) }); }) })] }); }; 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_10__/* ["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: "\u4E3B\u89C2\u9898" }), " ", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, { checked: isNecessary ? true : false, className: "ml10", onChange: function onChange(e) { return setIsNecessary(e.target.checked); }, children: "\u5FC5\u7B54" })] }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("p", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z.titleWrap, children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_18__/* ["default"] */ .Z.TextArea, { autoSize: { maxRows: 5 }, rows: 1, 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_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { gutter: [12, 12], children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { flex: "1" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { className: "tl", style: { marginTop: 15 }, children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_19__/* ["default"] */ .ZP, { type: "default", 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_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_19__/* ["default"] */ .ZP, { className: "ml20", type: "primary", onClick: function onClick() { return onSave(); }, children: "\u4FDD\u5B58" }), polls_status === 1 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_19__/* ["default"] */ .ZP, { className: "ml20", type: "primary", onClick: function onClick() { return onSave(true); }, children: "\u4FDD\u5B58\u5E76\u7EE7\u7EED" })] })] })] }); }; return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("section", { className: _editor_less_modules__WEBPACK_IMPORTED_MODULE_10__/* ["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))); /***/ }), /***/ 70651: /*!*********************************************************************!*\ !*** ./src/pages/Classrooms/Lists/Polls/Edit/index.tsx + 1 modules ***! \*********************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { IsNecessaryLabel: function() { return /* binding */ IsNecessaryLabel; }, "default": function() { return /* binding */ Edit; } }); // 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/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/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/toConsumableArray.js var toConsumableArray = __webpack_require__(37205); var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray); // 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/_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__(80184); // EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/form/index.js + 19 modules var es_form = __webpack_require__(78241); // 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/divider/index.js + 1 modules var divider = __webpack_require__(28103); // 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/tooltip/index.js + 3 modules var tooltip = __webpack_require__(6848); // EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules var input = __webpack_require__(10249); // 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.6.1@@ant-design/icons/es/icons/PlusCircleOutlined.js + 1 modules var PlusCircleOutlined = __webpack_require__(32134); // EXTERNAL MODULE: ./src/service/polls.ts var service_polls = __webpack_require__(6016); // EXTERNAL MODULE: ./src/pages/Classrooms/Lists/Polls/Edit/components/MultipleEditor/index.tsx var MultipleEditor = __webpack_require__(14027); // EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules var RenderHtml = __webpack_require__(36707); // EXTERNAL MODULE: ./src/pages/Classrooms/Lists/Polls/Edit/components/SingleEditor/index.tsx var SingleEditor = __webpack_require__(46066); // EXTERNAL MODULE: ./src/pages/Classrooms/Lists/Polls/Edit/components/SubjectiveEditor/index.tsx var SubjectiveEditor = __webpack_require__(24776); // EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 10 modules var markdown_editor = __webpack_require__(49731); ;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Polls/Edit/index.less?modules // extracted by mini-css-extract-plugin /* harmony default export */ var Editmodules = ({"flex_box_center":"flex_box_center___zXTbi","flex_space_between":"flex_space_between___PmyCC","flex_box_vertical_center":"flex_box_vertical_center___FVTkH","flex_box_center_end":"flex_box_center_end___hhcmG","flex_box_column":"flex_box_column___M32tw","bg":"bg___nBRtw","containerTitle":"containerTitle___aZMyO","containerDesc":"containerDesc___IBU0r","listItem":"listItem___N1XyK","info":"info___ckHt5","title":"title___ZKDBe","titleLeft":"titleLeft___f48Qy","titleRight":"titleRight___iByom","acitons":"acitons___x97ti","necessary_label":"necessary_label___Myrf1"}); // 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/Edit/index.tsx // import MdEditor from '@/components/' var ShixunsListPage = function ShixunsListPage(_ref) { var _polls$editData6, _userInfo$course, _polls$editData7, _polls$editData8, _polls$editData9; var polls = _ref.polls, globalSetting = _ref.globalSetting, loading = _ref.loading, user = _ref.user, dispatch = _ref.dispatch; var params = (0,_umi_production_exports.useParams)(); var userInfo = user.userInfo; var _Form$useForm = es_form/* default */.Z.useForm(), _Form$useForm2 = slicedToArray_default()(_Form$useForm, 1), form = _Form$useForm2[0]; var _useState = (0,_react_17_0_2_react.useState)([]), _useState2 = slicedToArray_default()(_useState, 2), editData = _useState2[0], setEditData = _useState2[1]; var _useState3 = (0,_react_17_0_2_react.useState)(false), _useState4 = slicedToArray_default()(_useState3, 2), isEdit = _useState4[0], setIsEdit = _useState4[1]; var _useState5 = (0,_react_17_0_2_react.useState)(-1), _useState6 = slicedToArray_default()(_useState5, 2), editKey = _useState6[0], setEditKey = _useState6[1]; var questionType = [{ name: "单选题", id: 1 }, { name: "多选题", id: 2 }, { name: "主观题", id: 3 }]; var childrenRef = (0,_react_17_0_2_react.useRef)(); (0,_react_17_0_2_react.useEffect)(function () { var _polls$editData; if ((_polls$editData = polls.editData) !== null && _polls$editData !== void 0 && _polls$editData.poll_questions) { var _polls$editData2, _polls$editData3, _polls$editData4, _polls$editData5; editData = toConsumableArray_default()((_polls$editData2 = polls.editData) === null || _polls$editData2 === void 0 ? void 0 : _polls$editData2.poll_questions); setEditData(toConsumableArray_default()((_polls$editData3 = polls.editData) === null || _polls$editData3 === void 0 ? void 0 : _polls$editData3.poll_questions)); form.setFieldsValue({ polls_name: (_polls$editData4 = polls.editData) === null || _polls$editData4 === void 0 || (_polls$editData4 = _polls$editData4.poll) === null || _polls$editData4 === void 0 ? void 0 : _polls$editData4.polls_name, polls_description: (_polls$editData5 = polls.editData) === null || _polls$editData5 === void 0 || (_polls$editData5 = _polls$editData5.poll) === null || _polls$editData5 === void 0 ? void 0 : _polls$editData5.polls_description }); } }, [polls.editData]); var polls_status = (_polls$editData6 = polls.editData) === null || _polls$editData6 === void 0 || (_polls$editData6 = _polls$editData6.poll) === null || _polls$editData6 === void 0 ? void 0 : _polls$editData6.polls_status; console.log("editdata1111:", editData); (0,_react_17_0_2_react.useEffect)(function () { dispatch({ type: "polls/editPolls", payload: objectSpread2_default()({}, params) }); }, [params.categoryId]); var save = /*#__PURE__*/function () { var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(type) { var value, res; return regeneratorRuntime_default()().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: _context.next = 2; return form.validateFields(); case 2: value = form.getFieldValue(); value.is_md = true; value.pollsId = params.categoryId; _context.next = 7; return (0,service_polls/* putPolls */.Qg)(objectSpread2_default()({}, value)); case 7: res = _context.sent; if (res.status === 0) { setIsEdit(false); dispatch({ type: "polls/editPolls", payload: objectSpread2_default()({}, params) }); } case 9: case "end": return _context.stop(); } }, _callee); })); return function save(_x) { return _ref2.apply(this, arguments); }; }(); var addQuestion = /*#__PURE__*/function () { var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(type) { return regeneratorRuntime_default()().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: if (!(editKey !== -1)) { _context2.next = 3; break; } message/* default */.ZP.error("不能同时编辑两题"); return _context2.abrupt("return"); case 3: setEditKey(editData.length + 1); setEditData([].concat(toConsumableArray_default()(editData), [{ question: { question_type: type } }])); case 5: case "end": return _context2.stop(); } }, _callee2); })); return function addQuestion(_x2) { return _ref3.apply(this, arguments); }; }(); var callback = function callback(key, data, allData) { switch (key) { case "edit": if (editKey === -1 || data === -1) { editKey = data; setEditKey(data); } else { message/* default */.ZP.error("不能同时编辑两题"); } break; case "add": if (editKey != -1) { message/* default */.ZP.error("不能同时编辑两题"); return; } delete data.id; editData.splice(data === null || data === void 0 ? void 0 : data.key, 0, { insert_id: data === null || data === void 0 ? void 0 : data.insert_id, question: objectSpread2_default()({}, data) }).slice(); setEditData(toConsumableArray_default()(editData)); setEditKey((data === null || data === void 0 ? void 0 : data.key) + 1); break; case "addContinue": // editData = [...polls.editData?.poll_questions] setEditData(toConsumableArray_default()(data)); break; case "del": editData.splice(data - 1, 1); setEditData(toConsumableArray_default()(editData)); setEditKey(-1); break; } }; var renderQuestion = function renderQuestion() { var _editData; return (_editData = editData) === null || _editData === void 0 ? void 0 : _editData.map(function (v, k) { var _v$question; v.key = k + 1; v.len = editData.length; if (v.question.question_type === 1) { return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", { children: [/*#__PURE__*/(0,jsx_runtime.jsx)(SingleEditor/* default */.Z, { ref: childrenRef, editKey: editKey, polls_status: polls_status, callback: callback, editData: v }), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {})] }, v.id); } if (v.question.question_type === 2) { return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", { children: [/*#__PURE__*/(0,jsx_runtime.jsx)(MultipleEditor/* default */.Z, { ref: childrenRef, editKey: editKey, polls_status: polls_status, callback: callback, editData: v }), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {})] }, v.id); } if (((_v$question = v.question) === null || _v$question === void 0 ? void 0 : _v$question.question_type) === 3) { return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", { children: [/*#__PURE__*/(0,jsx_runtime.jsx)(SubjectiveEditor/* default */.Z, { ref: childrenRef, editKey: editKey, polls_status: polls_status, callback: callback, editData: v }), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {})] }, v.id); } }); }; 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: userInfo && /*#__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: "".concat(userInfo.first_category_url), children: (_userInfo$course = userInfo.course) === null || _userInfo$course === void 0 ? void 0 : _userInfo$course.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\u5217\u8868" }) }), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, { children: "\u7F16\u8F91\u95EE\u5377" })] }) }), /*#__PURE__*/(0,jsx_runtime.jsx)("aside", { className: [Editmodules.title, 'mt20'].join(' '), children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, { style: { width: "100%" }, children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, { flex: "1", children: /*#__PURE__*/(0,jsx_runtime.jsx)("strong", { className: "font20 ml5", children: "\u7F16\u8F91\u95EE\u5377" }) }), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, { children: [/*#__PURE__*/(0,jsx_runtime.jsx)("a", { type: "primary", style: { fontSize: 16, marginRight: 10 }, onClick: function onClick() { _umi_production_exports.history.push("/classrooms/".concat(params.coursesId, "/poll/").concat(params.categoryId, "/detail?tabs=2")); dispatch({ type: 'polls/setActionTabs', payload: { key: '立即发布', selectArrs: [params.categoryId], types: 2, params: { categoryId: params.categoryId } } }); }, children: "\u7ACB\u5373\u53D1\u5E03" }), /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, { className: "font16 ", to: "/classrooms/".concat(params.coursesId, "/poll/").concat(params.categoryId, "/detail"), children: "\u8FD4\u56DE" })] })] }) })] }), /*#__PURE__*/(0,jsx_runtime.jsxs)("section", { className: [Editmodules.bg, 'pt30', 'pl30', 'pr30', 'pb30', 'mt20'].join(' '), children: [!isEdit && /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", { children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", { className: Editmodules.containerDesc, children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", { children: (_polls$editData7 = polls.editData) === null || _polls$editData7 === void 0 || (_polls$editData7 = _polls$editData7.poll) === null || _polls$editData7 === void 0 ? void 0 : _polls$editData7.polls_name }), /*#__PURE__*/(0,jsx_runtime.jsx)("div", { children: /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, { title: "\u7F16\u8F91", children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", { onClick: function onClick() { return setIsEdit(true); }, className: "iconfont c-green ml30 icon-bianjishijuan3x" }) }) })] }), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, { className: "c-light-black", value: ((_polls$editData8 = polls.editData) === null || _polls$editData8 === void 0 || (_polls$editData8 = _polls$editData8.poll) === null || _polls$editData8 === void 0 ? void 0 : _polls$editData8.polls_description) || '' })] }), isEdit && /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, { layout: "vertical", form: form, children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, { name: "polls_name", label: "\u95EE\u5377\u6807\u9898\uFF1A", rules: [{ required: true, message: "请填写问卷标题" }], children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, { maxLength: 60, placeholder: "\u95EE\u5377\u6807\u9898\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26" }) }), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, { label: "\u95EE\u5377\u987B\u77E5\uFF1A", name: "polls_description", children: /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, { watch: true, placeholder: "\u8BF7\u5728\u6B64\u8F93\u5165\u672C\u6B21\u95EE\u5377\u7B54\u9898\u7684\u76F8\u5173\u8BF4\u660E", defaultValue: (_polls$editData9 = polls.editData) === null || _polls$editData9 === void 0 || (_polls$editData9 = _polls$editData9.poll) === null || _polls$editData9 === void 0 ? void 0 : _polls$editData9.polls_description }) }), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z.Item, { className: "tr", children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, { type: "default", onClick: function onClick() { setIsEdit(false); }, style: { marginRight: 10 }, children: "\u53D6\u6D88" }), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, { style: { margin: '0px 20px' }, type: "primary", onClick: function onClick() { save(); }, children: "\u4FDD\u5B58" })] })] })] }), editData != '' && /*#__PURE__*/(0,jsx_runtime.jsx)("section", { className: [Editmodules.bg, 'pt30', 'pl20', 'pr20', 'pb20', 'mt20'].join(' '), children: renderQuestion() }), polls_status === 1 ? /*#__PURE__*/(0,jsx_runtime.jsx)("section", { className: [Editmodules.bg, 'pt30', 'pl30', 'pr30', 'pb30', 'mt20'].join(' '), children: questionType.map(function (item) { return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.ZP, { className: "mr20", type: "primary", onClick: function onClick() { return addQuestion(item.id); }, children: [/*#__PURE__*/(0,jsx_runtime.jsx)(PlusCircleOutlined/* default */.Z, { className: "mr5" }), item.name] }); }) }) : null] }); }; /* harmony default export */ var Edit = ((0,_umi_production_exports.connect)(function (_ref4) { var polls = _ref4.polls, loading = _ref4.loading, user = _ref4.user, globalSetting = _ref4.globalSetting; return { polls: polls, globalSetting: globalSetting, user: user, loading: loading.effects }; })(ShixunsListPage)); function IsNecessaryLabel(_ref5) { var v = _ref5.v; return /*#__PURE__*/(0,jsx_runtime.jsx)(_react_17_0_2_react.Fragment, { children: v > 0 ? /*#__PURE__*/(0,jsx_runtime.jsx)("span", { className: Editmodules.necessary_label, children: "\u5FC5\u7B54" }) : /*#__PURE__*/(0,jsx_runtime.jsx)("span", { className: Editmodules.necessary_label, children: "\u9009\u7B54" }) }); } /***/ }), /***/ 73702: /*!******************************************************************************!*\ !*** ./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"}); /***/ }) }]);