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.
2793 lines
126 KiB
2793 lines
126 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[2806],{
|
|
|
|
/***/ 14661:
|
|
/*!************************************************************!*\
|
|
!*** ./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"});
|
|
|
|
/***/ }),
|
|
|
|
/***/ 77954:
|
|
/*!*********************************************************************!*\
|
|
!*** ./src/components/Editor/NullChildEditor/index.jsx + 1 modules ***!
|
|
\*********************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ Editor_NullChildEditor; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
|
|
var input = __webpack_require__(98135);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tag/index.js + 5 modules
|
|
var es_tag = __webpack_require__(12563);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
|
|
var message = __webpack_require__(8591);
|
|
;// CONCATENATED MODULE: ./src/components/Editor/NullChildEditor/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var NullChildEditormodules = ({"flex":"flex___eLcnP","flex1":"flex1___yUTT7","color666":"color666___TiUhG","error":"error___gTTtv","deleteIcon":"deleteIcon___mnZW1","addIcon":"addIcon___JC5NS"});
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.7@@ant-design/icons/es/icons/PlusOutlined.js + 1 modules
|
|
var PlusOutlined = __webpack_require__(22415);
|
|
;// CONCATENATED MODULE: ./src/components/Editor/NullChildEditor/index.jsx
|
|
|
|
|
|
|
|
|
|
const { TextArea } = input["default"];
|
|
class NullChildEditor extends _react_17_0_2_react.Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
inputVisible: false,
|
|
EditInputIndex: -1
|
|
};
|
|
}
|
|
// componentDidMount() {
|
|
// // console.log(`${this.props.index}----`,this.props,e);
|
|
// if (this.props.answers[0].length <= 0) {
|
|
// this.setState({
|
|
// EditInputIndex: 0,
|
|
// });
|
|
// }
|
|
// }
|
|
render() {
|
|
let {
|
|
index,
|
|
onAnswerChange,
|
|
addChildAnswer,
|
|
exerciseIsPublish,
|
|
answers,
|
|
activeOptionErrorIndex,
|
|
flex = "0 0 1000px"
|
|
} = this.props;
|
|
console.log("----", answers);
|
|
let { inputVisible, EditInputIndex } = this.state;
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: NullChildEditormodules.flex }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"div",
|
|
{
|
|
className: `${NullChildEditormodules.color666} mb5 mt6`,
|
|
style: { flex: "0 0 90px" }
|
|
},
|
|
"\u7B54\u6848(\u586B\u7A7A",
|
|
index + 1,
|
|
"):"
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { border: "1px solid #f6f6f6", flex: 1, padding: 10 } }, answers == null ? void 0 : answers.map((tag, itemIndex) => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, EditInputIndex !== itemIndex ? (tag == null ? void 0 : tag.length) > 0 ? /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_tag["default"],
|
|
{
|
|
className: "edit-tag",
|
|
key: tag,
|
|
closable: true,
|
|
onClose: (e) => {
|
|
e.preventDefault();
|
|
if ((answers == null ? void 0 : answers.length) === 1 && itemIndex === 0) {
|
|
this.props.deleteChildAnswermain(index, itemIndex);
|
|
} else {
|
|
this.props.deleteChildAnswer(index, itemIndex);
|
|
}
|
|
}
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"span",
|
|
{
|
|
onDoubleClick: (e) => {
|
|
this.setState({
|
|
EditInputIndex: itemIndex
|
|
});
|
|
e.preventDefault();
|
|
}
|
|
},
|
|
tag
|
|
)
|
|
) : /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
input["default"],
|
|
{
|
|
defaultValue: tag,
|
|
style: {
|
|
width: 78,
|
|
marginRight: 8,
|
|
height: 24,
|
|
verticalAlign: "top"
|
|
},
|
|
onBlur: (e) => {
|
|
if (e.target.value.replaceAll(" ", "").length <= 0) {
|
|
message/* default */.ZP.info("\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7EAF\u7A7A\u683C");
|
|
return;
|
|
}
|
|
onAnswerChange(index, itemIndex, e.target.value);
|
|
this.setState({
|
|
EditInputIndex: -1,
|
|
inputVisible: false
|
|
});
|
|
}
|
|
}
|
|
) : /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
input["default"],
|
|
{
|
|
defaultValue: tag,
|
|
style: {
|
|
width: 78,
|
|
marginRight: 8,
|
|
height: 24,
|
|
verticalAlign: "top"
|
|
},
|
|
onBlur: (e) => {
|
|
if (e.target.value.replaceAll(" ", "").length <= 0) {
|
|
message/* default */.ZP.info("\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7EAF\u7A7A\u683C");
|
|
return;
|
|
}
|
|
onAnswerChange(index, itemIndex, e.target.value);
|
|
this.setState({
|
|
EditInputIndex: -1,
|
|
inputVisible: false
|
|
});
|
|
}
|
|
}
|
|
));
|
|
}), !inputVisible && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_tag["default"],
|
|
{
|
|
className: "site-tag-plus",
|
|
onClick: () => {
|
|
addChildAnswer(index);
|
|
this.setState({
|
|
inputVisible: true
|
|
});
|
|
}
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(PlusOutlined/* default */.Z, null),
|
|
" \u65B0\u589E\u7B54\u6848"
|
|
)));
|
|
}
|
|
}
|
|
/* harmony default export */ var Editor_NullChildEditor = (NullChildEditor);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 85607:
|
|
/*!************************************************!*\
|
|
!*** ./src/components/Editor/NullMDEditor.jsx ***!
|
|
\************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Z: function() { return /* binding */ NullMDEditor; }
|
|
/* harmony export */ });
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
|
|
/* harmony import */ var _markdown_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../markdown-editor */ 96180);
|
|
var __defProp = Object.defineProperty;
|
|
var __defProps = Object.defineProperties;
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
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 __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
var __publicField = (obj, key, value) => {
|
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
return value;
|
|
};
|
|
|
|
|
|
const NULL_CH = "\u2581";
|
|
class NullMDEditor extends react__WEBPACK_IMPORTED_MODULE_0__.Component {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "getChCountBeforeCursor", (cm, cursor) => {
|
|
const currentLine = cursor.line;
|
|
let placeholderCountBefore = 0;
|
|
for (let _line = 0; _line < currentLine; _line++) {
|
|
placeholderCountBefore += cm.getLine(_line).split(NULL_CH).length - 1;
|
|
}
|
|
const currentLineStringBeforeCursor = cm.getLine(currentLine).substring(0, cursor.ch);
|
|
placeholderCountBefore += currentLineStringBeforeCursor.split(NULL_CH).length - 1;
|
|
return placeholderCountBefore;
|
|
});
|
|
__publicField(this, "onCMBeforeChange", (cm, change) => {
|
|
const rangeText = cm.getRange(change.from, change.to);
|
|
let totalPlaceholderCount = 0;
|
|
change.text.forEach((item) => {
|
|
totalPlaceholderCount += item.split(NULL_CH).length - 1;
|
|
});
|
|
if (rangeText && rangeText.indexOf(NULL_CH) != -1) {
|
|
const placeholderCountInRange = rangeText.split(NULL_CH).length - 1;
|
|
const placeholderCountBefore = this.getChCountBeforeCursor(
|
|
cm,
|
|
change.from
|
|
);
|
|
console.log(
|
|
`\u5220\u9664${placeholderCountInRange}\u4E2A\uFF0C \u4E4B\u524D\u6709${placeholderCountBefore}\u4E2A\uFF0C\u65B0\u589E${totalPlaceholderCount}\u4E2A`
|
|
);
|
|
if (this.props.deleteEmptyDisabled) {
|
|
change.cancel();
|
|
} else {
|
|
this.props.onPlaceholderChange && this.props.onPlaceholderChange(
|
|
placeholderCountBefore,
|
|
placeholderCountInRange,
|
|
totalPlaceholderCount
|
|
);
|
|
}
|
|
} else if (totalPlaceholderCount) {
|
|
const placeholderCountBefore = this.getChCountBeforeCursor(
|
|
cm,
|
|
change.from
|
|
);
|
|
console.log(
|
|
`\u65B0\u589E${totalPlaceholderCount}\u4E2A\uFF0C\u4E4B\u524D\u6709${placeholderCountBefore}\u4E2A`
|
|
);
|
|
this.props.onPlaceholderChange && this.props.onPlaceholderChange(
|
|
placeholderCountBefore,
|
|
0,
|
|
totalPlaceholderCount
|
|
);
|
|
}
|
|
});
|
|
}
|
|
render() {
|
|
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
_markdown_editor__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z,
|
|
__spreadProps(__spreadValues({}, this.props), {
|
|
onCMBeforeChange: this.onCMBeforeChange
|
|
})
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 48369:
|
|
/*!****************************************************************************!*\
|
|
!*** ./src/pages/User/Detail/Topics/Exercise/Detail/index.tsx + 8 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__(67866);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/menu/index.js + 11 modules
|
|
var menu = __webpack_require__(20834);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/layout/index.js
|
|
var layout = __webpack_require__(44000);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/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/input/index.js + 5 modules
|
|
var input = __webpack_require__(98135);
|
|
// 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__(68243);
|
|
// EXTERNAL MODULE: ./src/service/user.ts
|
|
var service_user = __webpack_require__(38620);
|
|
// EXTERNAL MODULE: ./src/components/NoData/index.tsx
|
|
var NoData = __webpack_require__(87526);
|
|
// 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/checkbox/index.js + 3 modules
|
|
var es_checkbox = __webpack_require__(24905);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input-number/index.js + 14 modules
|
|
var input_number = __webpack_require__(54449);
|
|
// EXTERNAL MODULE: ./src/service/exercise.ts
|
|
var exercise = __webpack_require__(41044);
|
|
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 15 modules
|
|
var markdown_editor = __webpack_require__(96180);
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx
|
|
var RenderHtml = __webpack_require__(16921);
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Detail/components/editor.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var editormodules = ({"flex_box_center":"flex_box_center___p1qG1","flex_space_between":"flex_space_between___EHoRl","flex_box_vertical_center":"flex_box_vertical_center___c0u2d","flex_box_center_end":"flex_box_center_end___ueiDD","flex_box_column":"flex_box_column___tyRHS","wrap":"wrap___ce8sS","modal":"modal___yzD47","titleWrap":"titleWrap___OBPcs","required":"required___ncxFF","title":"title___cxIaz","colorGray":"colorGray___NXXsn","choiceWrap":"choiceWrap___AhJbr","answer":"answer____f42Z","activeAnswer":"activeAnswer___BqxNg","deleteIcon":"deleteIcon___iHXv4","addIcon":"addIcon___Kb1l4","editorWrap":"editorWrap___UmeId","htmlWrap":"htmlWrap____EtjV","radio":"radio___zqqhF","color333":"color333___PUxW5","color999":"color999___Uiwst","questionType":"questionType___GcJoU","questionChoices":"questionChoices___WgikS"});
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/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,
|
|
onRef = () => {
|
|
},
|
|
editData
|
|
} = _b, props = __objRest(_b, [
|
|
"problemset",
|
|
"globalSetting",
|
|
"loading",
|
|
"dispatch",
|
|
"onRef",
|
|
"editData"
|
|
]);
|
|
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)(5);
|
|
const [isEdit, setIsEdit] = (0,_react_17_0_2_react.useState)(false);
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
setQuestionChoiceList(["", "", "", ""]);
|
|
}, []);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
if (!(editData == null ? void 0 : editData.question_choices)) {
|
|
setIsEdit(true);
|
|
return;
|
|
}
|
|
setTitle(editData == null ? void 0 : editData.question_title);
|
|
setScore(parseInt(editData == null ? void 0 : editData.question_score));
|
|
setQuestionChoiceList(editData == null ? void 0 : editData.question_choices.map((item) => item.choice_text));
|
|
const answerIndexs = [];
|
|
editData == null ? void 0 : editData.standard_answer.map((item, index) => {
|
|
answerIndexs.push(item - 1);
|
|
});
|
|
setActiveAnswer(answerIndexs);
|
|
}, [editData]);
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, () => ({
|
|
onSave,
|
|
isEdit
|
|
}));
|
|
const onSave = () => __async(void 0, null, function* () {
|
|
if (!title) {
|
|
message/* default */.ZP.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE");
|
|
return false;
|
|
}
|
|
const findNotAnswerIndex = questionChoiceList.findIndex((item) => !item);
|
|
if (findNotAnswerIndex > -1) {
|
|
message/* default */.ZP.info(`\u8BF7\u5148\u8F93\u5165 ${tagList[findNotAnswerIndex]} \u9009\u9879\u7684\u5185\u5BB9`);
|
|
return false;
|
|
}
|
|
if (!activeAnswer.length) {
|
|
message/* default */.ZP.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E");
|
|
return false;
|
|
}
|
|
if (activeAnswer.length < 1) {
|
|
message/* default */.ZP.info("\u8BF7\u9009\u62E9\u7B54\u6848");
|
|
return false;
|
|
}
|
|
const choices = questionChoiceList.map((item, index) => {
|
|
return {
|
|
choice_text: item,
|
|
is_answer: activeAnswer.includes(index) ? index + 1 : 0
|
|
};
|
|
});
|
|
let res;
|
|
if (editData.question_id) {
|
|
res = yield dispatch({
|
|
type: "exercise/editExerciseQuestion",
|
|
payload: {
|
|
"id": editData.question_id,
|
|
"question_title": title,
|
|
"question_type": 1,
|
|
"question_score": "5.0",
|
|
"question_choices": choices.map((item) => item.choice_text),
|
|
"standard_answers": choices.filter((item) => item.is_answer).map((item) => item.is_answer)
|
|
}
|
|
});
|
|
} else {
|
|
res = yield dispatch({
|
|
type: "exercise/addExerciseQuestion",
|
|
payload: {
|
|
"categoryId": params.categoryId,
|
|
"question_title": title,
|
|
"question_type": 1,
|
|
"question_score": "5.0",
|
|
"question_choices": choices.map((item) => item.choice_text),
|
|
"standard_answers": choices.filter((item) => item.is_answer).map((item) => item.is_answer)
|
|
}
|
|
});
|
|
}
|
|
if (res.status === 0) {
|
|
message/* default */.ZP.success("\u4FDD\u5B58\u6210\u529F");
|
|
setIsEdit(false);
|
|
dispatch({
|
|
type: "exercise/editExercise",
|
|
payload: __spreadValues({}, params)
|
|
});
|
|
}
|
|
});
|
|
const actionArr = [
|
|
{ name: "\u5220\u9664", icon: "iconfont c-light-black ml30 icon-shanchu", id: "del" },
|
|
{ name: "\u4E0A\u79FB", icon: "iconfont c-green ml30 icon-shangyi_Hover", id: "up" },
|
|
{ name: "\u4E0B\u79FB", icon: "iconfont c-green ml30 icon-xiayi_moren", id: "down" },
|
|
{ name: "\u7F16\u8F91", icon: "iconfont c-green ml30 icon-bianjishijuan3x", id: "edit" }
|
|
];
|
|
const actionClick = (item) => __async(void 0, null, function* () {
|
|
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 __async(this, null, function* () {
|
|
yield (0,exercise/* exeriseQuestionDelete */.Fl)({
|
|
id: editData.question_id
|
|
});
|
|
dispatch({
|
|
type: "exercise/editExercise",
|
|
payload: __spreadValues({}, params)
|
|
});
|
|
});
|
|
}
|
|
});
|
|
break;
|
|
case "up":
|
|
case "down":
|
|
yield dispatch({
|
|
type: "exercise/exeriseMoveUpDown",
|
|
payload: {
|
|
id: editData.question_id,
|
|
opr: item.id
|
|
}
|
|
});
|
|
dispatch({
|
|
type: "exercise/editExercise",
|
|
payload: __spreadValues({}, params)
|
|
});
|
|
break;
|
|
case "edit":
|
|
setIsEdit(true);
|
|
break;
|
|
}
|
|
});
|
|
const showList = () => {
|
|
var _a2;
|
|
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" }, editData.key, "\u3001\u591A\u9009\u9898"), "\uFF08", editData.question_score, "\u5206\uFF09"), !editData.hideAction && 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__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { key: index, placement: "bottom", title: item.name }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { onClick: () => actionClick(item), className: item.icon }));
|
|
})), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt5" }, /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { value: editData.question_title })), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.questionChoices }, (_a2 = editData == null ? void 0 : editData.question_choices) == null ? void 0 : _a2.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, checked: editData.standard_answer.includes(index + 1), disabled: true }, tagList[index], ".")), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "1" }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "c-black font14" }, /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { value: item.choice_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" }, "\u9009\u62E9\u9898"), "\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09")), /* @__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 }, "\u9898\u5E72\uFF1A")), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
markdown_editor/* default */.Z,
|
|
{
|
|
id: "single-question-title",
|
|
watch: true,
|
|
height: 155,
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",
|
|
defaultValue: title,
|
|
onChange: (value) => setTitle(value)
|
|
}
|
|
), /* @__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"))), questionChoiceList.map((item, index) => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.choiceWrap, key: index }, /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848", placement: "left" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"div",
|
|
{
|
|
className: `${editormodules.answer} ${activeAnswer.includes(index) ? editormodules.activeAnswer : ""}`,
|
|
onClick: () => {
|
|
if (activeAnswer.includes(index)) {
|
|
setActiveAnswer(activeAnswer.filter((item2) => item2 !== index));
|
|
} else {
|
|
setActiveAnswer([...activeAnswer, index]);
|
|
}
|
|
}
|
|
},
|
|
tagList[index]
|
|
)), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.editorWrap }, activeEditor === index ? /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
markdown_editor/* default */.Z,
|
|
{
|
|
id: `single-question-option-${index}`,
|
|
watch: true,
|
|
height: 155,
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9009\u9879",
|
|
defaultValue: item,
|
|
onChange: (value) => {
|
|
questionChoiceList[index] = value;
|
|
setQuestionChoiceList(questionChoiceList);
|
|
}
|
|
}
|
|
) : /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.htmlWrap, onClick: () => setActiveEditor(index) }, /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { value: item }))), 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))
|
|
}
|
|
)), index < 7 && index === questionChoiceList.length - 1 && /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u65B0\u589E\u53C2\u8003\u7B54\u6848" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"i",
|
|
{
|
|
className: `${editormodules.addIcon} iconfont icon-roundaddfill ml6`,
|
|
onClick: () => setQuestionChoiceList([...questionChoiceList, ""])
|
|
}
|
|
)));
|
|
}), /* @__PURE__ */ _react_17_0_2_react.createElement("p", { className: "c-orange" }, "\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\u8F93\u5165\u6846\u53EF\u8BBE\u7F6E\u7B54\u6848\uFF1B\u9009\u4E2D\u7684\u9009\u9879\u5373\u4E3A\u6B63\u786E\u7B54\u6848\uFF0C\u9009\u62E9\u591A\u4E2A\u7B54\u6848\u5373\u4E3A\u591A\u9009\u9898"), /* @__PURE__ */ _react_17_0_2_react.createElement("p", { className: "" }, "\u5206\u503C\uFF1A", /* @__PURE__ */ _react_17_0_2_react.createElement(input_number/* default */.Z, { value: score, max: 1e4, min: -1, onChange: (value) => {
|
|
setScore(value);
|
|
} }), " \u5206"), /* @__PURE__ */ _react_17_0_2_react.createElement("aside", { className: "tr" }, editData.question_id && /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "default", onClick: () => setIsEdit(false) }, "\u53D6\u6D88"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { className: "ml20", type: "primary", onClick: () => onSave() }, "\u4FDD\u5B58")));
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: editormodules.wrap }, !isEdit && showList(), isEdit && 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/Exercise/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
|
|
} = _b, props = SingleEditor_objRest(_b, [
|
|
"problemset",
|
|
"globalSetting",
|
|
"loading",
|
|
"dispatch",
|
|
"onRef",
|
|
"editData"
|
|
]);
|
|
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 [isEdit, setIsEdit] = (0,_react_17_0_2_react.useState)(false);
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
setQuestionChoiceList(["", "", "", ""]);
|
|
}, []);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
if (!(editData == null ? void 0 : editData.question_choices)) {
|
|
setIsEdit(true);
|
|
return;
|
|
}
|
|
setTitle(editData == null ? void 0 : editData.question_title);
|
|
setScore(parseInt(editData == null ? void 0 : editData.question_score));
|
|
setQuestionChoiceList(editData == null ? void 0 : editData.question_choices.map((item) => item.choice_text));
|
|
const answerIndexs = [];
|
|
editData == null ? void 0 : editData.standard_answer.map((item, index) => {
|
|
answerIndexs.push(item - 1);
|
|
});
|
|
setActiveAnswer(answerIndexs);
|
|
}, [editData]);
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, () => ({
|
|
onSave,
|
|
isEdit
|
|
}));
|
|
const onSave = () => SingleEditor_async(void 0, null, function* () {
|
|
if (!title) {
|
|
message/* default */.ZP.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE");
|
|
return false;
|
|
}
|
|
const findNotAnswerIndex = questionChoiceList.findIndex((item) => !item);
|
|
if (findNotAnswerIndex > -1) {
|
|
message/* default */.ZP.info(`\u8BF7\u5148\u8F93\u5165 ${SingleEditor_tagList[findNotAnswerIndex]} \u9009\u9879\u7684\u5185\u5BB9`);
|
|
return false;
|
|
}
|
|
if (!activeAnswer.length) {
|
|
message/* default */.ZP.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E");
|
|
return false;
|
|
}
|
|
if (activeAnswer.length < 1) {
|
|
message/* default */.ZP.info("\u8BF7\u9009\u62E9\u7B54\u6848");
|
|
return false;
|
|
}
|
|
const choices = questionChoiceList.map((item, index) => {
|
|
return {
|
|
choice_text: item,
|
|
is_answer: activeAnswer.includes(index) ? index + 1 : 0
|
|
};
|
|
});
|
|
let res;
|
|
if (editData.question_id) {
|
|
res = yield (0,service_polls/* putExerciseBankQuestions */.Kc)({
|
|
"id": editData.question_id,
|
|
"question_title": title,
|
|
"question_type": 1,
|
|
"question_score": score,
|
|
"question_choices": choices.map((item) => item.choice_text),
|
|
"standard_answers": choices.filter((item) => item.is_answer).map((item) => item.is_answer)
|
|
});
|
|
} else {
|
|
res = yield (0,service_polls/* addExerciseBankQuestions */.iV)({
|
|
"exercise_bank_id": params.topicId,
|
|
"question_title": title,
|
|
"question_type": 1,
|
|
"question_score": "5.0",
|
|
"question_choices": choices.map((item) => item.choice_text),
|
|
"standard_answers": choices.filter((item) => item.is_answer).map((item) => item.is_answer)
|
|
});
|
|
}
|
|
if (res.status === 0) {
|
|
message/* default */.ZP.success("\u4FDD\u5B58\u6210\u529F");
|
|
setIsEdit(false);
|
|
}
|
|
yield dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: SingleEditor_spreadValues({}, params)
|
|
});
|
|
});
|
|
const actionArr = [
|
|
{ name: "\u5220\u9664", icon: "iconfont c-light-black ml30 icon-shanchu", id: "del" },
|
|
{ name: "\u4E0A\u79FB", icon: "iconfont c-green ml30 icon-shangyi_Hover", id: "up" },
|
|
{ name: "\u4E0B\u79FB", icon: "iconfont c-green ml30 icon-xiayi_moren", id: "down" },
|
|
{ name: "\u7F16\u8F91", icon: "iconfont c-green ml30 icon-bianjishijuan3x", id: "edit" }
|
|
];
|
|
const actionClick = (item) => SingleEditor_async(void 0, null, function* () {
|
|
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* () {
|
|
yield (0,service_polls/* deleteExerciseBanksQuestion */.x$)({
|
|
pollsId: editData.question_id
|
|
});
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: SingleEditor_spreadValues({}, params)
|
|
});
|
|
});
|
|
}
|
|
});
|
|
break;
|
|
case "up":
|
|
case "down":
|
|
yield (0,service_polls/* exercisesBanksMoveUpDown */.W)({
|
|
exerciseId: editData == null ? void 0 : editData.question_id,
|
|
opr: item.id
|
|
});
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: SingleEditor_spreadValues({}, params)
|
|
});
|
|
break;
|
|
case "edit":
|
|
setIsEdit(true);
|
|
break;
|
|
}
|
|
});
|
|
const showList = () => {
|
|
var _a2;
|
|
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" }, editData.key, "\u3001\u5355\u9009\u9898"), "\uFF08", editData.question_score, "\u5206\uFF09"), !editData.hideAction && 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__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { key: index, placement: "bottom", title: item.name }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { onClick: () => actionClick(item), className: item.icon }));
|
|
})), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt5" }, /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { value: editData.question_title })), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.questionChoices }, (_a2 = editData == null ? void 0 : editData.question_choices) == null ? void 0 : _a2.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, checked: editData.standard_answer.includes(index + 1), disabled: true }, SingleEditor_tagList[index], ".")), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "1" }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "c-black font14" }, /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { value: item.choice_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" }, "\u9009\u62E9\u9898"), "\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09")), /* @__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 }, "\u9898\u5E72\uFF1A")), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
markdown_editor/* default */.Z,
|
|
{
|
|
id: "single-question-title",
|
|
watch: true,
|
|
height: 155,
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",
|
|
defaultValue: title,
|
|
onChange: (value) => setTitle(value)
|
|
}
|
|
), /* @__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"))), questionChoiceList.map((item, index) => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.choiceWrap, key: index }, /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848", placement: "left" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"div",
|
|
{
|
|
className: `${editormodules.answer} ${activeAnswer.includes(index) ? editormodules.activeAnswer : ""}`,
|
|
onClick: () => {
|
|
if (activeAnswer.includes(index)) {
|
|
setActiveAnswer(activeAnswer.filter((item2) => item2 !== index));
|
|
} else {
|
|
setActiveAnswer([...activeAnswer, index]);
|
|
}
|
|
}
|
|
},
|
|
SingleEditor_tagList[index]
|
|
)), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.editorWrap }, activeEditor === index ? /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
markdown_editor/* default */.Z,
|
|
{
|
|
id: `single-question-option-${index}`,
|
|
watch: true,
|
|
height: 155,
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9009\u9879",
|
|
defaultValue: item,
|
|
onChange: (value) => {
|
|
questionChoiceList[index] = value;
|
|
setQuestionChoiceList(questionChoiceList);
|
|
}
|
|
}
|
|
) : /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.htmlWrap, onClick: () => setActiveEditor(index) }, /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { value: item }))), 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))
|
|
}
|
|
)), index < 7 && index === questionChoiceList.length - 1 && /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u65B0\u589E\u53C2\u8003\u7B54\u6848" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"i",
|
|
{
|
|
className: `${editormodules.addIcon} iconfont icon-roundaddfill ml6`,
|
|
onClick: () => setQuestionChoiceList([...questionChoiceList, ""])
|
|
}
|
|
)));
|
|
}), /* @__PURE__ */ _react_17_0_2_react.createElement("p", { className: "c-orange" }, "\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\u8F93\u5165\u6846\u53EF\u8BBE\u7F6E\u7B54\u6848\uFF1B\u9009\u4E2D\u7684\u9009\u9879\u5373\u4E3A\u6B63\u786E\u7B54\u6848\uFF0C\u9009\u62E9\u591A\u4E2A\u7B54\u6848\u5373\u4E3A\u591A\u9009\u9898"), /* @__PURE__ */ _react_17_0_2_react.createElement("p", { className: "" }, "\u5206\u503C\uFF1A", /* @__PURE__ */ _react_17_0_2_react.createElement(input_number/* default */.Z, { value: score, max: 1e4, min: -1, onChange: (value) => {
|
|
setScore(value);
|
|
} }), " \u5206"), /* @__PURE__ */ _react_17_0_2_react.createElement("aside", { className: "tr" }, editData.question_id && /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "default", onClick: () => setIsEdit(false) }, "\u53D6\u6D88"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { className: "ml20", type: "primary", onClick: () => onSave() }, "\u4FDD\u5B58")));
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: editormodules.wrap }, !isEdit && showList(), isEdit && 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/Exercise/Detail/components/JudgmentEditor/index.tsx
|
|
var JudgmentEditor_defProp = Object.defineProperty;
|
|
var JudgmentEditor_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var JudgmentEditor_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var JudgmentEditor_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var JudgmentEditor_defNormalProp = (obj, key, value) => key in obj ? JudgmentEditor_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var JudgmentEditor_spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (JudgmentEditor_hasOwnProp.call(b, prop))
|
|
JudgmentEditor_defNormalProp(a, prop, b[prop]);
|
|
if (JudgmentEditor_getOwnPropSymbols)
|
|
for (var prop of JudgmentEditor_getOwnPropSymbols(b)) {
|
|
if (JudgmentEditor_propIsEnum.call(b, prop))
|
|
JudgmentEditor_defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var JudgmentEditor_objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (JudgmentEditor_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && JudgmentEditor_getOwnPropSymbols)
|
|
for (var prop of JudgmentEditor_getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && JudgmentEditor_propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var JudgmentEditor_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 JudgmentEditor_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 JudgmentEditor = (_a, ref) => {
|
|
var _b = _a, {
|
|
problemset,
|
|
globalSetting,
|
|
loading,
|
|
dispatch,
|
|
onRef = () => {
|
|
},
|
|
editData
|
|
} = _b, props = JudgmentEditor_objRest(_b, [
|
|
"problemset",
|
|
"globalSetting",
|
|
"loading",
|
|
"dispatch",
|
|
"onRef",
|
|
"editData"
|
|
]);
|
|
const [activeAnswer, setActiveAnswer] = (0,_react_17_0_2_react.useState)();
|
|
const [title, setTitle] = (0,_react_17_0_2_react.useState)("");
|
|
const [isEdit, setIsEdit] = (0,_react_17_0_2_react.useState)(false);
|
|
const [score, setScore] = (0,_react_17_0_2_react.useState)(5);
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
if (!(editData == null ? void 0 : editData.question_choices)) {
|
|
setIsEdit(true);
|
|
return;
|
|
}
|
|
setTitle(editData == null ? void 0 : editData.question_title);
|
|
setScore(editData == null ? void 0 : editData.question_score);
|
|
setActiveAnswer(editData.standard_answer[0] + "");
|
|
}, [editData]);
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, () => ({
|
|
onSave,
|
|
isEdit
|
|
}));
|
|
const onSave = () => JudgmentEditor_async(void 0, null, function* () {
|
|
if (!title) {
|
|
message/* default */.ZP.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72");
|
|
return false;
|
|
}
|
|
if (!activeAnswer) {
|
|
message/* default */.ZP.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879");
|
|
return false;
|
|
}
|
|
const choices = [
|
|
{ choice_text: "\u6B63\u786E", is_answer: activeAnswer === "1" ? 1 : 0 },
|
|
{ choice_text: "\u9519\u8BEF", is_answer: activeAnswer === "2" ? 2 : 0 }
|
|
];
|
|
let res;
|
|
if (editData.question_id) {
|
|
res = yield (0,service_polls/* putExerciseBankQuestions */.Kc)({
|
|
"id": editData.question_id,
|
|
"question_title": title,
|
|
"question_type": 2,
|
|
"question_score": score,
|
|
"question_choices": choices.map((item) => item.choice_text),
|
|
"standard_answers": choices.filter((item) => item.is_answer).map((item) => item.is_answer)
|
|
});
|
|
} else {
|
|
res = yield (0,service_polls/* addExerciseBankQuestions */.iV)({
|
|
"exercise_bank_id": params.topicId,
|
|
"question_title": title,
|
|
"question_type": 2,
|
|
"question_score": score,
|
|
"question_choices": choices.map((item) => item.choice_text),
|
|
"standard_answers": choices.filter((item) => item.is_answer).map((item) => item.is_answer)
|
|
});
|
|
}
|
|
if (res.status === 0) {
|
|
message/* default */.ZP.success("\u4FDD\u5B58\u6210\u529F");
|
|
setIsEdit(false);
|
|
}
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: JudgmentEditor_spreadValues({}, params)
|
|
});
|
|
return {
|
|
name: title,
|
|
choices
|
|
};
|
|
});
|
|
const actionArr = [
|
|
{ name: "\u5220\u9664", icon: "iconfont c-light-black ml30 icon-shanchu", id: "del" },
|
|
{ name: "\u4E0A\u79FB", icon: "iconfont c-green ml30 icon-shangyi_Hover", id: "up" },
|
|
{ name: "\u4E0B\u79FB", icon: "iconfont c-green ml30 icon-xiayi_moren", id: "down" },
|
|
{ name: "\u7F16\u8F91", icon: "iconfont c-green ml30 icon-bianjishijuan3x", id: "edit" }
|
|
];
|
|
const actionClick = (item) => JudgmentEditor_async(void 0, null, function* () {
|
|
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 JudgmentEditor_async(this, null, function* () {
|
|
yield (0,service_polls/* deleteExerciseBanksQuestion */.x$)({
|
|
pollsId: editData.question_id
|
|
});
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: JudgmentEditor_spreadValues({}, params)
|
|
});
|
|
});
|
|
}
|
|
});
|
|
break;
|
|
case "up":
|
|
case "down":
|
|
yield (0,service_polls/* exercisesBanksMoveUpDown */.W)({
|
|
exerciseId: editData == null ? void 0 : editData.question_id,
|
|
opr: item.id
|
|
});
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: JudgmentEditor_spreadValues({}, params)
|
|
});
|
|
break;
|
|
case "edit":
|
|
setIsEdit(true);
|
|
break;
|
|
}
|
|
});
|
|
const showList = () => {
|
|
var _a2;
|
|
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" }, editData.key, "\u3001\u5224\u65AD\u9898"), "\uFF08", editData.question_score, "\u5206\uFF09"), !editData.hideAction && 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__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { key: index, placement: "bottom", title: item.name }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { onClick: () => actionClick(item), className: item.icon }));
|
|
})), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt5" }, editData.question_title), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.questionChoices }, (_a2 = editData == null ? void 0 : editData.question_choices) == null ? void 0 : _a2.map(function(item, index) {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(es_radio/* default */.ZP, { key: index, checked: editData.standard_answer.includes(index + 1), disabled: true }, JudgmentEditor_tagList[index], ". ", /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "c-black font14" }, item.choice_text));
|
|
})));
|
|
};
|
|
const showEdit = () => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "font16 c-blue" }, "\u5224\u65AD\u9898"), "\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09"), /* @__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 }, "\u9898\u5E72\uFF1A")), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
markdown_editor/* default */.Z,
|
|
{
|
|
id: "single-question-title",
|
|
watch: true,
|
|
height: 155,
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",
|
|
defaultValue: title,
|
|
onChange: (value) => setTitle(value)
|
|
}
|
|
), /* @__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"))), /* @__PURE__ */ _react_17_0_2_react.createElement(es_radio/* default.Group */.ZP.Group, { buttonStyle: "solid", value: activeAnswer, onChange: (e) => setActiveAnswer(e.target.value) }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_radio/* default.Button */.ZP.Button, { value: "1", className: `${editormodules.radio} mr40` }, "\u6B63\u786E"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_radio/* default.Button */.ZP.Button, { value: "2", className: editormodules.radio }, "\u9519\u8BEF")), /* @__PURE__ */ _react_17_0_2_react.createElement("p", { className: "c-orange" }, "\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\uFF0C\u53EF\u4EE5\u76F4\u63A5\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848"), /* @__PURE__ */ _react_17_0_2_react.createElement("p", { className: "" }, "\u5206\u503C\uFF1A", /* @__PURE__ */ _react_17_0_2_react.createElement(input_number/* default */.Z, { value: score, max: 1e4, min: -1, onChange: (value) => {
|
|
setScore(value);
|
|
} }), " \u5206"), /* @__PURE__ */ _react_17_0_2_react.createElement("aside", { className: "tr" }, editData.question_id && /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "default", onClick: () => setIsEdit(false) }, "\u53D6\u6D88"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { className: "ml20", type: "primary", onClick: () => onSave() }, "\u4FDD\u5B58")));
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: editormodules.wrap }, !isEdit && showList(), isEdit && showEdit());
|
|
};
|
|
/* harmony default export */ var components_JudgmentEditor = ((0,_umi_production_exports.connect)(
|
|
({
|
|
problemset,
|
|
loading,
|
|
globalSetting
|
|
}) => ({
|
|
problemset,
|
|
globalSetting,
|
|
loading: loading.effects
|
|
}),
|
|
null,
|
|
null,
|
|
{ forwardRef: true }
|
|
)((0,_react_17_0_2_react.forwardRef)(JudgmentEditor)));
|
|
|
|
// EXTERNAL MODULE: ./src/components/Editor/NullMDEditor.jsx
|
|
var NullMDEditor = __webpack_require__(85607);
|
|
// EXTERNAL MODULE: ./src/components/Editor/NullChildEditor/index.jsx + 1 modules
|
|
var NullChildEditor = __webpack_require__(77954);
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
var util = __webpack_require__(13462);
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Detail/components/CompletionEditor/index.tsx
|
|
var CompletionEditor_defProp = Object.defineProperty;
|
|
var CompletionEditor_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var CompletionEditor_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var CompletionEditor_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var CompletionEditor_defNormalProp = (obj, key, value) => key in obj ? CompletionEditor_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var CompletionEditor_spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (CompletionEditor_hasOwnProp.call(b, prop))
|
|
CompletionEditor_defNormalProp(a, prop, b[prop]);
|
|
if (CompletionEditor_getOwnPropSymbols)
|
|
for (var prop of CompletionEditor_getOwnPropSymbols(b)) {
|
|
if (CompletionEditor_propIsEnum.call(b, prop))
|
|
CompletionEditor_defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var CompletionEditor_objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (CompletionEditor_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && CompletionEditor_getOwnPropSymbols)
|
|
for (var prop of CompletionEditor_getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && CompletionEditor_propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var CompletionEditor_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 CompletionEditor_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 CompletionEditor = (_a, ref) => {
|
|
var _b = _a, {
|
|
problemset,
|
|
globalSetting,
|
|
loading,
|
|
dispatch,
|
|
editData
|
|
} = _b, props = CompletionEditor_objRest(_b, [
|
|
"problemset",
|
|
"globalSetting",
|
|
"loading",
|
|
"dispatch",
|
|
"editData"
|
|
]);
|
|
const [title, setTitle] = (0,_react_17_0_2_react.useState)("");
|
|
const [analysis, setAnalysis] = (0,_react_17_0_2_react.useState)("");
|
|
const [answerList, setAnswerList] = (0,_react_17_0_2_react.useState)([]);
|
|
const [activeOptionErrorIndex, setActiveOptionErrorIndex] = (0,_react_17_0_2_react.useState)("");
|
|
const [checked, setChecked] = (0,_react_17_0_2_react.useState)();
|
|
const [firstSetAnswerFlag, setFirstSetAnswerFlag] = (0,_react_17_0_2_react.useState)(false);
|
|
const [score, setScore] = (0,_react_17_0_2_react.useState)(5);
|
|
const [isEdit, setIsEdit] = (0,_react_17_0_2_react.useState)(false);
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
if (!(editData == null ? void 0 : editData.question_title)) {
|
|
setIsEdit(true);
|
|
return;
|
|
}
|
|
setTitle(editData == null ? void 0 : editData.question_title);
|
|
setChecked(editData == null ? void 0 : editData.is_ordered);
|
|
setScore(editData == null ? void 0 : editData.question_score);
|
|
const answer = editData == null ? void 0 : editData.standard_answer.map((item) => item.answer_text);
|
|
setAnswerList(answer);
|
|
}, [problemset.editData]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
setFirstSetAnswerFlag(false);
|
|
}, [isEdit]);
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, () => ({
|
|
onSave,
|
|
isEdit
|
|
}));
|
|
const onSave = () => CompletionEditor_async(void 0, null, function* () {
|
|
let answerArray = [];
|
|
let isEmpty = false;
|
|
answerList.forEach((answers, index) => {
|
|
answerArray.push({
|
|
choice_id: index + 1,
|
|
answer_text: []
|
|
});
|
|
answers.forEach((item, itemIndex) => {
|
|
answerArray[index].answer_text.push(item);
|
|
if (!item || !(0,util/* validateLength */.eR)(item, 1e4)) {
|
|
setActiveOptionErrorIndex(`${index}-${itemIndex}`);
|
|
message/* default */.ZP.info(!item ? `\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A` : "\u7B54\u6848\u4E0D\u80FD\u8D85\u8FC710000\u5B57\u7B26");
|
|
isEmpty = true;
|
|
}
|
|
});
|
|
});
|
|
if (isEmpty) {
|
|
return false;
|
|
}
|
|
let res;
|
|
if (editData.question_id) {
|
|
res = yield (0,service_polls/* putExerciseBankQuestions */.Kc)({
|
|
"id": editData.question_id,
|
|
"question_title": title,
|
|
"question_type": 3,
|
|
"question_score": score,
|
|
"is_ordered": checked,
|
|
"standard_answers": answerArray
|
|
});
|
|
} else {
|
|
res = yield (0,service_polls/* addExerciseBankQuestions */.iV)({
|
|
"exercise_bank_id": params.topicId,
|
|
"question_title": title,
|
|
"question_type": 3,
|
|
"question_score": score,
|
|
"is_ordered": checked,
|
|
"standard_answers": answerArray
|
|
});
|
|
}
|
|
if (res.status === 0) {
|
|
message/* default */.ZP.success("\u4FDD\u5B58\u6210\u529F");
|
|
setIsEdit(false);
|
|
}
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: CompletionEditor_spreadValues({}, params)
|
|
});
|
|
return {
|
|
name: title,
|
|
analysis,
|
|
standard_answers: answerArray,
|
|
is_ordered: checked
|
|
};
|
|
});
|
|
const handlePlaceholderChange = (placeholderCountBefore, placeholderCountInRange, totalPlaceholderCount) => {
|
|
const newStandardAnswers = answerList.slice();
|
|
if (placeholderCountInRange) {
|
|
newStandardAnswers.splice(
|
|
placeholderCountBefore,
|
|
placeholderCountInRange
|
|
);
|
|
}
|
|
if (totalPlaceholderCount && firstSetAnswerFlag) {
|
|
for (let i = 0; i < totalPlaceholderCount; i++) {
|
|
newStandardAnswers.splice(placeholderCountBefore + i, 0, [""]);
|
|
}
|
|
}
|
|
setFirstSetAnswerFlag(true);
|
|
setAnswerList(newStandardAnswers);
|
|
};
|
|
const handleAnswerChange = (index, itemIndex, val) => {
|
|
setActiveOptionErrorIndex("");
|
|
let newStandardAnswers = answerList.slice();
|
|
newStandardAnswers[index][itemIndex] = val;
|
|
setAnswerList(newStandardAnswers);
|
|
};
|
|
const handleAddChildAnswer = (index) => {
|
|
let newStandardAnswers = answerList.slice();
|
|
newStandardAnswers[index] = [...newStandardAnswers[index], ...[""]];
|
|
setAnswerList(newStandardAnswers);
|
|
};
|
|
const handleDeleteChildAnswer = (index, childIndex) => {
|
|
let newStandardAnswers = answerList.slice();
|
|
if (!newStandardAnswers[index][childIndex]) {
|
|
newStandardAnswers[index] = newStandardAnswers[index].filter((_, key) => key !== childIndex);
|
|
setAnswerList(newStandardAnswers);
|
|
return;
|
|
}
|
|
modal["default"].confirm({
|
|
centered: true,
|
|
okText: "\u786E\u5B9A",
|
|
cancelText: "\u53D6\u6D88",
|
|
title: "\u63D0\u793A",
|
|
content: "\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",
|
|
className: editormodules.modal,
|
|
onOk: () => {
|
|
newStandardAnswers[index] = newStandardAnswers[index].filter((_, key) => key !== childIndex);
|
|
setAnswerList(newStandardAnswers);
|
|
}
|
|
});
|
|
};
|
|
const handleDeleteChildAnswermain = (index) => {
|
|
modal["default"].confirm({
|
|
centered: true,
|
|
okText: "\u786E\u5B9A",
|
|
cancelText: "\u53D6\u6D88",
|
|
title: "\u63D0\u793A",
|
|
content: "\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",
|
|
className: editormodules.modal,
|
|
onOk: () => {
|
|
let newStandardAnswers = answerList.slice();
|
|
newStandardAnswers = answerList.filter((_, key) => index !== key);
|
|
setAnswerList(newStandardAnswers);
|
|
}
|
|
});
|
|
};
|
|
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" }, "\u586B\u7A7A\u9898"), "\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u5141\u8BB8\u624B\u52A8\u8C03\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848 \uFF1B\u652F\u6301\u6700\u591A5\u4E2A\u7A7A\uFF0C\u6BCF\u7A7A\u5F97\u5206\u6309\u7167\u672C\u9898\u7684\u603B\u5206\u5E73\u5747\u8BA1\u7B97\uFF09")), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
NullMDEditor/* default */.Z,
|
|
{
|
|
id: `completion-question-tittle`,
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u76EE",
|
|
height: 155,
|
|
defaultValue: title,
|
|
onChange: (value) => setTitle(value),
|
|
showNullButton: true,
|
|
onPlaceholderChange: handlePlaceholderChange
|
|
}
|
|
)), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt20" }, answerList.map((answers, index) => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
NullChildEditor/* default */.Z,
|
|
{
|
|
key: index,
|
|
answers,
|
|
index,
|
|
is_md: true,
|
|
activeOptionErrorIndex,
|
|
onAnswerChange: handleAnswerChange,
|
|
addChildAnswer: handleAddChildAnswer,
|
|
deleteChildAnswer: handleDeleteChildAnswer,
|
|
deleteChildAnswermain: handleDeleteChildAnswermain
|
|
}
|
|
);
|
|
})), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt20" }, answerList.length > 1 && /* @__PURE__ */ _react_17_0_2_react.createElement("span", null, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_checkbox["default"],
|
|
{
|
|
checked,
|
|
onChange: (e) => setChecked(e.target.checked),
|
|
className: `${editormodules.color333} font14`
|
|
},
|
|
"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: `${editormodules.color999} font12` }, "\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))), /* @__PURE__ */ _react_17_0_2_react.createElement("p", { className: "" }, "\u5206\u503C\uFF1A", /* @__PURE__ */ _react_17_0_2_react.createElement(input_number/* default */.Z, { value: score, max: 1e4, min: -1, onChange: (value) => {
|
|
setScore(value);
|
|
} }), " \u5206"), /* @__PURE__ */ _react_17_0_2_react.createElement("aside", { className: "tr" }, editData.question_id && /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "default", onClick: () => setIsEdit(false) }, "\u53D6\u6D88"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { className: "ml20", type: "primary", onClick: () => onSave() }, "\u4FDD\u5B58")));
|
|
};
|
|
const actionArr = [
|
|
{ name: "\u5220\u9664", icon: "iconfont c-light-black ml30 icon-shanchu", id: "del" },
|
|
{ name: "\u4E0A\u79FB", icon: "iconfont c-green ml30 icon-shangyi_Hover", id: "up" },
|
|
{ name: "\u4E0B\u79FB", icon: "iconfont c-green ml30 icon-xiayi_moren", id: "down" },
|
|
{ name: "\u7F16\u8F91", icon: "iconfont c-green ml30 icon-bianjishijuan3x", id: "edit" }
|
|
];
|
|
const actionClick = (item) => CompletionEditor_async(void 0, null, function* () {
|
|
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 CompletionEditor_async(this, null, function* () {
|
|
yield (0,service_polls/* deleteExerciseBanksQuestion */.x$)({
|
|
pollsId: editData.question_id
|
|
});
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: CompletionEditor_spreadValues({}, params)
|
|
});
|
|
});
|
|
}
|
|
});
|
|
break;
|
|
case "up":
|
|
case "down":
|
|
yield (0,service_polls/* exercisesBanksMoveUpDown */.W)({
|
|
exerciseId: editData == null ? void 0 : editData.question_id,
|
|
opr: item.id
|
|
});
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: CompletionEditor_spreadValues({}, params)
|
|
});
|
|
break;
|
|
case "edit":
|
|
setIsEdit(true);
|
|
break;
|
|
}
|
|
});
|
|
const showList = () => {
|
|
var _a2;
|
|
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" }, editData.key, "\u3001\u586B\u7A7A\u9898"), "\uFF08", editData.question_score, "\u5206\uFF09"), !editData.hideAction && 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__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { key: index, placement: "bottom", title: item.name }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { onClick: () => actionClick(item), className: item.icon }));
|
|
})), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt5" }, editData.question_title), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.questionChoices }, (_a2 = editData == null ? void 0 : editData.standard_answer) == null ? void 0 : _a2.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, "\u7B54\u6848\uFF08\u586B\u7A7A", item.choice_id, "\uFF09\uFF1A"), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "1" }, /* @__PURE__ */ _react_17_0_2_react.createElement(input["default"], { key: index, checked: editData.standard_answer.includes(index), disabled: true, value: item.answer_text })));
|
|
})));
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: editormodules.wrap }, !isEdit && showList(), isEdit && showEdit());
|
|
};
|
|
/* harmony default export */ var components_CompletionEditor = ((0,_umi_production_exports.connect)(
|
|
({
|
|
problemset,
|
|
loading,
|
|
globalSetting
|
|
}) => ({
|
|
problemset,
|
|
globalSetting,
|
|
loading: loading.effects
|
|
}),
|
|
null,
|
|
null,
|
|
{ forwardRef: true }
|
|
)((0,_react_17_0_2_react.forwardRef)(CompletionEditor)));
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/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 = (_a, ref) => {
|
|
var _b = _a, {
|
|
problemset,
|
|
globalSetting,
|
|
loading,
|
|
dispatch,
|
|
onRef = () => {
|
|
},
|
|
editData
|
|
} = _b, props = SubjectiveEditor_objRest(_b, [
|
|
"problemset",
|
|
"globalSetting",
|
|
"loading",
|
|
"dispatch",
|
|
"onRef",
|
|
"editData"
|
|
]);
|
|
const [title, setTitle] = (0,_react_17_0_2_react.useState)("");
|
|
const [analysis, setAnalysis] = (0,_react_17_0_2_react.useState)("");
|
|
const [answer, setAnswer] = (0,_react_17_0_2_react.useState)("");
|
|
const [score, setScore] = (0,_react_17_0_2_react.useState)(5);
|
|
const [isEdit, setIsEdit] = (0,_react_17_0_2_react.useState)(false);
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a2;
|
|
if (!(editData == null ? void 0 : editData.question_title)) {
|
|
setIsEdit(true);
|
|
return;
|
|
}
|
|
setTitle(editData == null ? void 0 : editData.question_title);
|
|
setAnswer((_a2 = editData == null ? void 0 : editData.standard_answer) == null ? void 0 : _a2[0]);
|
|
setScore(editData == null ? void 0 : editData.question_score);
|
|
}, [problemset.editData]);
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, () => ({
|
|
onSave,
|
|
isEdit
|
|
}));
|
|
const onSave = () => SubjectiveEditor_async(void 0, null, function* () {
|
|
if (!title) {
|
|
message/* default */.ZP.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72");
|
|
return false;
|
|
}
|
|
let res;
|
|
if (editData.question_id) {
|
|
res = yield (0,service_polls/* putExerciseBankQuestions */.Kc)({
|
|
"id": editData.question_id,
|
|
"question_title": title,
|
|
"question_type": 4,
|
|
"question_score": score,
|
|
"standard_answers": [answer]
|
|
});
|
|
} else {
|
|
res = yield (0,service_polls/* addExerciseBankQuestions */.iV)({
|
|
"exercise_bank_id": params.topicId,
|
|
"question_title": title,
|
|
"question_type": 4,
|
|
"question_score": score,
|
|
"standard_answers": [answer]
|
|
});
|
|
}
|
|
if (res.status === 0) {
|
|
message/* default */.ZP.success("\u4FDD\u5B58\u6210\u529F");
|
|
setIsEdit(false);
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: SubjectiveEditor_spreadValues({}, params)
|
|
});
|
|
}
|
|
return {
|
|
name: title,
|
|
answer_texts: [answer],
|
|
analysis
|
|
};
|
|
});
|
|
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" }, "\u7B80\u7B54\u9898"), "\uFF08\u4E3B\u89C2\u9898\uFF0C\u672A\u4F5C\u7B54\u7684\u60C5\u51B5\u4E0B\u81EA\u52A8\u8BC4\u4E3A\u96F6\u5206\uFF09")), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
markdown_editor/* default */.Z,
|
|
{
|
|
id: "single-question-title",
|
|
watch: true,
|
|
height: 155,
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",
|
|
defaultValue: title,
|
|
onChange: (value) => setTitle(value)
|
|
}
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement("p", { className: editormodules.titleWrap }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: editormodules.title }, "\u53C2\u8003\u7B54\u6848\uFF1A")), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
markdown_editor/* default */.Z,
|
|
{
|
|
id: "single-question-reference-answer",
|
|
watch: true,
|
|
height: 155,
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",
|
|
defaultValue: answer,
|
|
onChange: (value) => setAnswer(value)
|
|
}
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement("p", { className: "" }, "\u5206\u503C\uFF1A", /* @__PURE__ */ _react_17_0_2_react.createElement(input_number/* default */.Z, { value: score, max: 1e4, min: -1, onChange: (value) => {
|
|
setScore(value);
|
|
} }), " \u5206"), /* @__PURE__ */ _react_17_0_2_react.createElement("aside", { className: "tr" }, editData.question_id && /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "default", onClick: () => setIsEdit(false) }, "\u53D6\u6D88"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { className: "ml20", type: "primary", onClick: () => onSave() }, "\u4FDD\u5B58")));
|
|
};
|
|
const actionArr = [
|
|
{ name: "\u5220\u9664", icon: "iconfont c-light-black ml30 icon-shanchu", id: "del" },
|
|
{ name: "\u4E0A\u79FB", icon: "iconfont c-green ml30 icon-shangyi_Hover", id: "up" },
|
|
{ name: "\u4E0B\u79FB", icon: "iconfont c-green ml30 icon-xiayi_moren", id: "down" },
|
|
{ name: "\u7F16\u8F91", icon: "iconfont c-green ml30 icon-bianjishijuan3x", id: "edit" }
|
|
];
|
|
const actionClick = (item) => SubjectiveEditor_async(void 0, null, function* () {
|
|
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* () {
|
|
yield (0,service_polls/* deleteExerciseBanksQuestion */.x$)({
|
|
pollsId: editData.question_id
|
|
});
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: SubjectiveEditor_spreadValues({}, params)
|
|
});
|
|
});
|
|
}
|
|
});
|
|
break;
|
|
case "up":
|
|
case "down":
|
|
yield (0,service_polls/* exercisesBanksMoveUpDown */.W)({
|
|
exerciseId: editData == null ? void 0 : editData.question_id,
|
|
opr: item.id
|
|
});
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: SubjectiveEditor_spreadValues({}, params)
|
|
});
|
|
break;
|
|
case "edit":
|
|
setIsEdit(true);
|
|
break;
|
|
}
|
|
});
|
|
const showList = () => {
|
|
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" }, editData.key, "\u3001\u7B80\u7B54\u9898"), "\uFF08", editData.question_score, "\u5206\uFF09"), !editData.hideAction && 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__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { key: index, placement: "bottom", title: item.name }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { onClick: () => actionClick(item), className: item.icon }));
|
|
})), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt5" }, editData.question_title), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: editormodules.questionChoices }, /* @__PURE__ */ _react_17_0_2_react.createElement("p", null, /* @__PURE__ */ _react_17_0_2_react.createElement("strong", null, "\u53C2\u8003\u7B54\u6848\uFF1A")), /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { value: answer })));
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: editormodules.wrap }, !isEdit && showList(), isEdit && showEdit());
|
|
};
|
|
/* harmony default export */ var components_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)));
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Detail/components/ShixunEditor/index.tsx
|
|
var ShixunEditor_defProp = Object.defineProperty;
|
|
var ShixunEditor_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var ShixunEditor_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var ShixunEditor_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var ShixunEditor_defNormalProp = (obj, key, value) => key in obj ? ShixunEditor_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var ShixunEditor_spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (ShixunEditor_hasOwnProp.call(b, prop))
|
|
ShixunEditor_defNormalProp(a, prop, b[prop]);
|
|
if (ShixunEditor_getOwnPropSymbols)
|
|
for (var prop of ShixunEditor_getOwnPropSymbols(b)) {
|
|
if (ShixunEditor_propIsEnum.call(b, prop))
|
|
ShixunEditor_defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var ShixunEditor_objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (ShixunEditor_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && ShixunEditor_getOwnPropSymbols)
|
|
for (var prop of ShixunEditor_getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && ShixunEditor_propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var ShixunEditor_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 ShixunEditor_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 ShixunEditor = (_a, ref) => {
|
|
var _b = _a, {
|
|
problemset,
|
|
globalSetting,
|
|
loading,
|
|
dispatch,
|
|
editData
|
|
} = _b, props = ShixunEditor_objRest(_b, [
|
|
"problemset",
|
|
"globalSetting",
|
|
"loading",
|
|
"dispatch",
|
|
"editData"
|
|
]);
|
|
const [name, setName] = (0,_react_17_0_2_react.useState)("");
|
|
const [title, setTitle] = (0,_react_17_0_2_react.useState)("");
|
|
const [analysis, setAnalysis] = (0,_react_17_0_2_react.useState)("");
|
|
const [answerList, setAnswerList] = (0,_react_17_0_2_react.useState)([]);
|
|
const [activeOptionErrorIndex, setActiveOptionErrorIndex] = (0,_react_17_0_2_react.useState)("");
|
|
const [checked, setChecked] = (0,_react_17_0_2_react.useState)();
|
|
const [firstSetAnswerFlag, setFirstSetAnswerFlag] = (0,_react_17_0_2_react.useState)(false);
|
|
const [score, setScore] = (0,_react_17_0_2_react.useState)([]);
|
|
const [isEdit, setIsEdit] = (0,_react_17_0_2_react.useState)(false);
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a2;
|
|
if (editData.edit) {
|
|
setIsEdit(true);
|
|
}
|
|
setName(editData.shixun_name);
|
|
setTitle(editData.question_title);
|
|
const arr = [];
|
|
(_a2 = editData.shixun) == null ? void 0 : _a2.map((item) => {
|
|
arr.push(item.challenge_score);
|
|
});
|
|
setScore(arr);
|
|
}, [editData]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
setFirstSetAnswerFlag(false);
|
|
}, [isEdit]);
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, () => ({
|
|
onSave,
|
|
isEdit
|
|
}));
|
|
const onSave = () => ShixunEditor_async(void 0, null, function* () {
|
|
let answerArray = [];
|
|
let isEmpty = false;
|
|
if (isEmpty) {
|
|
return false;
|
|
}
|
|
let res;
|
|
if (editData.question_id) {
|
|
res = yield (0,service_polls/* putExerciseBankQuestions */.Kc)({
|
|
"id": editData.question_id,
|
|
"question_title": title,
|
|
"shixun_name": name,
|
|
"shixun_id": editData.shixun_id,
|
|
"question_type": 5,
|
|
"question_scores": score
|
|
});
|
|
} else {
|
|
res = yield (0,service_polls/* addExerciseBankQuestions */.iV)({
|
|
"exercise_bank_id": params.topicId,
|
|
"question_title": title,
|
|
"shixun_name": name,
|
|
"shixun_id": editData.shixun_id,
|
|
"question_type": 5,
|
|
"question_scores": score
|
|
});
|
|
}
|
|
if (res.status === 0) {
|
|
message/* default */.ZP.success("\u4FDD\u5B58\u6210\u529F");
|
|
setIsEdit(false);
|
|
}
|
|
yield dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: ShixunEditor_spreadValues({}, params)
|
|
});
|
|
return {
|
|
name: title,
|
|
analysis,
|
|
standard_answers: answerArray,
|
|
is_ordered: checked
|
|
};
|
|
});
|
|
const showEdit = () => {
|
|
var _a2;
|
|
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" }, "\u5B9E\u8BAD\u9898"), "\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u5141\u8BB8\u624B\u52A8\u8C03\u5206\uFF09")), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt10" }, /* @__PURE__ */ _react_17_0_2_react.createElement(input["default"], { defaultValue: name, onChange: (e) => {
|
|
;
|
|
setName(e.target.value);
|
|
} })), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt10" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
markdown_editor/* default */.Z,
|
|
{
|
|
id: `single-question-option-0`,
|
|
height: 155,
|
|
placeholder: "\u8BF7\u8F93\u5165\u5B9E\u8BAD\u9898\u5B8C\u6210\u8981\u6C42",
|
|
defaultValue: title,
|
|
onChange: (value) => {
|
|
setTitle(value);
|
|
}
|
|
}
|
|
)), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt20" }, (_a2 = editData.shixun) == null ? void 0 : _a2.map((item, index) => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { gutter: [20, 20] }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: "1" }, index + 1, ".", item.challenge_name), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(input_number/* default */.Z, { defaultValue: score[index], onChange: (value) => {
|
|
score[index] = value;
|
|
setScore(score);
|
|
console.log("srore:L", score[index]);
|
|
} })));
|
|
})), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt20" }, answerList.length > 1 && /* @__PURE__ */ _react_17_0_2_react.createElement("span", null, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_checkbox["default"],
|
|
{
|
|
checked,
|
|
onChange: (e) => setChecked(e.target.checked),
|
|
className: `${editormodules.color333} font14`
|
|
},
|
|
"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: `${editormodules.color999} font12` }, "\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))), /* @__PURE__ */ _react_17_0_2_react.createElement("aside", { className: "tr" }, !(editData == null ? void 0 : editData.edit) && /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "default", onClick: () => setIsEdit(false) }, "\u53D6\u6D88"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { className: "ml20", type: "primary", onClick: () => onSave() }, "\u4FDD\u5B58")));
|
|
};
|
|
const actionArr = [
|
|
{ name: "\u5220\u9664", icon: "iconfont c-light-black ml30 icon-shanchu", id: "del" },
|
|
{ name: "\u4E0A\u79FB", icon: "iconfont c-green ml30 icon-shangyi_Hover", id: "up" },
|
|
{ name: "\u4E0B\u79FB", icon: "iconfont c-green ml30 icon-xiayi_moren", id: "down" },
|
|
{ name: "\u7F16\u8F91", icon: "iconfont c-green ml30 icon-bianjishijuan3x", id: "edit" }
|
|
];
|
|
const actionClick = (item) => ShixunEditor_async(void 0, null, function* () {
|
|
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 ShixunEditor_async(this, null, function* () {
|
|
yield (0,service_polls/* deleteExerciseBanksQuestion */.x$)({
|
|
pollsId: editData.question_id
|
|
});
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: ShixunEditor_spreadValues({}, params)
|
|
});
|
|
});
|
|
}
|
|
});
|
|
break;
|
|
case "up":
|
|
case "down":
|
|
yield (0,service_polls/* exercisesBanksMoveUpDown */.W)({
|
|
exerciseId: editData == null ? void 0 : editData.question_id,
|
|
opr: item.id
|
|
});
|
|
dispatch({
|
|
type: "polls/getExerciseBanks",
|
|
payload: ShixunEditor_spreadValues({}, params)
|
|
});
|
|
break;
|
|
case "edit":
|
|
setIsEdit(true);
|
|
break;
|
|
}
|
|
});
|
|
const showList = () => {
|
|
var _a2;
|
|
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" }, editData.key, "\u3001\u5B9E\u8BAD\u9898"), "\uFF08", editData.question_score, "\u5206\uFF09"), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "tr" }, /* @__PURE__ */ _react_17_0_2_react.createElement(_umi_production_exports.Link, { target: "_blank", to: `/shixuns/${editData.shixun_identifier}/challenges` }, "\u5B9E\u8BAD\u8BE6\u60C5"), !editData.hideAction && 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__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { key: index, placement: "bottom", title: item.name }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { onClick: () => actionClick(item), className: item.icon }));
|
|
}))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "font16" }, editData.shixun_name), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mt30" }), (_a2 = editData.shixun) == null ? void 0 : _a2.map(function(item, index) {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { key: index }, "\u7B2C", index + 1, "\u5173 ", /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "ml10" }, item.challenge_name), " ", /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "ml10" }, item.challenge_score));
|
|
}));
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: editormodules.wrap }, !isEdit && showList(), isEdit && showEdit());
|
|
};
|
|
/* harmony default export */ var components_ShixunEditor = ((0,_umi_production_exports.connect)(
|
|
({
|
|
problemset,
|
|
loading,
|
|
globalSetting
|
|
}) => ({
|
|
problemset,
|
|
globalSetting,
|
|
loading: loading.effects
|
|
}),
|
|
null,
|
|
null,
|
|
{ forwardRef: true }
|
|
)((0,_react_17_0_2_react.forwardRef)(ShixunEditor)));
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Detail/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Detailmodules = ({"flex_box_center":"flex_box_center___eWsYC","flex_space_between":"flex_space_between___RALuo","flex_box_vertical_center":"flex_box_vertical_center___f7uVp","flex_box_center_end":"flex_box_center_end___UxPR3","flex_box_column":"flex_box_column___YUFuv","bg":"bg___zWTsF","containerTitle":"containerTitle___DzTZh","containerDesc":"containerDesc___a3TiA","listItem":"listItem____nHKG","info":"info___LWlgA","title":"title___gtaI4","titleLeft":"titleLeft___Ce3h9","titleRight":"titleRight___gARIc","acitons":"acitons___MrR2u","export":"export___u_8cL"});
|
|
// EXTERNAL MODULE: ./src/pages/User/Detail/Topics/components/SendToClassModal.tsx + 2 modules
|
|
var SendToClassModal = __webpack_require__(6993);
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/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 { SubMenu } = menu["default"];
|
|
const { Content, Sider } = layout["default"];
|
|
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, _r, _s, _t, _u, _v, _w, _x, _y, _z, _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, __, _$, _aa, _ba, _ca;
|
|
const params = (0,_umi_production_exports.useParams)();
|
|
const location = (0,_umi_production_exports.useLocation)();
|
|
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);
|
|
const questionType = [{ name: "\u9009\u62E9\u9898", id: 0 }, { name: "\u5224\u65AD\u9898", id: 2 }, { name: "\u586B\u7A7A\u9898", id: 3 }, { name: "\u7B80\u7B54\u9898", id: 4 }, { name: "\u5B9E\u8BAD\u9898", id: 5 }];
|
|
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.exercise_questions) {
|
|
setEditData([...(_b3 = polls.exerciseBanks) == null ? void 0 : _b3.exercise_questions]);
|
|
form.setFieldsValue({
|
|
exercise_name: (_d2 = (_c2 = polls.exerciseBanks) == null ? void 0 : _c2.exercise) == null ? void 0 : _d2.exercise_name,
|
|
exercise_description: (_f2 = (_e2 = polls.exerciseBanks) == null ? void 0 : _e2.exercise) == null ? void 0 : _f2.exercise_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* () {
|
|
var _a3, _b3;
|
|
yield form.validateFields();
|
|
const value = form.getFieldValue();
|
|
value.is_md = true;
|
|
value.topicId = (_b3 = (_a3 = polls.exerciseBanks) == null ? void 0 : _a3.exercise) == null ? void 0 : _b3.id;
|
|
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 = yield childrenRef == null ? void 0 : childrenRef.current;
|
|
if (d == null ? void 0 : d.isEdit) {
|
|
message/* default */.ZP.error("\u4E0D\u80FD\u540C\u65F6\u7F16\u8F91\u4E24\u9898");
|
|
return;
|
|
}
|
|
if (type === 5) {
|
|
dispatch({
|
|
type: "classroomList/setActionTabs",
|
|
payload: { key: "\u9009\u7528\u5B9E\u8DF5\u9879\u76EE" }
|
|
});
|
|
} else {
|
|
setEditData([...editData, { question_type: type }]);
|
|
}
|
|
});
|
|
const handleSend = () => {
|
|
dispatch({
|
|
type: "userDetail/setActionTabs",
|
|
payload: { key: "UserDetail-SendToClass", params: { object_id: [params.topicId], object_type: "exercise" } }
|
|
});
|
|
};
|
|
const renderQuestion = function() {
|
|
return editData == null ? void 0 : editData.map(function(v, k) {
|
|
v.key = k + 1;
|
|
v.len = editData.length;
|
|
if (v.question_type === 0) {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, /* @__PURE__ */ _react_17_0_2_react.createElement(components_SingleEditor, { ref: childrenRef, editData: v }), /* @__PURE__ */ _react_17_0_2_react.createElement(divider/* default */.Z, null));
|
|
}
|
|
if (v.question_type === 1) {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, /* @__PURE__ */ _react_17_0_2_react.createElement(MultipleEditor, { ref: childrenRef, editData: v }), /* @__PURE__ */ _react_17_0_2_react.createElement(divider/* default */.Z, null));
|
|
}
|
|
if (v.question_type === 2) {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, /* @__PURE__ */ _react_17_0_2_react.createElement(components_JudgmentEditor, { ref: childrenRef, editData: v }), /* @__PURE__ */ _react_17_0_2_react.createElement(divider/* default */.Z, null));
|
|
}
|
|
if (v.question_type === 3) {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, /* @__PURE__ */ _react_17_0_2_react.createElement(components_CompletionEditor, { editData: v }), /* @__PURE__ */ _react_17_0_2_react.createElement(divider/* default */.Z, null));
|
|
}
|
|
if (v.question_type === 4) {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, /* @__PURE__ */ _react_17_0_2_react.createElement(components_SubjectiveEditor, { editData: v }), /* @__PURE__ */ _react_17_0_2_react.createElement(divider/* default */.Z, null));
|
|
}
|
|
if (v.question_type === 5) {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, /* @__PURE__ */ _react_17_0_2_react.createElement(components_ShixunEditor, { 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/${params.username}/${params.topictype === "personal" ? "topics" : "topicbank"}/${params.topictype}`
|
|
},
|
|
params.topictype === "personal" ? "\u6211\u7684\u9898\u5E93" : "\u516C\u5171\u9898\u5E93"
|
|
)), /* @__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%" }, align: "middle" }, /* @__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.exercise) == null ? void 0 : _b2.exercise_name), /* @__PURE__ */ _react_17_0_2_react.createElement(util/* StatusClassroomsTags */.VV, { status: [((_d = (_c = polls.exerciseBanks) == null ? void 0 : _c.exercise) == null ? void 0 : _d.is_public) ? "\u516C\u5F00" : "\u79C1\u6709"] })), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
_umi_production_exports.Link,
|
|
{
|
|
className: "font16 c-light-black",
|
|
to: `/users/${userInfo.login}/topics/${params.topictype}`
|
|
},
|
|
"\u8FD4\u56DE"
|
|
))))), /* @__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 }, ((_e = polls.exerciseBanks) == null ? void 0 : _e.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}/exercise/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" }, (_g = (_f = polls.exerciseBanks) == null ? void 0 : _f.exercise) == null ? void 0 : _g.exercise_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: "\u8BD5\u5377\u6807\u9898\uFF1A",
|
|
rules: [{ required: true, message: "\u8BF7\u586B\u5199\u8BD5\u5377\u6807\u9898" }]
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(input["default"], { maxLength: 60, placeholder: "\u8BD5\u5377\u6807\u9898\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26" })
|
|
),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { label: "\u8BD5\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\u8BD5\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"
|
|
))
|
|
)), /* @__PURE__ */ _react_17_0_2_react.createElement("p", { className: "mt10", style: { display: "flex" } }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "fl", style: { flex: "1" } }, !!((_i = (_h = polls.exerciseBanks) == null ? void 0 : _h.exercise_types) == null ? void 0 : _i.q_singles) && /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "ml20" }, "\u5355\u9009\u9898", (_k = (_j = polls.exerciseBanks) == null ? void 0 : _j.exercise_types) == null ? void 0 : _k.q_singles, "\u9898\uFF0C\u5171", (_m = (_l = polls.exerciseBanks) == null ? void 0 : _l.exercise_types) == null ? void 0 : _m.q_singles_scores, "\u5206"), !!((_o = (_n = polls.exerciseBanks) == null ? void 0 : _n.exercise_types) == null ? void 0 : _o.q_doubles) && /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "ml20" }, "\u591A\u9009\u9898", (_q = (_p = polls.exerciseBanks) == null ? void 0 : _p.exercise_types) == null ? void 0 : _q.q_doubles, "\u9898\uFF0C\u5171", (_s = (_r = polls.exerciseBanks) == null ? void 0 : _r.exercise_types) == null ? void 0 : _s.q_doubles_scores, "\u5206"), !!((_u = (_t = polls.exerciseBanks) == null ? void 0 : _t.exercise_types) == null ? void 0 : _u.q_judges) && /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "ml20" }, "\u5224\u65AD\u9898", (_w = (_v = polls.exerciseBanks) == null ? void 0 : _v.exercise_types) == null ? void 0 : _w.q_judges, "\u9898\uFF0C\u5171", (_y = (_x = polls.exerciseBanks) == null ? void 0 : _x.exercise_types) == null ? void 0 : _y.q_judges_scores, "\u5206"), !!((_A = (_z = polls.exerciseBanks) == null ? void 0 : _z.exercise_types) == null ? void 0 : _A.q_nulls) && /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "ml20" }, "\u586B\u7A7A\u9898", (_C = (_B = polls.exerciseBanks) == null ? void 0 : _B.exercise_types) == null ? void 0 : _C.q_nulls, "\u9898\uFF0C\u5171", (_E = (_D = polls.exerciseBanks) == null ? void 0 : _D.exercise_types) == null ? void 0 : _E.q_nulls_scores, "\u5206"), !!((_G = (_F = polls.exerciseBanks) == null ? void 0 : _F.exercise_types) == null ? void 0 : _G.q_mains) && /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "ml20" }, "\u7B80\u7B54\u9898", (_I = (_H = polls.exerciseBanks) == null ? void 0 : _H.exercise_types) == null ? void 0 : _I.q_mains, "\u9898\uFF0C\u5171", (_K = (_J = polls.exerciseBanks) == null ? void 0 : _J.exercise_types) == null ? void 0 : _K.q_mains_scores, "\u5206"), !!((_M = (_L = polls.exerciseBanks) == null ? void 0 : _L.exercise_types) == null ? void 0 : _M.q_shixuns) && /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "ml20" }, "\u5B9E\u8BAD\u9898", (_O = (_N = polls.exerciseBanks) == null ? void 0 : _N.exercise_types) == null ? void 0 : _O.q_shixuns, "\u9898\uFF0C\u5171", (_Q = (_P = polls.exerciseBanks) == null ? void 0 : _P.exercise_types) == null ? void 0 : _Q.q_shixuns_scores, "\u5206"), !!((_S = (_R = polls.exerciseBanks) == null ? void 0 : _R.exercise_types) == null ? void 0 : _S.q_pros) && /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "ml20" }, "\u7F16\u7A0B\u9898", (_U = (_T = polls.exerciseBanks) == null ? void 0 : _T.exercise_types) == null ? void 0 : _U.q_pros, "\u9898\uFF0C\u5171", (_W = (_V = polls.exerciseBanks) == null ? void 0 : _V.exercise_types) == null ? void 0 : _W.q_pros_scores, "\u5206")), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "fr" }, !!((_Y = (_X = polls.exerciseBanks) == null ? void 0 : _X.exercise_types) == null ? void 0 : _Y.q_counts) && /* @__PURE__ */ _react_17_0_2_react.createElement("span", null, "\u5408\u8BA1 ", /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "color-blue" }, (__ = (_Z = polls.exerciseBanks) == null ? void 0 : _Z.exercise_types) == null ? void 0 : __.q_counts), " \u9898\uFF0C \u5171 ", /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: `${((_aa = (_$ = polls.exerciseBanks) == null ? void 0 : _$.exercise_types) == null ? void 0 : _aa.q_scores) > 100 ? "color-red font-bd" : "color-orange"}` }, (_ca = (_ba = polls.exerciseBanks) == null ? void 0 : _ba.exercise_types) == null ? void 0 : _ca.q_scores), " \u5206"))), /* @__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));
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6993:
|
|
/*!**********************************************************************************!*\
|
|
!*** ./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__(67866);
|
|
// 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__(56511);
|
|
// 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__(13462);
|
|
// EXTERNAL MODULE: ./src/components/ui-customization/index.tsx + 34 modules
|
|
var ui_customization = __webpack_require__(26324);
|
|
// 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__(38620);
|
|
// 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__(14661);
|
|
// EXTERNAL MODULE: ./src/service/account.ts
|
|
var account = __webpack_require__(20942);
|
|
;// 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));
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |