|
|
"use strict";
|
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[7043],{
|
|
|
|
|
|
/***/ 43528:
|
|
|
/*!***********************************************!*\
|
|
|
!*** ./src/components/Editor/NullMDEditor.js ***!
|
|
|
\***********************************************/
|
|
|
/***/ (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 _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js */ 82242);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/classCallCheck.js */ 82100);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/createClass.js */ 29186);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/assertThisInitialized.js */ 13720);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/inherits.js */ 80619);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_4__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/createSuper.js */ 47074);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_5__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/defineProperty.js */ 85573);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_6__);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react */ 59301);
|
|
|
/* harmony import */ var _markdown_editor__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../markdown-editor */ 15396);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var NULL_CH = '▁';
|
|
|
var NullMDEditor = /*#__PURE__*/function (_Component) {
|
|
|
_root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_4___default()(NullMDEditor, _Component);
|
|
|
var _super = _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_5___default()(NullMDEditor);
|
|
|
function NullMDEditor() {
|
|
|
var _this;
|
|
|
_root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_1___default()(this, NullMDEditor);
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
|
args[_key] = arguments[_key];
|
|
|
}
|
|
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
|
_root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_6___default()(_root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_3___default()(_this), "getChCountBeforeCursor", function (cm, cursor) {
|
|
|
var currentLine = cursor.line;
|
|
|
var placeholderCountBefore = 0;
|
|
|
for (var _line = 0; _line < currentLine; _line++) {
|
|
|
placeholderCountBefore += cm.getLine(_line).split(NULL_CH).length - 1;
|
|
|
}
|
|
|
var currentLineStringBeforeCursor = cm.getLine(currentLine).substring(0, cursor.ch);
|
|
|
placeholderCountBefore += currentLineStringBeforeCursor.split(NULL_CH).length - 1;
|
|
|
return placeholderCountBefore;
|
|
|
});
|
|
|
_root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_6___default()(_root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_3___default()(_this), "onCMBeforeChange", function (cm, change) {
|
|
|
var rangeText = cm.getRange(change.from, change.to);
|
|
|
var totalPlaceholderCount = 0;
|
|
|
change.text.forEach(function (item) {
|
|
|
totalPlaceholderCount += item.split(NULL_CH).length - 1;
|
|
|
});
|
|
|
if (rangeText && rangeText.indexOf(NULL_CH) != -1) {
|
|
|
var placeholderCountInRange = rangeText.split(NULL_CH).length - 1;
|
|
|
var placeholderCountBefore = _this.getChCountBeforeCursor(cm, change.from);
|
|
|
console.log("\u5220\u9664".concat(placeholderCountInRange, "\u4E2A\uFF0C \u4E4B\u524D\u6709").concat(placeholderCountBefore, "\u4E2A\uFF0C\u65B0\u589E").concat(totalPlaceholderCount, "\u4E2A"));
|
|
|
if (_this.props.deleteEmptyDisabled) {
|
|
|
// 删除空格不检测
|
|
|
change.cancel();
|
|
|
} else {
|
|
|
// const ret = window.confirm(
|
|
|
// `确认要删除第${
|
|
|
// placeholderCountInRange == 1
|
|
|
// ? placeholderCountBefore + 1
|
|
|
// : `${placeholderCountBefore + 1}-${placeholderCountBefore +
|
|
|
// placeholderCountInRange}`
|
|
|
// }个空吗?`,
|
|
|
// );
|
|
|
// if (ret) {
|
|
|
_this.props.onPlaceholderChange && _this.props.onPlaceholderChange(placeholderCountBefore, placeholderCountInRange, totalPlaceholderCount);
|
|
|
// } else {
|
|
|
// change.cancel();
|
|
|
// }
|
|
|
}
|
|
|
} else if (totalPlaceholderCount) {
|
|
|
var _placeholderCountBefore = _this.getChCountBeforeCursor(cm, change.from);
|
|
|
console.log("\u65B0\u589E".concat(totalPlaceholderCount, "\u4E2A\uFF0C\u4E4B\u524D\u6709").concat(_placeholderCountBefore, "\u4E2A"));
|
|
|
_this.props.onPlaceholderChange && _this.props.onPlaceholderChange(_placeholderCountBefore, 0, totalPlaceholderCount);
|
|
|
}
|
|
|
});
|
|
|
return _this;
|
|
|
}
|
|
|
_root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_2___default()(NullMDEditor, [{
|
|
|
key: "render",
|
|
|
value: function render() {
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_markdown_editor__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, this.props), {}, {
|
|
|
onCMBeforeChange: this.onCMBeforeChange
|
|
|
}));
|
|
|
}
|
|
|
}]);
|
|
|
return NullMDEditor;
|
|
|
}(react__WEBPACK_IMPORTED_MODULE_7__.Component);
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 42910:
|
|
|
/*!*********************************************************************!*\
|
|
|
!*** ./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/_@babel_runtime@7.23.6@@babel/runtime/helpers/classCallCheck.js
|
|
|
var classCallCheck = __webpack_require__(82100);
|
|
|
var classCallCheck_default = /*#__PURE__*/__webpack_require__.n(classCallCheck);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/createClass.js
|
|
|
var createClass = __webpack_require__(29186);
|
|
|
var createClass_default = /*#__PURE__*/__webpack_require__.n(createClass);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/inherits.js
|
|
|
var inherits = __webpack_require__(80619);
|
|
|
var inherits_default = /*#__PURE__*/__webpack_require__.n(inherits);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/createSuper.js
|
|
|
var createSuper = __webpack_require__(47074);
|
|
|
var createSuper_default = /*#__PURE__*/__webpack_require__.n(createSuper);
|
|
|
// 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 + 3 modules
|
|
|
var input = __webpack_require__(92832);
|
|
|
// 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.6.1@@ant-design/icons/es/icons/PlusOutlined.js + 1 modules
|
|
|
var PlusOutlined = __webpack_require__(62772);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/components/Editor/NullChildEditor/index.jsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TextArea = input/* default */.Z.TextArea;
|
|
|
var NullChildEditor = /*#__PURE__*/function (_Component) {
|
|
|
inherits_default()(NullChildEditor, _Component);
|
|
|
var _super = createSuper_default()(NullChildEditor);
|
|
|
function NullChildEditor(props) {
|
|
|
var _this;
|
|
|
classCallCheck_default()(this, NullChildEditor);
|
|
|
_this = _super.call(this, props);
|
|
|
_this.state = {
|
|
|
inputVisible: false,
|
|
|
EditInputIndex: -1
|
|
|
};
|
|
|
return _this;
|
|
|
}
|
|
|
// componentDidMount() {
|
|
|
// // console.log(`${this.props.index}----`,this.props,e);
|
|
|
// if (this.props.answers[0].length <= 0) {
|
|
|
// this.setState({
|
|
|
// EditInputIndex: 0,
|
|
|
// });
|
|
|
// }
|
|
|
// }
|
|
|
createClass_default()(NullChildEditor, [{
|
|
|
key: "render",
|
|
|
value: function render() {
|
|
|
var _this2 = this;
|
|
|
var _this$props = this.props,
|
|
|
index = _this$props.index,
|
|
|
onAnswerChange = _this$props.onAnswerChange,
|
|
|
addChildAnswer = _this$props.addChildAnswer,
|
|
|
exerciseIsPublish = _this$props.exerciseIsPublish,
|
|
|
answers = _this$props.answers,
|
|
|
activeOptionErrorIndex = _this$props.activeOptionErrorIndex,
|
|
|
_this$props$flex = _this$props.flex,
|
|
|
flex = _this$props$flex === void 0 ? '0 0 1000px' : _this$props$flex;
|
|
|
console.log('----', answers);
|
|
|
var _this$state = this.state,
|
|
|
inputVisible = _this$state.inputVisible,
|
|
|
EditInputIndex = _this$state.EditInputIndex;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: NullChildEditormodules.flex,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "".concat(NullChildEditormodules.color666, " mb5 mt6"),
|
|
|
style: {
|
|
|
flex: '0 0 90px'
|
|
|
},
|
|
|
children: ["\u7B54\u6848(\u586B\u7A7A", index + 1, "):"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
border: '1px solid #f6f6f6',
|
|
|
flex: 1,
|
|
|
padding: 10
|
|
|
},
|
|
|
children: [answers === null || answers === void 0 ? void 0 : answers.map(function (tag, itemIndex) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: EditInputIndex !== itemIndex ? (tag === null || tag === void 0 ? void 0 : tag.length) > 0 ? /*#__PURE__*/(0,jsx_runtime.jsx)(es_tag/* default */.Z, {
|
|
|
className: "edit-tag",
|
|
|
closable: true,
|
|
|
onClose: function onClose(e) {
|
|
|
e.preventDefault();
|
|
|
if ((answers === null || answers === void 0 ? void 0 : answers.length) === 1 && itemIndex === 0) {
|
|
|
_this2.props.deleteChildAnswermain(index, itemIndex);
|
|
|
} else {
|
|
|
_this2.props.deleteChildAnswer(index, itemIndex);
|
|
|
}
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onDoubleClick: function onDoubleClick(e) {
|
|
|
_this2.setState({
|
|
|
EditInputIndex: itemIndex
|
|
|
});
|
|
|
e.preventDefault();
|
|
|
},
|
|
|
children: tag
|
|
|
})
|
|
|
}, tag) : /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
defaultValue: tag,
|
|
|
style: {
|
|
|
width: 78,
|
|
|
marginRight: 8,
|
|
|
height: 24,
|
|
|
verticalAlign: 'top'
|
|
|
},
|
|
|
onBlur: function onBlur(e) {
|
|
|
if (e.target.value.replaceAll(' ', '').length <= 0) {
|
|
|
message/* default */.ZP.info('内容不能为纯空格');
|
|
|
return;
|
|
|
}
|
|
|
onAnswerChange(index, itemIndex, e.target.value);
|
|
|
_this2.setState({
|
|
|
EditInputIndex: -1,
|
|
|
inputVisible: false
|
|
|
});
|
|
|
}
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
defaultValue: tag,
|
|
|
style: {
|
|
|
width: 78,
|
|
|
marginRight: 8,
|
|
|
height: 24,
|
|
|
verticalAlign: 'top'
|
|
|
},
|
|
|
onBlur: function onBlur(e) {
|
|
|
if (e.target.value.replaceAll(' ', '').length <= 0) {
|
|
|
message/* default */.ZP.info('内容不能为纯空格');
|
|
|
return;
|
|
|
}
|
|
|
onAnswerChange(index, itemIndex, e.target.value);
|
|
|
_this2.setState({
|
|
|
EditInputIndex: -1,
|
|
|
inputVisible: false
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
}), !inputVisible && /*#__PURE__*/(0,jsx_runtime.jsxs)(es_tag/* default */.Z, {
|
|
|
className: "site-tag-plus",
|
|
|
onClick: function onClick() {
|
|
|
addChildAnswer(index);
|
|
|
|
|
|
// console.log(this.props.index);
|
|
|
_this2.setState({
|
|
|
inputVisible: true
|
|
|
});
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(PlusOutlined/* default */.Z, {}), " \u65B0\u589E\u7B54\u6848"]
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
}]);
|
|
|
return NullChildEditor;
|
|
|
}(_react_17_0_2_react.Component);
|
|
|
/* harmony default export */ var Editor_NullChildEditor = (NullChildEditor);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 31427:
|
|
|
/*!***************************************************************************!*\
|
|
|
!*** ./src/pages/User/Detail/Topics/Exercise/Edit/index.tsx + 10 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 */ Edit; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
|
|
|
var regeneratorRuntime = __webpack_require__(7557);
|
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
|
|
|
var asyncToGenerator = __webpack_require__(41498);
|
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(82242);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/toConsumableArray.js
|
|
|
var toConsumableArray = __webpack_require__(37205);
|
|
|
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(79800);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectWithoutProperties.js
|
|
|
var objectWithoutProperties = __webpack_require__(39647);
|
|
|
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
|
|
|
var _umi_production_exports = __webpack_require__(25789);
|
|
|
// 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/tooltip/index.js + 3 modules
|
|
|
var tooltip = __webpack_require__(6848);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 3 modules
|
|
|
var input = __webpack_require__(92832);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(3113);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/PlusCircleOutlined.js + 1 modules
|
|
|
var PlusCircleOutlined = __webpack_require__(32134);
|
|
|
// EXTERNAL MODULE: ./src/service/polls.ts
|
|
|
var service_polls = __webpack_require__(76292);
|
|
|
// 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/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__(5871);
|
|
|
// EXTERNAL MODULE: ./src/service/exercise.ts
|
|
|
var exercise = __webpack_require__(45185);
|
|
|
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 10 modules
|
|
|
var markdown_editor = __webpack_require__(15396);
|
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 2 modules
|
|
|
var RenderHtml = __webpack_require__(11209);
|
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Edit/components/editor.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var editormodules = ({"flex_box_center":"flex_box_center___T9vjl","flex_space_between":"flex_space_between___zZP1J","flex_box_vertical_center":"flex_box_vertical_center___vbIhw","flex_box_center_end":"flex_box_center_end___SjRau","flex_box_column":"flex_box_column___Ic_zi","flex-col":"flex-col___TxkD7","flex-row":"flex-row___ZpRYL","justify-start":"justify-start___mUACP","justify-center":"justify-center___WYEyA","justify-end":"justify-end___XBSaR","justify-evenly":"justify-evenly___clVhL","justify-around":"justify-around___ZspJQ","justify-between":"justify-between___iRWIU","align-start":"align-start___p9nJd","align-center":"align-center___kxmqB","align-end":"align-end___bxNKo","wrap":"wrap___GtXAk","modal":"modal___mDuC3","titleWrap":"titleWrap___EzCZh","required":"required___KgfdI","title":"title___TMgfc","colorGray":"colorGray___xNVTs","choiceWrap":"choiceWrap___Rv9ug","answer":"answer___hVpls","activeAnswer":"activeAnswer___oJoq9","deleteIcon":"deleteIcon___bkn4b","addIcon":"addIcon___S2pDY","editorWrap":"editorWrap___BOx_r","htmlWrap":"htmlWrap___ERVlQ","radio":"radio___lrt5b","color333":"color333___pz3OT","color999":"color999___jtQ7e","questionType":"questionType___qUnUb","questionChoices":"questionChoices___n36qp"});
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Edit/components/MultipleEditor/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["problemset", "globalSetting", "loading", "dispatch", "onRef", "editData"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var tagList = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
|
|
|
var SingleEditor = function SingleEditor(_ref, ref) {
|
|
|
var problemset = _ref.problemset,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
dispatch = _ref.dispatch,
|
|
|
_ref$onRef = _ref.onRef,
|
|
|
onRef = _ref$onRef === void 0 ? function () {} : _ref$onRef,
|
|
|
editData = _ref.editData,
|
|
|
props = objectWithoutProperties_default()(_ref, _excluded);
|
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
questionChoiceList = _useState2[0],
|
|
|
setQuestionChoiceList = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
activeEditor = _useState4[0],
|
|
|
setActiveEditor = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
activeAnswer = _useState6[0],
|
|
|
setActiveAnswer = _useState6[1];
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
title = _useState8[0],
|
|
|
setTitle = _useState8[1];
|
|
|
var _useState9 = (0,_react_17_0_2_react.useState)(5),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
score = _useState10[0],
|
|
|
setScore = _useState10[1];
|
|
|
var _useState11 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
isEdit = _useState12[0],
|
|
|
setIsEdit = _useState12[1];
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
setQuestionChoiceList(['', '', '', '']);
|
|
|
}, []);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (!(editData !== null && editData !== void 0 && editData.question_choices)) {
|
|
|
setIsEdit(true);
|
|
|
return;
|
|
|
}
|
|
|
setTitle(editData === null || editData === void 0 ? void 0 : editData.question_title);
|
|
|
setScore(parseInt(editData === null || editData === void 0 ? void 0 : editData.question_score));
|
|
|
setQuestionChoiceList(editData === null || editData === void 0 ? void 0 : editData.question_choices.map(function (item) {
|
|
|
return item.choice_text;
|
|
|
}));
|
|
|
var answerIndexs = [];
|
|
|
editData === null || editData === void 0 || editData.standard_answer.map(function (item, index) {
|
|
|
answerIndexs.push(item - 1);
|
|
|
});
|
|
|
setActiveAnswer(answerIndexs);
|
|
|
}, [editData]);
|
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, function () {
|
|
|
return {
|
|
|
onSave: onSave,
|
|
|
isEdit: isEdit
|
|
|
};
|
|
|
});
|
|
|
var onSave = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var findNotAnswerIndex, choices, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
if (title) {
|
|
|
_context.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.info("请您输入题目");
|
|
|
return _context.abrupt("return", false);
|
|
|
case 3:
|
|
|
findNotAnswerIndex = questionChoiceList.findIndex(function (item) {
|
|
|
return !item;
|
|
|
});
|
|
|
if (!(findNotAnswerIndex > -1)) {
|
|
|
_context.next = 7;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.info("\u8BF7\u5148\u8F93\u5165 ".concat(tagList[findNotAnswerIndex], " \u9009\u9879\u7684\u5185\u5BB9"));
|
|
|
return _context.abrupt("return", false);
|
|
|
case 7:
|
|
|
if (activeAnswer.length) {
|
|
|
_context.next = 10;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.info("请设置本题的正确答案,点击选项A/B...即可完成设置");
|
|
|
return _context.abrupt("return", false);
|
|
|
case 10:
|
|
|
if (!(activeAnswer.length < 1)) {
|
|
|
_context.next = 13;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.info("请选择答案");
|
|
|
return _context.abrupt("return", false);
|
|
|
case 13:
|
|
|
choices = questionChoiceList.map(function (item, index) {
|
|
|
return {
|
|
|
choice_text: item,
|
|
|
is_answer: activeAnswer.includes(index) ? index + 1 : 0
|
|
|
};
|
|
|
});
|
|
|
if (!editData.question_id) {
|
|
|
_context.next = 20;
|
|
|
break;
|
|
|
}
|
|
|
_context.next = 17;
|
|
|
return dispatch({
|
|
|
type: "exercise/editExerciseQuestion",
|
|
|
payload: {
|
|
|
"id": editData.question_id,
|
|
|
"question_title": title,
|
|
|
"question_type": 1,
|
|
|
"question_score": "5.0",
|
|
|
"question_choices": choices.map(function (item) {
|
|
|
return item.choice_text;
|
|
|
}),
|
|
|
"standard_answers": choices.filter(function (item) {
|
|
|
return item.is_answer;
|
|
|
}).map(function (item) {
|
|
|
return item.is_answer;
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
case 17:
|
|
|
res = _context.sent;
|
|
|
_context.next = 23;
|
|
|
break;
|
|
|
case 20:
|
|
|
_context.next = 22;
|
|
|
return dispatch({
|
|
|
type: "exercise/addExerciseQuestion",
|
|
|
payload: {
|
|
|
"categoryId": params.categoryId,
|
|
|
"question_title": title,
|
|
|
"question_type": 1,
|
|
|
"question_score": "5.0",
|
|
|
"question_choices": choices.map(function (item) {
|
|
|
return item.choice_text;
|
|
|
}),
|
|
|
"standard_answers": choices.filter(function (item) {
|
|
|
return item.is_answer;
|
|
|
}).map(function (item) {
|
|
|
return item.is_answer;
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
case 22:
|
|
|
res = _context.sent;
|
|
|
case 23:
|
|
|
if (res.status === 0) {
|
|
|
message/* default */.ZP.success("保存成功");
|
|
|
setIsEdit(false);
|
|
|
dispatch({
|
|
|
type: "exercise/editExercise",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
}
|
|
|
case 24:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function onSave() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var actionArr = [{
|
|
|
name: "删除",
|
|
|
icon: "iconfont c-light-black ml30 icon-shanchu",
|
|
|
id: "del"
|
|
|
}, {
|
|
|
name: "上移",
|
|
|
icon: "iconfont c-green ml30 icon-shangyi_Hover",
|
|
|
id: "up"
|
|
|
}, {
|
|
|
name: "下移",
|
|
|
icon: "iconfont c-green ml30 icon-xiayi_moren",
|
|
|
id: "down"
|
|
|
}, {
|
|
|
name: "编辑",
|
|
|
icon: "iconfont c-green ml30 icon-bianjishijuan3x",
|
|
|
id: "edit"
|
|
|
}];
|
|
|
var actionClick = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(item) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
_context3.t0 = item.id;
|
|
|
_context3.next = _context3.t0 === "del" ? 3 : _context3.t0 === "up" ? 5 : _context3.t0 === "down" ? 5 : _context3.t0 === "edit" ? 9 : 11;
|
|
|
break;
|
|
|
case 3:
|
|
|
modal/* default */.Z.confirm({
|
|
|
centered: true,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
title: '确认要删除这个问题吗?',
|
|
|
onOk: function onOk() {
|
|
|
return asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.next = 2;
|
|
|
return (0,exercise/* exeriseQuestionDelete */.Fl)({
|
|
|
id: editData.question_id
|
|
|
});
|
|
|
case 2:
|
|
|
dispatch({
|
|
|
type: "exercise/editExercise",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}))();
|
|
|
}
|
|
|
});
|
|
|
return _context3.abrupt("break", 11);
|
|
|
case 5:
|
|
|
_context3.next = 7;
|
|
|
return dispatch({
|
|
|
type: "exercise/exeriseMoveUpDown",
|
|
|
payload: {
|
|
|
id: editData.question_id,
|
|
|
opr: item.id
|
|
|
}
|
|
|
});
|
|
|
case 7:
|
|
|
dispatch({
|
|
|
type: "exercise/editExercise",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
return _context3.abrupt("break", 11);
|
|
|
case 9:
|
|
|
setIsEdit(true);
|
|
|
return _context3.abrupt("break", 11);
|
|
|
case 11:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return function actionClick(_x) {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var showList = function showList() {
|
|
|
var _editData$question_ch;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: editormodules.questionType,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font16 c-blue",
|
|
|
children: [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__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
placement: "bottom",
|
|
|
title: item.name,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onClick: function onClick() {
|
|
|
return actionClick(item);
|
|
|
},
|
|
|
className: item.icon
|
|
|
})
|
|
|
}, index);
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt5",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: editData.question_title
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: editormodules.questionChoices,
|
|
|
children: editData === null || editData === void 0 || (_editData$question_ch = editData.question_choices) === null || _editData$question_ch === void 0 ? void 0 : _editData$question_ch.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_checkbox/* default */.Z, {
|
|
|
checked: editData.standard_answer.includes(index + 1),
|
|
|
disabled: true,
|
|
|
children: [tagList[index], "."]
|
|
|
}, index)
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-black font14",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item.choice_text
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var showEdit = function showEdit() {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: editormodules.questionType,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font16 c-blue",
|
|
|
children: "\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__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
className: editormodules.titleWrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: editormodules.required,
|
|
|
children: "*"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: editormodules.title,
|
|
|
children: "\u9898\u5E72\uFF1A"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
id: "single-question-title",
|
|
|
watch: true,
|
|
|
height: 155,
|
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",
|
|
|
defaultValue: title,
|
|
|
onChange: function onChange(value) {
|
|
|
return setTitle(value);
|
|
|
}
|
|
|
}), questionChoiceList.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: editormodules.choiceWrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",
|
|
|
placement: "left",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "".concat(editormodules.answer, " ").concat(activeAnswer.includes(index) ? editormodules.activeAnswer : ''),
|
|
|
onClick: function onClick() {
|
|
|
if (activeAnswer.includes(index)) {
|
|
|
setActiveAnswer(activeAnswer.filter(function (item) {
|
|
|
return item !== index;
|
|
|
}));
|
|
|
} else {
|
|
|
setActiveAnswer([].concat(toConsumableArray_default()(activeAnswer), [index]));
|
|
|
}
|
|
|
},
|
|
|
children: tagList[index]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: editormodules.editorWrap,
|
|
|
children: activeEditor === index ? /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
id: "single-question-option-".concat(index),
|
|
|
watch: true,
|
|
|
height: 155,
|
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9009\u9879",
|
|
|
defaultValue: item,
|
|
|
onChange: function onChange(value) {
|
|
|
questionChoiceList[index] = value;
|
|
|
setQuestionChoiceList(questionChoiceList);
|
|
|
}
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: editormodules.htmlWrap,
|
|
|
onClick: function onClick() {
|
|
|
return setActiveEditor(index);
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item
|
|
|
})
|
|
|
})
|
|
|
}), index > 1 && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u5220\u9664",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "".concat(editormodules.deleteIcon, " iconfont icon-htmal5icon19"),
|
|
|
onClick: function onClick() {
|
|
|
return setQuestionChoiceList(questionChoiceList.filter(function (_, key) {
|
|
|
return key !== index;
|
|
|
}));
|
|
|
}
|
|
|
})
|
|
|
}), index < 7 && index === questionChoiceList.length - 1 && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u65B0\u589E\u53C2\u8003\u7B54\u6848",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "".concat(editormodules.addIcon, " iconfont icon-roundaddfill ml6"),
|
|
|
onClick: function onClick() {
|
|
|
return setQuestionChoiceList([].concat(toConsumableArray_default()(questionChoiceList), ['']));
|
|
|
}
|
|
|
})
|
|
|
})]
|
|
|
}, index);
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "c-orange",
|
|
|
children: "\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__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
className: "",
|
|
|
children: ["\u5206\u503C\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
value: score,
|
|
|
max: 10000,
|
|
|
min: -1,
|
|
|
onChange: function onChange(value) {
|
|
|
setScore(value);
|
|
|
}
|
|
|
}), " \u5206"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
className: "tr",
|
|
|
children: [editData.question_id && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "default",
|
|
|
onClick: function onClick() {
|
|
|
return setIsEdit(false);
|
|
|
},
|
|
|
children: "\u53D6\u6D88"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
className: "ml20",
|
|
|
type: "primary",
|
|
|
onClick: function onClick() {
|
|
|
return onSave();
|
|
|
},
|
|
|
children: "\u4FDD\u5B58"
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: editormodules.wrap,
|
|
|
children: [!isEdit && showList(), isEdit && showEdit()]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var MultipleEditor = ((0,_umi_production_exports.connect)(function (_ref4) {
|
|
|
var problemset = _ref4.problemset,
|
|
|
loading = _ref4.loading,
|
|
|
globalSetting = _ref4.globalSetting;
|
|
|
return {
|
|
|
problemset: problemset,
|
|
|
globalSetting: globalSetting,
|
|
|
loading: loading.effects
|
|
|
};
|
|
|
}, null, null, {
|
|
|
forwardRef: true
|
|
|
})( /*#__PURE__*/(0,_react_17_0_2_react.forwardRef)(SingleEditor)));
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/radio/index.js
|
|
|
var es_radio = __webpack_require__(69140);
|
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Edit/components/SingleEditor/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var SingleEditor_excluded = ["problemset", "globalSetting", "loading", "dispatch", "onRef", "editData"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var 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'];
|
|
|
var SingleEditor_SingleEditor = function SingleEditor(_ref, ref) {
|
|
|
var problemset = _ref.problemset,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
dispatch = _ref.dispatch,
|
|
|
_ref$onRef = _ref.onRef,
|
|
|
onRef = _ref$onRef === void 0 ? function () {} : _ref$onRef,
|
|
|
editData = _ref.editData,
|
|
|
props = objectWithoutProperties_default()(_ref, SingleEditor_excluded);
|
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
questionChoiceList = _useState2[0],
|
|
|
setQuestionChoiceList = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
activeEditor = _useState4[0],
|
|
|
setActiveEditor = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
activeAnswer = _useState6[0],
|
|
|
setActiveAnswer = _useState6[1];
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
title = _useState8[0],
|
|
|
setTitle = _useState8[1];
|
|
|
var _useState9 = (0,_react_17_0_2_react.useState)(0),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
score = _useState10[0],
|
|
|
setScore = _useState10[1];
|
|
|
var _useState11 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
isEdit = _useState12[0],
|
|
|
setIsEdit = _useState12[1];
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
setQuestionChoiceList(['', '', '', '']);
|
|
|
}, []);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (!(editData !== null && editData !== void 0 && editData.question_choices)) {
|
|
|
setIsEdit(true);
|
|
|
return;
|
|
|
}
|
|
|
setTitle(editData === null || editData === void 0 ? void 0 : editData.question_title);
|
|
|
setScore(parseInt(editData === null || editData === void 0 ? void 0 : editData.question_score));
|
|
|
setQuestionChoiceList(editData === null || editData === void 0 ? void 0 : editData.question_choices.map(function (item) {
|
|
|
return item.choice_text;
|
|
|
}));
|
|
|
var answerIndexs = [];
|
|
|
editData === null || editData === void 0 || editData.standard_answer.map(function (item, index) {
|
|
|
answerIndexs.push(item - 1);
|
|
|
});
|
|
|
setActiveAnswer(answerIndexs);
|
|
|
}, [editData]);
|
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, function () {
|
|
|
return {
|
|
|
onSave: onSave,
|
|
|
isEdit: isEdit
|
|
|
};
|
|
|
});
|
|
|
var onSave = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var findNotAnswerIndex, choices, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
if (title) {
|
|
|
_context.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.info("请您输入题目");
|
|
|
return _context.abrupt("return", false);
|
|
|
case 3:
|
|
|
findNotAnswerIndex = questionChoiceList.findIndex(function (item) {
|
|
|
return !item;
|
|
|
});
|
|
|
if (!(findNotAnswerIndex > -1)) {
|
|
|
_context.next = 7;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.info("\u8BF7\u5148\u8F93\u5165 ".concat(SingleEditor_tagList[findNotAnswerIndex], " \u9009\u9879\u7684\u5185\u5BB9"));
|
|
|
return _context.abrupt("return", false);
|
|
|
case 7:
|
|
|
if (activeAnswer.length) {
|
|
|
_context.next = 10;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.info("请设置本题的正确答案,点击选项A/B...即可完成设置");
|
|
|
return _context.abrupt("return", false);
|
|
|
case 10:
|
|
|
if (!(activeAnswer.length < 1)) {
|
|
|
_context.next = 13;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.info("请选择答案");
|
|
|
return _context.abrupt("return", false);
|
|
|
case 13:
|
|
|
choices = questionChoiceList.map(function (item, index) {
|
|
|
return {
|
|
|
choice_text: item,
|
|
|
is_answer: activeAnswer.includes(index) ? index + 1 : 0
|
|
|
};
|
|
|
});
|
|
|
if (!editData.question_id) {
|
|
|
_context.next = 20;
|
|
|
break;
|
|
|
}
|
|
|
_context.next = 17;
|
|
|
return (0,service_polls/* putExerciseBankQuestions */.Kc)({
|
|
|
"id": editData.question_id,
|
|
|
"question_title": title,
|
|
|
"question_type": 1,
|
|
|
"question_score": score,
|
|
|
"question_choices": choices.map(function (item) {
|
|
|
return item.choice_text;
|
|
|
}),
|
|
|
"standard_answers": choices.filter(function (item) {
|
|
|
return item.is_answer;
|
|
|
}).map(function (item) {
|
|
|
return item.is_answer;
|
|
|
})
|
|
|
});
|
|
|
case 17:
|
|
|
res = _context.sent;
|
|
|
_context.next = 23;
|
|
|
break;
|
|
|
case 20:
|
|
|
_context.next = 22;
|
|
|
return (0,service_polls/* addExerciseBankQuestions */.iV)({
|
|
|
"exercise_bank_id": params.topicId,
|
|
|
"question_title": title,
|
|
|
"question_type": 1,
|
|
|
"question_score": "5.0",
|
|
|
"question_choices": choices.map(function (item) {
|
|
|
return item.choice_text;
|
|
|
}),
|
|
|
"standard_answers": choices.filter(function (item) {
|
|
|
return item.is_answer;
|
|
|
}).map(function (item) {
|
|
|
return item.is_answer;
|
|
|
})
|
|
|
});
|
|
|
case 22:
|
|
|
res = _context.sent;
|
|
|
case 23:
|
|
|
if (res.status === 0) {
|
|
|
message/* default */.ZP.success("保存成功");
|
|
|
setIsEdit(false);
|
|
|
}
|
|
|
_context.next = 26;
|
|
|
return dispatch({
|
|
|
type: "polls/getExerciseBanks",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
case 26:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function onSave() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var actionArr = [{
|
|
|
name: "删除",
|
|
|
icon: "iconfont c-light-black ml30 icon-shanchu",
|
|
|
id: "del"
|
|
|
}, {
|
|
|
name: "上移",
|
|
|
icon: "iconfont c-green ml30 icon-shangyi_Hover",
|
|
|
id: "up"
|
|
|
}, {
|
|
|
name: "下移",
|
|
|
icon: "iconfont c-green ml30 icon-xiayi_moren",
|
|
|
id: "down"
|
|
|
}, {
|
|
|
name: "编辑",
|
|
|
icon: "iconfont c-green ml30 icon-bianjishijuan3x",
|
|
|
id: "edit"
|
|
|
}];
|
|
|
var actionClick = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(item) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
_context3.t0 = item.id;
|
|
|
_context3.next = _context3.t0 === "del" ? 3 : _context3.t0 === "up" ? 5 : _context3.t0 === "down" ? 5 : _context3.t0 === "edit" ? 9 : 11;
|
|
|
break;
|
|
|
case 3:
|
|
|
modal/* default */.Z.confirm({
|
|
|
centered: true,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
title: '确认要删除这个问题吗?',
|
|
|
onOk: function onOk() {
|
|
|
return asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.next = 2;
|
|
|
return (0,service_polls/* deleteExerciseBanksQuestion */.x$)({
|
|
|
pollsId: editData.question_id
|
|
|
});
|
|
|
case 2:
|
|
|
dispatch({
|
|
|
type: "polls/getExerciseBanks",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}))();
|
|
|
}
|
|
|
});
|
|
|
return _context3.abrupt("break", 11);
|
|
|
case 5:
|
|
|
_context3.next = 7;
|
|
|
return (0,service_polls/* exercisesBanksMoveUpDown */.W)({
|
|
|
exerciseId: editData === null || editData === void 0 ? void 0 : editData.question_id,
|
|
|
opr: item.id
|
|
|
});
|
|
|
case 7:
|
|
|
dispatch({
|
|
|
type: "polls/getExerciseBanks",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
return _context3.abrupt("break", 11);
|
|
|
case 9:
|
|
|
setIsEdit(true);
|
|
|
return _context3.abrupt("break", 11);
|
|
|
case 11:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return function actionClick(_x) {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var showList = function showList() {
|
|
|
var _editData$question_ch;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: editormodules.questionType,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font16 c-blue",
|
|
|
children: [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__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
placement: "bottom",
|
|
|
title: item.name,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onClick: function onClick() {
|
|
|
return actionClick(item);
|
|
|
},
|
|
|
className: item.icon
|
|
|
})
|
|
|
}, index);
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt5",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: editData.question_title
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: editormodules.questionChoices,
|
|
|
children: editData === null || editData === void 0 || (_editData$question_ch = editData.question_choices) === null || _editData$question_ch === void 0 ? void 0 : _editData$question_ch.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default */.ZP, {
|
|
|
checked: editData.standard_answer.includes(index + 1),
|
|
|
disabled: true,
|
|
|
children: [SingleEditor_tagList[index], "."]
|
|
|
}, index)
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-black font14",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item.choice_text
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var showEdit = function showEdit() {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: editormodules.questionType,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font16 c-blue",
|
|
|
children: "\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__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
className: editormodules.titleWrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: editormodules.required,
|
|
|
children: "*"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: editormodules.title,
|
|
|
children: "\u9898\u5E72\uFF1A"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
id: "single-question-title",
|
|
|
watch: true,
|
|
|
height: 155,
|
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",
|
|
|
defaultValue: title,
|
|
|
onChange: function onChange(value) {
|
|
|
return setTitle(value);
|
|
|
}
|
|
|
}), questionChoiceList.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: editormodules.choiceWrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",
|
|
|
placement: "left",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "".concat(editormodules.answer, " ").concat(activeAnswer.includes(index) ? editormodules.activeAnswer : ''),
|
|
|
onClick: function onClick() {
|
|
|
if (activeAnswer.includes(index)) {
|
|
|
setActiveAnswer(activeAnswer.filter(function (item) {
|
|
|
return item !== index;
|
|
|
}));
|
|
|
} else {
|
|
|
setActiveAnswer([].concat(toConsumableArray_default()(activeAnswer), [index]));
|
|
|
}
|
|
|
},
|
|
|
children: SingleEditor_tagList[index]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: editormodules.editorWrap,
|
|
|
children: activeEditor === index ? /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
id: "single-question-option-".concat(index),
|
|
|
watch: true,
|
|
|
height: 155,
|
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9009\u9879",
|
|
|
defaultValue: item,
|
|
|
onChange: function onChange(value) {
|
|
|
questionChoiceList[index] = value;
|
|
|
setQuestionChoiceList(questionChoiceList);
|
|
|
}
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: editormodules.htmlWrap,
|
|
|
onClick: function onClick() {
|
|
|
return setActiveEditor(index);
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item
|
|
|
})
|
|
|
})
|
|
|
}), index > 1 && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u5220\u9664",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "".concat(editormodules.deleteIcon, " iconfont icon-htmal5icon19"),
|
|
|
onClick: function onClick() {
|
|
|
return setQuestionChoiceList(questionChoiceList.filter(function (_, key) {
|
|
|
return key !== index;
|
|
|
}));
|
|
|
}
|
|
|
})
|
|
|
}), index < 7 && index === questionChoiceList.length - 1 && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u65B0\u589E\u53C2\u8003\u7B54\u6848",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "".concat(editormodules.addIcon, " iconfont icon-roundaddfill ml6"),
|
|
|
onClick: function onClick() {
|
|
|
return setQuestionChoiceList([].concat(toConsumableArray_default()(questionChoiceList), ['']));
|
|
|
}
|
|
|
})
|
|
|
})]
|
|
|
}, index);
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "c-orange",
|
|
|
children: "\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__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
className: "",
|
|
|
children: ["\u5206\u503C\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
value: score,
|
|
|
max: 10000,
|
|
|
min: -1,
|
|
|
onChange: function onChange(value) {
|
|
|
setScore(value);
|
|
|
}
|
|
|
}), " \u5206"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
className: "tr",
|
|
|
children: [editData.question_id && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "default",
|
|
|
onClick: function onClick() {
|
|
|
return setIsEdit(false);
|
|
|
},
|
|
|
children: "\u53D6\u6D88"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
className: "ml20",
|
|
|
type: "primary",
|
|
|
onClick: function onClick() {
|
|
|
return onSave();
|
|
|
},
|
|
|
children: "\u4FDD\u5B58"
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: editormodules.wrap,
|
|
|
children: [!isEdit && showList(), isEdit && showEdit()]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_SingleEditor = ((0,_umi_production_exports.connect)(function (_ref4) {
|
|
|
var problemset = _ref4.problemset,
|
|
|
loading = _ref4.loading,
|
|
|
globalSetting = _ref4.globalSetting;
|
|
|
return {
|
|
|
problemset: problemset,
|
|
|
globalSetting: globalSetting,
|
|
|
loading: loading.effects
|
|
|
};
|
|
|
}, null, null, {
|
|
|
forwardRef: true
|
|
|
})( /*#__PURE__*/(0,_react_17_0_2_react.forwardRef)(SingleEditor_SingleEditor)));
|
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Edit/components/JudgmentEditor/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var JudgmentEditor_excluded = ["problemset", "globalSetting", "loading", "dispatch", "onRef", "editData"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var 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'];
|
|
|
var JudgmentEditor = function JudgmentEditor(_ref, ref) {
|
|
|
var problemset = _ref.problemset,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
dispatch = _ref.dispatch,
|
|
|
_ref$onRef = _ref.onRef,
|
|
|
onRef = _ref$onRef === void 0 ? function () {} : _ref$onRef,
|
|
|
editData = _ref.editData,
|
|
|
props = objectWithoutProperties_default()(_ref, JudgmentEditor_excluded);
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
activeAnswer = _useState2[0],
|
|
|
setActiveAnswer = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
title = _useState4[0],
|
|
|
setTitle = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
isEdit = _useState6[0],
|
|
|
setIsEdit = _useState6[1];
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)(5),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
score = _useState8[0],
|
|
|
setScore = _useState8[1];
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (!(editData !== null && editData !== void 0 && editData.question_choices)) {
|
|
|
setIsEdit(true);
|
|
|
return;
|
|
|
}
|
|
|
setTitle(editData === null || editData === void 0 ? void 0 : editData.question_title);
|
|
|
setScore(editData === null || editData === void 0 ? void 0 : editData.question_score);
|
|
|
// const answer = editData?.question_choices.find(item => item.is_answer);
|
|
|
setActiveAnswer(editData.standard_answer[0] + '');
|
|
|
}, [editData]);
|
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, function () {
|
|
|
return {
|
|
|
onSave: onSave,
|
|
|
isEdit: isEdit
|
|
|
};
|
|
|
});
|
|
|
var onSave = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var choices, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
if (title) {
|
|
|
_context.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.info("请您输入题干");
|
|
|
return _context.abrupt("return", false);
|
|
|
case 3:
|
|
|
if (activeAnswer) {
|
|
|
_context.next = 6;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.info("请先点击选择本选择题的正确选项");
|
|
|
return _context.abrupt("return", false);
|
|
|
case 6:
|
|
|
choices = [{
|
|
|
choice_text: "正确",
|
|
|
is_answer: activeAnswer === "1" ? 1 : 0
|
|
|
}, {
|
|
|
choice_text: "错误",
|
|
|
is_answer: activeAnswer === "2" ? 2 : 0
|
|
|
}];
|
|
|
if (!editData.question_id) {
|
|
|
_context.next = 13;
|
|
|
break;
|
|
|
}
|
|
|
_context.next = 10;
|
|
|
return (0,service_polls/* putExerciseBankQuestions */.Kc)({
|
|
|
"id": editData.question_id,
|
|
|
"question_title": title,
|
|
|
"question_type": 2,
|
|
|
"question_score": score,
|
|
|
"question_choices": choices.map(function (item) {
|
|
|
return item.choice_text;
|
|
|
}),
|
|
|
"standard_answers": choices.filter(function (item) {
|
|
|
return item.is_answer;
|
|
|
}).map(function (item) {
|
|
|
return item.is_answer;
|
|
|
})
|
|
|
});
|
|
|
case 10:
|
|
|
res = _context.sent;
|
|
|
_context.next = 16;
|
|
|
break;
|
|
|
case 13:
|
|
|
_context.next = 15;
|
|
|
return (0,service_polls/* addExerciseBankQuestions */.iV)({
|
|
|
"exercise_bank_id": params.topicId,
|
|
|
"question_title": title,
|
|
|
"question_type": 2,
|
|
|
"question_score": score,
|
|
|
"question_choices": choices.map(function (item) {
|
|
|
return item.choice_text;
|
|
|
}),
|
|
|
"standard_answers": choices.filter(function (item) {
|
|
|
return item.is_answer;
|
|
|
}).map(function (item) {
|
|
|
return item.is_answer;
|
|
|
})
|
|
|
});
|
|
|
case 15:
|
|
|
res = _context.sent;
|
|
|
case 16:
|
|
|
if (res.status === 0) {
|
|
|
message/* default */.ZP.success("保存成功");
|
|
|
setIsEdit(false);
|
|
|
}
|
|
|
dispatch({
|
|
|
type: "polls/getExerciseBanks",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
return _context.abrupt("return", {
|
|
|
name: title,
|
|
|
choices: choices
|
|
|
});
|
|
|
case 19:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function onSave() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var actionArr = [{
|
|
|
name: "删除",
|
|
|
icon: "iconfont c-light-black ml30 icon-shanchu",
|
|
|
id: "del"
|
|
|
}, {
|
|
|
name: "上移",
|
|
|
icon: "iconfont c-green ml30 icon-shangyi_Hover",
|
|
|
id: "up"
|
|
|
}, {
|
|
|
name: "下移",
|
|
|
icon: "iconfont c-green ml30 icon-xiayi_moren",
|
|
|
id: "down"
|
|
|
}, {
|
|
|
name: "编辑",
|
|
|
icon: "iconfont c-green ml30 icon-bianjishijuan3x",
|
|
|
id: "edit"
|
|
|
}];
|
|
|
var actionClick = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(item) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
_context3.t0 = item.id;
|
|
|
_context3.next = _context3.t0 === "del" ? 3 : _context3.t0 === "up" ? 5 : _context3.t0 === "down" ? 5 : _context3.t0 === "edit" ? 9 : 11;
|
|
|
break;
|
|
|
case 3:
|
|
|
modal/* default */.Z.confirm({
|
|
|
centered: true,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
title: '确认要删除这个问题吗?',
|
|
|
onOk: function onOk() {
|
|
|
return asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.next = 2;
|
|
|
return (0,service_polls/* deleteExerciseBanksQuestion */.x$)({
|
|
|
pollsId: editData.question_id
|
|
|
});
|
|
|
case 2:
|
|
|
dispatch({
|
|
|
type: "polls/getExerciseBanks",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}))();
|
|
|
}
|
|
|
});
|
|
|
return _context3.abrupt("break", 11);
|
|
|
case 5:
|
|
|
_context3.next = 7;
|
|
|
return (0,service_polls/* exercisesBanksMoveUpDown */.W)({
|
|
|
exerciseId: editData === null || editData === void 0 ? void 0 : editData.question_id,
|
|
|
opr: item.id
|
|
|
});
|
|
|
case 7:
|
|
|
dispatch({
|
|
|
type: "polls/getExerciseBanks",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
return _context3.abrupt("break", 11);
|
|
|
case 9:
|
|
|
setIsEdit(true);
|
|
|
return _context3.abrupt("break", 11);
|
|
|
case 11:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return function actionClick(_x) {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var showList = function showList() {
|
|
|
var _editData$question_ch;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: editormodules.questionType,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font16 c-blue",
|
|
|
children: [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__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
placement: "bottom",
|
|
|
title: item.name,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onClick: function onClick() {
|
|
|
return actionClick(item);
|
|
|
},
|
|
|
className: item.icon
|
|
|
})
|
|
|
}, index);
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt5",
|
|
|
children: editData.question_title
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: editormodules.questionChoices,
|
|
|
children: editData === null || editData === void 0 || (_editData$question_ch = editData.question_choices) === null || _editData$question_ch === void 0 ? void 0 : _editData$question_ch.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default */.ZP, {
|
|
|
checked: editData.standard_answer.includes(index + 1),
|
|
|
disabled: true,
|
|
|
children: [JudgmentEditor_tagList[index], ". ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-black font14",
|
|
|
children: item.choice_text
|
|
|
})]
|
|
|
}, index);
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var showEdit = function showEdit() {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font16 c-blue",
|
|
|
children: "\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__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
className: editormodules.titleWrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: editormodules.required,
|
|
|
children: "*"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: editormodules.title,
|
|
|
children: "\u9898\u5E72\uFF1A"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
id: "single-question-title",
|
|
|
watch: true,
|
|
|
height: 155,
|
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",
|
|
|
defaultValue: title,
|
|
|
onChange: function onChange(value) {
|
|
|
return setTitle(value);
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
className: editormodules.titleWrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: editormodules.required,
|
|
|
children: "*"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: editormodules.title,
|
|
|
children: ["\u7B54\u6848\u9009\u9879\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: editormodules.colorGray,
|
|
|
children: "\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default.Group */.ZP.Group, {
|
|
|
buttonStyle: "solid",
|
|
|
value: activeAnswer,
|
|
|
onChange: function onChange(e) {
|
|
|
return setActiveAnswer(e.target.value);
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Button */.ZP.Button, {
|
|
|
value: "1",
|
|
|
className: "".concat(editormodules.radio, " mr40"),
|
|
|
children: "\u6B63\u786E"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Button */.ZP.Button, {
|
|
|
value: "2",
|
|
|
className: editormodules.radio,
|
|
|
children: "\u9519\u8BEF"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "c-orange",
|
|
|
children: "\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\uFF0C\u53EF\u4EE5\u76F4\u63A5\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
className: "",
|
|
|
children: ["\u5206\u503C\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
value: score,
|
|
|
max: 10000,
|
|
|
min: -1,
|
|
|
onChange: function onChange(value) {
|
|
|
setScore(value);
|
|
|
}
|
|
|
}), " \u5206"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
className: "tr",
|
|
|
children: [editData.question_id && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "default",
|
|
|
onClick: function onClick() {
|
|
|
return setIsEdit(false);
|
|
|
},
|
|
|
children: "\u53D6\u6D88"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
className: "ml20",
|
|
|
type: "primary",
|
|
|
onClick: function onClick() {
|
|
|
return onSave();
|
|
|
},
|
|
|
children: "\u4FDD\u5B58"
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: editormodules.wrap,
|
|
|
children: [!isEdit && showList(), isEdit && showEdit()]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_JudgmentEditor = ((0,_umi_production_exports.connect)(function (_ref4) {
|
|
|
var problemset = _ref4.problemset,
|
|
|
loading = _ref4.loading,
|
|
|
globalSetting = _ref4.globalSetting;
|
|
|
return {
|
|
|
problemset: problemset,
|
|
|
globalSetting: globalSetting,
|
|
|
loading: loading.effects
|
|
|
};
|
|
|
}, null, null, {
|
|
|
forwardRef: true
|
|
|
})( /*#__PURE__*/(0,_react_17_0_2_react.forwardRef)(JudgmentEditor)));
|
|
|
// EXTERNAL MODULE: ./src/components/Editor/NullMDEditor.js
|
|
|
var NullMDEditor = __webpack_require__(43528);
|
|
|
// EXTERNAL MODULE: ./src/components/Editor/NullChildEditor/index.jsx + 1 modules
|
|
|
var NullChildEditor = __webpack_require__(42910);
|
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
|
var util = __webpack_require__(20681);
|
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Edit/components/CompletionEditor/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var CompletionEditor_excluded = ["problemset", "globalSetting", "loading", "dispatch", "editData"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var 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']));
|
|
|
var CompletionEditor = function CompletionEditor(_ref, ref) {
|
|
|
var problemset = _ref.problemset,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
dispatch = _ref.dispatch,
|
|
|
editData = _ref.editData,
|
|
|
props = objectWithoutProperties_default()(_ref, CompletionEditor_excluded);
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
title = _useState2[0],
|
|
|
setTitle = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
analysis = _useState4[0],
|
|
|
setAnalysis = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
answerList = _useState6[0],
|
|
|
setAnswerList = _useState6[1];
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
activeOptionErrorIndex = _useState8[0],
|
|
|
setActiveOptionErrorIndex = _useState8[1];
|
|
|
var _useState9 = (0,_react_17_0_2_react.useState)(),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
checked = _useState10[0],
|
|
|
setChecked = _useState10[1];
|
|
|
var _useState11 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
firstSetAnswerFlag = _useState12[0],
|
|
|
setFirstSetAnswerFlag = _useState12[1];
|
|
|
var _useState13 = (0,_react_17_0_2_react.useState)(5),
|
|
|
_useState14 = slicedToArray_default()(_useState13, 2),
|
|
|
score = _useState14[0],
|
|
|
setScore = _useState14[1];
|
|
|
var _useState15 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState16 = slicedToArray_default()(_useState15, 2),
|
|
|
isEdit = _useState16[0],
|
|
|
setIsEdit = _useState16[1];
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (!(editData !== null && editData !== void 0 && editData.question_title)) {
|
|
|
setIsEdit(true);
|
|
|
return;
|
|
|
}
|
|
|
setTitle(editData === null || editData === void 0 ? void 0 : editData.question_title);
|
|
|
setChecked(editData === null || editData === void 0 ? void 0 : editData.is_ordered);
|
|
|
setScore(editData === null || editData === void 0 ? void 0 : editData.question_score);
|
|
|
var answer = editData === null || editData === void 0 ? void 0 : editData.standard_answer.map(function (item) {
|
|
|
return item.answer_text;
|
|
|
});
|
|
|
setAnswerList(answer);
|
|
|
}, [problemset.editData]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
setFirstSetAnswerFlag(false);
|
|
|
}, [isEdit]);
|
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, function () {
|
|
|
return {
|
|
|
onSave: onSave,
|
|
|
isEdit: isEdit
|
|
|
};
|
|
|
});
|
|
|
var onSave = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var answerArray, isEmpty, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
answerArray = [];
|
|
|
isEmpty = false;
|
|
|
answerList.forEach(function (answers, index) {
|
|
|
answerArray.push({
|
|
|
choice_id: index + 1,
|
|
|
answer_text: []
|
|
|
});
|
|
|
answers.forEach(function (item, itemIndex) {
|
|
|
answerArray[index].answer_text.push(item);
|
|
|
if (!item || !(0,util/* validateLength */.eR)(item, 10000)) {
|
|
|
setActiveOptionErrorIndex("".concat(index, "-").concat(itemIndex));
|
|
|
message/* default */.ZP.info(!item ? "\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A" : "答案不能超过10000字符");
|
|
|
isEmpty = true;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
if (!isEmpty) {
|
|
|
_context.next = 5;
|
|
|
break;
|
|
|
}
|
|
|
return _context.abrupt("return", false);
|
|
|
case 5:
|
|
|
if (!editData.question_id) {
|
|
|
_context.next = 11;
|
|
|
break;
|
|
|
}
|
|
|
_context.next = 8;
|
|
|
return (0,service_polls/* putExerciseBankQuestions */.Kc)({
|
|
|
"id": editData.question_id,
|
|
|
"question_title": title,
|
|
|
"question_type": 3,
|
|
|
"question_score": score,
|
|
|
"is_ordered": checked,
|
|
|
"standard_answers": answerArray
|
|
|
});
|
|
|
case 8:
|
|
|
res = _context.sent;
|
|
|
_context.next = 14;
|
|
|
break;
|
|
|
case 11:
|
|
|
_context.next = 13;
|
|
|
return (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
|
|
|
});
|
|
|
case 13:
|
|
|
res = _context.sent;
|
|
|
case 14:
|
|
|
if (res.status === 0) {
|
|
|
message/* default */.ZP.success("保存成功");
|
|
|
setIsEdit(false);
|
|
|
}
|
|
|
dispatch({
|
|
|
type: "polls/getExerciseBanks",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
return _context.abrupt("return", {
|
|
|
name: title,
|
|
|
analysis: analysis,
|
|
|
standard_answers: answerArray,
|
|
|
is_ordered: checked
|
|
|
});
|
|
|
case 17:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function onSave() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handlePlaceholderChange = function handlePlaceholderChange(placeholderCountBefore, placeholderCountInRange, totalPlaceholderCount) {
|
|
|
var newStandardAnswers = answerList.slice();
|
|
|
if (placeholderCountInRange) {
|
|
|
newStandardAnswers.splice(placeholderCountBefore, placeholderCountInRange);
|
|
|
}
|
|
|
if (totalPlaceholderCount && firstSetAnswerFlag) {
|
|
|
for (var i = 0; i < totalPlaceholderCount; i++) {
|
|
|
newStandardAnswers.splice(placeholderCountBefore + i, 0, [""]);
|
|
|
}
|
|
|
}
|
|
|
setFirstSetAnswerFlag(true);
|
|
|
setAnswerList(newStandardAnswers);
|
|
|
};
|
|
|
var handleAnswerChange = function handleAnswerChange(index, itemIndex, val) {
|
|
|
setActiveOptionErrorIndex('');
|
|
|
var newStandardAnswers = answerList.slice();
|
|
|
newStandardAnswers[index][itemIndex] = val;
|
|
|
setAnswerList(newStandardAnswers);
|
|
|
};
|
|
|
var handleAddChildAnswer = function handleAddChildAnswer(index) {
|
|
|
var newStandardAnswers = answerList.slice();
|
|
|
newStandardAnswers[index] = [].concat(toConsumableArray_default()(newStandardAnswers[index]), ['']);
|
|
|
setAnswerList(newStandardAnswers);
|
|
|
};
|
|
|
var handleDeleteChildAnswer = function handleDeleteChildAnswer(index, childIndex) {
|
|
|
var newStandardAnswers = answerList.slice();
|
|
|
if (!newStandardAnswers[index][childIndex]) {
|
|
|
newStandardAnswers[index] = newStandardAnswers[index].filter(function (_, key) {
|
|
|
return key !== childIndex;
|
|
|
});
|
|
|
setAnswerList(newStandardAnswers);
|
|
|
return;
|
|
|
}
|
|
|
modal/* default */.Z.confirm({
|
|
|
centered: true,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
title: '提示',
|
|
|
content: '确认要删除这个参考答案吗?',
|
|
|
className: editormodules.modal,
|
|
|
onOk: function onOk() {
|
|
|
newStandardAnswers[index] = newStandardAnswers[index].filter(function (_, key) {
|
|
|
return key !== childIndex;
|
|
|
});
|
|
|
setAnswerList(newStandardAnswers);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
var handleDeleteChildAnswermain = function handleDeleteChildAnswermain(index) {
|
|
|
modal/* default */.Z.confirm({
|
|
|
centered: true,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
title: '提示',
|
|
|
content: '确认要删除这个参考答案吗?',
|
|
|
className: editormodules.modal,
|
|
|
onOk: function onOk() {
|
|
|
var newStandardAnswers = answerList.slice();
|
|
|
newStandardAnswers = answerList.filter(function (_, key) {
|
|
|
return index !== key;
|
|
|
});
|
|
|
setAnswerList(newStandardAnswers);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
var showEdit = function showEdit() {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: editormodules.questionType,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font16 c-blue",
|
|
|
children: "\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__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(NullMDEditor/* default */.Z, {
|
|
|
id: "completion-question-tittle",
|
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u76EE",
|
|
|
height: 155,
|
|
|
defaultValue: title,
|
|
|
onChange: function onChange(value) {
|
|
|
return setTitle(value);
|
|
|
},
|
|
|
showNullButton: true,
|
|
|
onPlaceholderChange: handlePlaceholderChange
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt20",
|
|
|
children: answerList.map(function (answers, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(NullChildEditor/* default */.Z, {
|
|
|
answers: answers,
|
|
|
index: index,
|
|
|
is_md: true,
|
|
|
activeOptionErrorIndex: activeOptionErrorIndex,
|
|
|
onAnswerChange: handleAnswerChange,
|
|
|
addChildAnswer: handleAddChildAnswer,
|
|
|
deleteChildAnswer: handleDeleteChildAnswer,
|
|
|
deleteChildAnswermain: handleDeleteChildAnswermain
|
|
|
}, index);
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt20",
|
|
|
children: answerList.length > 1 && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
checked: checked,
|
|
|
onChange: function onChange(e) {
|
|
|
return setChecked(e.target.checked);
|
|
|
},
|
|
|
className: "".concat(editormodules.color333, " font14"),
|
|
|
children: "\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "".concat(editormodules.color999, " font12"),
|
|
|
children: "\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
className: "",
|
|
|
children: ["\u5206\u503C\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
value: score,
|
|
|
max: 10000,
|
|
|
min: -1,
|
|
|
onChange: function onChange(value) {
|
|
|
setScore(value);
|
|
|
}
|
|
|
}), " \u5206"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
className: "tr",
|
|
|
children: [editData.question_id && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "default",
|
|
|
onClick: function onClick() {
|
|
|
return setIsEdit(false);
|
|
|
},
|
|
|
children: "\u53D6\u6D88"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
className: "ml20",
|
|
|
type: "primary",
|
|
|
onClick: function onClick() {
|
|
|
return onSave();
|
|
|
},
|
|
|
children: "\u4FDD\u5B58"
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var actionArr = [{
|
|
|
name: "删除",
|
|
|
icon: "iconfont c-light-black ml30 icon-shanchu",
|
|
|
id: "del"
|
|
|
}, {
|
|
|
name: "上移",
|
|
|
icon: "iconfont c-green ml30 icon-shangyi_Hover",
|
|
|
id: "up"
|
|
|
}, {
|
|
|
name: "下移",
|
|
|
icon: "iconfont c-green ml30 icon-xiayi_moren",
|
|
|
id: "down"
|
|
|
}, {
|
|
|
name: "编辑",
|
|
|
icon: "iconfont c-green ml30 icon-bianjishijuan3x",
|
|
|
id: "edit"
|
|
|
}];
|
|
|
var actionClick = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(item) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
_context3.t0 = item.id;
|
|
|
_context3.next = _context3.t0 === "del" ? 3 : _context3.t0 === "up" ? 5 : _context3.t0 === "down" ? 5 : _context3.t0 === "edit" ? 9 : 11;
|
|
|
break;
|
|
|
case 3:
|
|
|
modal/* default */.Z.confirm({
|
|
|
centered: true,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
title: '确认要删除这个问题吗?',
|
|
|
onOk: function onOk() {
|
|
|
return asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.next = 2;
|
|
|
return (0,service_polls/* deleteExerciseBanksQuestion */.x$)({
|
|
|
pollsId: editData.question_id
|
|
|
});
|
|
|
case 2:
|
|
|
dispatch({
|
|
|
type: "polls/getExerciseBanks",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}))();
|
|
|
}
|
|
|
});
|
|
|
return _context3.abrupt("break", 11);
|
|
|
case 5:
|
|
|
_context3.next = 7;
|
|
|
return (0,service_polls/* exercisesBanksMoveUpDown */.W)({
|
|
|
exerciseId: editData === null || editData === void 0 ? void 0 : editData.question_id,
|
|
|
opr: item.id
|
|
|
});
|
|
|
case 7:
|
|
|
dispatch({
|
|
|
type: "polls/getExerciseBanks",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
return _context3.abrupt("break", 11);
|
|
|
case 9:
|
|
|
setIsEdit(true);
|
|
|
return _context3.abrupt("break", 11);
|
|
|
case 11:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return function actionClick(_x) {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var showList = function showList() {
|
|
|
var _editData$standard_an;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: editormodules.questionType,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font16 c-blue",
|
|
|
children: [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__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
placement: "bottom",
|
|
|
title: item.name,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onClick: function onClick() {
|
|
|
return actionClick(item);
|
|
|
},
|
|
|
className: item.icon
|
|
|
})
|
|
|
}, index);
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt5",
|
|
|
children: editData.question_title
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: editormodules.questionChoices,
|
|
|
children: editData === null || editData === void 0 || (_editData$standard_an = editData.standard_answer) === null || _editData$standard_an === void 0 ? void 0 : _editData$standard_an.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: ["\u7B54\u6848\uFF08\u586B\u7A7A", item.choice_id, "\uFF09\uFF1A"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
checked: editData.standard_answer.includes(index),
|
|
|
disabled: true,
|
|
|
value: item.answer_text
|
|
|
}, index)
|
|
|
})]
|
|
|
});
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: editormodules.wrap,
|
|
|
children: [!isEdit && showList(), isEdit && showEdit()]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_CompletionEditor = ((0,_umi_production_exports.connect)(function (_ref4) {
|
|
|
var problemset = _ref4.problemset,
|
|
|
loading = _ref4.loading,
|
|
|
globalSetting = _ref4.globalSetting;
|
|
|
return {
|
|
|
problemset: problemset,
|
|
|
globalSetting: globalSetting,
|
|
|
loading: loading.effects
|
|
|
};
|
|
|
}, null, null, {
|
|
|
forwardRef: true
|
|
|
})( /*#__PURE__*/(0,_react_17_0_2_react.forwardRef)(CompletionEditor)));
|
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Edit/components/SubjectiveEditor/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var SubjectiveEditor_excluded = ["problemset", "globalSetting", "loading", "dispatch", "onRef", "editData"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var 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']));
|
|
|
var SubjectiveEditor = function SubjectiveEditor(_ref, ref) {
|
|
|
var problemset = _ref.problemset,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
dispatch = _ref.dispatch,
|
|
|
_ref$onRef = _ref.onRef,
|
|
|
onRef = _ref$onRef === void 0 ? function () {} : _ref$onRef,
|
|
|
editData = _ref.editData,
|
|
|
props = objectWithoutProperties_default()(_ref, SubjectiveEditor_excluded);
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
title = _useState2[0],
|
|
|
setTitle = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
analysis = _useState4[0],
|
|
|
setAnalysis = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
answer = _useState6[0],
|
|
|
setAnswer = _useState6[1];
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)(5),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
score = _useState8[0],
|
|
|
setScore = _useState8[1];
|
|
|
var _useState9 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
isEdit = _useState10[0],
|
|
|
setIsEdit = _useState10[1];
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var _editData$standard_an;
|
|
|
if (!(editData !== null && editData !== void 0 && editData.question_title)) {
|
|
|
setIsEdit(true);
|
|
|
return;
|
|
|
}
|
|
|
setTitle(editData === null || editData === void 0 ? void 0 : editData.question_title);
|
|
|
setAnswer(editData === null || editData === void 0 || (_editData$standard_an = editData.standard_answer) === null || _editData$standard_an === void 0 ? void 0 : _editData$standard_an[0]);
|
|
|
setScore(editData === null || editData === void 0 ? void 0 : editData.question_score);
|
|
|
}, [problemset.editData]);
|
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, function () {
|
|
|
return {
|
|
|
onSave: onSave,
|
|
|
isEdit: isEdit
|
|
|
};
|
|
|
});
|
|
|
var onSave = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
if (title) {
|
|
|
_context.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.info("请您输入题干");
|
|
|
return _context.abrupt("return", false);
|
|
|
case 3:
|
|
|
if (!editData.question_id) {
|
|
|
_context.next = 9;
|
|
|
break;
|
|
|
}
|
|
|
_context.next = 6;
|
|
|
return (0,service_polls/* putExerciseBankQuestions */.Kc)({
|
|
|
"id": editData.question_id,
|
|
|
"question_title": title,
|
|
|
"question_type": 4,
|
|
|
"question_score": score,
|
|
|
"standard_answers": [answer]
|
|
|
});
|
|
|
case 6:
|
|
|
res = _context.sent;
|
|
|
_context.next = 12;
|
|
|
break;
|
|
|
case 9:
|
|
|
_context.next = 11;
|
|
|
return (0,service_polls/* addExerciseBankQuestions */.iV)({
|
|
|
"exercise_bank_id": params.topicId,
|
|
|
"question_title": title,
|
|
|
"question_type": 4,
|
|
|
"question_score": score,
|
|
|
"standard_answers": [answer]
|
|
|
});
|
|
|
case 11:
|
|
|
res = _context.sent;
|
|
|
case 12:
|
|
|
if (res.status === 0) {
|
|
|
message/* default */.ZP.success("保存成功");
|
|
|
setIsEdit(false);
|
|
|
dispatch({
|
|
|
type: "polls/getExerciseBanks",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
}
|
|
|
return _context.abrupt("return", {
|
|
|
name: title,
|
|
|
answer_texts: [answer],
|
|
|
analysis: analysis
|
|
|
});
|
|
|
case 14:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function onSave() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var showEdit = function showEdit() {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: editormodules.questionType,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font16 c-blue",
|
|
|
children: "\u753B\u56FE\u9898"
|
|
|
}), "\uFF08\u4E3B\u89C2\u9898\uFF0C\u672A\u4F5C\u7B54\u7684\u60C5\u51B5\u4E0B\u81EA\u52A8\u8BC4\u4E3A\u96F6\u5206\uFF09"]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
id: "single-question-title",
|
|
|
watch: true,
|
|
|
height: 155,
|
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",
|
|
|
defaultValue: title,
|
|
|
onChange: function onChange(value) {
|
|
|
return setTitle(value);
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: editormodules.titleWrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: editormodules.title,
|
|
|
children: "\u53C2\u8003\u7B54\u6848\uFF1A"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(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: function onChange(value) {
|
|
|
return setAnswer(value);
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
className: "",
|
|
|
children: ["\u5206\u503C\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
value: score,
|
|
|
max: 10000,
|
|
|
min: -1,
|
|
|
onChange: function onChange(value) {
|
|
|
setScore(value);
|
|
|
}
|
|
|
}), " \u5206"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
className: "tr",
|
|
|
children: [editData.question_id && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "default",
|
|
|
onClick: function onClick() {
|
|
|
return setIsEdit(false);
|
|
|
},
|
|
|
children: "\u53D6\u6D88"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
className: "ml20",
|
|
|
type: "primary",
|
|
|
onClick: function onClick() {
|
|
|
return onSave();
|
|
|
},
|
|
|
children: "\u4FDD\u5B58"
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var actionArr = [{
|
|
|
name: "删除",
|
|
|
icon: "iconfont c-light-black ml30 icon-shanchu",
|
|
|
id: "del"
|
|
|
}, {
|
|
|
name: "上移",
|
|
|
icon: "iconfont c-green ml30 icon-shangyi_Hover",
|
|
|
id: "up"
|
|
|
}, {
|
|
|
name: "下移",
|
|
|
icon: "iconfont c-green ml30 icon-xiayi_moren",
|
|
|
id: "down"
|
|
|
}, {
|
|
|
name: "编辑",
|
|
|
icon: "iconfont c-green ml30 icon-bianjishijuan3x",
|
|
|
id: "edit"
|
|
|
}];
|
|
|
var actionClick = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(item) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
_context3.t0 = item.id;
|
|
|
_context3.next = _context3.t0 === "del" ? 3 : _context3.t0 === "up" ? 5 : _context3.t0 === "down" ? 5 : _context3.t0 === "edit" ? 9 : 11;
|
|
|
break;
|
|
|
case 3:
|
|
|
modal/* default */.Z.confirm({
|
|
|
centered: true,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
title: '确认要删除这个问题吗?',
|
|
|
onOk: function onOk() {
|
|
|
return asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.next = 2;
|
|
|
return (0,service_polls/* deleteExerciseBanksQuestion */.x$)({
|
|
|
pollsId: editData.question_id
|
|
|
});
|
|
|
case 2:
|
|
|
dispatch({
|
|
|
type: "polls/getExerciseBanks",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}))();
|
|
|
}
|
|
|
});
|
|
|
return _context3.abrupt("break", 11);
|
|
|
case 5:
|
|
|
_context3.next = 7;
|
|
|
return (0,service_polls/* exercisesBanksMoveUpDown */.W)({
|
|
|
exerciseId: editData === null || editData === void 0 ? void 0 : editData.question_id,
|
|
|
opr: item.id
|
|
|
});
|
|
|
case 7:
|
|
|
dispatch({
|
|
|
type: "polls/getExerciseBanks",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
return _context3.abrupt("break", 11);
|
|
|
case 9:
|
|
|
setIsEdit(true);
|
|
|
return _context3.abrupt("break", 11);
|
|
|
case 11:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return function actionClick(_x) {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var showList = function showList() {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: editormodules.questionType,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font16 c-blue",
|
|
|
children: [editData.key, "\u3001\u753B\u56FE\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__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
placement: "bottom",
|
|
|
title: item.name,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onClick: function onClick() {
|
|
|
return actionClick(item);
|
|
|
},
|
|
|
className: item.icon
|
|
|
})
|
|
|
}, index);
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt5",
|
|
|
children: editData.question_title
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: editormodules.questionChoices,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("strong", {
|
|
|
children: "\u53C2\u8003\u7B54\u6848\uFF1A"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: answer
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: editormodules.wrap,
|
|
|
children: [!isEdit && showList(), isEdit && showEdit()]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_SubjectiveEditor = ((0,_umi_production_exports.connect)(function (_ref4) {
|
|
|
var problemset = _ref4.problemset,
|
|
|
loading = _ref4.loading,
|
|
|
globalSetting = _ref4.globalSetting;
|
|
|
return {
|
|
|
problemset: problemset,
|
|
|
globalSetting: globalSetting,
|
|
|
loading: loading.effects
|
|
|
};
|
|
|
}, null, null, {
|
|
|
forwardRef: true
|
|
|
})( /*#__PURE__*/(0,_react_17_0_2_react.forwardRef)(SubjectiveEditor)));
|
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Edit/components/ShixunEditor/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ShixunEditor_excluded = ["problemset", "globalSetting", "loading", "dispatch", "editData"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var 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']));
|
|
|
var ShixunEditor = function ShixunEditor(_ref, ref) {
|
|
|
var problemset = _ref.problemset,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
dispatch = _ref.dispatch,
|
|
|
editData = _ref.editData,
|
|
|
props = objectWithoutProperties_default()(_ref, ShixunEditor_excluded);
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
name = _useState2[0],
|
|
|
setName = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
title = _useState4[0],
|
|
|
setTitle = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
analysis = _useState6[0],
|
|
|
setAnalysis = _useState6[1];
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
answerList = _useState8[0],
|
|
|
setAnswerList = _useState8[1];
|
|
|
var _useState9 = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
activeOptionErrorIndex = _useState10[0],
|
|
|
setActiveOptionErrorIndex = _useState10[1];
|
|
|
var _useState11 = (0,_react_17_0_2_react.useState)(),
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
checked = _useState12[0],
|
|
|
setChecked = _useState12[1];
|
|
|
var _useState13 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState14 = slicedToArray_default()(_useState13, 2),
|
|
|
firstSetAnswerFlag = _useState14[0],
|
|
|
setFirstSetAnswerFlag = _useState14[1];
|
|
|
var _useState15 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState16 = slicedToArray_default()(_useState15, 2),
|
|
|
score = _useState16[0],
|
|
|
setScore = _useState16[1];
|
|
|
var _useState17 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState18 = slicedToArray_default()(_useState17, 2),
|
|
|
isEdit = _useState18[0],
|
|
|
setIsEdit = _useState18[1];
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var _editData$shixun;
|
|
|
if (editData.edit) {
|
|
|
setIsEdit(true);
|
|
|
}
|
|
|
setName(editData.shixun_name);
|
|
|
setTitle(editData.question_title);
|
|
|
var arr = [];
|
|
|
(_editData$shixun = editData.shixun) === null || _editData$shixun === void 0 || _editData$shixun.map(function (item) {
|
|
|
arr.push(item.challenge_score);
|
|
|
});
|
|
|
setScore(arr);
|
|
|
}, [editData]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
setFirstSetAnswerFlag(false);
|
|
|
}, [isEdit]);
|
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, function () {
|
|
|
return {
|
|
|
onSave: onSave,
|
|
|
isEdit: isEdit
|
|
|
};
|
|
|
});
|
|
|
var onSave = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var answerArray, isEmpty, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
answerArray = [];
|
|
|
isEmpty = false;
|
|
|
if (!isEmpty) {
|
|
|
_context.next = 4;
|
|
|
break;
|
|
|
}
|
|
|
return _context.abrupt("return", false);
|
|
|
case 4:
|
|
|
if (!editData.question_id) {
|
|
|
_context.next = 10;
|
|
|
break;
|
|
|
}
|
|
|
_context.next = 7;
|
|
|
return (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
|
|
|
});
|
|
|
case 7:
|
|
|
res = _context.sent;
|
|
|
_context.next = 13;
|
|
|
break;
|
|
|
case 10:
|
|
|
_context.next = 12;
|
|
|
return (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
|
|
|
});
|
|
|
case 12:
|
|
|
res = _context.sent;
|
|
|
case 13:
|
|
|
if (res.status === 0) {
|
|
|
message/* default */.ZP.success("保存成功");
|
|
|
setIsEdit(false);
|
|
|
}
|
|
|
_context.next = 16;
|
|
|
return dispatch({
|
|
|
type: "polls/getExerciseBanks",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
case 16:
|
|
|
return _context.abrupt("return", {
|
|
|
name: title,
|
|
|
analysis: analysis,
|
|
|
standard_answers: answerArray,
|
|
|
is_ordered: checked
|
|
|
});
|
|
|
case 17:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function onSave() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var showEdit = function showEdit() {
|
|
|
var _editData$shixun2;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: editormodules.questionType,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font16 c-blue",
|
|
|
children: "\u5B9E\u8BAD\u9898"
|
|
|
}), "\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u5141\u8BB8\u624B\u52A8\u8C03\u5206\uFF09"]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt10",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
defaultValue: name,
|
|
|
onChange: function onChange(e) {
|
|
|
;
|
|
|
setName(e.target.value);
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt10",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(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: function onChange(value) {
|
|
|
setTitle(value);
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt20",
|
|
|
children: (_editData$shixun2 = editData.shixun) === null || _editData$shixun2 === void 0 ? void 0 : _editData$shixun2.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
gutter: [20, 20],
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
children: [index + 1, ".", item.challenge_name]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
defaultValue: score[index],
|
|
|
onChange: function onChange(value) {
|
|
|
score[index] = value;
|
|
|
setScore(score);
|
|
|
console.log("srore:L", score[index]);
|
|
|
}
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt20",
|
|
|
children: answerList.length > 1 && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
checked: checked,
|
|
|
onChange: function onChange(e) {
|
|
|
return setChecked(e.target.checked);
|
|
|
},
|
|
|
className: "".concat(editormodules.color333, " font14"),
|
|
|
children: "\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "".concat(editormodules.color999, " font12"),
|
|
|
children: "\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
className: "tr",
|
|
|
children: [!(editData !== null && editData !== void 0 && editData.edit) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "default",
|
|
|
onClick: function onClick() {
|
|
|
return setIsEdit(false);
|
|
|
},
|
|
|
children: "\u53D6\u6D88"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
className: "ml20",
|
|
|
type: "primary",
|
|
|
onClick: function onClick() {
|
|
|
return onSave();
|
|
|
},
|
|
|
children: "\u4FDD\u5B58"
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var actionArr = [{
|
|
|
name: "删除",
|
|
|
icon: "iconfont c-light-black ml30 icon-shanchu",
|
|
|
id: "del"
|
|
|
}, {
|
|
|
name: "上移",
|
|
|
icon: "iconfont c-green ml30 icon-shangyi_Hover",
|
|
|
id: "up"
|
|
|
}, {
|
|
|
name: "下移",
|
|
|
icon: "iconfont c-green ml30 icon-xiayi_moren",
|
|
|
id: "down"
|
|
|
}, {
|
|
|
name: "编辑",
|
|
|
icon: "iconfont c-green ml30 icon-bianjishijuan3x",
|
|
|
id: "edit"
|
|
|
}];
|
|
|
var actionClick = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(item) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
_context3.t0 = item.id;
|
|
|
_context3.next = _context3.t0 === "del" ? 3 : _context3.t0 === "up" ? 5 : _context3.t0 === "down" ? 5 : _context3.t0 === "edit" ? 9 : 11;
|
|
|
break;
|
|
|
case 3:
|
|
|
modal/* default */.Z.confirm({
|
|
|
centered: true,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
title: '确认要删除这个问题吗?',
|
|
|
onOk: function onOk() {
|
|
|
return asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.next = 2;
|
|
|
return (0,service_polls/* deleteExerciseBanksQuestion */.x$)({
|
|
|
pollsId: editData.question_id
|
|
|
});
|
|
|
case 2:
|
|
|
dispatch({
|
|
|
type: "polls/getExerciseBanks",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}))();
|
|
|
}
|
|
|
});
|
|
|
return _context3.abrupt("break", 11);
|
|
|
case 5:
|
|
|
_context3.next = 7;
|
|
|
return (0,service_polls/* exercisesBanksMoveUpDown */.W)({
|
|
|
exerciseId: editData === null || editData === void 0 ? void 0 : editData.question_id,
|
|
|
opr: item.id
|
|
|
});
|
|
|
case 7:
|
|
|
dispatch({
|
|
|
type: "polls/getExerciseBanks",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
return _context3.abrupt("break", 11);
|
|
|
case 9:
|
|
|
setIsEdit(true);
|
|
|
return _context3.abrupt("break", 11);
|
|
|
case 11:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return function actionClick(_x) {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var showList = function showList() {
|
|
|
var _editData$shixun3;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: editormodules.questionType,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font16 c-blue",
|
|
|
children: [editData.key, "\u3001\u5B9E\u8BAD\u9898"]
|
|
|
}), "\uFF08", editData.question_score, "\u5206\uFF09"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "tr",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
|
target: "_blank",
|
|
|
to: "/shixuns/".concat(editData.shixun_identifier, "/challenges"),
|
|
|
children: "\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__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
placement: "bottom",
|
|
|
title: item.name,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onClick: function onClick() {
|
|
|
return actionClick(item);
|
|
|
},
|
|
|
className: item.icon
|
|
|
})
|
|
|
}, index);
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "font16",
|
|
|
children: editData.shixun_name
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt30"
|
|
|
}), (_editData$shixun3 = editData.shixun) === null || _editData$shixun3 === void 0 ? void 0 : _editData$shixun3.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u7B2C", index + 1, "\u5173 ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "ml10",
|
|
|
children: item.challenge_name
|
|
|
}), " ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "ml10",
|
|
|
children: item.challenge_score
|
|
|
})]
|
|
|
}, index);
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: editormodules.wrap,
|
|
|
children: [!isEdit && showList(), isEdit && showEdit()]
|
|
|
});
|
|
|
};
|
|
|
// export default connect(
|
|
|
// ({
|
|
|
// problemset,
|
|
|
// loading,
|
|
|
// globalSetting,
|
|
|
// }: {
|
|
|
// problemset: ProblemsetModelState;
|
|
|
// loading: Loading;
|
|
|
// globalSetting: GlobalSettingModelState;
|
|
|
// }) => ({
|
|
|
// problemset,
|
|
|
// globalSetting,
|
|
|
// loading: loading.effects,
|
|
|
// }),
|
|
|
// )(ShixunEditor);
|
|
|
/* harmony default export */ var components_ShixunEditor = ((0,_umi_production_exports.connect)(function (_ref4) {
|
|
|
var problemset = _ref4.problemset,
|
|
|
loading = _ref4.loading,
|
|
|
globalSetting = _ref4.globalSetting;
|
|
|
return {
|
|
|
problemset: problemset,
|
|
|
globalSetting: globalSetting,
|
|
|
loading: loading.effects
|
|
|
};
|
|
|
}, null, null, {
|
|
|
forwardRef: true
|
|
|
})( /*#__PURE__*/(0,_react_17_0_2_react.forwardRef)(ShixunEditor)));
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/drawer/index.js + 9 modules
|
|
|
var drawer = __webpack_require__(43428);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/pagination/index.js + 10 modules
|
|
|
var pagination = __webpack_require__(58421);
|
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Edit/components/SelectShixuns/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var SelectShixunsmodules = ({"flex_box_center":"flex_box_center___hUmFx","flex_space_between":"flex_space_between___ZQWRF","flex_box_vertical_center":"flex_box_vertical_center___NvFWH","flex_box_center_end":"flex_box_center_end___VzfH9","flex_box_column":"flex_box_column___jzLHY","flex-col":"flex-col___UoBvF","flex-row":"flex-row___v0vsm","justify-start":"justify-start___dB33j","justify-center":"justify-center___IiOsq","justify-end":"justify-end___pvtmY","justify-evenly":"justify-evenly___XK2hT","justify-around":"justify-around___t0Pyz","justify-between":"justify-between___qQbms","align-start":"align-start___jjhYs","align-center":"align-center___ZILc3","align-end":"align-end___iVZdh","wrp":"wrp___tA5YW","drawer":"drawer___aMsAr","menu":"menu___EdF6h","actived":"actived___rUgO6","actived2":"actived2___ENpPA","listItem":"listItem___Ixzli","info":"info___KHkuz","title":"title___pDJPn","titleLeft":"titleLeft___UBBKz","titleRight":"titleRight___WrCz9","search":"search___AEwRm","description":"description___CYPQc","menuCourse":"menuCourse___gwZ0E"});
|
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Edit/components/SelectShixuns/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Search = input/* default */.Z.Search;
|
|
|
var shixunFilter = [{
|
|
|
id: "type",
|
|
|
name: "筛选",
|
|
|
children: [{
|
|
|
name: "全部实训",
|
|
|
id: "all",
|
|
|
type: "type"
|
|
|
}, {
|
|
|
name: "我的实训",
|
|
|
id: "mine",
|
|
|
type: "type"
|
|
|
}]
|
|
|
}, {
|
|
|
id: "diff",
|
|
|
name: "难度",
|
|
|
children: [{
|
|
|
name: "全部",
|
|
|
id: "",
|
|
|
type: "diff"
|
|
|
}, {
|
|
|
name: "初级",
|
|
|
id: 1,
|
|
|
type: "diff"
|
|
|
}, {
|
|
|
name: "中级",
|
|
|
id: 2,
|
|
|
type: "diff"
|
|
|
}, {
|
|
|
name: "中高级",
|
|
|
id: 3,
|
|
|
type: "diff"
|
|
|
}, {
|
|
|
name: "高级",
|
|
|
id: 4,
|
|
|
type: "diff"
|
|
|
}]
|
|
|
}];
|
|
|
var PublishShixun = function PublishShixun(_ref) {
|
|
|
var _shixunLists$shixun_l2;
|
|
|
var classroomList = _ref.classroomList,
|
|
|
loading = _ref.loading,
|
|
|
dispatch = _ref.dispatch,
|
|
|
callback = _ref.callback;
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var location = (0,_umi_production_exports.useLocation)();
|
|
|
var actionTabs = classroomList.actionTabs;
|
|
|
var _Form$useForm = es_form/* default */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
var shixunLists = classroomList.shixunLists;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
selectArrs = _useState2[0],
|
|
|
setSelectArrs = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)({
|
|
|
page: 1,
|
|
|
type: "all",
|
|
|
diff: "",
|
|
|
status: "published",
|
|
|
order: "desc",
|
|
|
limit: 20,
|
|
|
sort: "publish_time",
|
|
|
no_jupyter: 1
|
|
|
}),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
query = _useState4[0],
|
|
|
setQuery = _useState4[1];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
dispatch({
|
|
|
type: 'classroomList/getShixunLists',
|
|
|
payload: objectSpread2_default()({}, query)
|
|
|
});
|
|
|
}, [params.categoryId]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
setSelectArrs([]);
|
|
|
}, [classroomList.actionTabs.key]);
|
|
|
if (classroomList.actionTabs.key !== '选用实践项目') return null;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(drawer/* default */.Z, {
|
|
|
title: "\u9009\u7528\u5B9E\u8DF5\u9879\u76EE",
|
|
|
placement: "bottom",
|
|
|
height: "100%",
|
|
|
closable: false
|
|
|
// onClose={this.onClose}
|
|
|
,
|
|
|
open: classroomList.actionTabs.key === '选用实践项目' ? true : false,
|
|
|
rootClassName: SelectShixunsmodules.drawer,
|
|
|
footer: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "tc",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
size: 'middle',
|
|
|
onClick: function onClick() {
|
|
|
dispatch({
|
|
|
type: 'classroomList/setActionTabs',
|
|
|
payload: {
|
|
|
key: ''
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
style: {
|
|
|
marginRight: 8
|
|
|
},
|
|
|
children: "\u53D6\u6D88"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
size: 'middle',
|
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var _shixunLists$shixun_l;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
if (selectArrs.length > 1) {
|
|
|
message/* default */.ZP.error("只能选择一个实践项目");
|
|
|
} else if (selectArrs.length === 0) {
|
|
|
message/* default */.ZP.error("请选择实践项目");
|
|
|
} else {
|
|
|
callback && callback(shixunLists === null || shixunLists === void 0 || (_shixunLists$shixun_l = shixunLists.shixun_list) === null || _shixunLists$shixun_l === void 0 ? void 0 : _shixunLists$shixun_l.filter(function (item) {
|
|
|
return item.id === selectArrs[0];
|
|
|
})[0]);
|
|
|
dispatch({
|
|
|
type: 'classroomList/setActionTabs',
|
|
|
payload: {
|
|
|
key: ''
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
})),
|
|
|
type: "primary",
|
|
|
children: "\u786E\u5B9A"
|
|
|
})]
|
|
|
}),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
|
className: "tc",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(Search, {
|
|
|
placeholder: "\u5B9E\u8BAD\u4FE1\u606F/\u9662\u6821\u540D\u79F0/\u521B\u5EFA\u8005",
|
|
|
enterButton: "\u641C\u7D22",
|
|
|
size: 'middle',
|
|
|
className: SelectShixunsmodules.search,
|
|
|
onSearch: function onSearch(value) {
|
|
|
query.keyword = value;
|
|
|
dispatch({
|
|
|
type: 'classroomList/getShixunLists',
|
|
|
payload: objectSpread2_default()({}, query)
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: "edu-container",
|
|
|
children: [shixunFilter.map(function (v, k) {
|
|
|
var _v$children;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
|
className: SelectShixunsmodules.menu,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: v.name
|
|
|
}), v === null || v === void 0 || (_v$children = v.children) === null || _v$children === void 0 ? void 0 : _v$children.map(function (val, key) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
className: query[v.id] == val.id ? SelectShixunsmodules.actived : '',
|
|
|
onClick: function onClick() {
|
|
|
query[v.id] = val.id;
|
|
|
setQuery(objectSpread2_default()({}, query));
|
|
|
dispatch({
|
|
|
type: 'classroomList/getShixunLists',
|
|
|
payload: objectSpread2_default()({}, query)
|
|
|
});
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("strong", {
|
|
|
children: val.name
|
|
|
})
|
|
|
}, key);
|
|
|
})]
|
|
|
}, k);
|
|
|
}), shixunLists === null || shixunLists === void 0 || (_shixunLists$shixun_l2 = shixunLists.shixun_list) === null || _shixunLists$shixun_l2 === void 0 ? void 0 : _shixunLists$shixun_l2.map(function (v, k) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: SelectShixunsmodules.listItem,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
checked: selectArrs.includes(v.id),
|
|
|
value: v.id,
|
|
|
onChange: function onChange(e) {
|
|
|
var key = selectArrs.indexOf(v.id);
|
|
|
if (selectArrs.indexOf(v.id) > -1) {
|
|
|
setSelectArrs(selectArrs.filter(function (val) {
|
|
|
return val !== v.id;
|
|
|
}));
|
|
|
} else {
|
|
|
setSelectArrs(selectArrs.concat(v.id));
|
|
|
}
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: SelectShixunsmodules.info,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: SelectShixunsmodules.title,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: SelectShixunsmodules.titleLeft,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("strong", {
|
|
|
className: "font16",
|
|
|
dangerouslySetInnerHTML: {
|
|
|
__html: v.title
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "flex-wrp mt10 font14 c-light-black",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: SelectShixunsmodules.description,
|
|
|
dangerouslySetInnerHTML: {
|
|
|
__html: v.description
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: " mt15",
|
|
|
children: v.challenge_names.map(function (val, key) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "mr30",
|
|
|
children: ["\u7B2C", key + 1, "\u5173 ", val, " "]
|
|
|
}, key);
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {
|
|
|
dashed: true
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "c-light-black mt20",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: v.author_name
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "ml15 mr15",
|
|
|
children: "|"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: v.author_school_name
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "ml15 mr15",
|
|
|
children: "|"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: ["\u96BE\u5EA6\u7CFB\u6570:", v.level]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "ml15 mr15",
|
|
|
children: "|"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u5B66\u4E60\u4EBA\u6570:"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: v.study_count
|
|
|
})]
|
|
|
})]
|
|
|
})]
|
|
|
}, k);
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "tc",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(pagination/* default */.Z, {
|
|
|
defaultCurrent: 1,
|
|
|
hideOnSinglePage: true,
|
|
|
defaultPageSize: 20,
|
|
|
showQuickJumper: true,
|
|
|
total: shixunLists === null || shixunLists === void 0 ? void 0 : shixunLists.shixuns_count,
|
|
|
onChange: function onChange(page) {
|
|
|
query.page = page;
|
|
|
setSelectArrs([]);
|
|
|
dispatch({
|
|
|
type: 'classroomList/getShixunLists',
|
|
|
payload: objectSpread2_default()({}, query)
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
})]
|
|
|
}, "bottom");
|
|
|
};
|
|
|
/* harmony default export */ var SelectShixuns = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
|
var classroomList = _ref3.classroomList,
|
|
|
loading = _ref3.loading;
|
|
|
return {
|
|
|
classroomList: classroomList,
|
|
|
loading: loading
|
|
|
};
|
|
|
})(PublishShixun));
|
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Edit/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var Editmodules = ({"flex_box_center":"flex_box_center___SQWFF","flex_space_between":"flex_space_between___CnFKV","flex_box_vertical_center":"flex_box_vertical_center___pIPP9","flex_box_center_end":"flex_box_center_end___wiYA8","flex_box_column":"flex_box_column___elCPc","flex-col":"flex-col___HcRYC","flex-row":"flex-row___G6mR4","justify-start":"justify-start___e3oTx","justify-center":"justify-center___DAi5u","justify-end":"justify-end___dTwG7","justify-evenly":"justify-evenly___fEOSr","justify-around":"justify-around___oadIL","justify-between":"justify-between___iryoQ","align-start":"align-start___XYrqV","align-center":"align-center___ElmOp","align-end":"align-end___zdWtw","bg":"bg___EaPuT","containerTitle":"containerTitle___ixpkx","containerDesc":"containerDesc___r2R0u","listItem":"listItem___jvD98","info":"info___dCwGz","title":"title___UW6TT","titleLeft":"titleLeft___MquHc","titleRight":"titleRight___aWhE3","acitons":"acitons___yle7y"});
|
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Edit/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Edit_excluded = ["polls", "globalSetting", "loading", "user", "dispatch"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// import MdEditor from '@/components/'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var SubMenu = menu/* default */.Z.SubMenu;
|
|
|
var Content = layout/* default */.Z.Content,
|
|
|
Sider = layout/* default */.Z.Sider;
|
|
|
var ShixunsListPage = function ShixunsListPage(_ref) {
|
|
|
var _polls$exerciseBanks6, _polls$exerciseBanks7, _polls$exerciseBanks8, _polls$exerciseBanks9, _polls$exerciseBanks10, _polls$exerciseBanks11, _polls$exerciseBanks12, _polls$exerciseBanks13, _polls$exerciseBanks14, _polls$exerciseBanks15, _polls$exerciseBanks16, _polls$exerciseBanks17, _polls$exerciseBanks18, _polls$exerciseBanks19, _polls$exerciseBanks20, _polls$exerciseBanks21, _polls$exerciseBanks22, _polls$exerciseBanks23, _polls$exerciseBanks24, _polls$exerciseBanks25, _polls$exerciseBanks26, _polls$exerciseBanks27, _polls$exerciseBanks28, _polls$exerciseBanks29, _polls$exerciseBanks30, _polls$exerciseBanks31, _polls$exerciseBanks32, _polls$exerciseBanks33;
|
|
|
var polls = _ref.polls,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
user = _ref.user,
|
|
|
dispatch = _ref.dispatch,
|
|
|
props = objectWithoutProperties_default()(_ref, Edit_excluded);
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var location = (0,_umi_production_exports.useLocation)();
|
|
|
var userInfo = user.userInfo;
|
|
|
var _Form$useForm = es_form/* default */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
editData = _useState2[0],
|
|
|
setEditData = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
isEdit = _useState4[0],
|
|
|
setIsEdit = _useState4[1];
|
|
|
var questionType = [{
|
|
|
name: "选择题",
|
|
|
id: 0
|
|
|
}, {
|
|
|
name: "判断题",
|
|
|
id: 2
|
|
|
}, {
|
|
|
name: "填空题",
|
|
|
id: 3
|
|
|
}, {
|
|
|
name: "画图题",
|
|
|
id: 4
|
|
|
}, {
|
|
|
name: "实训题",
|
|
|
id: 5
|
|
|
}];
|
|
|
var childrenRef = (0,_react_17_0_2_react.useRef)();
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var _polls$exerciseBanks;
|
|
|
if ((_polls$exerciseBanks = polls.exerciseBanks) !== null && _polls$exerciseBanks !== void 0 && _polls$exerciseBanks.exercise_questions) {
|
|
|
var _polls$exerciseBanks2, _polls$exerciseBanks3, _polls$exerciseBanks4;
|
|
|
setEditData(toConsumableArray_default()((_polls$exerciseBanks2 = polls.exerciseBanks) === null || _polls$exerciseBanks2 === void 0 ? void 0 : _polls$exerciseBanks2.exercise_questions));
|
|
|
form.setFieldsValue({
|
|
|
exercise_name: (_polls$exerciseBanks3 = polls.exerciseBanks) === null || _polls$exerciseBanks3 === void 0 || (_polls$exerciseBanks3 = _polls$exerciseBanks3.exercise) === null || _polls$exerciseBanks3 === void 0 ? void 0 : _polls$exerciseBanks3.exercise_name,
|
|
|
exercise_description: (_polls$exerciseBanks4 = polls.exerciseBanks) === null || _polls$exerciseBanks4 === void 0 || (_polls$exerciseBanks4 = _polls$exerciseBanks4.exercise) === null || _polls$exerciseBanks4 === void 0 ? void 0 : _polls$exerciseBanks4.exercise_description
|
|
|
});
|
|
|
}
|
|
|
}, [polls.exerciseBanks]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
dispatch({
|
|
|
type: "polls/getExerciseBanks",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
}, [params.categoryId]);
|
|
|
var save = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var _polls$exerciseBanks5;
|
|
|
var value;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return form.validateFields();
|
|
|
case 2:
|
|
|
value = form.getFieldValue();
|
|
|
value.is_md = true;
|
|
|
value.topicId = (_polls$exerciseBanks5 = polls.exerciseBanks) === null || _polls$exerciseBanks5 === void 0 || (_polls$exerciseBanks5 = _polls$exerciseBanks5.exercise) === null || _polls$exerciseBanks5 === void 0 ? void 0 : _polls$exerciseBanks5.id;
|
|
|
setIsEdit(false);
|
|
|
_context.next = 8;
|
|
|
return (0,service_polls/* putExerciseBanks */.hO)(objectSpread2_default()({}, value));
|
|
|
case 8:
|
|
|
dispatch({
|
|
|
type: "polls/getExerciseBanks",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
case 9:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function save() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var addQuestion = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(type) {
|
|
|
var d;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.next = 2;
|
|
|
return childrenRef === null || childrenRef === void 0 ? void 0 : childrenRef.current;
|
|
|
case 2:
|
|
|
d = _context2.sent;
|
|
|
if (!(d !== null && d !== void 0 && d.isEdit)) {
|
|
|
_context2.next = 6;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.error("不能同时编辑两题");
|
|
|
return _context2.abrupt("return");
|
|
|
case 6:
|
|
|
if (type === 5) {
|
|
|
dispatch({
|
|
|
type: "classroomList/setActionTabs",
|
|
|
payload: {
|
|
|
key: "选用实践项目"
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
setEditData([].concat(toConsumableArray_default()(editData), [{
|
|
|
question_type: type
|
|
|
}]));
|
|
|
}
|
|
|
case 7:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function addQuestion(_x) {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var renderQuestion = function renderQuestion() {
|
|
|
return editData === null || editData === void 0 ? void 0 : editData.map(function (v, k) {
|
|
|
v.key = k + 1;
|
|
|
v.len = editData.length;
|
|
|
if (v.question_type === 0) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(components_SingleEditor, {
|
|
|
ref: childrenRef,
|
|
|
editData: v
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {})]
|
|
|
});
|
|
|
}
|
|
|
if (v.question_type === 1) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(MultipleEditor, {
|
|
|
ref: childrenRef,
|
|
|
editData: v
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {})]
|
|
|
});
|
|
|
}
|
|
|
if (v.question_type === 2) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(components_JudgmentEditor, {
|
|
|
ref: childrenRef,
|
|
|
editData: v
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {})]
|
|
|
});
|
|
|
}
|
|
|
if (v.question_type === 3) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(components_CompletionEditor, {
|
|
|
editData: v
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {})]
|
|
|
});
|
|
|
}
|
|
|
if (v.question_type === 4) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(components_SubjectiveEditor, {
|
|
|
editData: v
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {})]
|
|
|
});
|
|
|
}
|
|
|
if (v.question_type === 5) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(components_ShixunEditor, {
|
|
|
editData: v
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {})]
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: "edu-container",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: "animated fadeIn",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
|
className: "mt10",
|
|
|
children: userInfo && /*#__PURE__*/(0,jsx_runtime.jsxs)(breadcrumb/* default */.Z, {
|
|
|
separator: ">",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
|
to: "/users/".concat(userInfo.login, "/topics/personal"),
|
|
|
children: "\u6211\u7684\u9898\u5E93"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
|
to: "/users/".concat(userInfo === null || userInfo === void 0 ? void 0 : userInfo.login, "/topics/").concat(params.topicId, "/").concat(params.topictype, "/exercise/detail"),
|
|
|
children: "\u8BE6\u60C5"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, {
|
|
|
children: "\u7F16\u8F91"
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
|
className: [Editmodules.title, 'mt20'].join(' '),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
style: {
|
|
|
width: "100%"
|
|
|
},
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("strong", {
|
|
|
className: "font20 ml5",
|
|
|
children: "\u7F16\u8F91\u8BD5\u5377"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(util/* StatusClassroomsTags */.VV, {
|
|
|
status: [(_polls$exerciseBanks6 = polls.exerciseBanks) !== null && _polls$exerciseBanks6 !== void 0 && (_polls$exerciseBanks6 = _polls$exerciseBanks6.exercise) !== null && _polls$exerciseBanks6 !== void 0 && _polls$exerciseBanks6.is_public ? "公开" : "私有"]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
|
className: "font16 c-light-black",
|
|
|
to: "/users/".concat(userInfo.login, "/topics/personal"),
|
|
|
children: "\u8FD4\u56DE"
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: [Editmodules.bg, 'pt30', 'pl30', 'pr30', 'pb30', 'mt20'].join(' '),
|
|
|
children: [!isEdit && /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Editmodules.containerDesc,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: (_polls$exerciseBanks7 = polls.exerciseBanks) === null || _polls$exerciseBanks7 === void 0 || (_polls$exerciseBanks7 = _polls$exerciseBanks7.exercise) === null || _polls$exerciseBanks7 === void 0 ? void 0 : _polls$exerciseBanks7.exercise_name
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u7F16\u8F91",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onClick: function onClick() {
|
|
|
return setIsEdit(true);
|
|
|
},
|
|
|
className: "iconfont c-green ml30 icon-bianjishijuan3x"
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "c-light-black",
|
|
|
children: (_polls$exerciseBanks8 = polls.exerciseBanks) === null || _polls$exerciseBanks8 === void 0 || (_polls$exerciseBanks8 = _polls$exerciseBanks8.exercise) === null || _polls$exerciseBanks8 === void 0 ? void 0 : _polls$exerciseBanks8.exercise_description
|
|
|
})]
|
|
|
}), isEdit && /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
|
|
|
layout: "vertical",
|
|
|
form: form,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "exercise_name",
|
|
|
label: "\u8BD5\u5377\u6807\u9898\uFF1A",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: "请填写试卷标题"
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
maxLength: 60,
|
|
|
placeholder: "\u8BD5\u5377\u6807\u9898\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
label: "\u8BD5\u5377\u987B\u77E5\uFF1A",
|
|
|
name: "exercise_description",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z.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__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
className: "tr",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "primary",
|
|
|
onClick: function onClick() {
|
|
|
save();
|
|
|
},
|
|
|
children: "\u4FDD\u5B58"
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
className: "mt10",
|
|
|
style: {
|
|
|
display: 'flex'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "fl",
|
|
|
style: {
|
|
|
flex: '1'
|
|
|
},
|
|
|
children: [!!((_polls$exerciseBanks9 = polls.exerciseBanks) !== null && _polls$exerciseBanks9 !== void 0 && (_polls$exerciseBanks9 = _polls$exerciseBanks9.exercise_types) !== null && _polls$exerciseBanks9 !== void 0 && _polls$exerciseBanks9.q_singles) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "ml20",
|
|
|
children: ["\u5355\u9009\u9898", (_polls$exerciseBanks10 = polls.exerciseBanks) === null || _polls$exerciseBanks10 === void 0 || (_polls$exerciseBanks10 = _polls$exerciseBanks10.exercise_types) === null || _polls$exerciseBanks10 === void 0 ? void 0 : _polls$exerciseBanks10.q_singles, "\u9898\uFF0C\u5171", (_polls$exerciseBanks11 = polls.exerciseBanks) === null || _polls$exerciseBanks11 === void 0 || (_polls$exerciseBanks11 = _polls$exerciseBanks11.exercise_types) === null || _polls$exerciseBanks11 === void 0 ? void 0 : _polls$exerciseBanks11.q_singles_scores, "\u5206"]
|
|
|
}), !!((_polls$exerciseBanks12 = polls.exerciseBanks) !== null && _polls$exerciseBanks12 !== void 0 && (_polls$exerciseBanks12 = _polls$exerciseBanks12.exercise_types) !== null && _polls$exerciseBanks12 !== void 0 && _polls$exerciseBanks12.q_doubles) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "ml20",
|
|
|
children: ["\u591A\u9009\u9898", (_polls$exerciseBanks13 = polls.exerciseBanks) === null || _polls$exerciseBanks13 === void 0 || (_polls$exerciseBanks13 = _polls$exerciseBanks13.exercise_types) === null || _polls$exerciseBanks13 === void 0 ? void 0 : _polls$exerciseBanks13.q_doubles, "\u9898\uFF0C\u5171", (_polls$exerciseBanks14 = polls.exerciseBanks) === null || _polls$exerciseBanks14 === void 0 || (_polls$exerciseBanks14 = _polls$exerciseBanks14.exercise_types) === null || _polls$exerciseBanks14 === void 0 ? void 0 : _polls$exerciseBanks14.q_doubles_scores, "\u5206"]
|
|
|
}), !!((_polls$exerciseBanks15 = polls.exerciseBanks) !== null && _polls$exerciseBanks15 !== void 0 && (_polls$exerciseBanks15 = _polls$exerciseBanks15.exercise_types) !== null && _polls$exerciseBanks15 !== void 0 && _polls$exerciseBanks15.q_judges) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "ml20",
|
|
|
children: ["\u5224\u65AD\u9898", (_polls$exerciseBanks16 = polls.exerciseBanks) === null || _polls$exerciseBanks16 === void 0 || (_polls$exerciseBanks16 = _polls$exerciseBanks16.exercise_types) === null || _polls$exerciseBanks16 === void 0 ? void 0 : _polls$exerciseBanks16.q_judges, "\u9898\uFF0C\u5171", (_polls$exerciseBanks17 = polls.exerciseBanks) === null || _polls$exerciseBanks17 === void 0 || (_polls$exerciseBanks17 = _polls$exerciseBanks17.exercise_types) === null || _polls$exerciseBanks17 === void 0 ? void 0 : _polls$exerciseBanks17.q_judges_scores, "\u5206"]
|
|
|
}), !!((_polls$exerciseBanks18 = polls.exerciseBanks) !== null && _polls$exerciseBanks18 !== void 0 && (_polls$exerciseBanks18 = _polls$exerciseBanks18.exercise_types) !== null && _polls$exerciseBanks18 !== void 0 && _polls$exerciseBanks18.q_nulls) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "ml20",
|
|
|
children: ["\u586B\u7A7A\u9898", (_polls$exerciseBanks19 = polls.exerciseBanks) === null || _polls$exerciseBanks19 === void 0 || (_polls$exerciseBanks19 = _polls$exerciseBanks19.exercise_types) === null || _polls$exerciseBanks19 === void 0 ? void 0 : _polls$exerciseBanks19.q_nulls, "\u9898\uFF0C\u5171", (_polls$exerciseBanks20 = polls.exerciseBanks) === null || _polls$exerciseBanks20 === void 0 || (_polls$exerciseBanks20 = _polls$exerciseBanks20.exercise_types) === null || _polls$exerciseBanks20 === void 0 ? void 0 : _polls$exerciseBanks20.q_nulls_scores, "\u5206"]
|
|
|
}), !!((_polls$exerciseBanks21 = polls.exerciseBanks) !== null && _polls$exerciseBanks21 !== void 0 && (_polls$exerciseBanks21 = _polls$exerciseBanks21.exercise_types) !== null && _polls$exerciseBanks21 !== void 0 && _polls$exerciseBanks21.q_mains) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "ml20",
|
|
|
children: ["\u753B\u56FE\u9898", (_polls$exerciseBanks22 = polls.exerciseBanks) === null || _polls$exerciseBanks22 === void 0 || (_polls$exerciseBanks22 = _polls$exerciseBanks22.exercise_types) === null || _polls$exerciseBanks22 === void 0 ? void 0 : _polls$exerciseBanks22.q_mains, "\u9898\uFF0C\u5171", (_polls$exerciseBanks23 = polls.exerciseBanks) === null || _polls$exerciseBanks23 === void 0 || (_polls$exerciseBanks23 = _polls$exerciseBanks23.exercise_types) === null || _polls$exerciseBanks23 === void 0 ? void 0 : _polls$exerciseBanks23.q_mains_scores, "\u5206"]
|
|
|
}), !!((_polls$exerciseBanks24 = polls.exerciseBanks) !== null && _polls$exerciseBanks24 !== void 0 && (_polls$exerciseBanks24 = _polls$exerciseBanks24.exercise_types) !== null && _polls$exerciseBanks24 !== void 0 && _polls$exerciseBanks24.q_shixuns) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "ml20",
|
|
|
children: ["\u5B9E\u8BAD\u9898", (_polls$exerciseBanks25 = polls.exerciseBanks) === null || _polls$exerciseBanks25 === void 0 || (_polls$exerciseBanks25 = _polls$exerciseBanks25.exercise_types) === null || _polls$exerciseBanks25 === void 0 ? void 0 : _polls$exerciseBanks25.q_shixuns, "\u9898\uFF0C\u5171", (_polls$exerciseBanks26 = polls.exerciseBanks) === null || _polls$exerciseBanks26 === void 0 || (_polls$exerciseBanks26 = _polls$exerciseBanks26.exercise_types) === null || _polls$exerciseBanks26 === void 0 ? void 0 : _polls$exerciseBanks26.q_shixuns_scores, "\u5206"]
|
|
|
}), !!((_polls$exerciseBanks27 = polls.exerciseBanks) !== null && _polls$exerciseBanks27 !== void 0 && (_polls$exerciseBanks27 = _polls$exerciseBanks27.exercise_types) !== null && _polls$exerciseBanks27 !== void 0 && _polls$exerciseBanks27.q_pros) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "ml20",
|
|
|
children: ["\u7F16\u7A0B\u9898", (_polls$exerciseBanks28 = polls.exerciseBanks) === null || _polls$exerciseBanks28 === void 0 || (_polls$exerciseBanks28 = _polls$exerciseBanks28.exercise_types) === null || _polls$exerciseBanks28 === void 0 ? void 0 : _polls$exerciseBanks28.q_pros, "\u9898\uFF0C\u5171", (_polls$exerciseBanks29 = polls.exerciseBanks) === null || _polls$exerciseBanks29 === void 0 || (_polls$exerciseBanks29 = _polls$exerciseBanks29.exercise_types) === null || _polls$exerciseBanks29 === void 0 ? void 0 : _polls$exerciseBanks29.q_pros_scores, "\u5206"]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "fr",
|
|
|
children: !!((_polls$exerciseBanks30 = polls.exerciseBanks) !== null && _polls$exerciseBanks30 !== void 0 && (_polls$exerciseBanks30 = _polls$exerciseBanks30.exercise_types) !== null && _polls$exerciseBanks30 !== void 0 && _polls$exerciseBanks30.q_counts) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: ["\u5408\u8BA1 ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "color-blue",
|
|
|
children: (_polls$exerciseBanks31 = polls.exerciseBanks) === null || _polls$exerciseBanks31 === void 0 || (_polls$exerciseBanks31 = _polls$exerciseBanks31.exercise_types) === null || _polls$exerciseBanks31 === void 0 ? void 0 : _polls$exerciseBanks31.q_counts
|
|
|
}), " \u9898\uFF0C \u5171 ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "".concat(((_polls$exerciseBanks32 = polls.exerciseBanks) === null || _polls$exerciseBanks32 === void 0 || (_polls$exerciseBanks32 = _polls$exerciseBanks32.exercise_types) === null || _polls$exerciseBanks32 === void 0 ? void 0 : _polls$exerciseBanks32.q_scores) > 100 ? 'color-red font-bd' : 'color-orange'),
|
|
|
children: (_polls$exerciseBanks33 = polls.exerciseBanks) === null || _polls$exerciseBanks33 === void 0 || (_polls$exerciseBanks33 = _polls$exerciseBanks33.exercise_types) === null || _polls$exerciseBanks33 === void 0 ? void 0 : _polls$exerciseBanks33.q_scores
|
|
|
}), " \u5206"]
|
|
|
})
|
|
|
})]
|
|
|
}), editData != '' && /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
|
className: [Editmodules.bg, 'pt30', 'pl20', 'pr20', 'pb20', 'mt20'].join(' '),
|
|
|
children: renderQuestion()
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
|
style: {
|
|
|
display: 'flex'
|
|
|
},
|
|
|
className: [Editmodules.bg, 'pt30', 'pl30', 'pr30', 'pb30', 'mt20'].join(' '),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
flex: '1'
|
|
|
},
|
|
|
children: questionType.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.ZP, {
|
|
|
className: "mr20",
|
|
|
type: "primary",
|
|
|
onClick: function onClick() {
|
|
|
return addQuestion(item.id);
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(PlusCircleOutlined/* default */.Z, {
|
|
|
className: "mr5"
|
|
|
}), item.name]
|
|
|
});
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(SelectShixuns, {
|
|
|
callback: function callback(data) {
|
|
|
editData.push({
|
|
|
shixun: data.challenge_names.map(function (item) {
|
|
|
return {
|
|
|
challenge_name: item,
|
|
|
challenge_score: 5
|
|
|
};
|
|
|
}),
|
|
|
shixun_name: data.title,
|
|
|
shixun_id: data.id,
|
|
|
question_type: 5,
|
|
|
edit: true
|
|
|
});
|
|
|
setEditData(toConsumableArray_default()(editData));
|
|
|
}
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var Edit = ((0,_umi_production_exports.connect)(function (_ref4) {
|
|
|
var polls = _ref4.polls,
|
|
|
loading = _ref4.loading,
|
|
|
user = _ref4.user,
|
|
|
globalSetting = _ref4.globalSetting;
|
|
|
return {
|
|
|
polls: polls,
|
|
|
globalSetting: globalSetting,
|
|
|
user: user,
|
|
|
loading: loading.effects
|
|
|
};
|
|
|
})(ShixunsListPage));
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
}]); |