You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1530 lines
75 KiB
1530 lines
75 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[799],{
|
|
|
|
/***/ 47229:
|
|
/*!************************************************************!*\
|
|
!*** ./src/components/ui-customization/reset.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___vG4eV","flex_space_between":"flex_space_between___qVVxe","flex_box_vertical_center":"flex_box_vertical_center___P8Z8s","flex_box_center_end":"flex_box_center_end___VMme3","flex_box_column":"flex_box_column___VMHwm","dropdownmenus":"dropdownmenus___oVzoj","popupClassNames":"popupClassNames___OcZq7","selectdown":"selectdown___mmcA8"});
|
|
|
|
/***/ }),
|
|
|
|
/***/ 82436:
|
|
/*!************************************************************************!*\
|
|
!*** ./src/pages/User/Detail/Topics/Poll/Detail/index.tsx + 5 modules ***!
|
|
\************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
// ESM COMPAT FLAG
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"default": function() { return /* binding */ Detail; }
|
|
});
|
|
|
|
// 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 + 15 modules
|
|
var _umi_production_exports = __webpack_require__(23852);
|
|
// 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/modal/index.js + 16 modules
|
|
var modal = __webpack_require__(43418);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tabs/index.js + 24 modules
|
|
var tabs = __webpack_require__(99313);
|
|
// 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__(20008);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
var es_button = __webpack_require__(3113);
|
|
// EXTERNAL MODULE: ./src/service/polls.ts
|
|
var service_polls = __webpack_require__(74051);
|
|
// EXTERNAL MODULE: ./src/service/user.ts
|
|
var service_user = __webpack_require__(63203);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/checkbox/index.js + 3 modules
|
|
var es_checkbox = __webpack_require__(24905);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/select/index.js
|
|
var es_select = __webpack_require__(57809);
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx
|
|
var RenderHtml = __webpack_require__(92936);
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Poll/Detail/components/editor.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var editormodules = ({"flex_box_center":"flex_box_center___ZXamY","flex_space_between":"flex_space_between___OhehO","flex_box_vertical_center":"flex_box_vertical_center___JcdoD","flex_box_center_end":"flex_box_center_end___BQR8z","flex_box_column":"flex_box_column___ZtKH_","wrap":"wrap___ucM4I","modal":"modal___Snz7U","titleWrap":"titleWrap___GoOJH","required":"required___hcR9L","title":"title___Fk25W","colorGray":"colorGray___s_7Rh","choiceWrap":"choiceWrap___Km9CZ","answer":"answer___nCBKN","activeAnswer":"activeAnswer___pykZr","deleteIcon":"deleteIcon___FtIV6","addIcon":"addIcon___pjZkR","editorWrap":"editorWrap___VTBdJ","htmlWrap":"htmlWrap___Cqe4T","radio":"radio___Uahep","color333":"color333___NsMb3","color999":"color999___qJjRp","questionType":"questionType___BC_py","questionChoices":"questionChoices____TjNP"});
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Poll/Detail/components/MultipleEditor/index.tsx
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && __getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var __async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const 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"
|
|
];
|
|
const SingleEditor = (_a, ref) => {
|
|
var _b = _a, {
|
|
problemset,
|
|
globalSetting,
|
|
loading,
|
|
dispatch,
|
|
showAnswerTip = true,
|
|
onRef = () => {
|
|
},
|
|
editData,
|
|
editKey,
|
|
callback
|
|
} = _b, props = __objRest(_b, [
|
|
"problemset",
|
|
"globalSetting",
|
|
"loading",
|
|
"dispatch",
|
|
"showAnswerTip",
|
|
"onRef",
|
|
"editData",
|
|
"editKey",
|
|
"callback"
|
|
]);
|
|
const [questionChoiceList, setQuestionChoiceList] = (0,_react_17_0_2_react.useState)([]);
|
|
const [activeEditor, setActiveEditor] = (0,_react_17_0_2_react.useState)();
|
|
const [activeAnswer, setActiveAnswer] = (0,_react_17_0_2_react.useState)([]);
|
|
const [title, setTitle] = (0,_react_17_0_2_react.useState)("");
|
|
const [score, setScore] = (0,_react_17_0_2_react.useState)(0);
|
|
const [isNecessary, setIsNecessary] = (0,_react_17_0_2_react.useState)(true);
|
|
const [other, setOther] = (0,_react_17_0_2_react.useState)(false);
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
const [maxChoices, setMaxChoices] = (0,_react_17_0_2_react.useState)("");
|
|
const [minChoices, setMinChoices] = (0,_react_17_0_2_react.useState)("");
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a2, _b2, _c, _d, _e, _f, _g, _h;
|
|
if (!((_a2 = editData == null ? void 0 : editData.question) == null ? void 0 : _a2.question_title)) {
|
|
setQuestionChoiceList([{ disabled: false, value: "" }, { disabled: false, value: "" }, { disabled: false, value: "" }, { disabled: false, value: "" }]);
|
|
setIsNecessary(true);
|
|
setTitle("");
|
|
setOther(false);
|
|
return;
|
|
}
|
|
setMaxChoices((_b2 = editData == null ? void 0 : editData.question) == null ? void 0 : _b2.max_choices);
|
|
setMinChoices((_c = editData == null ? void 0 : editData.question) == null ? void 0 : _c.min_choices);
|
|
setTitle((_d = editData == null ? void 0 : editData.question) == null ? void 0 : _d.question_title);
|
|
setIsNecessary(!!((_e = editData == null ? void 0 : editData.question) == null ? void 0 : _e.is_necessary));
|
|
setQuestionChoiceList((_f = editData == null ? void 0 : editData.question) == null ? void 0 : _f.answers.map((item) => {
|
|
return {
|
|
value: item.answer_text,
|
|
disabled: item.answer_text === "\u5176\u5B83" ? true : false
|
|
};
|
|
}));
|
|
setOther(!!((_h = (_g = editData == null ? void 0 : editData.question) == null ? void 0 : _g.answers) == null ? void 0 : _h.find((item) => item.answer_text === "\u5176\u5B83")));
|
|
}, [editData]);
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, () => ({
|
|
onSave
|
|
}));
|
|
const onSave = (status) => __async(void 0, null, function* () {
|
|
var _a2;
|
|
if (maxChoices && !minChoices || !maxChoices && minChoices) {
|
|
message/* default */.ZP.info('\u53EF\u9009\uFF1A\u6700\u5C0F\u548C\u6700\u5927\u9650\u5236\u987B\u540C\u65F6\u4E3A\u6570\u503C\u6216\u8005\u201C--"');
|
|
return;
|
|
}
|
|
if (minChoices > maxChoices) {
|
|
message/* default */.ZP.info("\u53EF\u9009\u7684\u6700\u5927\u9650\u5236\u4E0D\u80FD\u5C0F\u4E8E\u6700\u5C0F\u9650\u5236");
|
|
return;
|
|
}
|
|
if (!title) {
|
|
message/* default */.ZP.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE");
|
|
return false;
|
|
}
|
|
const findNotAnswerIndex = questionChoiceList.findIndex((item) => !item.value);
|
|
if (findNotAnswerIndex > -1) {
|
|
message/* default */.ZP.info(`\u8BF7\u5148\u8F93\u5165 ${tagList[findNotAnswerIndex]} \u9009\u9879\u7684\u5185\u5BB9`);
|
|
return false;
|
|
}
|
|
let res;
|
|
const 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((item) => item.value)
|
|
};
|
|
if ((_a2 = editData.question) == null ? void 0 : _a2.id) {
|
|
res = yield (0,service_polls/* putPollBankQuestions */.wo)(__spreadValues({
|
|
"pollsId": editData.question.id
|
|
}, bodyData));
|
|
} else {
|
|
res = yield (0,service_polls/* addPollBankQuestions */.Fd)(__spreadValues({
|
|
"exercise_bank_id": params.topicId
|
|
}, bodyData));
|
|
}
|
|
if (res.status === 0) {
|
|
message/* default */.ZP.success("\u4FDD\u5B58\u6210\u529F");
|
|
callback("edit", -1);
|
|
const d = yield dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: __spreadValues({}, params)
|
|
});
|
|
if (status) {
|
|
bodyData.answers = bodyData.question_answers.map((item) => {
|
|
return { answer_text: item };
|
|
});
|
|
callback("addContinue", __spreadValues({ type: 2, insert_id: editData.question.id, key: editData.key, question_type: 1 }, bodyData), d.questions);
|
|
}
|
|
}
|
|
});
|
|
const showList = () => {
|
|
var _a2, _b2, _c, _d;
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.questionType }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "font16" }, "\u7B2C", editData.key, "\u9898"), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "font16 c-light-black ml10" }, "\u591A\u9009\u9898"), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "tag-grey-eae ml10 mr10" }, ((_a2 = editData == null ? void 0 : editData.question) == null ? void 0 : _a2.is_necessary) === 0 ? "\u9009\u7B54" : "\u5FC5\u7B54"), "\u53EF\u9009", (_b2 = editData == null ? void 0 : editData.question) == null ? void 0 : _b2.min_choices, "-", (_c = editData == null ? void 0 : editData.question) == null ? void 0 : _c.max_choices, "\u9879")), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt5" }, /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { value: editData.question.question_title })), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.questionChoices }, (_d = editData == null ? void 0 : editData.question.answers) == null ? void 0 : _d.map(function(item, index) {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(es_checkbox["default"], { key: index, disabled: true }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "c-black font14" }, item.answer_text))));
|
|
})));
|
|
};
|
|
const showEdit = () => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.questionType }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "font16 c-blue" }, "\u591A\u9009\u9898"), " ", /* @__PURE__ */ _react_17_0_2_react.createElement(es_checkbox["default"], { checked: isNecessary ? true : false, className: "ml10", onChange: (e) => setIsNecessary(e.target.checked) }, "\u5FC5\u7B54"))), /* @__PURE__ */ _react_17_0_2_react.createElement("p", { className: editormodules.titleWrap }, /* @__PURE__ */ _react_17_0_2_react.createElement(input["default"].TextArea, { autoSize: { maxRows: 5 }, rows: 1, value: title, placeholder: "\u8BF7\u8F93\u5165\u9898\u76EE", onChange: (e) => setTitle(e.target.value) })), questionChoiceList.map((item, index) => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { className: editormodules.choiceWrap, key: index, gutter: [12, 12] }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "font16" }, "\u9009\u9879")), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { className: editormodules.editorWrap, flex: "1" }, /* @__PURE__ */ _react_17_0_2_react.createElement(input["default"].TextArea, { autoSize: { maxRows: 5 }, value: questionChoiceList[index]["value"], rows: 1, disabled: item.disabled ? true : false, onChange: (e) => {
|
|
questionChoiceList[index]["value"] = e.target.value;
|
|
setQuestionChoiceList([...questionChoiceList]);
|
|
} })), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, index > 1 && /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u5220\u9664" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"i",
|
|
{
|
|
className: `${editormodules.deleteIcon} iconfont icon-htmal5icon19`,
|
|
onClick: () => {
|
|
setQuestionChoiceList(questionChoiceList.filter((_, key) => key !== index));
|
|
if (item.disabled)
|
|
setOther(false);
|
|
}
|
|
}
|
|
))));
|
|
}), /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { gutter: [12, 12] }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, "\u53EF\u9009"), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"], { value: minChoices || "", style: { width: 120 }, onChange: (value) => setMinChoices(value) }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: "" }, "--"), questionChoiceList.map(function(item, index) {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: String(index + 2) }, index + 2);
|
|
})), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "ml10 mr10" }, "~"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"], { style: { width: 120 }, value: maxChoices || "", onChange: (value) => setMaxChoices(value) }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: "" }, "--"), questionChoiceList.map(function(item, index) {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(es_select["default"].Option, { value: String(index + 2) }, index + 2);
|
|
})))), /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { gutter: [12, 12] }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "1" }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "default", onClick: () => {
|
|
if (questionChoiceList.find((i) => i.value === "\u5176\u5B83")) {
|
|
setQuestionChoiceList([...questionChoiceList.filter((i) => i.value !== "\u5176\u5B83"), { value: "" }, { value: "\u5176\u5B83", disabled: true }]);
|
|
} else {
|
|
setQuestionChoiceList([...questionChoiceList, { value: "" }]);
|
|
}
|
|
} }, "\u65B0\u589E\u9009\u9879"), !other && /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "default", className: "ml20", onClick: () => {
|
|
setQuestionChoiceList([...questionChoiceList, { disabled: true, value: "\u5176\u5B83" }]);
|
|
setOther(true);
|
|
} }, "\u65B0\u589E\u5176\u5B83\u9009\u9879")), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { className: "tl" }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "default", onClick: () => {
|
|
var _a2;
|
|
if ((_a2 = editData.question) == null ? void 0 : _a2.id) {
|
|
callback("edit", -1);
|
|
} else {
|
|
callback("del", editData.key);
|
|
}
|
|
} }, "\u53D6\u6D88"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { className: "ml20", type: "primary", onClick: () => onSave() }, "\u4FDD\u5B58"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { className: "ml20", type: "primary", onClick: () => onSave(true) }, "\u4FDD\u5B58\u5E76\u7EE7\u7EED"))));
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: editormodules.wrap }, editKey !== editData.key && showList(), editKey === editData.key && showEdit());
|
|
};
|
|
/* harmony default export */ var MultipleEditor = ((0,_umi_production_exports.connect)(
|
|
({
|
|
problemset,
|
|
loading,
|
|
globalSetting
|
|
}) => ({
|
|
problemset,
|
|
globalSetting,
|
|
loading: loading.effects
|
|
}),
|
|
null,
|
|
null,
|
|
{ forwardRef: true }
|
|
)((0,_react_17_0_2_react.forwardRef)(SingleEditor)));
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/radio/index.js + 5 modules
|
|
var es_radio = __webpack_require__(5112);
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Poll/Detail/components/SingleEditor/index.tsx
|
|
var SingleEditor_defProp = Object.defineProperty;
|
|
var SingleEditor_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var SingleEditor_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var SingleEditor_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var SingleEditor_defNormalProp = (obj, key, value) => key in obj ? SingleEditor_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var SingleEditor_spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (SingleEditor_hasOwnProp.call(b, prop))
|
|
SingleEditor_defNormalProp(a, prop, b[prop]);
|
|
if (SingleEditor_getOwnPropSymbols)
|
|
for (var prop of SingleEditor_getOwnPropSymbols(b)) {
|
|
if (SingleEditor_propIsEnum.call(b, prop))
|
|
SingleEditor_defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var SingleEditor_objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (SingleEditor_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && SingleEditor_getOwnPropSymbols)
|
|
for (var prop of SingleEditor_getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && SingleEditor_propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var SingleEditor_async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const SingleEditor_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"
|
|
];
|
|
const SingleEditor_SingleEditor = (_a, ref) => {
|
|
var _b = _a, {
|
|
problemset,
|
|
globalSetting,
|
|
loading,
|
|
dispatch,
|
|
onRef = () => {
|
|
},
|
|
editData,
|
|
editKey,
|
|
callback,
|
|
showAnswerTip = true
|
|
} = _b, props = SingleEditor_objRest(_b, [
|
|
"problemset",
|
|
"globalSetting",
|
|
"loading",
|
|
"dispatch",
|
|
"onRef",
|
|
"editData",
|
|
"editKey",
|
|
"callback",
|
|
"showAnswerTip"
|
|
]);
|
|
const [questionChoiceList, setQuestionChoiceList] = (0,_react_17_0_2_react.useState)([]);
|
|
const [activeEditor, setActiveEditor] = (0,_react_17_0_2_react.useState)();
|
|
const [activeAnswer, setActiveAnswer] = (0,_react_17_0_2_react.useState)([]);
|
|
const [title, setTitle] = (0,_react_17_0_2_react.useState)("");
|
|
const [score, setScore] = (0,_react_17_0_2_react.useState)(0);
|
|
const [isNecessary, setIsNecessary] = (0,_react_17_0_2_react.useState)(false);
|
|
const [other, setOther] = (0,_react_17_0_2_react.useState)(false);
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a2, _b2, _c, _d, _e, _f;
|
|
if (!((_a2 = editData == null ? void 0 : editData.question) == null ? void 0 : _a2.question_title)) {
|
|
setQuestionChoiceList([{ disabled: false, value: "" }, { disabled: false, value: "" }, { disabled: false, value: "" }, { disabled: false, value: "" }]);
|
|
setIsNecessary(false);
|
|
setTitle("");
|
|
setOther(false);
|
|
return;
|
|
}
|
|
setTitle((_b2 = editData == null ? void 0 : editData.question) == null ? void 0 : _b2.question_title);
|
|
setIsNecessary(!!((_c = editData == null ? void 0 : editData.question) == null ? void 0 : _c.is_necessary));
|
|
setQuestionChoiceList((_d = editData == null ? void 0 : editData.question) == null ? void 0 : _d.answers.map((item) => {
|
|
return {
|
|
value: item.answer_text,
|
|
disabled: item.answer_text === "\u5176\u5B83" ? true : false
|
|
};
|
|
}));
|
|
setOther(!!((_f = (_e = editData == null ? void 0 : editData.question) == null ? void 0 : _e.answers) == null ? void 0 : _f.find((item) => item.answer_text === "\u5176\u5B83")));
|
|
}, [editData]);
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, () => ({
|
|
onSave
|
|
}));
|
|
const onSave = (status) => SingleEditor_async(void 0, null, function* () {
|
|
var _a2;
|
|
if (!title) {
|
|
message/* default */.ZP.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE");
|
|
return false;
|
|
}
|
|
const findNotAnswerIndex = questionChoiceList.findIndex((item) => !item.value);
|
|
if (findNotAnswerIndex > -1) {
|
|
message/* default */.ZP.info(`\u8BF7\u5148\u8F93\u5165 ${SingleEditor_tagList[findNotAnswerIndex]} \u9009\u9879\u7684\u5185\u5BB9`);
|
|
return false;
|
|
}
|
|
let res;
|
|
const bodyData = {
|
|
"question_title": title,
|
|
"question_type": 1,
|
|
"insert_id": editData.insert_id,
|
|
"is_necessary": Math.ceil(isNecessary),
|
|
"question_answers": questionChoiceList.map((item) => item.value)
|
|
};
|
|
if ((_a2 = editData.question) == null ? void 0 : _a2.id) {
|
|
res = yield (0,service_polls/* putPollBankQuestions */.wo)(SingleEditor_spreadValues({
|
|
"pollsId": editData.question.id
|
|
}, bodyData));
|
|
} else {
|
|
res = yield (0,service_polls/* addPollBankQuestions */.Fd)(SingleEditor_spreadValues({
|
|
"exercise_bank_id": params.topicId
|
|
}, bodyData));
|
|
}
|
|
if (res.status === 0) {
|
|
message/* default */.ZP.success("\u4FDD\u5B58\u6210\u529F");
|
|
callback("edit", -1);
|
|
const d = yield dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: SingleEditor_spreadValues({}, params)
|
|
});
|
|
if (status) {
|
|
bodyData.answers = bodyData.question_answers.map((item) => {
|
|
return { answer_text: item };
|
|
});
|
|
callback("addContinue", SingleEditor_spreadValues({ type: 1, insert_id: editData.question.id, key: editData.key, question_type: 1 }, bodyData), d.questions);
|
|
}
|
|
}
|
|
});
|
|
const actionArr = [
|
|
{ name: "\u5220\u9664", icon: "iconfont c-light-black ml30 icon-shanchu current", id: "del" },
|
|
{ name: "\u4E0A\u79FB", icon: "iconfont c-green ml30 icon-xiangshangyi current", id: "up" },
|
|
{ name: "\u4E0B\u79FB", icon: "iconfont c-green ml30 icon-xiangxiayi current", id: "down" },
|
|
{ name: "\u6DFB\u52A0", icon: "iconfont c-green ml30 icon-tianjia current", id: "add" },
|
|
{ name: "\u7F16\u8F91", icon: "iconfont c-green ml30 icon-bianjidaibeijing current", id: "edit" }
|
|
];
|
|
const actionClick = (item) => SingleEditor_async(void 0, null, function* () {
|
|
var _b2, _c;
|
|
switch (item.id) {
|
|
case "del":
|
|
let _a2;
|
|
modal["default"].confirm({
|
|
centered: true,
|
|
okText: "\u786E\u5B9A",
|
|
cancelText: "\u53D6\u6D88",
|
|
title: "\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",
|
|
onOk() {
|
|
return SingleEditor_async(this, null, function* () {
|
|
var _a3;
|
|
yield (0,service_polls/* deleteExerciseBanksQuestion */.x$)({
|
|
pollsId: (_a3 = editData == null ? void 0 : editData.question) == null ? void 0 : _a3.id
|
|
});
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: SingleEditor_spreadValues({}, params)
|
|
});
|
|
});
|
|
}
|
|
});
|
|
break;
|
|
case "up":
|
|
case "down":
|
|
yield (0,service_polls/* exerciseBanksMoveUpDown */.vf)({
|
|
pollsId: (_b2 = editData == null ? void 0 : editData.question) == null ? void 0 : _b2.id,
|
|
opr: item.id
|
|
});
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: SingleEditor_spreadValues({}, params)
|
|
});
|
|
break;
|
|
case "edit":
|
|
callback("edit", editData.key);
|
|
break;
|
|
case "add":
|
|
callback("add", { type: 1, key: editData.key, insert_id: (_c = editData == null ? void 0 : editData.question) == null ? void 0 : _c.id, question_type: 1 });
|
|
break;
|
|
}
|
|
});
|
|
const showList = () => {
|
|
var _a2, _b2;
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.questionType }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "font16" }, "\u7B2C", editData.key, "\u9898"), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "font16 c-light-black ml10" }, "\u5355\u9009\u9898"), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "tag-grey-eae ml10" }, ((_a2 = editData == null ? void 0 : editData.question) == null ? void 0 : _a2.is_necessary) === 0 ? "\u9009\u7B54" : "\u5FC5\u7B54"))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt5" }, /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { value: editData.question.question_title })), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.questionChoices }, (_b2 = editData == null ? void 0 : editData.question.answers) == null ? void 0 : _b2.map(function(item, index) {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(es_radio/* default */.ZP, { key: index, disabled: true })), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "1" }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "c-black font14" }, item.answer_text)));
|
|
})));
|
|
};
|
|
const showEdit = () => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.questionType }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "font16 c-blue" }, "\u5355\u9009\u9898"), " ", /* @__PURE__ */ _react_17_0_2_react.createElement(es_checkbox["default"], { checked: isNecessary ? true : false, className: "ml10", onChange: (e) => setIsNecessary(e.target.checked) }, "\u5FC5\u7B54"))), /* @__PURE__ */ _react_17_0_2_react.createElement("p", { className: editormodules.titleWrap }, /* @__PURE__ */ _react_17_0_2_react.createElement(input["default"].TextArea, { autoSize: { maxRows: 5 }, rows: 1, value: title, placeholder: "\u8BF7\u8F93\u5165\u9898\u76EE", onChange: (e) => setTitle(e.target.value) })), questionChoiceList.map((item, index) => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { className: editormodules.choiceWrap, key: index, gutter: [12, 12] }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "font16" }, "\u9009\u9879")), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { className: editormodules.editorWrap, flex: "1" }, /* @__PURE__ */ _react_17_0_2_react.createElement(input["default"].TextArea, { autoSize: { maxRows: 5 }, value: questionChoiceList[index]["value"], rows: 1, disabled: questionChoiceList[index]["value"] === "\u5176\u5B83" ? true : false, onChange: (e) => {
|
|
questionChoiceList[index]["value"] = e.target.value;
|
|
setQuestionChoiceList([...questionChoiceList]);
|
|
} })), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, index > 1 && /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u5220\u9664" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"i",
|
|
{
|
|
className: `${editormodules.deleteIcon} iconfont icon-htmal5icon19`,
|
|
onClick: () => {
|
|
setQuestionChoiceList(questionChoiceList.filter((_, key) => key !== index));
|
|
if (item.disabled)
|
|
setOther(false);
|
|
}
|
|
}
|
|
))));
|
|
}), /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { gutter: [12, 12] }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "1" }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "default", onClick: () => {
|
|
if (questionChoiceList.find((i) => i.value === "\u5176\u5B83")) {
|
|
setQuestionChoiceList([...questionChoiceList.filter((i) => i.value !== "\u5176\u5B83"), { value: "" }, { value: "\u5176\u5B83", disabled: true }]);
|
|
} else {
|
|
setQuestionChoiceList([...questionChoiceList, { value: "" }]);
|
|
}
|
|
\u65B0\u589E\u9009\u9879;
|
|
} }), !other && /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "default", className: "ml20", onClick: () => {
|
|
setQuestionChoiceList([...questionChoiceList, { disabled: true, value: "\u5176\u5B83" }]);
|
|
setOther(true);
|
|
} }, "\u65B0\u589E\u5176\u5B83\u9009\u9879")), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { className: "tl" }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "default", onClick: () => {
|
|
var _a2;
|
|
if ((_a2 = editData.question) == null ? void 0 : _a2.id) {
|
|
callback("edit", -1);
|
|
} else {
|
|
callback("del", editData.key);
|
|
}
|
|
} }, "\u53D6\u6D88"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { className: "ml20", type: "primary", onClick: () => onSave() }, "\u4FDD\u5B58"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { className: "ml20", type: "primary", onClick: () => onSave(true) }, "\u4FDD\u5B58\u5E76\u7EE7\u7EED"))));
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: editormodules.wrap }, editKey !== editData.key && showList(), editKey === editData.key && showEdit());
|
|
};
|
|
/* harmony default export */ var components_SingleEditor = ((0,_umi_production_exports.connect)(
|
|
({
|
|
problemset,
|
|
loading,
|
|
globalSetting
|
|
}) => ({
|
|
problemset,
|
|
globalSetting,
|
|
loading: loading.effects
|
|
}),
|
|
null,
|
|
null,
|
|
{ forwardRef: true }
|
|
)((0,_react_17_0_2_react.forwardRef)(SingleEditor_SingleEditor)));
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Poll/Detail/components/SubjectiveEditor/index.tsx
|
|
var SubjectiveEditor_defProp = Object.defineProperty;
|
|
var SubjectiveEditor_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var SubjectiveEditor_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var SubjectiveEditor_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var SubjectiveEditor_defNormalProp = (obj, key, value) => key in obj ? SubjectiveEditor_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var SubjectiveEditor_spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (SubjectiveEditor_hasOwnProp.call(b, prop))
|
|
SubjectiveEditor_defNormalProp(a, prop, b[prop]);
|
|
if (SubjectiveEditor_getOwnPropSymbols)
|
|
for (var prop of SubjectiveEditor_getOwnPropSymbols(b)) {
|
|
if (SubjectiveEditor_propIsEnum.call(b, prop))
|
|
SubjectiveEditor_defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var SubjectiveEditor_objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (SubjectiveEditor_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && SubjectiveEditor_getOwnPropSymbols)
|
|
for (var prop of SubjectiveEditor_getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && SubjectiveEditor_propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var SubjectiveEditor_async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const SubjectiveEditor_tagList = (/* unused pure expression or super */ null && ([
|
|
"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"
|
|
]));
|
|
const SubjectiveEditor_SingleEditor = (_a, ref) => {
|
|
var _b = _a, {
|
|
problemset,
|
|
globalSetting,
|
|
loading,
|
|
dispatch,
|
|
onRef = () => {
|
|
},
|
|
editData,
|
|
showAnswerTip = true,
|
|
editKey,
|
|
callback
|
|
} = _b, props = SubjectiveEditor_objRest(_b, [
|
|
"problemset",
|
|
"globalSetting",
|
|
"loading",
|
|
"dispatch",
|
|
"onRef",
|
|
"editData",
|
|
"showAnswerTip",
|
|
"editKey",
|
|
"callback"
|
|
]);
|
|
const [title, setTitle] = (0,_react_17_0_2_react.useState)("");
|
|
const [isNecessary, setIsNecessary] = (0,_react_17_0_2_react.useState)(true);
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a2, _b2, _c;
|
|
if (!((_a2 = editData == null ? void 0 : editData.question) == null ? void 0 : _a2.question_title)) {
|
|
setIsNecessary(true);
|
|
setTitle("");
|
|
return;
|
|
}
|
|
setTitle((_b2 = editData == null ? void 0 : editData.question) == null ? void 0 : _b2.question_title);
|
|
setIsNecessary(!!((_c = editData == null ? void 0 : editData.question) == null ? void 0 : _c.is_necessary));
|
|
}, [editData]);
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, () => ({
|
|
onSave
|
|
}));
|
|
const onSave = (status) => SubjectiveEditor_async(void 0, null, function* () {
|
|
var _a2;
|
|
if (!title) {
|
|
message/* default */.ZP.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE");
|
|
return false;
|
|
}
|
|
let res;
|
|
const bodyData = {
|
|
"question_title": title,
|
|
"question_type": 3,
|
|
"insert_id": editData.insert_id,
|
|
"is_necessary": Math.ceil(isNecessary)
|
|
};
|
|
if ((_a2 = editData.question) == null ? void 0 : _a2.id) {
|
|
res = yield (0,service_polls/* putPollBankQuestions */.wo)(SubjectiveEditor_spreadValues({
|
|
"pollsId": editData.question.id
|
|
}, bodyData));
|
|
} else {
|
|
res = yield (0,service_polls/* addPollBankQuestions */.Fd)(SubjectiveEditor_spreadValues({
|
|
"exercise_bank_id": params.topicId
|
|
}, bodyData));
|
|
}
|
|
if (res.status === 0) {
|
|
message/* default */.ZP.success("\u4FDD\u5B58\u6210\u529F");
|
|
callback("edit", -1);
|
|
const d = yield dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: SubjectiveEditor_spreadValues({}, params)
|
|
});
|
|
if (status) {
|
|
callback("addContinue", SubjectiveEditor_spreadValues({ type: 3, insert_id: editData.question.id, key: editData.key, question_type: 1 }, bodyData), d.questions);
|
|
}
|
|
}
|
|
});
|
|
const actionArr = [
|
|
{ name: "\u5220\u9664", icon: "iconfont c-light-black ml30 icon-shanchu current", id: "del" },
|
|
{ name: "\u4E0A\u79FB", icon: "iconfont c-green ml30 icon-xiangshangyi current", id: "up" },
|
|
{ name: "\u4E0B\u79FB", icon: "iconfont c-green ml30 icon-xiangxiayi current", id: "down" },
|
|
{ name: "\u6DFB\u52A0", icon: "iconfont c-green ml30 icon-tianjia current", id: "add" },
|
|
{ name: "\u7F16\u8F91", icon: "iconfont c-green ml30 icon-bianjidaibeijing current", id: "edit" }
|
|
];
|
|
const actionClick = (item) => SubjectiveEditor_async(void 0, null, function* () {
|
|
var _b2, _c;
|
|
switch (item.id) {
|
|
case "del":
|
|
let _a2;
|
|
modal["default"].confirm({
|
|
centered: true,
|
|
okText: "\u786E\u5B9A",
|
|
cancelText: "\u53D6\u6D88",
|
|
title: "\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",
|
|
onOk() {
|
|
return SubjectiveEditor_async(this, null, function* () {
|
|
var _a3;
|
|
yield (0,service_polls/* deleteExerciseBanksQuestion */.x$)({
|
|
pollsId: (_a3 = editData == null ? void 0 : editData.question) == null ? void 0 : _a3.id
|
|
});
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: SubjectiveEditor_spreadValues({}, params)
|
|
});
|
|
});
|
|
}
|
|
});
|
|
break;
|
|
case "up":
|
|
case "down":
|
|
yield (0,service_polls/* exerciseBanksMoveUpDown */.vf)({
|
|
pollsId: (_b2 = editData == null ? void 0 : editData.question) == null ? void 0 : _b2.id,
|
|
opr: item.id
|
|
});
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: SubjectiveEditor_spreadValues({}, params)
|
|
});
|
|
break;
|
|
case "edit":
|
|
callback("edit", editData.key);
|
|
break;
|
|
case "add":
|
|
callback("add", { type: 3, key: editData.key, insert_id: (_c = editData == null ? void 0 : editData.question) == null ? void 0 : _c.id, question_type: 3 });
|
|
break;
|
|
}
|
|
});
|
|
const showList = () => {
|
|
var _a2, _b2;
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.questionType }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "font16" }, "\u7B2C", editData.key, "\u9898"), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "font16 c-light-black ml10" }, "\u4E3B\u89C2\u9898"), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "tag-grey-eae ml10 mr10" }, ((_a2 = editData == null ? void 0 : editData.question) == null ? void 0 : _a2.is_necessary) === 0 ? "\u9009\u7B54" : "\u5FC5\u7B54"))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt5" }, /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { value: editData.question.question_title }), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt15" }, /* @__PURE__ */ _react_17_0_2_react.createElement(input["default"].TextArea, { placeholder: "\u5728\u6B64\u586B\u5165\u7B54\u6848", rows: 5, disabled: true }))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.questionChoices }, (_b2 = editData == null ? void 0 : editData.question.answers) == null ? void 0 : _b2.map(function(item, index) {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(es_checkbox["default"], { key: index, disabled: true }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "c-black font14" }, item.answer_text))));
|
|
})));
|
|
};
|
|
const showEdit = () => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.questionType }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "font16 c-blue" }, "\u4E3B\u89C2\u9898"), " ", /* @__PURE__ */ _react_17_0_2_react.createElement(es_checkbox["default"], { checked: isNecessary ? true : false, className: "ml10", onChange: (e) => setIsNecessary(e.target.checked) }, "\u5FC5\u7B54"))), /* @__PURE__ */ _react_17_0_2_react.createElement("p", { className: editormodules.titleWrap }, /* @__PURE__ */ _react_17_0_2_react.createElement(input["default"].TextArea, { autoSize: { maxRows: 5 }, rows: 1, value: title, placeholder: "\u8BF7\u8F93\u5165\u9898\u76EE", onChange: (e) => setTitle(e.target.value) })), showAnswerTip ? /* @__PURE__ */ _react_17_0_2_react.createElement("p", { className: editormodules.titleWrap }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: editormodules.required }, "*"), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: editormodules.title }, "\u7B54\u6848\u9009\u9879\uFF1A", /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: editormodules.colorGray }, "\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))) : null, /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { gutter: [12, 12] }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "1" }), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { className: "tl" }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "default", onClick: () => {
|
|
var _a2;
|
|
if ((_a2 = editData.question) == null ? void 0 : _a2.id) {
|
|
callback("edit", -1);
|
|
} else {
|
|
callback("del", editData.key);
|
|
}
|
|
} }, "\u53D6\u6D88"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { className: "ml20", type: "primary", onClick: () => onSave() }, "\u4FDD\u5B58"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { className: "ml20", type: "primary", onClick: () => onSave(true) }, "\u4FDD\u5B58\u5E76\u7EE7\u7EED"))));
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: editormodules.wrap }, editKey !== editData.key && showList(), editKey === editData.key && showEdit());
|
|
};
|
|
/* harmony default export */ var SubjectiveEditor = ((0,_umi_production_exports.connect)(
|
|
({
|
|
problemset,
|
|
loading,
|
|
globalSetting
|
|
}) => ({
|
|
problemset,
|
|
globalSetting,
|
|
loading: loading.effects
|
|
}),
|
|
null,
|
|
null,
|
|
{ forwardRef: true }
|
|
)((0,_react_17_0_2_react.forwardRef)(SubjectiveEditor_SingleEditor)));
|
|
|
|
// EXTERNAL MODULE: ./src/components/NoData/index.tsx
|
|
var NoData = __webpack_require__(46948);
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Poll/Detail/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Detailmodules = ({"flex_box_center":"flex_box_center___IqikW","flex_space_between":"flex_space_between___H4npu","flex_box_vertical_center":"flex_box_vertical_center___pxWg2","flex_box_center_end":"flex_box_center_end___fI1p7","flex_box_column":"flex_box_column___uFxAf","bg":"bg___Emql5","containerTitle":"containerTitle___fmYJh","containerDesc":"containerDesc___CC8H4","listItem":"listItem___zg_9F","info":"info___RsS8d","title":"title___w3IkP","titleLeft":"titleLeft___IS2Mw","titleRight":"titleRight____welO","acitons":"acitons___np4Mm","export":"export___atwjg"});
|
|
// EXTERNAL MODULE: ./src/pages/User/Detail/Topics/components/SendToClassModal.tsx + 2 modules
|
|
var SendToClassModal = __webpack_require__(16806);
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Poll/Detail/index.tsx
|
|
var Detail_defProp = Object.defineProperty;
|
|
var Detail_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var Detail_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var Detail_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var Detail_defNormalProp = (obj, key, value) => key in obj ? Detail_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var Detail_spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (Detail_hasOwnProp.call(b, prop))
|
|
Detail_defNormalProp(a, prop, b[prop]);
|
|
if (Detail_getOwnPropSymbols)
|
|
for (var prop of Detail_getOwnPropSymbols(b)) {
|
|
if (Detail_propIsEnum.call(b, prop))
|
|
Detail_defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var Detail_objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (Detail_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && Detail_getOwnPropSymbols)
|
|
for (var prop of Detail_getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && Detail_propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var Detail_async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ShixunsListPage = (_a) => {
|
|
var _b = _a, {
|
|
polls,
|
|
globalSetting,
|
|
loading,
|
|
user,
|
|
dispatch
|
|
} = _b, props = Detail_objRest(_b, [
|
|
"polls",
|
|
"globalSetting",
|
|
"loading",
|
|
"user",
|
|
"dispatch"
|
|
]);
|
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
const { userInfo } = user;
|
|
const [form] = es_form["default"].useForm();
|
|
const [editData, setEditData] = (0,_react_17_0_2_react.useState)([]);
|
|
const [isEdit, setIsEdit] = (0,_react_17_0_2_react.useState)(false);
|
|
let [editKey, setEditKey] = (0,_react_17_0_2_react.useState)(-1);
|
|
const questionType = [{ name: "\u5355\u9009\u9898", id: 1 }, { name: "\u591A\u9009\u9898", id: 2 }, { name: "\u4E3B\u89C2\u9898", id: 3 }];
|
|
const childrenRef = (0,_react_17_0_2_react.useRef)();
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a3, _b3, _c2, _d2, _e2, _f2;
|
|
if ((_a3 = polls.exerciseBanks) == null ? void 0 : _a3.questions) {
|
|
setEditData([...(_b3 = polls.exerciseBanks) == null ? void 0 : _b3.questions]);
|
|
form.setFieldsValue({
|
|
exercise_name: (_d2 = (_c2 = polls.exerciseBanks) == null ? void 0 : _c2.poll) == null ? void 0 : _d2.name,
|
|
exercise_description: (_f2 = (_e2 = polls.exerciseBanks) == null ? void 0 : _e2.poll) == null ? void 0 : _f2.description
|
|
});
|
|
}
|
|
}, [polls.exerciseBanks]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: Detail_spreadValues({}, params)
|
|
});
|
|
}, [params.categoryId]);
|
|
const save = () => Detail_async(void 0, null, function* () {
|
|
yield form.validateFields();
|
|
const value = form.getFieldValue();
|
|
value.is_md = true;
|
|
value.topicId = params.topicId;
|
|
setIsEdit(false);
|
|
yield (0,service_polls/* putExerciseBanks */.hO)(Detail_spreadValues({}, value));
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: Detail_spreadValues({}, params)
|
|
});
|
|
});
|
|
const addQuestion = (type) => Detail_async(void 0, null, function* () {
|
|
const d = childrenRef == null ? void 0 : childrenRef.current;
|
|
if (editKey !== -1) {
|
|
message/* default */.ZP.error("\u4E0D\u80FD\u540C\u65F6\u7F16\u8F91\u4E24\u9898");
|
|
return;
|
|
}
|
|
setEditKey(editData.length + 1);
|
|
setEditData([...editData, { question: { question_type: type } }]);
|
|
});
|
|
const handleSend = () => {
|
|
dispatch({
|
|
type: "userDetail/setActionTabs",
|
|
payload: { key: "UserDetail-SendToClass", params: { object_id: [params.topicId], object_type: "poll" } }
|
|
});
|
|
};
|
|
const callback = (key, data, allData) => {
|
|
switch (key) {
|
|
case "edit":
|
|
setEditKey(data);
|
|
break;
|
|
case "add":
|
|
if (editKey != -1) {
|
|
message/* default */.ZP.error("\u4E0D\u80FD\u540C\u65F6\u7F16\u8F91\u4E24\u9898");
|
|
return;
|
|
}
|
|
editData.splice((data == null ? void 0 : data.key) + 1, 0, { insert_id: data == null ? void 0 : data.insert_id, question: Detail_spreadValues({}, data) }).slice();
|
|
setEditData([...editData]);
|
|
setEditKey((data == null ? void 0 : data.key) + 1);
|
|
break;
|
|
case "addContinue":
|
|
allData.splice(data == null ? void 0 : data.key, 0, { insert_id: data == null ? void 0 : data.insert_id, question: Detail_spreadValues({}, data) }).slice();
|
|
setEditData([...allData]);
|
|
setEditKey((data == null ? void 0 : data.key) + 1);
|
|
break;
|
|
case "del":
|
|
editData.splice(data - 1, 1);
|
|
setEditData([...editData]);
|
|
setEditKey(-1);
|
|
break;
|
|
}
|
|
};
|
|
const renderQuestion = function() {
|
|
return editData == null ? void 0 : editData.map(function(v, k) {
|
|
var _a3;
|
|
v.key = k + 1;
|
|
v.len = editData.length;
|
|
if (v.question.question_type === 1) {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, /* @__PURE__ */ _react_17_0_2_react.createElement(components_SingleEditor, { ref: childrenRef, editKey, callback, editData: v }), /* @__PURE__ */ _react_17_0_2_react.createElement(divider/* default */.Z, null));
|
|
}
|
|
if (v.question.question_type === 2) {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, /* @__PURE__ */ _react_17_0_2_react.createElement(MultipleEditor, { ref: childrenRef, editKey, callback, editData: v }), /* @__PURE__ */ _react_17_0_2_react.createElement(divider/* default */.Z, null));
|
|
}
|
|
if (((_a3 = v.question) == null ? void 0 : _a3.question_type) === 3) {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, /* @__PURE__ */ _react_17_0_2_react.createElement(SubjectiveEditor, { ref: childrenRef, editKey, callback, editData: v }), /* @__PURE__ */ _react_17_0_2_react.createElement(divider/* default */.Z, null));
|
|
}
|
|
});
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: "edu-container" }, /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: "animated fadeIn" }, /* @__PURE__ */ _react_17_0_2_react.createElement("aside", { className: "mt10" }, userInfo && /* @__PURE__ */ _react_17_0_2_react.createElement(breadcrumb/* default */.Z, { separator: ">" }, /* @__PURE__ */ _react_17_0_2_react.createElement(breadcrumb/* default */.Z.Item, null, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
_umi_production_exports.Link,
|
|
{
|
|
to: `/users/${userInfo.login}/topics/personal`
|
|
},
|
|
"\u6211\u7684\u8BFE\u5802\u8D44\u6E90"
|
|
)), /* @__PURE__ */ _react_17_0_2_react.createElement(breadcrumb/* default */.Z.Item, null, "\u8BE6\u60C5"))), /* @__PURE__ */ _react_17_0_2_react.createElement("aside", { className: [Detailmodules.title, "mt20"].join(" ") }, /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { style: { width: "100%" } }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "1" }, /* @__PURE__ */ _react_17_0_2_react.createElement("strong", { className: "font20 ml5" }, (_b2 = (_a2 = polls.exerciseBanks) == null ? void 0 : _a2.poll) == null ? void 0 : _b2.name)), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null)))), /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: [Detailmodules.bg, "pl30", "pr30", "pb30", "mt20", "relative"].join(" ") }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Detailmodules.export }, ((_c = polls.exerciseBanks) == null ? void 0 : _c.authorize) && /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"a",
|
|
{
|
|
onClick: (e) => {
|
|
e.preventDefault();
|
|
modal["default"].confirm({
|
|
centered: true,
|
|
okText: "\u786E\u5B9A",
|
|
cancelText: "\u53D6\u6D88",
|
|
title: "\u63D0\u793A",
|
|
content: "\u662F\u5426\u786E\u8BA4\u5220\u9664?",
|
|
onOk: () => Detail_async(void 0, null, function* () {
|
|
const res = yield (0,service_user/* deleteQuestionBanks */.Tv)({
|
|
object_type: "normal",
|
|
object_id: [params.topicId]
|
|
});
|
|
if (res.status === 0) {
|
|
_umi_production_exports.history.push(`/users/${params.username}/topics/personal`);
|
|
}
|
|
})
|
|
});
|
|
}
|
|
},
|
|
"\u5220\u9664"
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
_umi_production_exports.Link,
|
|
{
|
|
to: `/users/${userInfo.login}/topics/${params.topicId}/${params.topictype}/poll/edit`
|
|
},
|
|
"\u7F16\u8F91"
|
|
)), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"a",
|
|
{
|
|
onClick: (e) => {
|
|
e.preventDefault();
|
|
handleSend();
|
|
}
|
|
},
|
|
"\u53D1\u9001"
|
|
)), /* @__PURE__ */ _react_17_0_2_react.createElement(tabs["default"], { className: Detailmodules.tabs }, /* @__PURE__ */ _react_17_0_2_react.createElement(tabs["default"].TabPane, { tab: /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "font16 pt10 pb12" }, "\u5185\u5BB9\u8BE6\u60C5"), key: "1" }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "c-light-black" }, (_e = (_d = polls.exerciseBanks) == null ? void 0 : _d.poll) == null ? void 0 : _e.description))), !isEdit && /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Detailmodules.containerDesc }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, (_g = (_f = polls.exerciseBanks) == null ? void 0 : _f.poll) == null ? void 0 : _g.name), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u7F16\u8F91" }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { onClick: () => setIsEdit(true), className: "iconfont c-green ml30 icon-bianjidaibeijing" })))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "c-light-black" }, (_i = (_h = polls.exerciseBanks) == null ? void 0 : _h.poll) == null ? void 0 : _i.description)), isEdit && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"],
|
|
{
|
|
layout: "vertical",
|
|
form
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
name: "exercise_name",
|
|
label: "\u95EE\u5377\u6807\u9898\uFF1A",
|
|
rules: [{ required: true, message: "\u8BF7\u586B\u5199\u95EE\u5377\u6807\u9898" }]
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(input["default"], { maxLength: 60, placeholder: "\u95EE\u5377\u6807\u9898\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26" })
|
|
),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { label: "\u95EE\u5377\u987B\u77E5\uFF1A", name: "exercise_description" }, /* @__PURE__ */ _react_17_0_2_react.createElement(input["default"].TextArea, { rows: 6, placeholder: "\u8BF7\u5728\u6B64\u8F93\u5165\u672C\u6B21\u95EE\u5377\u7B54\u9898\u7684\u76F8\u5173\u8BF4\u660E\uFF0C\u6700\u5927\u9650\u5236100\u4E2A\u5B57\u7B26" })),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { className: "tr" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_button/* default */.ZP,
|
|
{
|
|
type: "primary",
|
|
onClick: () => {
|
|
save();
|
|
}
|
|
},
|
|
"\u4FDD\u5B58"
|
|
))
|
|
)), editData != "" && /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: "mt20" }, /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: 1 }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "c-light-black mr20" }, "\u5355\u9009\u9898 ", (_k = (_j = polls.exerciseBanks) == null ? void 0 : _j.question_types) == null ? void 0 : _k.q_singles, " \u9898"), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "c-light-black mr20" }, "\u591A\u9009\u9898 ", (_m = (_l = polls.exerciseBanks) == null ? void 0 : _l.question_types) == null ? void 0 : _m.q_doubles, " \u9898"), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "c-light-black" }, "\u4E3B\u89C2\u9898 ", (_o = (_n = polls.exerciseBanks) == null ? void 0 : _n.question_types) == null ? void 0 : _o.q_mains, " \u9898")), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { className: "c-light-black" }, "\u5408\u8BA1 ", /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "c-orange" }, (_q = (_p = polls.exerciseBanks) == null ? void 0 : _p.question_types) == null ? void 0 : _q.q_counts), " \u9898"))), /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: [Detailmodules.bg, "pt30", "pl20", "pr20", "pb20", "mt20"].join(" ") }, editData != "" && renderQuestion(), editData == "" && /* @__PURE__ */ _react_17_0_2_react.createElement(NoData/* default */.Z, null)), /* @__PURE__ */ _react_17_0_2_react.createElement(SendToClassModal/* default */.Z, null));
|
|
};
|
|
/* harmony default export */ var Detail = ((0,_umi_production_exports.connect)(
|
|
({
|
|
polls,
|
|
loading,
|
|
user,
|
|
globalSetting
|
|
}) => ({
|
|
polls,
|
|
globalSetting,
|
|
user,
|
|
loading: loading.effects
|
|
})
|
|
)(ShixunsListPage));
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 16806:
|
|
/*!**********************************************************************************!*\
|
|
!*** ./src/pages/User/Detail/Topics/components/SendToClassModal.tsx + 2 modules ***!
|
|
\**********************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ components_SendToClassModal; }
|
|
});
|
|
|
|
// 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 + 15 modules
|
|
var _umi_production_exports = __webpack_require__(23852);
|
|
// 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/modal/index.js + 16 modules
|
|
var modal = __webpack_require__(43418);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tabs/index.js + 24 modules
|
|
var tabs = __webpack_require__(99313);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/skeleton/index.js + 12 modules
|
|
var skeleton = __webpack_require__(2518);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/radio/index.js + 5 modules
|
|
var es_radio = __webpack_require__(5112);
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/components/SendToClassModal.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var SendToClassModalmodules = ({"title":"title___XAxiE","radioWrap":"radioWrap___k0pOB","radio":"radio___x9kMt","colorFF0000":"colorFF0000___IMgd0","pagination":"pagination___ou2ht","checkboxWrapper":"checkboxWrapper___kF7xI"});
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
var util = __webpack_require__(75798);
|
|
// EXTERNAL MODULE: ./src/components/ui-customization/index.tsx + 34 modules
|
|
var ui_customization = __webpack_require__(20473);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/spin/index.js + 1 modules
|
|
var spin = __webpack_require__(71418);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/checkbox/index.js + 3 modules
|
|
var es_checkbox = __webpack_require__(24905);
|
|
// EXTERNAL MODULE: ./src/service/user.ts
|
|
var user = __webpack_require__(63203);
|
|
// EXTERNAL MODULE: ./node_modules/_react-infinite-scroller@1.2.4@react-infinite-scroller/index.js
|
|
var _react_infinite_scroller_1_2_4_react_infinite_scroller = __webpack_require__(26724);
|
|
var _react_infinite_scroller_1_2_4_react_infinite_scroller_default = /*#__PURE__*/__webpack_require__.n(_react_infinite_scroller_1_2_4_react_infinite_scroller);
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/components/SendToSubject.tsx
|
|
var __async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const SendToSubject = ({ username, setStages, stages, hasError, setHasError }) => {
|
|
const [searchValue, setSearchValue] = (0,_react_17_0_2_react.useState)("");
|
|
const [page, setPage] = (0,_react_17_0_2_react.useState)(1);
|
|
const [subjectList, setSubjectList] = (0,_react_17_0_2_react.useState)([]);
|
|
const [listLoading, setListLoading] = (0,_react_17_0_2_react.useState)(false);
|
|
const [totalCount, setTotalCount] = (0,_react_17_0_2_react.useState)(0);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
getSubjectList({ page: 1, search: "" }, true);
|
|
}, []);
|
|
const getSubjectList = (params, reset) => __async(void 0, null, function* () {
|
|
setListLoading(true);
|
|
const res = yield (0,user/* getPaths */.w3)({
|
|
username,
|
|
category: "manage",
|
|
page: params.page,
|
|
search: params.search
|
|
});
|
|
setListLoading(false);
|
|
setSubjectList((pre) => reset ? res == null ? void 0 : res.subjects : [...pre, ...res == null ? void 0 : res.subjects]);
|
|
setTotalCount(res == null ? void 0 : res.count);
|
|
});
|
|
const scrollElementRef = (0,_react_17_0_2_react.useRef)();
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SendToClassModalmodules.wrap }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mb10" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
ui_customization/* CustomInput */.t7,
|
|
{
|
|
placeholder: "\u8BF7\u8F93\u5165\u5B9E\u8DF5\u8BFE\u7A0B\u540D\u79F0\u7684\u5173\u952E\u5B57\u8FDB\u884C\u641C\u7D22",
|
|
value: searchValue,
|
|
style: {
|
|
width: 500
|
|
},
|
|
onChange: (value) => {
|
|
setSearchValue(value);
|
|
setPage(1);
|
|
scrollElementRef.current.scrollTo({ behavior: "smooth", top: 0 });
|
|
getSubjectList({ page: 1, search: value }, true);
|
|
}
|
|
}
|
|
)), /* @__PURE__ */ _react_17_0_2_react.createElement(spin/* default */.Z, { spinning: listLoading }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SendToClassModalmodules.radioWrap, ref: scrollElementRef }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
(_react_infinite_scroller_1_2_4_react_infinite_scroller_default()),
|
|
{
|
|
initialLoad: false,
|
|
pageStart: 1,
|
|
threshold: 6,
|
|
loadMore: () => {
|
|
setPage(page + 1);
|
|
getSubjectList({ page: page + 1, search: searchValue }, false);
|
|
},
|
|
hasMore: subjectList.length < totalCount,
|
|
useWindow: false
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_radio/* default.Group */.ZP.Group,
|
|
{
|
|
value: stages.subjectId,
|
|
onChange: (e) => {
|
|
setStages({ subjectId: e.target.value, stage_ids: [] });
|
|
setHasError(false);
|
|
}
|
|
},
|
|
subjectList.map((item) => {
|
|
const options = item.stages.map((stage) => ({ label: stage.name, value: stage.id }));
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { key: item.id }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_radio/* default */.ZP,
|
|
{
|
|
className: SendToClassModalmodules.radio,
|
|
value: item.id
|
|
},
|
|
item.name
|
|
), item.id === stages.subjectId && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SendToClassModalmodules.checkboxWrapper }, options.length > 0 && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_checkbox["default"],
|
|
{
|
|
indeterminate: stages.stage_ids.length > 0 && stages.stage_ids.length < options.length,
|
|
onChange: (e) => {
|
|
setStages({ subjectId: item.id, stage_ids: e.target.checked ? options.map((option) => option.value) : [] });
|
|
},
|
|
checked: stages.stage_ids.length === options.length
|
|
},
|
|
"\u5168\u9009"
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_checkbox["default"].Group,
|
|
{
|
|
options,
|
|
value: stages.stage_ids,
|
|
onChange: (checkedValue) => setStages({ subjectId: item.id, stage_ids: checkedValue })
|
|
}
|
|
)));
|
|
})
|
|
)
|
|
))), hasError && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SendToClassModalmodules.colorFF0000 }, "\u8BF7\u5148\u9009\u62E9\u5B9E\u8DF5\u8BFE\u7A0B\u53CA\u7AE0\u8282"));
|
|
};
|
|
/* harmony default export */ var components_SendToSubject = (SendToSubject);
|
|
|
|
// EXTERNAL MODULE: ./src/components/ui-customization/reset.less?modules
|
|
var resetmodules = __webpack_require__(47229);
|
|
// EXTERNAL MODULE: ./src/service/account.ts
|
|
var account = __webpack_require__(58814);
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/components/SendToClassModal.tsx
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && __getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var SendToClassModal_async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const SendToClassModal = (_a) => {
|
|
var _b = _a, {
|
|
userDetail,
|
|
globalSetting,
|
|
loading,
|
|
user,
|
|
dispatch
|
|
} = _b, props = __objRest(_b, [
|
|
"userDetail",
|
|
"globalSetting",
|
|
"loading",
|
|
"user",
|
|
"dispatch"
|
|
]);
|
|
var _a2, _b2, _c, _d, _e;
|
|
const [activeKey, setActiveKey] = (0,_react_17_0_2_react.useState)("course");
|
|
const [searchValue, setSearchValue] = (0,_react_17_0_2_react.useState)("");
|
|
const [courseList, setCourseList] = (0,_react_17_0_2_react.useState)([]);
|
|
const [radioValue, setRadioValue] = (0,_react_17_0_2_react.useState)();
|
|
const [listLoading, setListLoading] = (0,_react_17_0_2_react.useState)(false);
|
|
const [hasError, setHasError] = (0,_react_17_0_2_react.useState)(false);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
if (userDetail.actionTabs.key === "UserDetail-SendToClass") {
|
|
getCourseList(searchValue);
|
|
}
|
|
}, [userDetail.actionTabs.key]);
|
|
const getCourseList = (value) => SendToClassModal_async(void 0, null, function* () {
|
|
setListLoading(true);
|
|
const res = yield dispatch({
|
|
type: "userDetail/topicGetCourseList",
|
|
payload: { search: value }
|
|
});
|
|
if (res) {
|
|
setCourseList((res == null ? void 0 : res.courses) || []);
|
|
}
|
|
setListLoading(false);
|
|
});
|
|
const [stages, setStages] = (0,_react_17_0_2_react.useState)({ subjectId: "", stage_ids: [] });
|
|
const handleOk = () => SendToClassModal_async(void 0, null, function* () {
|
|
var _a3, _b3, _c2, _d2, _e2, _f;
|
|
if (activeKey === "course") {
|
|
if (!radioValue) {
|
|
setHasError(true);
|
|
return;
|
|
}
|
|
const res = yield dispatch({
|
|
type: "userDetail/topicSendToClass",
|
|
payload: __spreadValues({ course_id: radioValue }, (_a3 = userDetail.actionTabs) == null ? void 0 : _a3.params)
|
|
});
|
|
dispatch({
|
|
type: "userDetail/setActionTabs",
|
|
payload: {}
|
|
});
|
|
if (res && res.status === 0) {
|
|
const urlMapping = {
|
|
"normal": "common_homework",
|
|
"group": "group_homework",
|
|
"exercise": "exercise",
|
|
"poll": "poll",
|
|
"videos": "video"
|
|
};
|
|
(0,util/* openNewWindow */.xg)(`/classrooms/${radioValue}/${urlMapping[(_c2 = (_b3 = userDetail.actionTabs) == null ? void 0 : _b3.params) == null ? void 0 : _c2.object_type]}`);
|
|
}
|
|
} else {
|
|
if (!stages.subjectId || !stages.stage_ids.length) {
|
|
setHasError(true);
|
|
return;
|
|
}
|
|
const res = yield (0,account/* createSubjectVideo */.nI)({ id: (_e2 = (_d2 = userDetail.actionTabs) == null ? void 0 : _d2.params) == null ? void 0 : _e2.object_id, login: (_f = user.userInfo) == null ? void 0 : _f.login }, { stage_ids: stages.stage_ids });
|
|
if (res.status === 0) {
|
|
message/* default */.ZP.success("\u53D1\u9001\u6210\u529F");
|
|
dispatch({
|
|
type: "userDetail/setActionTabs",
|
|
payload: {}
|
|
});
|
|
(0,util/* openNewWindow */.xg)(`/paths/${stages.subjectId}`);
|
|
}
|
|
}
|
|
});
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
centered: true,
|
|
keyboard: false,
|
|
closable: false,
|
|
destroyOnClose: true,
|
|
open: userDetail.actionTabs.key === "UserDetail-SendToClass",
|
|
title: "\u53D1\u9001",
|
|
okText: "\u786E\u5B9A",
|
|
cancelText: "\u53D6\u6D88",
|
|
confirmLoading: loading["userDetail/sendToClass"],
|
|
width: 600,
|
|
afterClose: () => {
|
|
setHasError(false);
|
|
setCourseList([]);
|
|
setStages({ subjectId: "", stage_ids: [] });
|
|
setSearchValue("");
|
|
},
|
|
onOk: handleOk,
|
|
wrapClassName: resetmodules/* default */.Z.CustomCss,
|
|
onCancel: () => {
|
|
dispatch({
|
|
type: "userDetail/setActionTabs",
|
|
payload: {}
|
|
});
|
|
}
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
tabs["default"],
|
|
{
|
|
activeKey,
|
|
onChange: (key) => {
|
|
setHasError(false);
|
|
setActiveKey(key);
|
|
},
|
|
items: [
|
|
{
|
|
label: "\u8BFE\u5802",
|
|
key: "course",
|
|
children: /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SendToClassModalmodules.wrap }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mb10" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
ui_customization/* CustomInput */.t7,
|
|
{
|
|
placeholder: "\u8BF7\u8F93\u5165\u8BFE\u5802\u540D\u79F0\u7684\u5173\u952E\u5B57\u8FDB\u884C\u641C\u7D22",
|
|
value: searchValue,
|
|
style: {
|
|
width: 500
|
|
},
|
|
onChange: (value) => {
|
|
setSearchValue(value);
|
|
getCourseList(value);
|
|
}
|
|
}
|
|
)), /* @__PURE__ */ _react_17_0_2_react.createElement(skeleton/* default */.Z, { active: true, loading: listLoading }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SendToClassModalmodules.radioWrap }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_radio/* default.Group */.ZP.Group,
|
|
{
|
|
value: radioValue,
|
|
onChange: (e) => {
|
|
setRadioValue(e.target.value);
|
|
setHasError(false);
|
|
}
|
|
},
|
|
courseList.map((item, key) => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_radio/* default */.ZP,
|
|
{
|
|
className: SendToClassModalmodules.radio,
|
|
value: item.course_id,
|
|
key: item.course_id
|
|
},
|
|
item.course_name
|
|
);
|
|
})
|
|
))), ((_b2 = (_a2 = userDetail.actionTabs) == null ? void 0 : _a2.params) == null ? void 0 : _b2.object_type) !== "videos" && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SendToClassModalmodules.title }, "\u6E29\u99A8\u63D0\u793A\uFF1A\u9009\u62E9\u7684\u9898\u5C06\u4F1A\u53D1\u9001\u5230\u6307\u5B9A\u8BFE\u5802"), hasError && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SendToClassModalmodules.colorFF0000 }, "\u8BF7\u5148\u9009\u62E9\u8BFE\u5802")),
|
|
show: true
|
|
},
|
|
{
|
|
label: "\u5B9E\u8DF5\u8BFE\u7A0B",
|
|
key: "subject",
|
|
children: /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
components_SendToSubject,
|
|
{
|
|
username: (_c = user.userInfo) == null ? void 0 : _c.login,
|
|
stages,
|
|
setStages,
|
|
hasError,
|
|
setHasError
|
|
}
|
|
),
|
|
show: ((_e = (_d = userDetail.actionTabs) == null ? void 0 : _d.params) == null ? void 0 : _e.object_type) === "videos"
|
|
}
|
|
].filter((item) => item.show)
|
|
}
|
|
)
|
|
);
|
|
};
|
|
/* harmony default export */ var components_SendToClassModal = ((0,_umi_production_exports.connect)(
|
|
({
|
|
userDetail,
|
|
loading,
|
|
globalSetting,
|
|
user
|
|
}) => ({
|
|
userDetail,
|
|
globalSetting,
|
|
loading: loading.effects,
|
|
user
|
|
})
|
|
)(SendToClassModal));
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |