|
|
"use strict";
|
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[23613,59741],{
|
|
|
|
|
|
/***/ 69532:
|
|
|
/*!***********************************************!*\
|
|
|
!*** ./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_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/classCallCheck.js */ 94312);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/createClass.js */ 24127);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/assertThisInitialized.js */ 1300);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/inherits.js */ 93242);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_4__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/createSuper.js */ 10564);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_5__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/defineProperty.js */ 22060);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_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 */ 83954);
|
|
|
/* 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_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_4___default()(NullMDEditor, _Component);
|
|
|
var _super = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_5___default()(NullMDEditor);
|
|
|
function NullMDEditor() {
|
|
|
var _this;
|
|
|
_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_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_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_6___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_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_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_6___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_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_test3_node_modules_babel_runtime_7_23_2_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_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, this.props), {}, {
|
|
|
onCMBeforeChange: this.onCMBeforeChange
|
|
|
}));
|
|
|
}
|
|
|
}]);
|
|
|
return NullMDEditor;
|
|
|
}(react__WEBPACK_IMPORTED_MODULE_7__.Component);
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 80330:
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/pages/tasks/util.js ***!
|
|
|
\*********************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ Ax: function() { return /* binding */ processTreeData; },
|
|
|
/* harmony export */ Ds: function() { return /* binding */ debounce; },
|
|
|
/* harmony export */ KI: function() { return /* binding */ apiPref; },
|
|
|
/* harmony export */ SI: function() { return /* binding */ getTreeData; },
|
|
|
/* harmony export */ f1: function() { return /* binding */ isCompileOk; }
|
|
|
/* harmony export */ });
|
|
|
/* unused harmony export isProd */
|
|
|
/* harmony import */ var _utils_env__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/utils/env */ 78130);
|
|
|
|
|
|
function isCompileOk(rs) {
|
|
|
var flag = true;
|
|
|
if (rs.length > 0) {
|
|
|
for (var i = 0; i < rs.length; i++) {
|
|
|
if (rs[i].compile_success == 0 || !rs[i].compile_success) {
|
|
|
flag = false;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
flag = false;
|
|
|
}
|
|
|
return flag;
|
|
|
}
|
|
|
function getTreeData(data) {
|
|
|
var parentKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
|
var result = [];
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
var item = data[i];
|
|
|
var key = parentKey ? "".concat(parentKey, "/").concat(item.name) : "".concat(item.name);
|
|
|
result.push({
|
|
|
title: item.name,
|
|
|
isLeaf: item.type === 'tree' ? false : true,
|
|
|
key: key
|
|
|
});
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
function processTreeData(repos, key, newData) {
|
|
|
for (var i = 0; i < repos.length; i++) {
|
|
|
var item = repos[i];
|
|
|
if (item.key === key) {
|
|
|
item.children = newData;
|
|
|
break;
|
|
|
}
|
|
|
if (item.children) {
|
|
|
processTreeData(item.children, key, newData);
|
|
|
}
|
|
|
}
|
|
|
return repos;
|
|
|
}
|
|
|
function debounce(func, wait, immediate) {
|
|
|
var timeout;
|
|
|
return function () {
|
|
|
var context = this,
|
|
|
args = arguments;
|
|
|
var later = function later() {
|
|
|
timeout = null;
|
|
|
if (!immediate) func.apply(context, args);
|
|
|
};
|
|
|
var callNow = immediate && !timeout;
|
|
|
clearTimeout(timeout);
|
|
|
timeout = setTimeout(later, wait);
|
|
|
if (callNow) func.apply(context, args);
|
|
|
};
|
|
|
}
|
|
|
var isProd = true;
|
|
|
var apiPref = _utils_env__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.API_SERVER;
|
|
|
// export const isProd =
|
|
|
// window.location.href.indexOf('test-') > 0 ||
|
|
|
// window.location.href.indexOf('localhost') > 0
|
|
|
// ? false
|
|
|
// : true;
|
|
|
|
|
|
// export const apiPref = isProd
|
|
|
// ? 'https://www.educoder.net'
|
|
|
// : 'https://test-newweb.educoder.net';
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 75816:
|
|
|
/*!**********************************************!*\
|
|
|
!*** ./src/components/AsyncButton/index.tsx ***!
|
|
|
\**********************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ Z: function() { return /* binding */ AsyncButton; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js */ 10574);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js */ 39343);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js */ 11006);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectWithoutProperties.js */ 27161);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_4__);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd */ 3113);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react */ 59301);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["children"];
|
|
|
|
|
|
|
|
|
|
|
|
var AsyncButton = function AsyncButton(_ref) {
|
|
|
var children = _ref.children,
|
|
|
props = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_4___default()(_ref, _excluded);
|
|
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(false),
|
|
|
_useState2 = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState, 2),
|
|
|
btnLoading = _useState2[0],
|
|
|
setBtnLoading = _useState2[1];
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, props), {}, {
|
|
|
loading: btnLoading,
|
|
|
onClick: /*#__PURE__*/function () {
|
|
|
var _ref2 = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee(e) {
|
|
|
return _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.prev = 0;
|
|
|
setBtnLoading(true);
|
|
|
_context.next = 4;
|
|
|
return props.onClick(e);
|
|
|
case 4:
|
|
|
setBtnLoading(false);
|
|
|
_context.next = 11;
|
|
|
break;
|
|
|
case 7:
|
|
|
_context.prev = 7;
|
|
|
_context.t0 = _context["catch"](0);
|
|
|
console.error(_context.t0);
|
|
|
setBtnLoading(false);
|
|
|
case 11:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee, null, [[0, 7]]);
|
|
|
}));
|
|
|
return function (_x) {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}(),
|
|
|
children: children
|
|
|
}));
|
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 7177:
|
|
|
/*!*********************************************************************!*\
|
|
|
!*** ./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.2@@babel/runtime/helpers/classCallCheck.js
|
|
|
var classCallCheck = __webpack_require__(94312);
|
|
|
var classCallCheck_default = /*#__PURE__*/__webpack_require__.n(classCallCheck);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/createClass.js
|
|
|
var createClass = __webpack_require__(24127);
|
|
|
var createClass_default = /*#__PURE__*/__webpack_require__.n(createClass);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/inherits.js
|
|
|
var inherits = __webpack_require__(93242);
|
|
|
var inherits_default = /*#__PURE__*/__webpack_require__.n(inherits);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/createSuper.js
|
|
|
var createSuper = __webpack_require__(10564);
|
|
|
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 + 5 modules
|
|
|
var input = __webpack_require__(1056);
|
|
|
// 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.2.6@@ant-design/icons/es/icons/PlusOutlined.js + 1 modules
|
|
|
var PlusOutlined = __webpack_require__(378);
|
|
|
// 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);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 17538:
|
|
|
/*!**********************************************************!*\
|
|
|
!*** ./src/components/QuestionEditor/BProgramEditor.tsx ***!
|
|
|
\**********************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ t: function() { return /* binding */ BProgramEditor; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectWithoutProperties.js */ 27161);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/createForOfIteratorHelper.js */ 98190);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/defineProperty.js */ 22060);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js */ 11006);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react */ 59301);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! antd */ 1056);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! antd */ 78673);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! antd */ 78241);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! antd */ 95237);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! antd */ 43604);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! antd */ 85731);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! antd */ 57809);
|
|
|
/* harmony import */ var _MdEditorInForm__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./MdEditorInForm */ 627);
|
|
|
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! umi */ 45295);
|
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./index.less?modules */ 70992);
|
|
|
/* harmony import */ var _Buttonloading__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Buttonloading */ 81525);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["key", "name"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TextArea = antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.TextArea;
|
|
|
var language = [{
|
|
|
title: 'C',
|
|
|
key: 'C'
|
|
|
}, {
|
|
|
title: 'C++',
|
|
|
key: 'C++'
|
|
|
}, {
|
|
|
title: 'Python',
|
|
|
key: 'Python'
|
|
|
}, {
|
|
|
title: 'Java',
|
|
|
key: 'Java'
|
|
|
}, {
|
|
|
title: 'JavaScript',
|
|
|
key: 'JavaScript'
|
|
|
}, {
|
|
|
title: 'Ruby',
|
|
|
key: 'Ruby'
|
|
|
}];
|
|
|
var ReversedSwitch = function ReversedSwitch(_ref) {
|
|
|
var value = _ref.value,
|
|
|
_onChange = _ref.onChange;
|
|
|
//打开为false,关闭为true,即一个特殊的Switch。
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, {
|
|
|
checked: value,
|
|
|
onChange: function onChange(checked) {
|
|
|
_onChange(checked);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
var NULL_CH = '@▁@';
|
|
|
var NULL_CH1 = '@▁▁@';
|
|
|
var BProgramEditor = function BProgramEditor(_ref2) {
|
|
|
var questionTitlePlaceholder = _ref2.questionTitlePlaceholder,
|
|
|
form = _ref2.form,
|
|
|
_ref2$scoreByBlank = _ref2.scoreByBlank,
|
|
|
scoreByBlank = _ref2$scoreByBlank === void 0 ? false : _ref2$scoreByBlank,
|
|
|
hackidentifier = _ref2.hackidentifier,
|
|
|
answerKey = _ref2.answerKey;
|
|
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(false),
|
|
|
_useState2 = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_useState, 2),
|
|
|
editAnalysis = _useState2[0],
|
|
|
setEditAnalysis = _useState2[1];
|
|
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(false),
|
|
|
_useState4 = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_useState3, 2),
|
|
|
isloading = _useState4[0],
|
|
|
setloading = _useState4[1];
|
|
|
var param = (0,umi__WEBPACK_IMPORTED_MODULE_7__.useParams)();
|
|
|
var isEdit = param.type === 'edit';
|
|
|
var getChCountBeforeCursor = function getChCountBeforeCursor(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;
|
|
|
}
|
|
|
for (var _line2 = 0; _line2 < currentLine; _line2++) {
|
|
|
placeholderCountBefore += cm.getLine(_line2).split(NULL_CH1).length - 1;
|
|
|
}
|
|
|
var currentLineStringBeforeCursor = cm.getLine(currentLine).substring(0, cursor.ch);
|
|
|
placeholderCountBefore += currentLineStringBeforeCursor.split(NULL_CH).length - 1;
|
|
|
placeholderCountBefore += currentLineStringBeforeCursor.split(NULL_CH1).length - 1;
|
|
|
return placeholderCountBefore;
|
|
|
};
|
|
|
var _onCMBeforeChange = function onCMBeforeChange(cm, change, addBlank, removeBlank) {
|
|
|
var rangeText = cm.getRange(change.from, change.to);
|
|
|
var newBlankNum = 0;
|
|
|
change.text.forEach(function (item) {
|
|
|
newBlankNum += item.split(NULL_CH).length - 1;
|
|
|
});
|
|
|
change.text.forEach(function (item) {
|
|
|
newBlankNum += item.split(NULL_CH1).length - 1;
|
|
|
});
|
|
|
if (change.origin === 'setValue') {
|
|
|
//setValue为初始化,此时不需要删除也不需要增加填空项
|
|
|
return;
|
|
|
}
|
|
|
if (rangeText && (rangeText.indexOf(NULL_CH) !== -1 || rangeText.indexOf(NULL_CH1) !== -1)) {
|
|
|
var placeholderCountInRange = rangeText.split(NULL_CH).length - 1 + rangeText.split(NULL_CH1).length - 1;
|
|
|
var placeholderCountBefore = getChCountBeforeCursor(cm, change.from);
|
|
|
console.log("\u5220\u9664".concat(placeholderCountInRange, "\u4E2A\uFF0C \u524D\u9762\u6709").concat(placeholderCountBefore, "\u4E2A\uFF0C\u65B0\u589E").concat(newBlankNum, "\u4E2A"));
|
|
|
if (placeholderCountInRange > 1) {
|
|
|
var indexArray = Array.from({
|
|
|
length: placeholderCountInRange
|
|
|
}, function (item, index) {
|
|
|
return placeholderCountBefore + index;
|
|
|
});
|
|
|
removeBlank(indexArray);
|
|
|
} else {
|
|
|
removeBlank(placeholderCountBefore);
|
|
|
}
|
|
|
} else if (newBlankNum > 0) {
|
|
|
var _placeholderCountBefore = getChCountBeforeCursor(cm, change.from);
|
|
|
console.log("\u65B0\u589E".concat(newBlankNum, "\u4E2A\uFF0C\u4E4B\u524D\u6709").concat(_placeholderCountBefore, "\u4E2A"));
|
|
|
addBlank(newBlankNum, _placeholderCountBefore);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
//新增和删除需要重新设置position,position表示填空的位置
|
|
|
var rewritePosition = function rewritePosition() {
|
|
|
var preAnswerData = form.getFieldValue(answerKey);
|
|
|
form.setFieldsValue(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2___default()({}, answerKey, preAnswerData.map(function (item, index) {
|
|
|
return _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()({}, item), {}, {
|
|
|
position: index + 1
|
|
|
});
|
|
|
})));
|
|
|
};
|
|
|
var addFnRef = (0,react__WEBPACK_IMPORTED_MODULE_5__.useRef)();
|
|
|
var addBlank = function addBlank(addNum, insertIndex) {
|
|
|
for (var i = 0; i < addNum; i++) {
|
|
|
addFnRef.current({
|
|
|
position: null,
|
|
|
answer_text: ''
|
|
|
}, insertIndex + i);
|
|
|
}
|
|
|
rewritePosition();
|
|
|
};
|
|
|
var removeFnRef = (0,react__WEBPACK_IMPORTED_MODULE_5__.useRef)();
|
|
|
var removeBlank = function removeBlank(deleteIndex) {
|
|
|
removeFnRef.current(deleteIndex);
|
|
|
rewritePosition();
|
|
|
};
|
|
|
var standardAnswersValue = antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.useWatch(answerKey, form);
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.wrap,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u8BD5\u9898\u63CF\u8FF0",
|
|
|
name: ['hack', 'description'],
|
|
|
style: {
|
|
|
display: "table"
|
|
|
},
|
|
|
className: "w100",
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
},
|
|
|
rules: [{
|
|
|
required: true
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_6__/* .MdEditorInForm */ .h, {
|
|
|
scrollId: "name",
|
|
|
watch: true,
|
|
|
height: 140
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.questionTitleEditorWrap,
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u7A0B\u5E8F\u4EE3\u7801",
|
|
|
name: ['hack_codes', 'code'],
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
},
|
|
|
rules: [{
|
|
|
required: true
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_6__/* .MdEditorInForm */ .h, {
|
|
|
scrollId: "name",
|
|
|
watch: true,
|
|
|
height: 400,
|
|
|
showNullProgramButton: true,
|
|
|
onChange: function onChange(a, b) {
|
|
|
var preAnswerData = form.getFieldValue(answerKey);
|
|
|
console.log('--preAnswerData', preAnswerData, b);
|
|
|
form.setFieldsValue(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2___default()({}, answerKey, preAnswerData === null || preAnswerData === void 0 ? void 0 : preAnswerData.map(function (item, index) {
|
|
|
var _b$index;
|
|
|
return _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()({}, item), {}, {
|
|
|
position: index + 1,
|
|
|
multi_line: b === null || b === void 0 || (_b$index = b[index]) === null || _b$index === void 0 ? void 0 : _b$index.multiLine
|
|
|
});
|
|
|
})));
|
|
|
},
|
|
|
placeholder: questionTitlePlaceholder,
|
|
|
onCMBeforeChange: function onCMBeforeChange(cm, change) {
|
|
|
_onCMBeforeChange(cm, change, addBlank, removeBlank);
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.List, {
|
|
|
name: answerKey,
|
|
|
rules: [{
|
|
|
validator: function validator(rule, values) {
|
|
|
if ((values === null || values === void 0 ? void 0 : values.length) === 0) {
|
|
|
return Promise.reject(new Error('答案不能为空'));
|
|
|
}
|
|
|
var _iterator = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_1___default()(values),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var item = _step.value;
|
|
|
var _ref3 = item || {},
|
|
|
answer_text = _ref3.answer_text;
|
|
|
if ((answer_text === null || answer_text === void 0 ? void 0 : answer_text.length) === 0) {
|
|
|
return Promise.reject(new Error('填空项答案不能为空'));
|
|
|
}
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
return Promise.resolve();
|
|
|
}
|
|
|
}],
|
|
|
children: function children(fields, _ref4, _ref5) {
|
|
|
var add = _ref4.add,
|
|
|
remove = _ref4.remove;
|
|
|
var errors = _ref5.errors;
|
|
|
addFnRef.current = add;
|
|
|
removeFnRef.current = remove;
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u586B\u7A7A\u9879\u7B54\u6848",
|
|
|
required: true,
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
}
|
|
|
}), fields.map(function (_ref6, index) {
|
|
|
var _standardAnswersValue, _standardAnswersValue2;
|
|
|
var key = _ref6.key,
|
|
|
name = _ref6.name,
|
|
|
restField = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_0___default()(_ref6, _excluded);
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, {
|
|
|
className: "mb20",
|
|
|
align: "middle",
|
|
|
wrap: false,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, {
|
|
|
flex: '0 0 auto',
|
|
|
className: "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.blankIndex),
|
|
|
children: ["\u586B\u7A7A\u9879", index + 1]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, {
|
|
|
flex: 1,
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, {
|
|
|
align: "top",
|
|
|
justify: "space-between",
|
|
|
wrap: false,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, {
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Item, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()({}, restField), {}, {
|
|
|
name: [name, 'answer_text'],
|
|
|
noStyle: true,
|
|
|
children: standardAnswersValue !== null && standardAnswersValue !== void 0 && (_standardAnswersValue = standardAnswersValue[name]) !== null && _standardAnswersValue !== void 0 && _standardAnswersValue.multi_line || standardAnswersValue !== null && standardAnswersValue !== void 0 && (_standardAnswersValue2 = standardAnswersValue[name]) !== null && _standardAnswersValue2 !== void 0 && _standardAnswersValue2.multiLine ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(TextArea, {
|
|
|
spellCheck: false,
|
|
|
style: {
|
|
|
marginLeft: 10,
|
|
|
width: 550
|
|
|
}
|
|
|
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z, {
|
|
|
style: {
|
|
|
marginLeft: 10,
|
|
|
width: 550
|
|
|
},
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.blankInput
|
|
|
// defaultValue={v}
|
|
|
,
|
|
|
size: "large",
|
|
|
maxLength: 1000,
|
|
|
onBlur: function onBlur(e) {}
|
|
|
})
|
|
|
}))
|
|
|
}), scoreByBlank && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, {
|
|
|
flex: '224px',
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Item, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()({}, restField), {}, {
|
|
|
name: [name, 'score'],
|
|
|
label: "\u5206\u503C",
|
|
|
rules: [{
|
|
|
required: true
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, {
|
|
|
size: "large",
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.blankInput,
|
|
|
min: 0.1,
|
|
|
max: 100,
|
|
|
precision: 1,
|
|
|
style: {
|
|
|
width: '100%'
|
|
|
},
|
|
|
placeholder: "\u6309\u7A7A\u7ED9\u5206\u8BF7\u8F93\u5165\u5206\u503C"
|
|
|
})
|
|
|
}))
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
}, key);
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("div", {
|
|
|
onClick: function onClick() {
|
|
|
return setEditAnalysis(true);
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Item, {
|
|
|
name: ['hack', 'analysis'],
|
|
|
label: "\u9898\u76EE\u89E3\u6790",
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_6__/* .RegularInput */ .x, {
|
|
|
placeholder: "\u8BF7\u7F16\u8F91\u9898\u76EE\u89E3\u6790\uFF08\u975E\u5FC5\u586B\uFF09",
|
|
|
isEdit: editAnalysis
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u7F16\u7A0B\u8BED\u8A00",
|
|
|
style: {
|
|
|
marginTop: 30
|
|
|
},
|
|
|
name: ['hack_codes', 'language'],
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
},
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请选择编程语言'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__["default"], {
|
|
|
size: "large",
|
|
|
children: language.map(function (item) {
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_17__["default"].Option, {
|
|
|
value: item.key,
|
|
|
children: [" ", item.title]
|
|
|
}, item.title);
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Item, {
|
|
|
label: '最大评测时长(秒)',
|
|
|
style: {
|
|
|
marginTop: 30
|
|
|
},
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
},
|
|
|
required: true,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Item, {
|
|
|
name: ['hack', 'time_limit'],
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入单个测试集评测时长限制'
|
|
|
}, {
|
|
|
type: 'number',
|
|
|
min: 3,
|
|
|
message: '最小限制时间是3秒'
|
|
|
}],
|
|
|
noStyle: true,
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, {
|
|
|
precision: 0,
|
|
|
max: 10,
|
|
|
min: 3,
|
|
|
size: "large",
|
|
|
style: {
|
|
|
width: '97%'
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("span", {
|
|
|
className: "ml10 font14",
|
|
|
children: "\u79D2"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, {
|
|
|
align: "middle",
|
|
|
style: {
|
|
|
marginTop: 30
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Item, {
|
|
|
name: ['hack', 'allow_student_debug'],
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(ReversedSwitch, {})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, {
|
|
|
className: "ml10",
|
|
|
children: "\u5141\u8BB8\u5B66\u751F\u7B54\u9898\u65F6\u8FDB\u884C\u4EE3\u7801\u8C03\u8BD5"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u6D4B\u8BD5\u7528\u4F8B",
|
|
|
required: true
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div", {
|
|
|
style: {
|
|
|
background: '#F6F7F9',
|
|
|
padding: 15
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u8F93\u5165",
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
},
|
|
|
name: ['hack_sets', 'input'],
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(TextArea, {
|
|
|
rows: 4
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u8F93\u51FA",
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
},
|
|
|
name: ['hack_sets', 'output'],
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入输出内容'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(TextArea, {
|
|
|
rows: 4
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_Buttonloading__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, {
|
|
|
answerKey: answerKey,
|
|
|
hackidentifier: hackidentifier,
|
|
|
ButtonText: '自测运行',
|
|
|
ButtonProps: {
|
|
|
ghost: true,
|
|
|
icon: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("i", {
|
|
|
className: "iconfont icon-ceshi"
|
|
|
}),
|
|
|
style: {
|
|
|
background: 'rgba(55,173,131,0.05)',
|
|
|
borderRadius: 19,
|
|
|
border: '1px solid #37AD83',
|
|
|
width: 116,
|
|
|
height: 38,
|
|
|
display: 'inline-flex',
|
|
|
fontSize: 14,
|
|
|
alignItems: 'center',
|
|
|
justifyContent: 'center',
|
|
|
marginTop: 20,
|
|
|
cursor: 'pointer',
|
|
|
color: '#37AD83'
|
|
|
}
|
|
|
},
|
|
|
form: form
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 81525:
|
|
|
/*!*********************************************************!*\
|
|
|
!*** ./src/components/QuestionEditor/Buttonloading.tsx ***!
|
|
|
\*********************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js */ 10574);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js */ 39343);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js */ 11006);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! umi */ 45295);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react */ 59301);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! antd */ 8591);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! antd */ 3113);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! antd */ 43418);
|
|
|
/* harmony import */ var js_base64__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! js-base64 */ 24334);
|
|
|
/* harmony import */ var js_base64__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(js_base64__WEBPACK_IMPORTED_MODULE_6__);
|
|
|
/* harmony import */ var _utils_fetch__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/utils/fetch */ 91506);
|
|
|
/* harmony import */ var _pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/pages/MyProblem/service */ 43887);
|
|
|
/* harmony import */ var _pages_MyProblem_TestCasePanel__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/pages/MyProblem/TestCasePanel */ 90678);
|
|
|
/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! moment */ 9498);
|
|
|
/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_10__);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* @description: 自测运行
|
|
|
* @param {*}
|
|
|
* ButtonProps:按钮部分样式等参数
|
|
|
* ButtonText 按钮文字
|
|
|
* form 表单内容
|
|
|
* answerKey 填空字段
|
|
|
* items 为运行调试字段
|
|
|
* @return {*}
|
|
|
*/
|
|
|
var ButtonLoading = function ButtonLoading(_ref) {
|
|
|
var ButtonProps = _ref.ButtonProps,
|
|
|
ButtonText = _ref.ButtonText,
|
|
|
form = _ref.form,
|
|
|
answerKey = _ref.answerKey,
|
|
|
_ref$hackidentifier = _ref.hackidentifier,
|
|
|
hackidentifier = _ref$hackidentifier === void 0 ? "" : _ref$hackidentifier,
|
|
|
_ref$items = _ref.items,
|
|
|
items = _ref$items === void 0 ? {} : _ref$items;
|
|
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(false),
|
|
|
_useState2 = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState, 2),
|
|
|
isloading = _useState2[0],
|
|
|
setisloading = _useState2[1];
|
|
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(''),
|
|
|
_useState4 = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState3, 2),
|
|
|
identifier = _useState4[0],
|
|
|
setidentifier = _useState4[1];
|
|
|
var param = (0,umi__WEBPACK_IMPORTED_MODULE_4__.useParams)();
|
|
|
var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)({}),
|
|
|
_useState6 = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState5, 2),
|
|
|
modalshow = _useState6[0],
|
|
|
setmodalshow = _useState6[1];
|
|
|
var isEdit = param.type === 'edit';
|
|
|
var type = window.location.href.includes('problemset') ? 1 : 2;
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_5__.useEffect)(function () {
|
|
|
if (isEdit || hackidentifier) {
|
|
|
setidentifier(hackidentifier || param.id);
|
|
|
}
|
|
|
}, [param]);
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_5__.useEffect)(function () {
|
|
|
return function () {
|
|
|
sessionStorage.removeItem("projectFill");
|
|
|
};
|
|
|
}, []);
|
|
|
function onUpdateCode(_x, _x2) {
|
|
|
return _onUpdateCode.apply(this, arguments);
|
|
|
}
|
|
|
function _onUpdateCode() {
|
|
|
_onUpdateCode = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee4(re, id) {
|
|
|
var _stats$filter;
|
|
|
var code, stats, codes, response;
|
|
|
return _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee4$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
code = form.getFieldValue("hack_codes");
|
|
|
stats = form.getFieldValue(answerKey);
|
|
|
if (code.code) {
|
|
|
_context4.next = 5;
|
|
|
break;
|
|
|
}
|
|
|
antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.info('程序代码不能为空!');
|
|
|
return _context4.abrupt("return");
|
|
|
case 5:
|
|
|
if (code.language) {
|
|
|
_context4.next = 8;
|
|
|
break;
|
|
|
}
|
|
|
antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.info('编程语言不能为空!');
|
|
|
return _context4.abrupt("return");
|
|
|
case 8:
|
|
|
if (!(stats.length > 0 && ((_stats$filter = stats.filter(function (item) {
|
|
|
return !item.answer_text;
|
|
|
})) === null || _stats$filter === void 0 ? void 0 : _stats$filter.length) > 0)) {
|
|
|
_context4.next = 11;
|
|
|
break;
|
|
|
}
|
|
|
antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.info('填空项不能为空!');
|
|
|
return _context4.abrupt("return");
|
|
|
case 11:
|
|
|
codes = code.code;
|
|
|
if (stats.length > 0) {
|
|
|
stats === null || stats === void 0 || stats.map(function (item) {
|
|
|
if (item.multi_line) {
|
|
|
codes = codes.substring(0, codes.indexOf('@▁▁@')) + item.answer_text + codes.substring(codes.indexOf('@▁▁@') + 4);
|
|
|
} else {
|
|
|
codes = codes.substring(0, codes.indexOf('@▁@')) + item.answer_text + codes.substring(codes.indexOf('@▁@') + 3);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
_context4.next = 15;
|
|
|
return (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__/* .updateCode */ .n4)(id, re ? re : {
|
|
|
code: js_base64__WEBPACK_IMPORTED_MODULE_6__.Base64.encode(codes),
|
|
|
language: code.language
|
|
|
});
|
|
|
case 15:
|
|
|
response = _context4.sent;
|
|
|
return _context4.abrupt("return", response);
|
|
|
case 17:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
return _onUpdateCode.apply(this, arguments);
|
|
|
}
|
|
|
function onUpdateCodes(_x3, _x4) {
|
|
|
return _onUpdateCodes.apply(this, arguments);
|
|
|
}
|
|
|
function _onUpdateCodes() {
|
|
|
_onUpdateCodes = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee5(re, id) {
|
|
|
var _stats$filter2;
|
|
|
var stats, codes, response;
|
|
|
return _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee5$(_context5) {
|
|
|
while (1) switch (_context5.prev = _context5.next) {
|
|
|
case 0:
|
|
|
stats = items.userAnswer;
|
|
|
codes = js_base64__WEBPACK_IMPORTED_MODULE_6__.Base64.decode(items.code);
|
|
|
debugger;
|
|
|
if (!(stats.length > 0 && ((_stats$filter2 = stats.filter(function (item) {
|
|
|
return !item.value;
|
|
|
})) === null || _stats$filter2 === void 0 ? void 0 : _stats$filter2.length) > 0)) {
|
|
|
_context5.next = 6;
|
|
|
break;
|
|
|
}
|
|
|
antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.info('填空项不能为空!');
|
|
|
return _context5.abrupt("return");
|
|
|
case 6:
|
|
|
if (stats.length > 0) {
|
|
|
stats === null || stats === void 0 || stats.map(function (item) {
|
|
|
if (item.multi_line) {
|
|
|
codes = codes.substring(0, codes.indexOf('@▁▁@')) + item.value + codes.substring(codes.indexOf('@▁▁@') + 4);
|
|
|
} else {
|
|
|
codes = codes.substring(0, codes.indexOf('@▁@')) + item.value + codes.substring(codes.indexOf('@▁@') + 3);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
_context5.next = 9;
|
|
|
return (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__/* .updateCode */ .n4)(id, re ? re : {
|
|
|
code: js_base64__WEBPACK_IMPORTED_MODULE_6__.Base64.encode(codes),
|
|
|
language: items.language
|
|
|
});
|
|
|
case 9:
|
|
|
response = _context5.sent;
|
|
|
return _context5.abrupt("return", response);
|
|
|
case 11:
|
|
|
case "end":
|
|
|
return _context5.stop();
|
|
|
}
|
|
|
}, _callee5);
|
|
|
}));
|
|
|
return _onUpdateCodes.apply(this, arguments);
|
|
|
}
|
|
|
function getTimeStamp() {
|
|
|
return new Date().getTime();
|
|
|
}
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .ZP, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({
|
|
|
loading: isloading
|
|
|
}, ButtonProps), {}, {
|
|
|
onClick: /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee3() {
|
|
|
var _res, _response, executeCode, startTime, aa, res, formValues, _formValues$hack, _res2, _formValues$hack2, res1, response, _executeCode, _startTime;
|
|
|
return _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
if (!(ButtonText === '运行调试')) {
|
|
|
_context3.next = 20;
|
|
|
break;
|
|
|
}
|
|
|
setisloading(true);
|
|
|
if (!isloading) {
|
|
|
_context3.next = 4;
|
|
|
break;
|
|
|
}
|
|
|
return _context3.abrupt("return");
|
|
|
case 4:
|
|
|
_context3.next = 6;
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP)("/api/problems/".concat(identifier, "/start.json"), {
|
|
|
method: 'get'
|
|
|
});
|
|
|
case 6:
|
|
|
_res = _context3.sent;
|
|
|
_context3.next = 9;
|
|
|
return onUpdateCodes(null, _res === null || _res === void 0 ? void 0 : _res.identifier);
|
|
|
case 9:
|
|
|
_response = _context3.sent;
|
|
|
if (!((_response === null || _response === void 0 ? void 0 : _response.status) === 0)) {
|
|
|
_context3.next = 18;
|
|
|
break;
|
|
|
}
|
|
|
executeCode = /*#__PURE__*/function () {
|
|
|
var _ref3 = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee() {
|
|
|
var _yield$getOperationRe, status, message, data, executeTime, isTimeOut;
|
|
|
return _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__/* .getOperationResult */ .rX)(_res === null || _res === void 0 ? void 0 : _res.identifier, 'submit');
|
|
|
case 2:
|
|
|
_yield$getOperationRe = _context.sent;
|
|
|
status = _yield$getOperationRe.status;
|
|
|
message = _yield$getOperationRe.message;
|
|
|
data = _yield$getOperationRe.data;
|
|
|
executeTime = getTimeStamp();
|
|
|
isTimeOut = executeTime - startTime > 6 * 1000;
|
|
|
if (status !== 0 && !isTimeOut) {
|
|
|
setTimeout(executeCode, 1000);
|
|
|
}
|
|
|
if (!isTimeOut) {
|
|
|
_context.next = 13;
|
|
|
break;
|
|
|
}
|
|
|
antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z.error({
|
|
|
centered: true,
|
|
|
okText: '知道啦',
|
|
|
title: '调试代码超时'
|
|
|
});
|
|
|
setisloading(false);
|
|
|
return _context.abrupt("return");
|
|
|
case 13:
|
|
|
if (status === 0) {
|
|
|
setisloading(false);
|
|
|
// let datas = await Fetch(`/api/myproblems/record_detail.json`, {
|
|
|
// method: 'GET',
|
|
|
// params: {
|
|
|
// id: data?.id
|
|
|
// }
|
|
|
// })
|
|
|
|
|
|
setmodalshow(data);
|
|
|
if (data.status === 2) {
|
|
|
setisloading(false);
|
|
|
antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z.error({
|
|
|
centered: true,
|
|
|
okText: '知道啦',
|
|
|
title: '调试代码超时'
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
case 14:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function executeCode() {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
startTime = getTimeStamp();
|
|
|
_context3.next = 15;
|
|
|
return (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__/* .sumbitCode */ .bM)(_res === null || _res === void 0 ? void 0 : _res.identifier, {});
|
|
|
case 15:
|
|
|
executeCode();
|
|
|
_context3.next = 19;
|
|
|
break;
|
|
|
case 18:
|
|
|
setisloading(false);
|
|
|
case 19:
|
|
|
return _context3.abrupt("return");
|
|
|
case 20:
|
|
|
aa = true;
|
|
|
_context3.next = 23;
|
|
|
return form.validateFields().then(function () {
|
|
|
aa = false;
|
|
|
}, function (errInfo) {
|
|
|
var _errInfo$errorFields, _errInfo$errorFields2;
|
|
|
if (errInfo.errorFields[0].name.includes("standard_answers")) {
|
|
|
antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.error("填空项答案不能为空");
|
|
|
} else {
|
|
|
antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.error(errInfo.errorFields[0].errors[0]);
|
|
|
}
|
|
|
if (((_errInfo$errorFields = errInfo.errorFields) === null || _errInfo$errorFields === void 0 ? void 0 : _errInfo$errorFields.length) === 0) {
|
|
|
aa = false;
|
|
|
}
|
|
|
form.scrollToField(errInfo === null || errInfo === void 0 || (_errInfo$errorFields2 = errInfo.errorFields) === null || _errInfo$errorFields2 === void 0 || (_errInfo$errorFields2 = _errInfo$errorFields2[0]) === null || _errInfo$errorFields2 === void 0 ? void 0 : _errInfo$errorFields2.name, {
|
|
|
behavior: 'smooth',
|
|
|
block: 'center'
|
|
|
});
|
|
|
aa = true;
|
|
|
});
|
|
|
case 23:
|
|
|
if (!aa) {
|
|
|
_context3.next = 25;
|
|
|
break;
|
|
|
}
|
|
|
return _context3.abrupt("return");
|
|
|
case 25:
|
|
|
setisloading(true);
|
|
|
if (!isloading) {
|
|
|
_context3.next = 28;
|
|
|
break;
|
|
|
}
|
|
|
return _context3.abrupt("return");
|
|
|
case 28:
|
|
|
res = '';
|
|
|
formValues = form.getFieldsValue();
|
|
|
if (identifier) {
|
|
|
_context3.next = 39;
|
|
|
break;
|
|
|
}
|
|
|
_context3.next = 33;
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP)("/api/problems.json", {
|
|
|
method: 'post',
|
|
|
body: _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues), {}, {
|
|
|
hack: _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues === null || formValues === void 0 ? void 0 : formValues.hack), {}, {
|
|
|
sub_discipline_id: formValues === null || formValues === void 0 || (_formValues$hack = formValues.hack) === null || _formValues$hack === void 0 || (_formValues$hack = _formValues$hack.sub_discipline_id) === null || _formValues$hack === void 0 ? void 0 : _formValues$hack[1],
|
|
|
difficult: formValues.difficulty,
|
|
|
item_banks_group_id: formValues.item_banks_group_id
|
|
|
}),
|
|
|
hack_codes: _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues.hack_codes), {}, {
|
|
|
code: js_base64__WEBPACK_IMPORTED_MODULE_6__.Base64.encode(formValues.hack_codes.code)
|
|
|
}),
|
|
|
hack_sets: [_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues.hack_sets)],
|
|
|
is_blank: true
|
|
|
})
|
|
|
});
|
|
|
case 33:
|
|
|
res = _context3.sent;
|
|
|
identifier = (_res2 = res) === null || _res2 === void 0 ? void 0 : _res2.identifier;
|
|
|
sessionStorage.projectFill = identifier;
|
|
|
setidentifier(identifier);
|
|
|
_context3.next = 42;
|
|
|
break;
|
|
|
case 39:
|
|
|
_context3.next = 41;
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP)("/api/problems/".concat(identifier, ".json"), {
|
|
|
method: 'put',
|
|
|
body: _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues), {}, {
|
|
|
hack: _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues === null || formValues === void 0 ? void 0 : formValues.hack), {}, {
|
|
|
sub_discipline_id: formValues === null || formValues === void 0 || (_formValues$hack2 = formValues.hack) === null || _formValues$hack2 === void 0 || (_formValues$hack2 = _formValues$hack2.sub_discipline_id) === null || _formValues$hack2 === void 0 ? void 0 : _formValues$hack2[1],
|
|
|
difficult: formValues.difficulty,
|
|
|
item_banks_group_id: formValues.item_banks_group_id
|
|
|
}),
|
|
|
hack_codes: _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues.hack_codes), {}, {
|
|
|
code: js_base64__WEBPACK_IMPORTED_MODULE_6__.Base64.encode(formValues.hack_codes.code)
|
|
|
}),
|
|
|
update_hack_sets: [_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues.hack_sets)],
|
|
|
is_blank: true
|
|
|
})
|
|
|
});
|
|
|
case 41:
|
|
|
res = _context3.sent;
|
|
|
case 42:
|
|
|
_context3.next = 44;
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP)("/api/problems/".concat(identifier, "/start.json"), {
|
|
|
method: 'get'
|
|
|
});
|
|
|
case 44:
|
|
|
res1 = _context3.sent;
|
|
|
_context3.next = 47;
|
|
|
return onUpdateCode(null, res1 === null || res1 === void 0 ? void 0 : res1.identifier);
|
|
|
case 47:
|
|
|
response = _context3.sent;
|
|
|
if (!((response === null || response === void 0 ? void 0 : response.status) === 0)) {
|
|
|
_context3.next = 56;
|
|
|
break;
|
|
|
}
|
|
|
_executeCode = /*#__PURE__*/function () {
|
|
|
var _ref4 = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee2() {
|
|
|
var _yield$getOperationRe2, status, message, data, executeTime, isTimeOut;
|
|
|
return _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.next = 2;
|
|
|
return (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__/* .getOperationResult */ .rX)(res1 === null || res1 === void 0 ? void 0 : res1.identifier, 'submit');
|
|
|
case 2:
|
|
|
_yield$getOperationRe2 = _context2.sent;
|
|
|
status = _yield$getOperationRe2.status;
|
|
|
message = _yield$getOperationRe2.message;
|
|
|
data = _yield$getOperationRe2.data;
|
|
|
executeTime = getTimeStamp();
|
|
|
isTimeOut = executeTime - _startTime > (formValues.hack.time_limit + 3) * 1000;
|
|
|
if (status !== 0 && !isTimeOut) {
|
|
|
setTimeout(_executeCode, 1000);
|
|
|
}
|
|
|
if (!isTimeOut) {
|
|
|
_context2.next = 13;
|
|
|
break;
|
|
|
}
|
|
|
antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z.error({
|
|
|
centered: true,
|
|
|
okText: '知道啦',
|
|
|
title: '调试代码超时'
|
|
|
});
|
|
|
setisloading(false);
|
|
|
return _context2.abrupt("return");
|
|
|
case 13:
|
|
|
if (status === 0) {
|
|
|
setisloading(false);
|
|
|
setmodalshow(data);
|
|
|
if (data.status === 2) {
|
|
|
setisloading(false);
|
|
|
antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z.error({
|
|
|
centered: true,
|
|
|
okText: '知道啦',
|
|
|
title: '调试代码超时'
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
case 14:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function _executeCode() {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
_startTime = getTimeStamp();
|
|
|
_context3.next = 53;
|
|
|
return (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__/* .sumbitCode */ .bM)(res1 === null || res1 === void 0 ? void 0 : res1.identifier, {});
|
|
|
case 53:
|
|
|
_executeCode();
|
|
|
_context3.next = 57;
|
|
|
break;
|
|
|
case 56:
|
|
|
setisloading(false);
|
|
|
case 57:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
})),
|
|
|
children: ButtonText
|
|
|
})), (modalshow === null || modalshow === void 0 ? void 0 : modalshow.id) && modalshow.status !== 2 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, {
|
|
|
open: (modalshow === null || modalshow === void 0 ? void 0 : modalshow.id) && modalshow.status !== 2,
|
|
|
title: "\u8FD0\u884C\u7ED3\u679C",
|
|
|
width: 1100,
|
|
|
footer: false,
|
|
|
onOk: function onOk() {
|
|
|
setmodalshow({});
|
|
|
},
|
|
|
onCancel: function onCancel() {
|
|
|
setmodalshow({});
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
|
|
|
style: {
|
|
|
maxHeight: 600,
|
|
|
overflow: 'auto',
|
|
|
marginBottom: 15
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
|
|
|
style: {
|
|
|
marginBottom: 20,
|
|
|
display: 'flex',
|
|
|
justifyContent: 'space-between',
|
|
|
fontSize: 14
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#666666'
|
|
|
},
|
|
|
children: "\u72B6\u6001"
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
|
|
|
style: {
|
|
|
marginLeft: 12,
|
|
|
color: modalshow.status !== 0 && '#E30000'
|
|
|
},
|
|
|
children: _pages_MyProblem_TestCasePanel__WEBPACK_IMPORTED_MODULE_9__/* .ExecuteDict */ .Im[modalshow.status]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#666666'
|
|
|
},
|
|
|
children: "\u63D0\u4EA4\u65F6\u95F4"
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
|
|
|
style: {
|
|
|
marginLeft: 12
|
|
|
},
|
|
|
children: moment__WEBPACK_IMPORTED_MODULE_10___default()(modalshow.created_at).format('YYYY-MM-DD HH:mm:ss')
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#666666'
|
|
|
},
|
|
|
children: "\u8BED\u8A00"
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
|
|
|
style: {
|
|
|
marginLeft: 12
|
|
|
},
|
|
|
children: modalshow.language
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#666666'
|
|
|
},
|
|
|
children: "\u6267\u884C\u7528\u65F6"
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("span", {
|
|
|
style: {
|
|
|
marginLeft: 12
|
|
|
},
|
|
|
children: [modalshow.execute_time, "ms"]
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_pages_MyProblem_TestCasePanel__WEBPACK_IMPORTED_MODULE_9__/* .DetailCommitOut */ .Y4, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, modalshow))]
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ __webpack_exports__.Z = (ButtonLoading);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 54847:
|
|
|
/*!****************************************************************!*\
|
|
|
!*** ./src/components/QuestionEditor/ChoiceQuestionEditor.tsx ***!
|
|
|
\****************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ u: function() { return /* binding */ ChoiceQuestionEditor; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectWithoutProperties.js */ 27161);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js */ 11006);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/defineProperty.js */ 22060);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ 59301);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! antd */ 95237);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! antd */ 43604);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! antd */ 6848);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! antd */ 78241);
|
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./index.less?modules */ 70992);
|
|
|
/* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @ant-design/icons */ 71029);
|
|
|
/* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @ant-design/icons */ 87306);
|
|
|
/* harmony import */ var _MdEditorInForm__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./MdEditorInForm */ 627);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["key", "name"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 ChoiceQuestionItem = function ChoiceQuestionItem(_ref) {
|
|
|
var value = _ref.value,
|
|
|
_onChange = _ref.onChange,
|
|
|
choiceTextKey = _ref.choiceTextKey,
|
|
|
answerKey = _ref.answerKey,
|
|
|
index = _ref.index,
|
|
|
isEdit = _ref.isEdit,
|
|
|
setInputActive = _ref.setInputActive,
|
|
|
form = _ref.form,
|
|
|
choiceOptionsPath = _ref.choiceOptionsPath,
|
|
|
allowChangeMode = _ref.allowChangeMode,
|
|
|
showAddIcon = _ref.showAddIcon,
|
|
|
addItem = _ref.addItem,
|
|
|
deleteItem = _ref.deleteItem;
|
|
|
var isActiveAnswer = (value === null || value === void 0 ? void 0 : value[answerKey]) === 1;
|
|
|
var setAllOptionsToFalse = function setAllOptionsToFalse() {
|
|
|
var options = form.getFieldValue(choiceOptionsPath);
|
|
|
form.setFieldValue(choiceOptionsPath, options.map(function (item) {
|
|
|
return _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()({}, item), {}, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2___default()({}, answerKey, 0));
|
|
|
}));
|
|
|
};
|
|
|
var setActiveAnswer = function setActiveAnswer() {
|
|
|
if (isActiveAnswer) {
|
|
|
_onChange(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()({}, value), {}, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2___default()({}, answerKey, 0)));
|
|
|
} else {
|
|
|
if (!allowChangeMode) {
|
|
|
setAllOptionsToFalse();
|
|
|
}
|
|
|
_onChange(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()({}, value), {}, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2___default()({}, answerKey, 1)));
|
|
|
}
|
|
|
};
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.choiceWrap,
|
|
|
align: "middle",
|
|
|
wrap: false,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, {
|
|
|
onClick: setActiveAnswer,
|
|
|
className: "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.choiceIndex, " ").concat(isActiveAnswer ? _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.activeAnswer : ''),
|
|
|
children: tagList[index]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, {
|
|
|
flex: 1,
|
|
|
className: "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.editorWrap, " ml15"),
|
|
|
onClick: setInputActive,
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_6__/* .RegularInput */ .x, {
|
|
|
height: 155,
|
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9009\u9879",
|
|
|
isEdit: isEdit,
|
|
|
value: value === null || value === void 0 ? void 0 : value[choiceTextKey],
|
|
|
onChange: function onChange(v) {
|
|
|
_onChange(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()({}, value), {}, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2___default()({}, choiceTextKey, v)));
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, {
|
|
|
flex: '0 0 auto',
|
|
|
className: "ml15",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
|
|
|
onClick: setActiveAnswer,
|
|
|
className: "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.setAnswerBtn, " ").concat(isActiveAnswer ? _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.activeAnswer : ''),
|
|
|
children: isActiveAnswer ? '正确答案' : '设为答案'
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.actionWrapper,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z, {
|
|
|
title: "\u65B0\u589E\u53C2\u8003\u7B54\u6848",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ant_design_icons__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z, {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.addIcon,
|
|
|
onClick: addItem,
|
|
|
style: {
|
|
|
visibility: showAddIcon ? 'visible' : 'hidden'
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z, {
|
|
|
title: "\u5220\u9664",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ant_design_icons__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.deleteIcon,
|
|
|
onClick: deleteItem,
|
|
|
style: {
|
|
|
visibility: index > 1 ? 'visible' : 'hidden'
|
|
|
}
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var ChoiceQuestionEditor = function ChoiceQuestionEditor(_ref2) {
|
|
|
var questionTitlePlaceholder = _ref2.questionTitlePlaceholder,
|
|
|
titleKey = _ref2.titleKey,
|
|
|
choiceKey = _ref2.choiceKey,
|
|
|
analysisKey = _ref2.analysisKey,
|
|
|
choiceTextKey = _ref2.choiceTextKey,
|
|
|
answerKey = _ref2.answerKey,
|
|
|
choiceOptionsPath = _ref2.choiceOptionsPath,
|
|
|
_ref2$allowChangeMode = _ref2.allowChangeMode,
|
|
|
allowChangeMode = _ref2$allowChangeMode === void 0 ? true : _ref2$allowChangeMode,
|
|
|
form = _ref2.form,
|
|
|
_ref2$showAnalysis = _ref2.showAnalysis,
|
|
|
showAnalysis = _ref2$showAnalysis === void 0 ? true : _ref2$showAnalysis;
|
|
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_4__.useState)(),
|
|
|
_useState2 = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState, 2),
|
|
|
activeEditor = _useState2[0],
|
|
|
setActiveEditor = _useState2[1];
|
|
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_4__.useState)(false),
|
|
|
_useState4 = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState3, 2),
|
|
|
editAnalysis = _useState4[0],
|
|
|
setEditAnalysis = _useState4[1];
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.wrap,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.questionTitleEditorWrap,
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u9898\u5E72",
|
|
|
name: titleKey,
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
},
|
|
|
rules: [{
|
|
|
required: true
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_6__/* .MdEditorInForm */ .h, {
|
|
|
scrollId: Array.isArray(titleKey) ? titleKey.join('_') : "".concat(titleKey),
|
|
|
watch: true,
|
|
|
height: 140,
|
|
|
placeholder: questionTitlePlaceholder
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u7B54\u6848\u9009\u9879",
|
|
|
required: true,
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.List, {
|
|
|
name: choiceKey,
|
|
|
rules: [{
|
|
|
validator: function validator(rule, values) {
|
|
|
var hasAnswer = values.some(function (option) {
|
|
|
return option[answerKey] === 1;
|
|
|
});
|
|
|
var emptyAnswerIndex = values.findIndex(function (option) {
|
|
|
var _option$choiceTextKey;
|
|
|
return ((_option$choiceTextKey = option[choiceTextKey]) === null || _option$choiceTextKey === void 0 ? void 0 : _option$choiceTextKey.length) <= 0;
|
|
|
});
|
|
|
if (emptyAnswerIndex !== -1) {
|
|
|
return Promise.reject(new Error("\u8BF7\u5148\u8F93\u5165".concat(tagList[emptyAnswerIndex], "\u9009\u9879\u7684\u5185\u5BB9")));
|
|
|
}
|
|
|
if (!hasAnswer) {
|
|
|
return Promise.reject(new Error('请设置正确答案'));
|
|
|
}
|
|
|
return Promise.resolve();
|
|
|
}
|
|
|
}],
|
|
|
children: function children(fields, _ref3) {
|
|
|
var add = _ref3.add,
|
|
|
remove = _ref3.remove;
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div", {
|
|
|
id: Array.isArray(choiceOptionsPath) ? choiceOptionsPath.join('_') : "".concat(choiceOptionsPath),
|
|
|
children: [fields.map(function (_ref4, index) {
|
|
|
var key = _ref4.key,
|
|
|
name = _ref4.name,
|
|
|
restField = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_0___default()(_ref4, _excluded);
|
|
|
var isEdit = activeEditor === key;
|
|
|
var setInputActive = function setInputActive() {
|
|
|
setActiveEditor(key);
|
|
|
};
|
|
|
var showAddIcon = index < 7 && index === fields.length - 1;
|
|
|
var addItem = function addItem() {
|
|
|
var _add;
|
|
|
return add((_add = {}, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2___default()(_add, choiceTextKey, ''), _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2___default()(_add, answerKey, 0), _add));
|
|
|
};
|
|
|
var deleteItem = function deleteItem() {
|
|
|
return remove(name);
|
|
|
};
|
|
|
return /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_4__.createElement)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Item, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()({}, restField), {}, {
|
|
|
key: key,
|
|
|
name: name,
|
|
|
noStyle: true
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(ChoiceQuestionItem, {
|
|
|
choiceTextKey: choiceTextKey,
|
|
|
answerKey: answerKey,
|
|
|
index: index,
|
|
|
isEdit: isEdit,
|
|
|
setInputActive: setInputActive,
|
|
|
form: form,
|
|
|
choiceOptionsPath: choiceOptionsPath,
|
|
|
allowChangeMode: allowChangeMode,
|
|
|
showAddIcon: showAddIcon,
|
|
|
addItem: addItem,
|
|
|
deleteItem: deleteItem
|
|
|
}));
|
|
|
}), fields.length < 8 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
|
|
|
className: "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.addBtn, " mb30"),
|
|
|
onClick: function onClick() {
|
|
|
var _add2;
|
|
|
return add((_add2 = {}, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2___default()(_add2, choiceTextKey, ''), _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2___default()(_add2, answerKey, 0), _add2));
|
|
|
},
|
|
|
children: "\u6DFB\u52A0\u9009\u9879"
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
}), showAnalysis && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
|
|
|
onClick: function onClick() {
|
|
|
return setEditAnalysis(true);
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Item, {
|
|
|
name: analysisKey,
|
|
|
label: "\u9898\u76EE\u89E3\u6790",
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_6__/* .RegularInput */ .x, {
|
|
|
placeholder: "\u8BF7\u7F16\u8F91\u9898\u76EE\u89E3\u6790\uFF08\u975E\u5FC5\u586B\uFF09",
|
|
|
isEdit: editAnalysis
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 38285:
|
|
|
/*!*********************************************************************!*\
|
|
|
!*** ./src/components/QuestionEditor/CombinationQuestionEditor.tsx ***!
|
|
|
\*********************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ r: function() { return /* binding */ CombinationQuestionEditor; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectWithoutProperties.js */ 27161);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ 59301);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd */ 74997);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! antd */ 78241);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! antd */ 95237);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! antd */ 85731);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! antd */ 6848);
|
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./index.less?modules */ 70992);
|
|
|
/* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @ant-design/icons */ 87306);
|
|
|
/* harmony import */ var _MdEditorInForm__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./MdEditorInForm */ 627);
|
|
|
/* harmony import */ var _ChoiceQuestionEditor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ChoiceQuestionEditor */ 54847);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
var _excluded = ["key", "name"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// import type { ChoiceQuestionType } from './types'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Panel = antd__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.Panel;
|
|
|
var CombinationQuestionEditor = function CombinationQuestionEditor(_ref) {
|
|
|
var questionTitlePlaceholder = _ref.questionTitlePlaceholder,
|
|
|
choiceKey = _ref.choiceKey,
|
|
|
form = _ref.form,
|
|
|
withScore = _ref.withScore;
|
|
|
// const [editAnalysis, setEditAnalysis] = useState(false)
|
|
|
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.wrap,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.questionTitleEditorWrap,
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u9898\u5E72",
|
|
|
name: "name",
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
},
|
|
|
rules: [{
|
|
|
required: true
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_4__/* .MdEditorInForm */ .h, {
|
|
|
scrollId: "name",
|
|
|
watch: true,
|
|
|
height: 140,
|
|
|
placeholder: questionTitlePlaceholder
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u5C0F\u9898",
|
|
|
required: true,
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.List, {
|
|
|
name: "sub_item_banks",
|
|
|
rules: [{
|
|
|
validator: function validator(rule, values) {
|
|
|
if (!values) {
|
|
|
return Promise.reject(new Error('请添加小题'));
|
|
|
}
|
|
|
return Promise.resolve();
|
|
|
}
|
|
|
}],
|
|
|
children: function children(fields, _ref2) {
|
|
|
var add = _ref2.add,
|
|
|
remove = _ref2.remove;
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, {
|
|
|
className: fields.length > 0 ? _index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.collapseWrapper : '',
|
|
|
bordered: false,
|
|
|
expandIcon: function expandIcon(_ref3) {
|
|
|
var isActive = _ref3.isActive;
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("i", {
|
|
|
className: "iconfont icon-weizhankai ".concat(isActive ? _index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.open : _index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.close),
|
|
|
style: {
|
|
|
fontSize: 14,
|
|
|
transition: 'all .2s'
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
children: fields.map(function (_ref4, index) {
|
|
|
var key = _ref4.key,
|
|
|
name = _ref4.name,
|
|
|
restField = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_1___default()(_ref4, _excluded);
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(Panel, {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.panel,
|
|
|
forceRender: true,
|
|
|
header: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.panelHeader,
|
|
|
children: ["\u7B2C", index + 1, "\u5C0F\u9898", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("span", {
|
|
|
children: "\uFF08\u5355\u9009\u9898\uFF09"
|
|
|
})]
|
|
|
}),
|
|
|
extra: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, {
|
|
|
align: "middle",
|
|
|
onClick: function onClick(e) {
|
|
|
return e.stopPropagation();
|
|
|
},
|
|
|
children: [withScore && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.Item, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, restField), {}, {
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入小题分值'
|
|
|
}],
|
|
|
label: "\u5206\u503C",
|
|
|
name: [name, 'question_score'],
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.blankInputNumberWrapper,
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z, {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.blankInput,
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u5F53\u524D\u5C0F\u9898\u5206\u6570",
|
|
|
min: 0.1,
|
|
|
precision: 1,
|
|
|
max: 100,
|
|
|
style: {
|
|
|
width: 150
|
|
|
}
|
|
|
})
|
|
|
})), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z, {
|
|
|
title: "\u5220\u9664",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_ant_design_icons__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, {
|
|
|
className: "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.deleteIcon, " ml40"),
|
|
|
onClick: function onClick() {
|
|
|
return remove(name);
|
|
|
}
|
|
|
})
|
|
|
})]
|
|
|
}),
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.Item, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, restField), {}, {
|
|
|
name: name,
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_ChoiceQuestionEditor__WEBPACK_IMPORTED_MODULE_5__/* .ChoiceQuestionEditor */ .u, {
|
|
|
questionTitlePlaceholder: "\u8BF7\u7F16\u8F91\u9009\u62E9\u9898\u9898\u5E72\u5185\u5BB9",
|
|
|
allowChangeMode: false,
|
|
|
form: form,
|
|
|
choiceKey: [name, 'choices'],
|
|
|
titleKey: [name, 'name'],
|
|
|
analysisKey: [name, 'analysis'],
|
|
|
choiceOptionsPath: ['sub_item_banks', name, 'choices'],
|
|
|
choiceTextKey: "choice_text",
|
|
|
answerKey: "is_answer"
|
|
|
})
|
|
|
}))
|
|
|
}, key);
|
|
|
})
|
|
|
}), fields.length < 20 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", {
|
|
|
className: "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.addBtn),
|
|
|
onClick: function onClick() {
|
|
|
return add({
|
|
|
name: '',
|
|
|
choices: Array.from({
|
|
|
length: 4
|
|
|
}, function () {
|
|
|
return {
|
|
|
choice_text: '',
|
|
|
is_answer: 0
|
|
|
};
|
|
|
}),
|
|
|
analysis: ''
|
|
|
});
|
|
|
},
|
|
|
children: "\u6DFB\u52A0\u5C0F\u9898"
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 32837:
|
|
|
/*!********************************************************************!*\
|
|
|
!*** ./src/components/QuestionEditor/CompletionQuestionEditor.tsx ***!
|
|
|
\********************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ u: function() { return /* binding */ CompletionQuestionEditor; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectWithoutProperties.js */ 27161);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/createForOfIteratorHelper.js */ 98190);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/defineProperty.js */ 22060);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js */ 11006);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/toConsumableArray.js */ 93923);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_5__);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react */ 59301);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! antd */ 43418);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! antd */ 95237);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! antd */ 43604);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! antd */ 1056);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! antd */ 6848);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! antd */ 78673);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! antd */ 78241);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! antd */ 85731);
|
|
|
/* harmony import */ var _MdEditorInForm__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./MdEditorInForm */ 627);
|
|
|
/* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @ant-design/icons */ 87306);
|
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./index.less?modules */ 70992);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["key", "name"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var BlankEditor = function BlankEditor(_ref) {
|
|
|
var value = _ref.value,
|
|
|
onChange = _ref.onChange;
|
|
|
var handleDelete = function handleDelete(index) {
|
|
|
antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z.confirm({
|
|
|
centered: true,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
title: '提示',
|
|
|
content: '确认要删除这个参考答案吗?',
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.modal,
|
|
|
onOk: function onOk() {
|
|
|
var valueCopy = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_5___default()(value);
|
|
|
valueCopy.splice(index, 1);
|
|
|
onChange(valueCopy);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
var handleAdd = function handleAdd() {
|
|
|
var valueCopy = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_5___default()(value);
|
|
|
valueCopy.push('');
|
|
|
onChange(valueCopy);
|
|
|
};
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z, {
|
|
|
align: "middle",
|
|
|
className: "ml20",
|
|
|
gutter: [40, 20],
|
|
|
children: [value === null || value === void 0 ? void 0 : value.map(function (v, index) {
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.blankWrapper,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z, {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.blankInput,
|
|
|
defaultValue: v,
|
|
|
maxLength: 1000,
|
|
|
onBlur: function onBlur(e) {
|
|
|
var valueCopy = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_5___default()(value);
|
|
|
var inputTrimValue = e.target.value.trim();
|
|
|
valueCopy[index] = inputTrimValue;
|
|
|
onChange(valueCopy);
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, {
|
|
|
title: "\u5220\u9664",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_ant_design_icons__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.deleteIcon,
|
|
|
style: {
|
|
|
marginLeft: 15,
|
|
|
visibility: index > 0 ? 'visible' : 'hidden'
|
|
|
},
|
|
|
onClick: function onClick() {
|
|
|
return handleDelete(index);
|
|
|
}
|
|
|
})
|
|
|
})]
|
|
|
}, "".concat(v, "_").concat(index));
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, {
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div", {
|
|
|
className: "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.addBtn),
|
|
|
onClick: function onClick() {
|
|
|
handleAdd();
|
|
|
},
|
|
|
children: "\u65B0\u589E\u7B54\u6848"
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var ReversedSwitch = function ReversedSwitch(_ref2) {
|
|
|
var _ref2$value = _ref2.value,
|
|
|
value = _ref2$value === void 0 ? true : _ref2$value,
|
|
|
_onChange = _ref2.onChange;
|
|
|
//打开为false,关闭为true,即一个特殊的Switch。
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, {
|
|
|
checked: !value,
|
|
|
onChange: function onChange(checked) {
|
|
|
_onChange(!checked);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
var NULL_CH = '▁';
|
|
|
var CompletionQuestionEditor = function CompletionQuestionEditor(_ref3) {
|
|
|
var questionTitlePlaceholder = _ref3.questionTitlePlaceholder,
|
|
|
form = _ref3.form,
|
|
|
_ref3$scoreByBlank = _ref3.scoreByBlank,
|
|
|
scoreByBlank = _ref3$scoreByBlank === void 0 ? false : _ref3$scoreByBlank,
|
|
|
answerKey = _ref3.answerKey;
|
|
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)(false),
|
|
|
_useState2 = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_useState, 2),
|
|
|
editAnalysis = _useState2[0],
|
|
|
setEditAnalysis = _useState2[1];
|
|
|
var getChCountBeforeCursor = function getChCountBeforeCursor(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;
|
|
|
};
|
|
|
var _onCMBeforeChange = function onCMBeforeChange(cm, change, addBlank, removeBlank) {
|
|
|
var rangeText = cm.getRange(change.from, change.to);
|
|
|
var newBlankNum = 0;
|
|
|
change.text.forEach(function (item) {
|
|
|
newBlankNum += item.split(NULL_CH).length - 1;
|
|
|
});
|
|
|
if (change.origin === 'setValue') {
|
|
|
//setValue为初始化,此时不需要删除也不需要增加填空项
|
|
|
return;
|
|
|
}
|
|
|
if (rangeText && rangeText.indexOf(NULL_CH) !== -1) {
|
|
|
var placeholderCountInRange = rangeText.split(NULL_CH).length - 1;
|
|
|
var placeholderCountBefore = getChCountBeforeCursor(cm, change.from);
|
|
|
console.log("\u5220\u9664".concat(placeholderCountInRange, "\u4E2A\uFF0C \u524D\u9762\u6709").concat(placeholderCountBefore, "\u4E2A\uFF0C\u65B0\u589E").concat(newBlankNum, "\u4E2A"));
|
|
|
if (placeholderCountInRange > 1) {
|
|
|
var indexArray = Array.from({
|
|
|
length: placeholderCountInRange
|
|
|
}, function (item, index) {
|
|
|
return placeholderCountBefore + index;
|
|
|
});
|
|
|
removeBlank(indexArray);
|
|
|
} else {
|
|
|
removeBlank(placeholderCountBefore);
|
|
|
}
|
|
|
} else if (newBlankNum > 0) {
|
|
|
var _placeholderCountBefore = getChCountBeforeCursor(cm, change.from);
|
|
|
console.log("\u65B0\u589E".concat(newBlankNum, "\u4E2A\uFF0C\u4E4B\u524D\u6709").concat(_placeholderCountBefore, "\u4E2A"));
|
|
|
addBlank(newBlankNum, _placeholderCountBefore);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
//新增和删除需要重新设置position,position表示填空的位置
|
|
|
var rewritePosition = function rewritePosition() {
|
|
|
var preAnswerData = form.getFieldValue(answerKey);
|
|
|
form.setFieldsValue(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_2___default()({}, answerKey, preAnswerData.map(function (item, index) {
|
|
|
return _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()({}, item), {}, {
|
|
|
position: index + 1
|
|
|
});
|
|
|
})));
|
|
|
};
|
|
|
var addFnRef = (0,react__WEBPACK_IMPORTED_MODULE_6__.useRef)();
|
|
|
var addBlank = function addBlank(addNum, insertIndex) {
|
|
|
for (var i = 0; i < addNum; i++) {
|
|
|
addFnRef.current({
|
|
|
position: null,
|
|
|
answer_text: ['']
|
|
|
}, insertIndex + i);
|
|
|
}
|
|
|
rewritePosition();
|
|
|
};
|
|
|
var removeFnRef = (0,react__WEBPACK_IMPORTED_MODULE_6__.useRef)();
|
|
|
var removeBlank = function removeBlank(deleteIndex) {
|
|
|
removeFnRef.current(deleteIndex);
|
|
|
rewritePosition();
|
|
|
};
|
|
|
var standardAnswersValue = antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z.useWatch(answerKey, form);
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.wrap,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.questionTitleEditorWrap,
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u9898\u5E72",
|
|
|
name: "name",
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
},
|
|
|
rules: [{
|
|
|
required: true
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_7__/* .MdEditorInForm */ .h, {
|
|
|
scrollId: "name",
|
|
|
watch: true,
|
|
|
height: 140,
|
|
|
placeholder: questionTitlePlaceholder,
|
|
|
showNullButton: true,
|
|
|
onCMBeforeChange: function onCMBeforeChange(cm, change) {
|
|
|
_onCMBeforeChange(cm, change, addBlank, removeBlank);
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z.List, {
|
|
|
name: answerKey,
|
|
|
rules: [{
|
|
|
validator: function validator(rule, values) {
|
|
|
if ((values === null || values === void 0 ? void 0 : values.length) === 0) {
|
|
|
return Promise.reject(new Error('答案不能为空'));
|
|
|
}
|
|
|
var _iterator = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_1___default()(values),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var item = _step.value;
|
|
|
var _ref4 = item || {},
|
|
|
answer_text = _ref4.answer_text;
|
|
|
if (answer_text !== null && answer_text !== void 0 && answer_text.some(function (text) {
|
|
|
return (text === null || text === void 0 ? void 0 : text.length) === 0;
|
|
|
})) {
|
|
|
return Promise.reject(new Error('填空项答案不能为空'));
|
|
|
}
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
return Promise.resolve();
|
|
|
}
|
|
|
}],
|
|
|
children: function children(fields, _ref5, _ref6) {
|
|
|
var add = _ref5.add,
|
|
|
remove = _ref5.remove;
|
|
|
var errors = _ref6.errors;
|
|
|
addFnRef.current = add;
|
|
|
removeFnRef.current = remove;
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u7B54\u6848\u9009\u9879",
|
|
|
required: true,
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
}
|
|
|
}), fields.map(function (_ref7, index) {
|
|
|
var key = _ref7.key,
|
|
|
name = _ref7.name,
|
|
|
restField = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_0___default()(_ref7, _excluded);
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z, {
|
|
|
className: "mb20",
|
|
|
align: "middle",
|
|
|
wrap: false,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, {
|
|
|
flex: '0 0 auto',
|
|
|
className: "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.blankIndex),
|
|
|
children: ["\u586B\u7A7A\u9879", index + 1]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, {
|
|
|
flex: 1,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z, {
|
|
|
align: "top",
|
|
|
justify: "space-between",
|
|
|
wrap: false,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, {
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z.Item, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()({}, restField), {}, {
|
|
|
name: [name, 'answer_text'],
|
|
|
noStyle: true,
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(BlankEditor, {})
|
|
|
}))
|
|
|
}), scoreByBlank && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, {
|
|
|
flex: '224px',
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z.Item, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()({}, restField), {}, {
|
|
|
name: [name, 'score'],
|
|
|
label: "\u5206\u503C",
|
|
|
rules: [{
|
|
|
required: true
|
|
|
}],
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.blankInputNumberWrapper,
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_18__/* ["default"] */ .Z, {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.blankInput,
|
|
|
min: 0.1,
|
|
|
max: 100,
|
|
|
precision: 1,
|
|
|
style: {
|
|
|
width: '100%'
|
|
|
},
|
|
|
placeholder: "\u6309\u7A7A\u7ED9\u5206\u8BF7\u8F93\u5165\u5206\u503C"
|
|
|
})
|
|
|
}))
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z.Item, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_3___default()({}, restField), {}, {
|
|
|
name: [name, 'position'],
|
|
|
noStyle: true,
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z, {
|
|
|
type: "hidden"
|
|
|
})
|
|
|
}))]
|
|
|
})]
|
|
|
}, key);
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
}), (standardAnswersValue === null || standardAnswersValue === void 0 ? void 0 : standardAnswersValue.length) > 1 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z, {
|
|
|
align: "middle",
|
|
|
className: (standardAnswersValue === null || standardAnswersValue === void 0 ? void 0 : standardAnswersValue.length) > 1 ? 'mb30' : "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.hide),
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z.Item, {
|
|
|
name: "is_ordered",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(ReversedSwitch, {})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, {
|
|
|
className: "ml10",
|
|
|
children: "\u5141\u8BB8\u5B66\u751F\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u4E0E\u6807\u51C6\u7B54\u6848\u7684\u987A\u5E8F\u4E0D\u4E00\u81F4"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div", {
|
|
|
onClick: function onClick() {
|
|
|
return setEditAnalysis(true);
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z.Item, {
|
|
|
name: "analysis",
|
|
|
label: "\u9898\u76EE\u89E3\u6790",
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_7__/* .RegularInput */ .x, {
|
|
|
placeholder: "\u8BF7\u7F16\u8F91\u9898\u76EE\u89E3\u6790\uFF08\u975E\u5FC5\u586B\uFF09",
|
|
|
isEdit: editAnalysis
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 54620:
|
|
|
/*!******************************************************************!*\
|
|
|
!*** ./src/components/QuestionEditor/JudgmentQuestionEditor.tsx ***!
|
|
|
\******************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ Z: function() { return /* binding */ JudgmentQuestionEditor; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectWithoutProperties.js */ 27161);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js */ 11006);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/defineProperty.js */ 22060);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ 59301);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! antd */ 95237);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! antd */ 43604);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! antd */ 78241);
|
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./index.less?modules */ 70992);
|
|
|
/* harmony import */ var _MdEditorInForm__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./MdEditorInForm */ 627);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["key", "name"];
|
|
|
var _tagMap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var tagMap = (_tagMap = {}, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_3___default()(_tagMap, '正确', 'T'), _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_3___default()(_tagMap, '错误', 'F'), _tagMap);
|
|
|
var JudgmentQuestionItem = function JudgmentQuestionItem(_ref) {
|
|
|
var value = _ref.value,
|
|
|
onChange = _ref.onChange,
|
|
|
form = _ref.form;
|
|
|
var isActiveAnswer = (value === null || value === void 0 ? void 0 : value.is_answer) === 1;
|
|
|
var judgementText = value === null || value === void 0 ? void 0 : value.choice_text;
|
|
|
var setActiveAnswer = function setActiveAnswer() {
|
|
|
var formListValue = form.getFieldsValue().choices.map(function (choice) {
|
|
|
return {
|
|
|
choice_text: choice.choice_text,
|
|
|
is_answer: 0
|
|
|
};
|
|
|
});
|
|
|
form.setFieldsValue({
|
|
|
choices: formListValue
|
|
|
});
|
|
|
onChange(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({}, value), {}, {
|
|
|
is_answer: 1
|
|
|
}));
|
|
|
};
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.choiceWrap,
|
|
|
align: "middle",
|
|
|
wrap: false,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, {
|
|
|
onClick: setActiveAnswer,
|
|
|
className: "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.choiceIndex, " ").concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.judgementIndex, " ").concat(isActiveAnswer ? _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.activeAnswer : ''),
|
|
|
children: tagMap[judgementText]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, {
|
|
|
flex: 1,
|
|
|
className: "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.editorWrap, " ml15"),
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
|
|
|
className: "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.inputBorder, " ").concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.placeholder, " ").concat(isActiveAnswer ? _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.activeJudgementAnswer : ''),
|
|
|
children: judgementText
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, {
|
|
|
flex: '0 0 auto',
|
|
|
className: "ml15",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
|
|
|
onClick: setActiveAnswer,
|
|
|
className: "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.setAnswerBtn, " ").concat(isActiveAnswer ? _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.activeAnswer : ''),
|
|
|
children: isActiveAnswer ? '正确答案' : '设为答案'
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var JudgmentQuestionEditor = function JudgmentQuestionEditor(_ref2) {
|
|
|
var questionTitlePlaceholder = _ref2.questionTitlePlaceholder,
|
|
|
choiceKey = _ref2.choiceKey,
|
|
|
form = _ref2.form;
|
|
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_4__.useState)(false),
|
|
|
_useState2 = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState, 2),
|
|
|
editAnalysis = _useState2[0],
|
|
|
setEditAnalysis = _useState2[1];
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.wrap,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.questionTitleEditorWrap,
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u9898\u5E72",
|
|
|
name: "name",
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
},
|
|
|
rules: [{
|
|
|
required: true
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_6__/* .MdEditorInForm */ .h, {
|
|
|
scrollId: "name",
|
|
|
watch: true,
|
|
|
height: 140,
|
|
|
placeholder: questionTitlePlaceholder
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u7B54\u6848\u9009\u9879",
|
|
|
required: true,
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z.List, {
|
|
|
name: "choices",
|
|
|
rules: [{
|
|
|
validator: function validator(rule, values) {
|
|
|
var hasAnswer = values.some(function (option) {
|
|
|
return (option === null || option === void 0 ? void 0 : option.is_answer) === 1;
|
|
|
});
|
|
|
if (hasAnswer) {
|
|
|
return Promise.resolve();
|
|
|
}
|
|
|
return Promise.reject(new Error('请设置正确答案'));
|
|
|
}
|
|
|
}],
|
|
|
children: function children(fields) {
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
|
|
|
id: "choices",
|
|
|
children: fields.map(function (_ref3) {
|
|
|
var key = _ref3.key,
|
|
|
name = _ref3.name,
|
|
|
restField = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_0___default()(_ref3, _excluded);
|
|
|
return /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_4__.createElement)(antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z.Item, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({}, restField), {}, {
|
|
|
key: key,
|
|
|
name: name,
|
|
|
noStyle: true
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(JudgmentQuestionItem, {
|
|
|
form: form
|
|
|
}));
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
|
|
|
onClick: function onClick() {
|
|
|
return setEditAnalysis(true);
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z.Item, {
|
|
|
name: "analysis",
|
|
|
label: "\u9898\u76EE\u89E3\u6790",
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_6__/* .RegularInput */ .x, {
|
|
|
placeholder: "\u8BF7\u7F16\u8F91\u9898\u76EE\u89E3\u6790\uFF08\u975E\u5FC5\u586B\uFF09",
|
|
|
isEdit: editAnalysis
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 627:
|
|
|
/*!**********************************************************!*\
|
|
|
!*** ./src/components/QuestionEditor/MdEditorInForm.tsx ***!
|
|
|
\**********************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ h: function() { return /* binding */ MdEditorInForm; },
|
|
|
/* harmony export */ x: function() { return /* binding */ RegularInput; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectWithoutProperties.js */ 27161);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var _components_markdown_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/components/markdown-editor */ 83954);
|
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./index.less?modules */ 70992);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ 59301);
|
|
|
/* harmony import */ var _components_RenderHtml__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/components/RenderHtml */ 11436);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
var _excluded = ["value", "onChange", "scrollId"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var MdEditorInForm = function MdEditorInForm(_ref) {
|
|
|
var value = _ref.value,
|
|
|
_onChange = _ref.onChange,
|
|
|
scrollId = _ref.scrollId,
|
|
|
props = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_1___default()(_ref, _excluded);
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", {
|
|
|
id: scrollId || '',
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_components_markdown_editor__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, props), {}, {
|
|
|
defaultValue: value,
|
|
|
onChange: function onChange(a, b) {
|
|
|
console.log("a:", a, b);
|
|
|
if (!!(b !== null && b !== void 0 && b.length)) _onChange(a, b);else _onChange(a);
|
|
|
}
|
|
|
}))
|
|
|
});
|
|
|
};
|
|
|
var RegularInput = function RegularInput(_ref2) {
|
|
|
var value = _ref2.value,
|
|
|
onChange = _ref2.onChange,
|
|
|
placeholder = _ref2.placeholder,
|
|
|
_ref2$height = _ref2.height,
|
|
|
height = _ref2$height === void 0 ? 140 : _ref2$height,
|
|
|
isEdit = _ref2.isEdit;
|
|
|
return isEdit ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_components_markdown_editor__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
|
|
|
watch: true,
|
|
|
isFocus: true,
|
|
|
height: height,
|
|
|
placeholder: placeholder,
|
|
|
defaultValue: value,
|
|
|
onChange: onChange
|
|
|
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", {
|
|
|
style: {
|
|
|
cursor: 'pointer'
|
|
|
},
|
|
|
children: value ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_components_RenderHtml__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.inputBorder,
|
|
|
value: value
|
|
|
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", {
|
|
|
className: "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.inputBorder, " ").concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.placeholder),
|
|
|
children: placeholder
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 32840:
|
|
|
/*!********************************************************************!*\
|
|
|
!*** ./src/components/QuestionEditor/SubjectiveQuestionEditor.tsx ***!
|
|
|
\********************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ W: function() { return /* binding */ SubjectiveQuestionEditor; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/createForOfIteratorHelper.js */ 98190);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js */ 11006);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectWithoutProperties.js */ 27161);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ 59301);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! antd */ 8591);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! antd */ 12563);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! antd */ 78241);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! antd */ 78673);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! antd */ 95237);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! antd */ 43604);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! antd */ 6848);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! antd */ 1056);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! antd */ 85731);
|
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./index.less?modules */ 70992);
|
|
|
/* harmony import */ var _MdEditorInForm__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./MdEditorInForm */ 627);
|
|
|
/* harmony import */ var _components_markdown_editor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/components/markdown-editor */ 83954);
|
|
|
/* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! @ant-design/icons */ 98815);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["value", "onChange"],
|
|
|
_excluded2 = ["key", "name"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var AnswerTextFormItem = function AnswerTextFormItem(_ref) {
|
|
|
var value = _ref.value,
|
|
|
onChange = _ref.onChange,
|
|
|
props = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_3___default()(_ref, _excluded);
|
|
|
var handleChange = function handleChange(v) {
|
|
|
onChange([v]);
|
|
|
};
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_components_markdown_editor__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({}, props), {}, {
|
|
|
defaultValue: value === null || value === void 0 ? void 0 : value[0],
|
|
|
onChange: handleChange
|
|
|
}));
|
|
|
};
|
|
|
var test = function test(str) {
|
|
|
if (!str) {
|
|
|
return false;
|
|
|
}
|
|
|
var containSpecial = new RegExp("[ `~!@#$^&*()={}':;,\\[\\].<>/?~!@#¥……&*()—【】‘;:”“。,、?「」『』_\\+\\-·%《》]|[\\\\/]");
|
|
|
// if (containSpecial.test(str)) {
|
|
|
// message.warning("关键词不能含有特殊字符!")
|
|
|
// return false
|
|
|
// }
|
|
|
if (str === '|') {
|
|
|
antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .ZP.warning("关键词不能只输入一个“|”字符!");
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
|
};
|
|
|
var KeywordTag = function KeywordTag(_ref2) {
|
|
|
var _ref2$value = _ref2.value,
|
|
|
value = _ref2$value === void 0 ? [] : _ref2$value,
|
|
|
onClose = _ref2.onClose;
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z, {
|
|
|
closable: true,
|
|
|
onClose: onClose,
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.keywordTag,
|
|
|
children: value === null || value === void 0 ? void 0 : value.join(' 或 ')
|
|
|
});
|
|
|
};
|
|
|
var SubjectiveQuestionEditor = function SubjectiveQuestionEditor(_ref3) {
|
|
|
var questionTitlePlaceholder = _ref3.questionTitlePlaceholder,
|
|
|
form = _ref3.form,
|
|
|
showKeywords = _ref3.showKeywords,
|
|
|
_ref3$isMustKeyWords = _ref3.isMustKeyWords,
|
|
|
isMustKeyWords = _ref3$isMustKeyWords === void 0 ? showKeywords : _ref3$isMustKeyWords;
|
|
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_4__.useState)(false),
|
|
|
_useState2 = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState, 2),
|
|
|
editAnalysis = _useState2[0],
|
|
|
setEditAnalysis = _useState2[1];
|
|
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_4__.useState)(''),
|
|
|
_useState4 = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState3, 2),
|
|
|
keywordsInput = _useState4[0],
|
|
|
setKeywordsInput = _useState4[1];
|
|
|
var useKeywordsValue = antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.useWatch('use_keywords', form);
|
|
|
var questionScore = antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.useWatch('question_score', form);
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.wrap,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.questionTitleEditorWrap,
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u9898\u5E72",
|
|
|
name: "name",
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
},
|
|
|
rules: [{
|
|
|
required: true
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_6__/* .MdEditorInForm */ .h, {
|
|
|
scrollId: "name",
|
|
|
watch: true,
|
|
|
height: 140,
|
|
|
placeholder: questionTitlePlaceholder
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u53C2\u8003\u7B54\u6848",
|
|
|
name: "answer_texts",
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(AnswerTextFormItem, {
|
|
|
watch: true,
|
|
|
height: 140,
|
|
|
placeholder: '请编辑参考答案(非必填)'
|
|
|
})
|
|
|
}), showKeywords && !isMustKeyWords && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.Item, {
|
|
|
hidden: true,
|
|
|
name: "use_keywords",
|
|
|
valuePropName: "checked",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, {
|
|
|
defaultChecked: true
|
|
|
})
|
|
|
}), showKeywords && isMustKeyWords && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z, {
|
|
|
align: "middle",
|
|
|
className: "mb30",
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.Item, {
|
|
|
name: "use_keywords",
|
|
|
valuePropName: "checked",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, {})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, {
|
|
|
className: "ml10",
|
|
|
children: "\u5F00\u542F\u5173\u952E\u8BCD\u81EA\u52A8\u5224\u5206"
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, {
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, {
|
|
|
placement: "right",
|
|
|
title: "\u9009\u4E2D\u540E\uFF0C\u9700\u8981\u8BBE\u7F6E\u6BCF\u4E2A\u5173\u952E\u8BCD\u7684\u5206\u503C\uFF0C\u7CFB\u7EDF\u4F1A\u6839\u636E\u8BBE\u7F6E\u7684\u5173\u952E\u8BCD\u8FDB\u884C\u81EA\u52A8\u5224\u5206\uFF1B \u6240\u6709\u5173\u952E\u8BCD\u5206\u503C\u4E4B\u548C\u5FC5\u987B\u5C0F\u4E8E\u7B49\u4E8E\u5C0F\u9898\u5206\u503C\u3002",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_ant_design_icons__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, {
|
|
|
style: {
|
|
|
color: '#3061D0',
|
|
|
marginLeft: 6,
|
|
|
cursor: 'pointer'
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
}), (useKeywordsValue || !isMustKeyWords) && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.List, {
|
|
|
name: "keywords",
|
|
|
rules: [{
|
|
|
validator: function validator(rule, values) {
|
|
|
if (!isMustKeyWords) {
|
|
|
return Promise.resolve();
|
|
|
}
|
|
|
if (!(values !== null && values !== void 0 && values.length)) {
|
|
|
return Promise.reject(new Error('请输入关键词'));
|
|
|
}
|
|
|
var keywordsScoreSum = values === null || values === void 0 ? void 0 : values.reduce(function (pre, cur) {
|
|
|
return pre + cur.score;
|
|
|
}, 0);
|
|
|
if (keywordsScoreSum > parseFloat(questionScore)) {
|
|
|
return Promise.reject(new Error('所有关键词的分值之和必须小于等于该小题的分值'));
|
|
|
}
|
|
|
return Promise.resolve();
|
|
|
}
|
|
|
}],
|
|
|
children: function children(fields, _ref4) {
|
|
|
var add = _ref4.add,
|
|
|
remove = _ref4.remove;
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("div", {
|
|
|
className: "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.title, " mb10"),
|
|
|
children: !isMustKeyWords ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("span", {
|
|
|
style: {
|
|
|
color: "#9096A3"
|
|
|
},
|
|
|
children: "\u5224\u5206\u5173\u952E\u8BCD"
|
|
|
}) : "关键词"
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z, {
|
|
|
align: "middle",
|
|
|
className: "font14 mb30",
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, {
|
|
|
flex: 1,
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, {
|
|
|
value: keywordsInput,
|
|
|
onChange: function onChange(e) {
|
|
|
setKeywordsInput(e.target.value);
|
|
|
},
|
|
|
maxLength: 50,
|
|
|
allowClear: true,
|
|
|
onPressEnter: function onPressEnter(e) {
|
|
|
var _e$target, _v$split, _currentKeywordsValue;
|
|
|
var v = "".concat((_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value).replaceAll(' ', ''); //去除所有的空格,同时空格也不触发非法字符校验了
|
|
|
var keywordArr = v === null || v === void 0 || (_v$split = v.split('|')) === null || _v$split === void 0 ? void 0 : _v$split.filter(function (k) {
|
|
|
return !!k;
|
|
|
});
|
|
|
var currentKeywordsValue = form.getFieldValue('keywords');
|
|
|
var existKeywords = (currentKeywordsValue === null || currentKeywordsValue === void 0 || (_currentKeywordsValue = currentKeywordsValue.map(function (item) {
|
|
|
return item === null || item === void 0 ? void 0 : item.keyword;
|
|
|
})) === null || _currentKeywordsValue === void 0 ? void 0 : _currentKeywordsValue.flat()) || [];
|
|
|
var _iterator = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_0___default()(keywordArr),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var word = _step.value;
|
|
|
if (existKeywords.includes(word)) {
|
|
|
antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .ZP.error('为避免判分错误,请勿设置相同的关键词');
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
if (test(v)) {
|
|
|
add({
|
|
|
keyword: keywordArr,
|
|
|
score: 1
|
|
|
});
|
|
|
setKeywordsInput('');
|
|
|
}
|
|
|
},
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.inputBorder,
|
|
|
placeholder: "\u652F\u6301\u8BBE\u7F6E\u591A\u4E2A\u5173\u952E\u8BCD\uFF1B\u5E76\u5217\u5173\u952E\u8BCD\uFF08\u6216\u7684\u5173\u7CFB\uFF09\u8BF7\u7528\u201C|\u201D\u5206\u9694\u5F00"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, {
|
|
|
flex: '148px',
|
|
|
style: {
|
|
|
textAlign: 'right',
|
|
|
color: '#9096A3'
|
|
|
},
|
|
|
children: "\u201C\u56DE\u8F66\u952E\u201D\u4FDD\u5B58\u5173\u952E\u8BCD"
|
|
|
})]
|
|
|
}), fields.map(function (_ref5) {
|
|
|
var key = _ref5.key,
|
|
|
name = _ref5.name,
|
|
|
restField = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_3___default()(_ref5, _excluded2);
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z, {
|
|
|
className: "mb20",
|
|
|
style: {
|
|
|
marginRight: 148
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, {
|
|
|
flex: 1,
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z, {
|
|
|
align: "middle",
|
|
|
justify: "space-between",
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.Item, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({}, restField), {}, {
|
|
|
name: [name, "keyword"],
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(KeywordTag, {
|
|
|
onClose: function onClose() {
|
|
|
return remove(name);
|
|
|
}
|
|
|
})
|
|
|
})), isMustKeyWords && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.Item, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({}, restField), {}, {
|
|
|
name: [name, "score"],
|
|
|
label: "\u5206\u503C",
|
|
|
rules: [{
|
|
|
required: true
|
|
|
}],
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.blankInputNumberWrapper,
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_18__/* ["default"] */ .Z, {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.blankInput,
|
|
|
min: 0.1,
|
|
|
max: 100,
|
|
|
precision: 1,
|
|
|
style: {
|
|
|
width: '100%'
|
|
|
},
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u5206\u6570"
|
|
|
})
|
|
|
}))]
|
|
|
})
|
|
|
})
|
|
|
}, key);
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("div", {
|
|
|
onClick: function onClick() {
|
|
|
return setEditAnalysis(true);
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z.Item, {
|
|
|
name: "analysis",
|
|
|
label: "\u9898\u76EE\u89E3\u6790",
|
|
|
labelCol: {
|
|
|
span: 24
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_6__/* .RegularInput */ .x, {
|
|
|
placeholder: "\u8BF7\u7F16\u8F91\u9898\u76EE\u89E3\u6790\uFF08\u975E\u5FC5\u586B\uFF09",
|
|
|
isEdit: editAnalysis
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 9205:
|
|
|
/*!*************************************************!*\
|
|
|
!*** ./src/components/QuestionEditor/index.tsx ***!
|
|
|
\*************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ Wk: function() { return /* reexport safe */ _SubjectiveQuestionEditor__WEBPACK_IMPORTED_MODULE_3__.W; },
|
|
|
/* harmony export */ ZZ: function() { return /* reexport safe */ _JudgmentQuestionEditor__WEBPACK_IMPORTED_MODULE_1__.Z; },
|
|
|
/* harmony export */ rL: function() { return /* reexport safe */ _CombinationQuestionEditor__WEBPACK_IMPORTED_MODULE_4__.r; },
|
|
|
/* harmony export */ tc: function() { return /* reexport safe */ _BProgramEditor__WEBPACK_IMPORTED_MODULE_5__.t; },
|
|
|
/* harmony export */ u8: function() { return /* reexport safe */ _CompletionQuestionEditor__WEBPACK_IMPORTED_MODULE_2__.u; },
|
|
|
/* harmony export */ uh: function() { return /* reexport safe */ _ChoiceQuestionEditor__WEBPACK_IMPORTED_MODULE_0__.u; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _ChoiceQuestionEditor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ChoiceQuestionEditor */ 54847);
|
|
|
/* harmony import */ var _JudgmentQuestionEditor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./JudgmentQuestionEditor */ 54620);
|
|
|
/* harmony import */ var _CompletionQuestionEditor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CompletionQuestionEditor */ 32837);
|
|
|
/* harmony import */ var _SubjectiveQuestionEditor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./SubjectiveQuestionEditor */ 32840);
|
|
|
/* harmony import */ var _CombinationQuestionEditor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./CombinationQuestionEditor */ 38285);
|
|
|
/* harmony import */ var _BProgramEditor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./BProgramEditor */ 17538);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 40807:
|
|
|
/*!******************************************************!*\
|
|
|
!*** ./src/components/Spinner/index.tsx + 1 modules ***!
|
|
|
\******************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
Z: function() { return /* binding */ Spinner; }
|
|
|
});
|
|
|
|
|
|
// 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__(45295);
|
|
|
;// CONCATENATED MODULE: ./src/components/Spinner/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var Spinnermodules = ({"ldsRing":"ldsRing___mpBZC","idsRingWrapper":"idsRingWrapper___Of9_n","ldsring":"ldsring___o0w2t"});
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/components/Spinner/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* harmony default export */ var Spinner = (function (_ref) {
|
|
|
var message = _ref.message,
|
|
|
className = _ref.className,
|
|
|
children = _ref.children,
|
|
|
_ref$style = _ref.style,
|
|
|
style = _ref$style === void 0 ? {} : _ref$style;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "".concat(Spinnermodules.idsRingWrapper, " ").concat(className),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Spinnermodules.ldsRing,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {})]
|
|
|
}), message ? /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
style: style,
|
|
|
children: message
|
|
|
}) : null, /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Outlet, {})]
|
|
|
});
|
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 79669:
|
|
|
/*!*************************************************************!*\
|
|
|
!*** ./src/components/markdown-editor/code-block/index.tsx ***!
|
|
|
\*************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ h: function() { return /* binding */ MyCodeMirror; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js */ 11006);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ 59301);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd */ 57809);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! antd */ 78241);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! antd */ 3113);
|
|
|
/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! codemirror */ 89780);
|
|
|
/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(codemirror__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var codemirror_lib_codemirror_css__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! codemirror/lib/codemirror.css */ 7042);
|
|
|
/* harmony import */ var codemirror_theme_blackboard_css__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! codemirror/theme/blackboard.css */ 93202);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Option = antd__WEBPACK_IMPORTED_MODULE_7__["default"].Option;
|
|
|
|
|
|
//https://github.com/codemirror/CodeMirror/issues/4838
|
|
|
var formItemLayout = {
|
|
|
labelCol: {
|
|
|
span: 4
|
|
|
},
|
|
|
wrapperCol: {
|
|
|
span: 20
|
|
|
}
|
|
|
};
|
|
|
var LanguageDesc = {
|
|
|
asp: ['ASP', 'vbscript'],
|
|
|
actionscript: ['ActionScript(3.0)/Flash/Flex', 'clike'],
|
|
|
bash: ['Bash/Bat', 'shell'],
|
|
|
css: ['CSS', 'css'],
|
|
|
c: ['C', 'clike'],
|
|
|
cpp: ['C++', 'clike'],
|
|
|
csharp: ['C#', 'clike'],
|
|
|
coffeescript: ['CoffeeScript', 'coffeescript'],
|
|
|
d: ['D', 'd'],
|
|
|
dart: ['Dart', 'dart'],
|
|
|
delphi: ['Delphi/Pascal', 'pascal'],
|
|
|
erlang: ['Erlang', 'erlang'],
|
|
|
go: ['Golang', 'go'],
|
|
|
groovy: ['Groovy', 'groovy'],
|
|
|
html: ['HTML', 'text/html'],
|
|
|
java: ['Java', 'clike'],
|
|
|
json: ['JSON', 'text/json'],
|
|
|
javascript: ['Javascript', 'javascript'],
|
|
|
lua: ['Lua', 'lua'],
|
|
|
less: ['LESS', 'css'],
|
|
|
markdown: ['Markdown', 'gfm'],
|
|
|
'objective-c': ['Objective-C', 'clike'],
|
|
|
php: ['PHP', 'php'],
|
|
|
perl: ['Perl', 'perl'],
|
|
|
python: ['Python', 'python'],
|
|
|
r: ['R', 'r'],
|
|
|
rst: ['reStructedText', 'rst'],
|
|
|
ruby: ['Ruby', 'ruby'],
|
|
|
sql: ['SQL', 'sql'],
|
|
|
sass: ['SASS/SCSS', 'sass'],
|
|
|
shell: ['Shell', 'shell'],
|
|
|
scala: ['Scala', 'clike'],
|
|
|
swift: ['Swift', 'clike'],
|
|
|
vb: ['VB/VBScript', 'vb'],
|
|
|
xml: ['XML', 'text/xml'],
|
|
|
yaml: ['YAML', 'yaml']
|
|
|
};
|
|
|
/* harmony default export */ __webpack_exports__.Z = (function (_ref) {
|
|
|
var callback = _ref.callback,
|
|
|
onCancel = _ref.onCancel;
|
|
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)('python'),
|
|
|
_useState2 = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState, 2),
|
|
|
mode = _useState2[0],
|
|
|
setMode = _useState2[1];
|
|
|
function onSetMode(value) {
|
|
|
setMode(LanguageDesc[value][1]);
|
|
|
}
|
|
|
function onSubmit(values) {
|
|
|
callback(values);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formItemLayout), {}, {
|
|
|
className: "code-block-panel",
|
|
|
initialValues: {
|
|
|
language: 'python',
|
|
|
content: ''
|
|
|
},
|
|
|
onFinish: onSubmit,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u4EE3\u7801\u8BED\u8A00",
|
|
|
name: "language",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_7__["default"], {
|
|
|
getPopupContainer: function getPopupContainer(trigger) {
|
|
|
return trigger.parentNode;
|
|
|
},
|
|
|
onChange: onSetMode,
|
|
|
children: Object.keys(LanguageDesc).map(function (item) {
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(Option, {
|
|
|
value: item,
|
|
|
children: LanguageDesc[item][0]
|
|
|
}, item);
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u4EE3\u7801\u5185\u5BB9",
|
|
|
name: "content",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入代码内容'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(MyCodeMirror, {
|
|
|
mode: mode
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", {
|
|
|
className: "flex-container flex-end",
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .ZP, {
|
|
|
type: "primary",
|
|
|
htmlType: "submit",
|
|
|
style: {
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: "\u786E\u5B9A"
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .ZP, {
|
|
|
type: "ghost",
|
|
|
onClick: onCancel,
|
|
|
children: "\u53D6\u6D88"
|
|
|
})]
|
|
|
})]
|
|
|
}));
|
|
|
});
|
|
|
function MyCodeMirror(_ref2) {
|
|
|
var value = _ref2.value,
|
|
|
onChange = _ref2.onChange,
|
|
|
mode = _ref2.mode,
|
|
|
_ref2$options = _ref2.options,
|
|
|
options = _ref2$options === void 0 ? {} : _ref2$options;
|
|
|
var el = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)();
|
|
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(),
|
|
|
_useState4 = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState3, 2),
|
|
|
cm = _useState4[0],
|
|
|
setCm = _useState4[1];
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
var onChangeHandler = function onChangeHandler(cm) {
|
|
|
var content = cm.getValue();
|
|
|
onChange && onChange(content);
|
|
|
};
|
|
|
cm.on('change', onChangeHandler);
|
|
|
return function () {
|
|
|
cm.off('change', onChangeHandler);
|
|
|
};
|
|
|
}
|
|
|
}, [cm, onChange]);
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
cm.setOption('mode', mode);
|
|
|
}
|
|
|
}, [cm, mode]);
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
if (value !== cm.getValue() || value === '') {
|
|
|
setTimeout(function () {
|
|
|
cm.setValue(value || '');
|
|
|
}, 300);
|
|
|
}
|
|
|
}
|
|
|
}, [cm, value]);
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
|
|
|
if (el.current && !cm) {
|
|
|
var instance = codemirror__WEBPACK_IMPORTED_MODULE_3___default().fromTextArea(el.current, _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({
|
|
|
mode: mode,
|
|
|
lineNumbers: true,
|
|
|
lineWrapping: true,
|
|
|
autoCloseBrackets: true,
|
|
|
tabSize: 4,
|
|
|
autofocus: true,
|
|
|
autoCloseTags: true,
|
|
|
matchBrackets: true,
|
|
|
styleActiveLine: true
|
|
|
}, options));
|
|
|
setCm(instance);
|
|
|
}
|
|
|
}, [el.current, cm]);
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", {
|
|
|
className: "my-codemirror-container",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("textarea", {
|
|
|
ref: el
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 83954:
|
|
|
/*!***************************************************************!*\
|
|
|
!*** ./src/components/markdown-editor/index.tsx + 10 modules ***!
|
|
|
\***************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
Z: function() { return /* binding */ markdown_editor; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/createForOfIteratorHelper.js
|
|
|
var createForOfIteratorHelper = __webpack_require__(98190);
|
|
|
var createForOfIteratorHelper_default = /*#__PURE__*/__webpack_require__.n(createForOfIteratorHelper);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js
|
|
|
var regeneratorRuntime = __webpack_require__(10574);
|
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js
|
|
|
var asyncToGenerator = __webpack_require__(39343);
|
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(11006);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/defineProperty.js
|
|
|
var defineProperty = __webpack_require__(22060);
|
|
|
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/lib/codemirror.js
|
|
|
var codemirror = __webpack_require__(89780);
|
|
|
var codemirror_default = /*#__PURE__*/__webpack_require__.n(codemirror);
|
|
|
// EXTERNAL MODULE: ./node_modules/_resize-observer-polyfill@1.5.1@resize-observer-polyfill/dist/ResizeObserver.es.js
|
|
|
var ResizeObserver_es = __webpack_require__(76374);
|
|
|
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/lib/codemirror.css
|
|
|
var lib_codemirror = __webpack_require__(7042);
|
|
|
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/addon/edit/closetag.js
|
|
|
var closetag = __webpack_require__(6313);
|
|
|
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/addon/edit/closebrackets.js
|
|
|
var closebrackets = __webpack_require__(25717);
|
|
|
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/addon/display/placeholder.js
|
|
|
var placeholder = __webpack_require__(99498);
|
|
|
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/mode/markdown/markdown.js
|
|
|
var markdown = __webpack_require__(25419);
|
|
|
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/mode/stex/stex.js
|
|
|
var stex = __webpack_require__(67549);
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/index.less
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules
|
|
|
var RenderHtml = __webpack_require__(11436);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/components/RenderHtml/stex.tsx
|
|
|
|
|
|
// const latexjs = require('latex-l.js/dist/latex.js');
|
|
|
// import "latex-l.js/dist/css/base.css"
|
|
|
|
|
|
|
|
|
/* harmony default export */ var RenderHtml_stex = (function (_ref) {
|
|
|
var _ref$value = _ref.value,
|
|
|
value = _ref$value === void 0 ? '' : _ref$value,
|
|
|
className = _ref.className,
|
|
|
showTextOnly = _ref.showTextOnly,
|
|
|
showLines = _ref.showLines,
|
|
|
_ref$style = _ref.style,
|
|
|
style = _ref$style === void 0 ? {} : _ref$style;
|
|
|
var html = (0,_react_17_0_2_react.useMemo)(function () {
|
|
|
// try {
|
|
|
// const latex = value || 'This is some text';
|
|
|
// let generator = new latexjs.default.HtmlGenerator({ hyphenate: true })
|
|
|
// let doc = latexjs.default.parse(latex, { generator: generator }).htmlDocument()
|
|
|
// return doc.body.innerHTML
|
|
|
// }catch(e){
|
|
|
// console.log("e:",e)
|
|
|
// return "错误的latex语法,请检查"
|
|
|
// }
|
|
|
return "";
|
|
|
}, [value]);
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
dangerouslySetInnerHTML: {
|
|
|
__html: html
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
});
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(26801);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/toolbar/index.less
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/css/iconfont.css
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/toolbar/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var DEFAULTICONS = [{
|
|
|
title: '粗体',
|
|
|
icon: 'icon-bold',
|
|
|
actionName: 'bold'
|
|
|
}, {
|
|
|
title: '斜体',
|
|
|
icon: 'icon-italic',
|
|
|
actionName: 'italic'
|
|
|
}, '|', {
|
|
|
title: '无序列表',
|
|
|
icon: 'icon-unorder-list',
|
|
|
actionName: 'list-ul'
|
|
|
}, {
|
|
|
title: '有序列表',
|
|
|
icon: 'icon-order-list',
|
|
|
actionName: 'list-ol'
|
|
|
}, '|', {
|
|
|
title: '行内代码',
|
|
|
icon: 'icon-code',
|
|
|
actionName: 'code'
|
|
|
}, {
|
|
|
title: '代码块(多语言风格)',
|
|
|
icon: 'icon-file-code',
|
|
|
actionName: 'code-block'
|
|
|
}, {
|
|
|
title: '链接',
|
|
|
icon: 'icon-link',
|
|
|
actionName: 'link'
|
|
|
}, '|', {
|
|
|
title: '行内公式',
|
|
|
icon: 'icon-sum',
|
|
|
actionName: 'inline-latex'
|
|
|
}, {
|
|
|
title: '多行公式',
|
|
|
icon: 'icon-formula',
|
|
|
actionName: 'latex'
|
|
|
}, '|', {
|
|
|
title: '添加图片',
|
|
|
icon: 'icon-picture',
|
|
|
actionName: 'upload-image'
|
|
|
}, {
|
|
|
title: '表格',
|
|
|
icon: 'icon-table',
|
|
|
actionName: 'add-table'
|
|
|
}, '|', {
|
|
|
title: '换行',
|
|
|
icon: 'icon-minus',
|
|
|
actionName: 'line-break'
|
|
|
}, {
|
|
|
title: '清空',
|
|
|
icon: 'icon-eraser',
|
|
|
actionName: 'eraser'
|
|
|
}];
|
|
|
function AButton(_ref) {
|
|
|
var onActionCallback = _ref.onActionCallback,
|
|
|
title = _ref.title,
|
|
|
icon = _ref.icon,
|
|
|
actionName = _ref.actionName,
|
|
|
_ref$className = _ref.className,
|
|
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
|
children = _ref.children;
|
|
|
function onAction() {
|
|
|
onActionCallback(actionName);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
|
|
|
title: title,
|
|
|
className: className,
|
|
|
onClick: onAction,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "md-iconfont ".concat(icon)
|
|
|
}), children]
|
|
|
});
|
|
|
}
|
|
|
/* harmony default export */ var toolbar = (function (_ref2) {
|
|
|
var watch = _ref2.watch,
|
|
|
showNullButton = _ref2.showNullButton,
|
|
|
showNullProgramButton = _ref2.showNullProgramButton,
|
|
|
onActionCallback = _ref2.onActionCallback,
|
|
|
fullScreen = _ref2.fullScreen,
|
|
|
insertTemp = _ref2.insertTemp,
|
|
|
hidetoolBar = _ref2.hidetoolBar;
|
|
|
var icons = [].concat(DEFAULTICONS, [{
|
|
|
title: "".concat(watch ? '关闭实时预览' : '开启实时预览'),
|
|
|
icon: "".concat(watch ? 'icon-eye-slash' : 'icon-eye'),
|
|
|
actionName: 'trigger-watch'
|
|
|
}]);
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
|
className: "markdown-toolbar-container",
|
|
|
children: [!hidetoolBar && icons.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: item.actionName ? /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, objectSpread2_default()(objectSpread2_default()({}, item), {}, {
|
|
|
onActionCallback: onActionCallback
|
|
|
})) : /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "v-line"
|
|
|
})
|
|
|
}, index);
|
|
|
}), showNullButton ? /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
|
|
|
icon: "icon-edit insert-blank",
|
|
|
className: "btn-null",
|
|
|
title: "\u589E\u52A0\u586B\u7A7A",
|
|
|
actionName: "add-null-ch",
|
|
|
onActionCallback: onActionCallback,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "fill-tip",
|
|
|
children: "\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"
|
|
|
})
|
|
|
})
|
|
|
}) : null, showNullProgramButton ? /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
|
|
|
icon: "icon-edit insert-blank",
|
|
|
className: "btn-null",
|
|
|
title: "\u589E\u52A0\u586B\u7A7A",
|
|
|
actionName: "add-signal",
|
|
|
onActionCallback: onActionCallback,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "fill-tip",
|
|
|
children: "\u6DFB\u52A0\u5355\u884C\u586B\u7A7A\u9879"
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
|
|
|
icon: "icon-uniE900 insert-blank",
|
|
|
className: "btn-null",
|
|
|
title: "\u589E\u52A0\u586B\u7A7A",
|
|
|
actionName: "add-multiple",
|
|
|
onActionCallback: onActionCallback,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "fill-tip",
|
|
|
children: "\u6DFB\u52A0\u591A\u884C\u586B\u7A7A\u9879"
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
}) : null, insertTemp && /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
|
|
|
icon: "icon-edit",
|
|
|
className: "btn-null",
|
|
|
title: "\u63D2\u5165\u6A21\u677F",
|
|
|
actionName: "inster-template-".concat(insertTemp),
|
|
|
onActionCallback: onActionCallback,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "fill-tip",
|
|
|
children: "\u63D2\u5165\u6A21\u677F"
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
className: "btn-full-screen",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
|
|
|
icon: "".concat(fullScreen ? 'icon-shrink' : 'icon-enlarge'),
|
|
|
title: fullScreen ? '关闭全屏' : '开启全屏',
|
|
|
actionName: "trigger-full-screen",
|
|
|
onActionCallback: onActionCallback
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
// EXTERNAL MODULE: ./src/components/modal.tsx
|
|
|
var modal = __webpack_require__(83016);
|
|
|
// 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/input/index.js + 5 modules
|
|
|
var input = __webpack_require__(1056);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(3113);
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/link/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var formItemLayout = {
|
|
|
labelCol: {
|
|
|
span: 4
|
|
|
},
|
|
|
wrapperCol: {
|
|
|
span: 20
|
|
|
}
|
|
|
};
|
|
|
/* harmony default export */ var markdown_editor_link = (function (_ref) {
|
|
|
var callback = _ref.callback,
|
|
|
onCancel = _ref.onCancel;
|
|
|
function onSubmit(values) {
|
|
|
callback(values);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, objectSpread2_default()(objectSpread2_default()({}, formItemLayout), {}, {
|
|
|
initialValues: {
|
|
|
link: 'http://',
|
|
|
title: ''
|
|
|
},
|
|
|
className: "link-panel",
|
|
|
onFinish: onSubmit,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
label: "\u94FE\u63A5\u5730\u5740",
|
|
|
name: "link",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入链接地址'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
label: "\u94FE\u63A5\u6807\u9898",
|
|
|
name: "title",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入链接标题'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "flex-container flex-end",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "primary",
|
|
|
htmlType: "submit",
|
|
|
style: {
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: "\u786E\u5B9A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "ghost",
|
|
|
onClick: onCancel,
|
|
|
children: "\u53D6\u6D88"
|
|
|
})]
|
|
|
})]
|
|
|
}));
|
|
|
});
|
|
|
// EXTERNAL MODULE: ./src/components/markdown-editor/code-block/index.tsx
|
|
|
var code_block = __webpack_require__(79669);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
|
|
|
var message = __webpack_require__(8591);
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/upload-image/index.less
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
// EXTERNAL MODULE: ./src/pages/tasks/util.js
|
|
|
var util = __webpack_require__(80330);
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/upload-image/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var useForm = es_form/* default */.Z.useForm;
|
|
|
var style = {
|
|
|
width: 280,
|
|
|
marginRight: 10
|
|
|
};
|
|
|
var upload_image_formItemLayout = {
|
|
|
labelCol: {
|
|
|
span: 5
|
|
|
},
|
|
|
wrapperCol: {
|
|
|
span: 19
|
|
|
}
|
|
|
};
|
|
|
/* harmony default export */ var upload_image = (function (_ref) {
|
|
|
var callback = _ref.callback,
|
|
|
onCancel = _ref.onCancel;
|
|
|
var _useForm = useForm(),
|
|
|
_useForm2 = slicedToArray_default()(_useForm, 1),
|
|
|
form = _useForm2[0];
|
|
|
var nameRef = (0,_react_17_0_2_react.useRef)();
|
|
|
function onSubmit(values) {
|
|
|
callback(objectSpread2_default()(objectSpread2_default()({}, values), {}, {
|
|
|
name: nameRef.current
|
|
|
}));
|
|
|
}
|
|
|
function onAddUrl(data, file) {
|
|
|
if (data.status === -1) {
|
|
|
message/* default */.ZP.error(data.message);
|
|
|
return;
|
|
|
}
|
|
|
form.setFieldsValue({
|
|
|
src: "/api/attachments/".concat(data.id),
|
|
|
type: file.type
|
|
|
});
|
|
|
}
|
|
|
function onFileChange(e) {
|
|
|
var file = e.target.files[0];
|
|
|
nameRef.current = file.name;
|
|
|
uploadImage(file, onAddUrl);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, objectSpread2_default()(objectSpread2_default()({
|
|
|
form: form
|
|
|
}, upload_image_formItemLayout), {}, {
|
|
|
className: "upload-image-panel",
|
|
|
onFinish: onSubmit,
|
|
|
style: {
|
|
|
width: 470,
|
|
|
overflow: "hidden"
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
label: "\u56FE\u7247\u5730\u5740",
|
|
|
required: true,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "flex-container",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: "src",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入文件地址'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
style: style
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(UploadButton, {
|
|
|
onFileChange: onFileChange
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
label: "\u56FE\u7247\u63CF\u8FF0",
|
|
|
name: "alt"
|
|
|
// rules={[{ required: true, message: '请输入图片描述' }]}
|
|
|
,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
style: {
|
|
|
width: 264
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z.Item, {
|
|
|
style: {
|
|
|
textAlign: "right"
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "primary",
|
|
|
htmlType: "submit",
|
|
|
style: {
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: "\u786E\u5B9A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "default",
|
|
|
onClick: onCancel,
|
|
|
children: "\u53D6\u6D88"
|
|
|
})]
|
|
|
})]
|
|
|
}));
|
|
|
});
|
|
|
function UploadButton(_ref2) {
|
|
|
var onFileChange = _ref2.onFileChange;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("label", {
|
|
|
className: "upload-button",
|
|
|
style: {
|
|
|
cursor: "pointer"
|
|
|
},
|
|
|
children: ["\u672C\u5730\u4E0A\u4F20", /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
type: "file",
|
|
|
onChange: onFileChange
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
function uploadImage(file, callback) {
|
|
|
if (!file) {
|
|
|
throw new String('没有文件');
|
|
|
return;
|
|
|
}
|
|
|
var formData = new FormData();
|
|
|
formData.append('editormd-image-file', file);
|
|
|
formData.append('file_param_name', 'editormd-image-file');
|
|
|
formData.append('byxhr', 'true');
|
|
|
var xhr = new window.XMLHttpRequest();
|
|
|
xhr.withCredentials = true;
|
|
|
xhr.addEventListener('load', function (response) {
|
|
|
callback(JSON.parse(response.target.responseText), file);
|
|
|
}, false);
|
|
|
xhr.addEventListener('error', function (error) {
|
|
|
console.error(error);
|
|
|
}, false);
|
|
|
xhr.open('POST', "".concat(util/* apiPref */.KI, "/api/attachments.json"));
|
|
|
xhr.send(formData);
|
|
|
}
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/radio/index.js + 5 modules
|
|
|
var es_radio = __webpack_require__(5112);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input-number/index.js + 14 modules
|
|
|
var input_number = __webpack_require__(85731);
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/add-table-panel/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var RadioGroup = es_radio/* default.Group */.ZP.Group;
|
|
|
var add_table_panel_style = {
|
|
|
margin: '0 8px'
|
|
|
};
|
|
|
/* harmony default export */ var add_table_panel = (function (_ref) {
|
|
|
var callback = _ref.callback,
|
|
|
onCancel = _ref.onCancel;
|
|
|
function onSubmit(values) {
|
|
|
callback(values);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
|
|
|
className: "add-table-panel",
|
|
|
initialValues: {
|
|
|
row: 3,
|
|
|
col: 2,
|
|
|
align: 'default'
|
|
|
},
|
|
|
onFinish: onSubmit,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "flex-container",
|
|
|
style: {
|
|
|
alignItems: "baseline"
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: add_table_panel_style,
|
|
|
children: "\u5355\u5143\u683C\u6570\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: add_table_panel_style,
|
|
|
children: "\u884C\u6570"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "row",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入行数'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: add_table_panel_style,
|
|
|
children: "\u5217\u6570"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "col",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入列数'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "flex-container",
|
|
|
style: {
|
|
|
marginTop: 12,
|
|
|
alignItems: "baseline"
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: add_table_panel_style,
|
|
|
children: "\u5BF9\u9F50\u65B9\u5F0F\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "align",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(RadioGroup, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
|
|
|
value: "default",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "fa fa-align-justify"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
|
|
|
value: "left",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "fa fa-align-left"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
|
|
|
value: "center",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "fa fa-align-center"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
|
|
|
value: "right",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "fa fa-align-right"
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "flex-container flex-end",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "primary",
|
|
|
htmlType: "submit",
|
|
|
style: {
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: "\u786E\u5B9A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "ghost",
|
|
|
onClick: onCancel,
|
|
|
children: "\u53D6\u6D88"
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
|
var env = __webpack_require__(78130);
|
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
|
var fetch = __webpack_require__(91506);
|
|
|
// EXTERNAL MODULE: ./node_modules/_uuid@8.3.0@uuid/dist/esm-browser/v4.js + 4 modules
|
|
|
var v4 = __webpack_require__(1012);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
|
|
|
var es_modal = __webpack_require__(43418);
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/constant.ts
|
|
|
var LINK = 'link';
|
|
|
var UPLOAD_IMAGE = 'upload-image';
|
|
|
var CODE_BLOCK = 'code-block';
|
|
|
var ADD_TABLE = 'add-table';
|
|
|
var HRLINE = '------------';
|
|
|
var ALIGNSIGN = {
|
|
|
"default": HRLINE,
|
|
|
left: ":".concat(HRLINE),
|
|
|
center: ":".concat(HRLINE, ":"),
|
|
|
right: "".concat(HRLINE, ":")
|
|
|
};
|
|
|
// EXTERNAL MODULE: ./src/components/useInterval.tsx
|
|
|
var useInterval = __webpack_require__(47169);
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _DEFAULTKEYMAP, _TitleDesc;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function noop() {}
|
|
|
var pending = 0;
|
|
|
var StorageTimeTicket = 10000;
|
|
|
var NULL_CH = '▁';
|
|
|
var ADD_MULTI = '@▁▁@';
|
|
|
var ADD_SINGLE = '@▁@';
|
|
|
var TEMP1 = '\n**模板标题**\n模板正文内容,可输入文本内容和粘贴图片等操作'; //课程须知模板
|
|
|
function processSize(size) {
|
|
|
return !/^\d+$/.test(size) ? size : "".concat(size, "px");
|
|
|
}
|
|
|
var isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|
|
|
var key = isMac ? 'Cmd' : 'Ctrl';
|
|
|
var officeSix = ["pptm", "pptx", "ppt", "pot", "pps", "ppa", "potx", "ppsx", "ppam", "pptm", "potm", "ppsm", "doc", "docx", "dot", "dotx", "docm", "dotm", "xls", "xlsx", "csv", "xlt", "xla", "xltx", "xlsm", "xltm", "xlam", "xlsb"];
|
|
|
var DEFAULTKEYMAP = (_DEFAULTKEYMAP = {}, defineProperty_default()(_DEFAULTKEYMAP, key + '-B', 'bold'), defineProperty_default()(_DEFAULTKEYMAP, key + '-I', 'italic'), _DEFAULTKEYMAP);
|
|
|
var TitleDesc = (_TitleDesc = {}, defineProperty_default()(_TitleDesc, LINK, '添加链接'), defineProperty_default()(_TitleDesc, CODE_BLOCK, '添加代码块'), defineProperty_default()(_TitleDesc, UPLOAD_IMAGE, '添加文件'), defineProperty_default()(_TitleDesc, ADD_TABLE, '添加表格'), _TitleDesc);
|
|
|
|
|
|
//https://codemirror.net/demo
|
|
|
//The height can be set through CSS (by giving the .CodeMirror class a height property), or by calling the cm's setSize method.
|
|
|
/* harmony default export */ var markdown_editor = (function (_ref) {
|
|
|
var _ref$defaultValue = _ref.defaultValue,
|
|
|
defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
|
|
|
onChange = _ref.onChange,
|
|
|
_ref$width = _ref.width,
|
|
|
width = _ref$width === void 0 ? '100%' : _ref$width,
|
|
|
_ref$height = _ref.height,
|
|
|
height = _ref$height === void 0 ? 400 : _ref$height,
|
|
|
_ref$miniToolbar = _ref.miniToolbar,
|
|
|
miniToolbar = _ref$miniToolbar === void 0 ? false : _ref$miniToolbar,
|
|
|
_ref$isFocus = _ref.isFocus,
|
|
|
isFocus = _ref$isFocus === void 0 ? false : _ref$isFocus,
|
|
|
watch = _ref.watch,
|
|
|
insertTemp = _ref.insertTemp,
|
|
|
_ref$mode = _ref.mode,
|
|
|
mode = _ref$mode === void 0 ? "markdown" : _ref$mode,
|
|
|
_ref$id = _ref.id,
|
|
|
id = _ref$id === void 0 ? 'markdown-editor-id' : _ref$id,
|
|
|
_ref$showResizeBar = _ref.showResizeBar,
|
|
|
showResizeBar = _ref$showResizeBar === void 0 ? false : _ref$showResizeBar,
|
|
|
_ref$noStorage = _ref.noStorage,
|
|
|
noStorage = _ref$noStorage === void 0 ? false : _ref$noStorage,
|
|
|
_ref$showNullButton = _ref.showNullButton,
|
|
|
showNullButton = _ref$showNullButton === void 0 ? false : _ref$showNullButton,
|
|
|
_ref$showNullProgramB = _ref.showNullProgramButton,
|
|
|
showNullProgramButton = _ref$showNullProgramB === void 0 ? false : _ref$showNullProgramB,
|
|
|
_ref$hidetoolBar = _ref.hidetoolBar,
|
|
|
hidetoolBar = _ref$hidetoolBar === void 0 ? false : _ref$hidetoolBar,
|
|
|
_ref$fullScreen = _ref.fullScreen,
|
|
|
fullScreen = _ref$fullScreen === void 0 ? false : _ref$fullScreen,
|
|
|
onBlur = _ref.onBlur,
|
|
|
onCMBeforeChange = _ref.onCMBeforeChange,
|
|
|
onFullScreen = _ref.onFullScreen,
|
|
|
_ref$className = _ref.className,
|
|
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
|
_ref$disablePaste = _ref.disablePaste,
|
|
|
disablePaste = _ref$disablePaste === void 0 ? false : _ref$disablePaste,
|
|
|
_ref$disabled = _ref.disabled,
|
|
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
|
_ref$disabledFill = _ref.disabledFill,
|
|
|
disabledFill = _ref$disabledFill === void 0 ? false : _ref$disabledFill,
|
|
|
_ref$placeholder = _ref.placeholder,
|
|
|
placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
|
|
|
_ref$values = _ref.values,
|
|
|
values = _ref$values === void 0 ? '' : _ref$values;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(null),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
cm = _useState2[0],
|
|
|
setCm = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(defaultValue),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
value = _useState4[0],
|
|
|
setValue = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(watch),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
preview = _useState6[0],
|
|
|
setPreview = _useState6[1];
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)(fullScreen),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
isFull = _useState8[0],
|
|
|
setIsFull = _useState8[1];
|
|
|
var _useState9 = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
action = _useState10[0],
|
|
|
setAction = _useState10[1];
|
|
|
var _useState11 = (0,_react_17_0_2_react.useState)(0),
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
lastedUpdateTime = _useState12[0],
|
|
|
setLastedUpdateTime = _useState12[1];
|
|
|
var _useState13 = (0,_react_17_0_2_react.useState)(height),
|
|
|
_useState14 = slicedToArray_default()(_useState13, 2),
|
|
|
h = _useState14[0],
|
|
|
setH = _useState14[1];
|
|
|
var _useState15 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState16 = slicedToArray_default()(_useState15, 2),
|
|
|
tip = _useState16[0],
|
|
|
setTip = _useState16[1];
|
|
|
var uuidRef = (0,_react_17_0_2_react.useRef)((0,v4/* default */.Z)());
|
|
|
var openPhoneRef = (0,_react_17_0_2_react.useRef)(false);
|
|
|
var timer = (0,_react_17_0_2_react.useRef)();
|
|
|
var cmEl = (0,_react_17_0_2_react.useRef)();
|
|
|
var containerEl = (0,_react_17_0_2_react.useRef)();
|
|
|
var resizeBarEl = (0,_react_17_0_2_react.useRef)();
|
|
|
var previewEl = (0,_react_17_0_2_react.useRef)();
|
|
|
var checkFiles = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var _res$attachments;
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return (0,fetch/* default */.ZP)("/api/attachments/distinct_hash_val.json", {
|
|
|
method: "post",
|
|
|
body: {
|
|
|
hash_val: uuidRef.current
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context.sent;
|
|
|
if (!!(res !== null && res !== void 0 && (_res$attachments = res.attachments) !== null && _res$attachments !== void 0 && _res$attachments.length)) {
|
|
|
console.log("cm:", cm, cmEl);
|
|
|
res.attachments.map(function (item) {
|
|
|
if (item.content_type.indexOf("image") > -1) {
|
|
|
cm.replaceSelection(".concat(item.content_type, ")"));
|
|
|
} else if (item.content_type.indexOf("video") > -1) {
|
|
|
cm.replaceSelection("<video width=\"100%\" controls src=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "\"></video>"));
|
|
|
} else if (item.content_type.indexOf("pdf") > -1) {
|
|
|
cm.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(item.id, "?type=").concat(item.content_type, "&disposition=inline\" target=\"_blank\">").concat(item.name, "</a>"));
|
|
|
} else {
|
|
|
cm.replaceSelection("[".concat(item.name, "](").concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(item.id, "?type=").concat(item.content_type, ")"));
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function checkFiles() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
|
|
|
// useEffect(() => {
|
|
|
// setValue(defaultValue)
|
|
|
// cm?.setValue(defaultValue)
|
|
|
// },[])
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var scrollTop = window.scrollY || window.pageYOffset;
|
|
|
setValue(values);
|
|
|
cm === null || cm === void 0 || cm.setValue(values);
|
|
|
window.scrollTo(0, scrollTop);
|
|
|
}, [values]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
onFullScreen === null || onFullScreen === void 0 || onFullScreen(isFull);
|
|
|
}, [isFull]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (cmEl.current) {
|
|
|
var onPaste = function onPaste(_, e) {
|
|
|
if (disablePaste) {
|
|
|
e.preventDefault();
|
|
|
return;
|
|
|
}
|
|
|
var clipboardData = e.clipboardData;
|
|
|
if (clipboardData) {
|
|
|
var types = clipboardData.types.toString();
|
|
|
var items = clipboardData.items;
|
|
|
if (types === 'Files' || clipboardData.types.indexOf("Files") > -1) {
|
|
|
e.preventDefault();
|
|
|
if (mode == "stex") return;
|
|
|
try {
|
|
|
var _items$;
|
|
|
var item = items[1];
|
|
|
if (((_items$ = items[0]) === null || _items$ === void 0 ? void 0 : _items$.kind) === 'file') {
|
|
|
item = items[0];
|
|
|
}
|
|
|
var file = item.getAsFile();
|
|
|
var fileSix = file.name.split(".").pop();
|
|
|
// console.log("item:", item, file, item?.type?.match(/^video\//i))
|
|
|
uploadImage(file, function (data) {
|
|
|
if (data.id) {
|
|
|
var _file$type, _file$type2, _file$type3;
|
|
|
if ((file === null || file === void 0 || (_file$type = file.type) === null || _file$type === void 0 ? void 0 : _file$type.indexOf("image")) > -1) {
|
|
|
instance.replaceSelection(".concat(data.content_type, ")"));
|
|
|
} else if ((file === null || file === void 0 || (_file$type2 = file.type) === null || _file$type2 === void 0 ? void 0 : _file$type2.indexOf("video")) > -1) {
|
|
|
instance.replaceSelection("<video width=\"100%\" controls src=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "\"></video>"));
|
|
|
} else if ((file === null || file === void 0 || (_file$type3 = file.type) === null || _file$type3 === void 0 ? void 0 : _file$type3.indexOf("pdf")) > -1) {
|
|
|
instance.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=").concat(file.type, "&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
|
|
|
} else if (officeSix.includes(fileSix)) {
|
|
|
instance.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=office&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
|
|
|
} else {
|
|
|
instance.replaceSelection("[".concat(file.name, "](").concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=").concat(data.content_type, ")"));
|
|
|
}
|
|
|
} else {
|
|
|
if ((data === null || data === void 0 ? void 0 : data.status) === 401) document.location.href = '/user/login';
|
|
|
}
|
|
|
});
|
|
|
} catch (e) {
|
|
|
message/* default */.ZP.warning("请使用chrome浏览器粘贴");
|
|
|
}
|
|
|
return true;
|
|
|
} else {
|
|
|
//toMarkdown ?
|
|
|
// let html = clipboardData.getData('text/html')
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
};
|
|
|
var instance = codemirror_default().fromTextArea(cmEl.current, {
|
|
|
mode: mode,
|
|
|
// inputStyle: 'contenteditable',
|
|
|
lineNumbers: miniToolbar ? false : true,
|
|
|
lineWrapping: true,
|
|
|
value: defaultValue,
|
|
|
autoCloseTags: true,
|
|
|
autoCloseBrackets: true
|
|
|
});
|
|
|
instance.on("keyup", function (cm, event) {
|
|
|
if (event.keyCode === 8) {
|
|
|
if (cm.getValue() == "") {
|
|
|
instance.setOption("placeholder", placeholder);
|
|
|
} else {
|
|
|
instance.setOption("placeholder", null);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
instance.on("keydown", function (cm, event) {
|
|
|
if (event.keyCode === 8) {
|
|
|
var pos = deleteAtSymbol(cm);
|
|
|
if (pos) {
|
|
|
event.preventDefault();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
isFocus && instance.focus();
|
|
|
instance.on('paste', onPaste);
|
|
|
instance.on('dragleave', function (data, e) {
|
|
|
containerEl.current.classList.remove("mouse-hover-md");
|
|
|
});
|
|
|
instance.on('dragover', function (data, e) {
|
|
|
containerEl.current.classList.add("mouse-hover-md");
|
|
|
});
|
|
|
instance.on('drop', function (data, e) {
|
|
|
containerEl.current.classList.add("mouse-hover-md");
|
|
|
// var file;
|
|
|
var files;
|
|
|
// Check if files were dropped
|
|
|
files = e.dataTransfer.files;
|
|
|
if (files.length > 0) {
|
|
|
e.preventDefault();
|
|
|
e.stopPropagation();
|
|
|
// file = files[0];
|
|
|
// alert('File: ' + file.name);
|
|
|
// return false;
|
|
|
var _loop = function _loop() {
|
|
|
var file = files[i];
|
|
|
var fileSix = file.name.split(".").pop();
|
|
|
uploadImage(file, function (data) {
|
|
|
if (data.id) {
|
|
|
var _file$type4, _file$type5, _file$type6;
|
|
|
if ((file === null || file === void 0 || (_file$type4 = file.type) === null || _file$type4 === void 0 ? void 0 : _file$type4.indexOf("image")) > -1) {
|
|
|
instance.replaceSelection(".concat(data.content_type, ")"));
|
|
|
} else if ((file === null || file === void 0 || (_file$type5 = file.type) === null || _file$type5 === void 0 ? void 0 : _file$type5.indexOf("video")) > -1) {
|
|
|
instance.replaceSelection("<video width=\"100%\" controls src=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "\"></video>"));
|
|
|
} else if ((file === null || file === void 0 || (_file$type6 = file.type) === null || _file$type6 === void 0 ? void 0 : _file$type6.indexOf("pdf")) > -1) {
|
|
|
instance.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=").concat(file.type, "&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
|
|
|
} else if (officeSix.includes(fileSix)) {
|
|
|
instance.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=office&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
|
|
|
} else {
|
|
|
instance.replaceSelection("[".concat(file.name, "](").concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=").concat(data.content_type, ")"));
|
|
|
}
|
|
|
} else {
|
|
|
if ((data === null || data === void 0 ? void 0 : data.status) === 401) document.location.href = '/user/login';
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
for (var i = 0; i < files.length; i++) {
|
|
|
_loop();
|
|
|
}
|
|
|
// files.map((file:any) => {
|
|
|
|
|
|
// })
|
|
|
}
|
|
|
});
|
|
|
|
|
|
if (disabled) {
|
|
|
instance.on("beforeChange", function (instances, change) {
|
|
|
if (change.origin === "paste" || change.origin === "+input") {
|
|
|
change.cancel();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
setCm(instance);
|
|
|
return function () {
|
|
|
instance.off('paste', onPaste);
|
|
|
};
|
|
|
}
|
|
|
}, []);
|
|
|
var resizeEditorBodyHeight = (0,_react_17_0_2_react.useCallback)(function () {
|
|
|
if (containerEl.current) {
|
|
|
try {
|
|
|
// let toolH = containerEl.current.getElementsByClassName('markdown-toolbar-container')[0].offsetHeight
|
|
|
// let mdBody = containerEl.current.getElementsByClassName('markdown-editor-body')[0]
|
|
|
// if (!isFull) {
|
|
|
// mdBody.style.height = `${h - toolH}px`
|
|
|
// } else {
|
|
|
// mdBody.style.height = `calc(100vh - ${toolH}px)`
|
|
|
// }
|
|
|
} catch (error) {
|
|
|
console.log(error, '---- to set md editor body height');
|
|
|
}
|
|
|
}
|
|
|
}, [h, containerEl, isFull]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
function onLayout() {
|
|
|
var ro = new ResizeObserver_es/* default */.Z(function (entries) {
|
|
|
var _iterator = createForOfIteratorHelper_default()(entries),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var entry = _step.value;
|
|
|
if (entry.target.offsetHeight > 0 || entry.target.offsetWidth > 0) {
|
|
|
resizeEditorBodyHeight();
|
|
|
cm.setSize('100%', '100%');
|
|
|
cm.refresh();
|
|
|
}
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
});
|
|
|
ro.observe(cmEl.current.parentElement);
|
|
|
return ro;
|
|
|
}
|
|
|
if (cm) {
|
|
|
var ro = onLayout();
|
|
|
return function () {
|
|
|
var _cmEl$current, _cmEl$current2;
|
|
|
if ((_cmEl$current = cmEl.current) !== null && _cmEl$current !== void 0 && _cmEl$current.parentElement) ro.unobserve((_cmEl$current2 = cmEl.current) === null || _cmEl$current2 === void 0 ? void 0 : _cmEl$current2.parentElement);
|
|
|
};
|
|
|
}
|
|
|
}, [cm, resizeEditorBodyHeight]);
|
|
|
|
|
|
//keymap
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
var keymap = [];
|
|
|
var _loop2 = function _loop2() {
|
|
|
var _Object$entries$_i = slicedToArray_default()(_Object$entries[_i], 2),
|
|
|
k = _Object$entries$_i[0],
|
|
|
value = _Object$entries$_i[1];
|
|
|
var map = defineProperty_default()({}, k, function () {
|
|
|
onActionCallback(value);
|
|
|
});
|
|
|
keymap.push(map);
|
|
|
cm.addKeyMap(map);
|
|
|
};
|
|
|
for (var _i = 0, _Object$entries = Object.entries(DEFAULTKEYMAP); _i < _Object$entries.length; _i++) {
|
|
|
_loop2();
|
|
|
}
|
|
|
timer.current = setInterval(function () {
|
|
|
if (openPhoneRef.current) {
|
|
|
checkFiles();
|
|
|
}
|
|
|
}, 4000);
|
|
|
return function () {
|
|
|
clearInterval(timer.current);
|
|
|
for (var _i2 = 0, _keymap = keymap; _i2 < _keymap.length; _i2++) {
|
|
|
var m = _keymap[_i2];
|
|
|
cm.removeKeyMap(m);
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
}, [cm]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (fullScreen !== isFull) {
|
|
|
setIsFull(fullScreen);
|
|
|
}
|
|
|
}, [fullScreen]);
|
|
|
(0,useInterval/* default */.Z)(function () {
|
|
|
if (!noStorage && lastedUpdateTime > 0) {
|
|
|
var currentTime = new Date().getTime();
|
|
|
var lastedValue = window.sessionStorage.getItem(id);
|
|
|
if (currentTime >= lastedUpdateTime + StorageTimeTicket && (!lastedValue || lastedValue !== value)) {
|
|
|
window.sessionStorage.setItem(id, value);
|
|
|
setTip(true);
|
|
|
}
|
|
|
}
|
|
|
}, StorageTimeTicket);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
setPreview(watch);
|
|
|
}, [cm, watch]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
isFocus && cm.focus();
|
|
|
}
|
|
|
}, [cm, isFocus]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (preview && cm) {
|
|
|
var syncScroll = function syncScroll(e) {
|
|
|
var target = e.target;
|
|
|
if (previewEl.current) {
|
|
|
var ratio = target.scrollTop / target.scrollHeight;
|
|
|
previewEl.current.scrollTop = previewEl.current.scrollHeight * ratio;
|
|
|
}
|
|
|
};
|
|
|
var scrollEl = cm.getScrollerElement();
|
|
|
scrollEl.addEventListener('scroll', syncScroll);
|
|
|
return function () {
|
|
|
scrollEl.removeEventListener('scroll', syncScroll);
|
|
|
};
|
|
|
}
|
|
|
}, [cm, preview]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (cm && onCMBeforeChange) {
|
|
|
var onChangeHandler = function onChangeHandler(cm, change) {
|
|
|
onCMBeforeChange(cm, change);
|
|
|
};
|
|
|
cm.on('beforeChange', onChangeHandler);
|
|
|
return function () {
|
|
|
cm.off('beforeChange', onChangeHandler);
|
|
|
};
|
|
|
}
|
|
|
}, [cm, onCMBeforeChange]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (cm && onBlur) {
|
|
|
var onBlurHandler = function onBlurHandler() {
|
|
|
onBlur(cm.getValue());
|
|
|
};
|
|
|
cm.on('blur', onBlurHandler);
|
|
|
return function () {
|
|
|
cm.off('blur', onBlurHandler);
|
|
|
};
|
|
|
}
|
|
|
}, [cm, onBlur]);
|
|
|
function deleteAtSymbol(cm, change) {
|
|
|
var doc = cm.getDoc();
|
|
|
var cursor = doc.getCursor();
|
|
|
var line = doc.getLine(cursor.line);
|
|
|
var ch = line.charAt(cursor.ch - 1);
|
|
|
var p1 = line.lastIndexOf("@▁@", cursor.ch);
|
|
|
var p2 = line.lastIndexOf("@▁▁@", cursor.ch);
|
|
|
var posStart = p1 > p2 ? p1 : p2;
|
|
|
var n = p1 > p2 ? 3 : 4;
|
|
|
if (ADD_MULTI.indexOf(ch) === -1) return null;
|
|
|
console.log("change1:", change, cm, line, cursor, posStart, p1, p2, ch);
|
|
|
if (posStart >= 0 && cursor.ch - posStart < 5) {
|
|
|
var posEnd = posStart + n;
|
|
|
doc.replaceRange("", {
|
|
|
line: cursor.line,
|
|
|
ch: posStart
|
|
|
}, {
|
|
|
line: cursor.line,
|
|
|
ch: posEnd
|
|
|
});
|
|
|
return {
|
|
|
line: cursor.line,
|
|
|
ch: posEnd
|
|
|
};
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
var onChangeHandler = function onChangeHandler(cm, change) {
|
|
|
var content = cm.getValue();
|
|
|
setValue(content);
|
|
|
setLastedUpdateTime(new Date().getTime());
|
|
|
cm.getScrollerElement().dispatchEvent(new CustomEvent('scroll'));
|
|
|
if (onChange) {
|
|
|
if (showNullProgramButton) {
|
|
|
onChange(content, formatProgramFill(content));
|
|
|
} else {
|
|
|
onChange(content);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
cm.on('change', onChangeHandler);
|
|
|
return function () {
|
|
|
cm.off('change', onChangeHandler);
|
|
|
};
|
|
|
}
|
|
|
}, [cm, onChange]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
// isFocus && cm.focus()
|
|
|
if (defaultValue === null || defaultValue === undefined) {
|
|
|
cm.setValue('');
|
|
|
setValue('');
|
|
|
} else {
|
|
|
var scrollTop = window.scrollY || window.pageYOffset;
|
|
|
if (defaultValue !== cm.getValue()) {
|
|
|
cm.setValue(defaultValue);
|
|
|
setValue(defaultValue);
|
|
|
cm.setCursor(disabled ? 1 : cm.lineCount(), 0);
|
|
|
window.scrollTo(0, scrollTop);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, [cm, defaultValue]);
|
|
|
var onActionCallback = (0,_react_17_0_2_react.useCallback)(function (actionName) {
|
|
|
var cursor = cm.getCursor();
|
|
|
var selection = cm.getSelection();
|
|
|
var selectionText = selection.split('\n');
|
|
|
switch (actionName) {
|
|
|
case 'bold':
|
|
|
cm.replaceSelection('**' + selection + '**');
|
|
|
if (selection === '') {
|
|
|
cm.setCursor(cursor.line, cursor.ch + 2);
|
|
|
}
|
|
|
return cm.focus();
|
|
|
case 'italic':
|
|
|
cm.replaceSelection('*' + selection + '*');
|
|
|
if (selection === '') {
|
|
|
cm.setCursor(cursor.line, cursor.ch + 1);
|
|
|
}
|
|
|
return cm.focus();
|
|
|
case 'code':
|
|
|
cm.replaceSelection('`' + selection + '`');
|
|
|
if (selection === '') {
|
|
|
cm.setCursor(cursor.line, cursor.ch + 1);
|
|
|
}
|
|
|
return cm.focus();
|
|
|
case 'inline-latex':
|
|
|
cm.replaceSelection('`$$' + selection + '$$`');
|
|
|
if (selection === '') {
|
|
|
cm.setCursor(cursor.line, cursor.ch + 3);
|
|
|
}
|
|
|
return cm.focus();
|
|
|
case 'latex':
|
|
|
cm.replaceSelection("```latex\n" + selection + "\n```");
|
|
|
cm.setCursor(cursor.line + 1, selection.length + 1);
|
|
|
return cm.focus();
|
|
|
case 'line-break':
|
|
|
cm.replaceSelection('<br/>\n');
|
|
|
return cm.focus();
|
|
|
case 'list-ul':
|
|
|
if (selection === '') {
|
|
|
cm.replaceSelection('- ' + selection);
|
|
|
} else {
|
|
|
cm.replaceSelection(selectionText.map(function (item) {
|
|
|
return item === '' ? '' : "- ".concat(item);
|
|
|
}).join('\n'));
|
|
|
}
|
|
|
return cm.focus();
|
|
|
case 'list-ol':
|
|
|
if (selection === '') {
|
|
|
cm.replaceSelection('1. ' + selection);
|
|
|
} else {
|
|
|
cm.replaceSelection(selectionText.map(function (item, index) {
|
|
|
return item === '' ? '' : "".concat(index + 1, ". ").concat(item);
|
|
|
}).join('\n'));
|
|
|
}
|
|
|
return cm.focus();
|
|
|
case 'add-null-ch':
|
|
|
if (selection === '') {
|
|
|
cm.setCursor(cursor.line, cursor.ch);
|
|
|
}
|
|
|
cm.replaceSelection(NULL_CH);
|
|
|
return cm.focus();
|
|
|
case 'add-signal':
|
|
|
if (selection === '') {
|
|
|
cm.setCursor(cursor.line, cursor.ch);
|
|
|
}
|
|
|
cm.replaceSelection(ADD_SINGLE);
|
|
|
return cm.focus();
|
|
|
case 'add-multiple':
|
|
|
if (selection === '') {
|
|
|
cm.setCursor(cursor.line, cursor.ch);
|
|
|
}
|
|
|
cm.replaceSelection(ADD_MULTI);
|
|
|
return cm.focus();
|
|
|
case 'inster-template-1':
|
|
|
if (selection === '') {
|
|
|
cm.setCursor(cursor.line, cursor.ch);
|
|
|
}
|
|
|
cm.replaceSelection(TEMP1);
|
|
|
return cm.focus();
|
|
|
case 'eraser':
|
|
|
cm.setValue('');
|
|
|
return cm.focus();
|
|
|
case 'trigger-watch':
|
|
|
setPreview(!preview);
|
|
|
return cm.focus();
|
|
|
case 'trigger-full-screen':
|
|
|
setIsFull(!isFull);
|
|
|
return cm.focus();
|
|
|
case LINK:
|
|
|
setAction(LINK);
|
|
|
return;
|
|
|
case CODE_BLOCK:
|
|
|
setAction(CODE_BLOCK);
|
|
|
return;
|
|
|
case UPLOAD_IMAGE:
|
|
|
setAction(UPLOAD_IMAGE);
|
|
|
return;
|
|
|
case ADD_TABLE:
|
|
|
setAction(ADD_TABLE);
|
|
|
return;
|
|
|
default:
|
|
|
throw new Error();
|
|
|
}
|
|
|
}, [cm, preview, isFull]);
|
|
|
var ExecutePluginAction = (0,_react_17_0_2_react.useCallback)(function (values) {
|
|
|
setAction('');
|
|
|
switch (action) {
|
|
|
case LINK:
|
|
|
var title = values.title,
|
|
|
link = values.link;
|
|
|
cm.replaceSelection("[".concat(title, "](").concat(link, ")"));
|
|
|
return cm.focus();
|
|
|
case CODE_BLOCK:
|
|
|
var language = values.language,
|
|
|
content = values.content;
|
|
|
cm.replaceSelection(['```' + language, content, '```'].join('\n'));
|
|
|
return cm.focus();
|
|
|
case UPLOAD_IMAGE:
|
|
|
var src = values.src,
|
|
|
alt = values.alt;
|
|
|
if (alt) {
|
|
|
cm.replaceSelection(".concat(src, " \"").concat(alt, "\" )"));
|
|
|
} else {
|
|
|
cm.replaceSelection(""));
|
|
|
}
|
|
|
return cm.focus();
|
|
|
case ADD_TABLE:
|
|
|
var row = values.row,
|
|
|
col = values.col,
|
|
|
align = values.align;
|
|
|
var table = '\n';
|
|
|
for (var r = 0; r < row; r++) {
|
|
|
var rows = [];
|
|
|
var heads = [];
|
|
|
for (var c = 0; c < col; c++) {
|
|
|
if (r === 1) {
|
|
|
heads.push(ALIGNSIGN[align]);
|
|
|
}
|
|
|
rows.push(' ');
|
|
|
}
|
|
|
if (r === 1) {
|
|
|
table += "| ".concat(heads.join(' | '), " |\n");
|
|
|
}
|
|
|
table += "| ".concat(rows.join(col === 1 ? '' : ' | '), " |\n");
|
|
|
}
|
|
|
cm.replaceSelection(table + '\n');
|
|
|
return cm.focus();
|
|
|
default:
|
|
|
throw new Error();
|
|
|
}
|
|
|
}, [cm, action]);
|
|
|
var PluginEl = (0,_react_17_0_2_react.useMemo)(function () {
|
|
|
switch (action) {
|
|
|
case LINK:
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor_link, {
|
|
|
callback: ExecutePluginAction,
|
|
|
onCancel: onCancel
|
|
|
});
|
|
|
case CODE_BLOCK:
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(code_block/* default */.Z, {
|
|
|
callback: ExecutePluginAction,
|
|
|
onCancel: onCancel
|
|
|
});
|
|
|
case UPLOAD_IMAGE:
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(upload_image, {
|
|
|
callback: ExecutePluginAction,
|
|
|
onCancel: onCancel
|
|
|
});
|
|
|
case ADD_TABLE:
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(add_table_panel, {
|
|
|
callback: ExecutePluginAction,
|
|
|
onCancel: onCancel
|
|
|
});
|
|
|
default:
|
|
|
return null;
|
|
|
}
|
|
|
}, [action]);
|
|
|
function onCancel() {
|
|
|
setAction('');
|
|
|
}
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (resizeBarEl.current) {
|
|
|
var onMouseDown = function onMouseDown(e) {
|
|
|
dragging = true;
|
|
|
startY = e.pageY;
|
|
|
};
|
|
|
var onMouseUp = function onMouseUp() {
|
|
|
dragging = false;
|
|
|
};
|
|
|
var onMouseMove = function onMouseMove(e) {
|
|
|
if (dragging) {
|
|
|
var delta = e.pageY - startY;
|
|
|
if (delta < 0) {
|
|
|
delta = 0;
|
|
|
}
|
|
|
if (delta > 300) {
|
|
|
delta = 300;
|
|
|
}
|
|
|
var resizeH = height + delta + 'px';
|
|
|
setH(resizeH);
|
|
|
}
|
|
|
};
|
|
|
var resizeBar = resizeBarEl.current;
|
|
|
var dragging = false;
|
|
|
var startY = 0;
|
|
|
resizeBar.addEventListener('mousedown', onMouseDown);
|
|
|
document.addEventListener('mousemove', onMouseMove);
|
|
|
document.addEventListener('mouseup', onMouseUp);
|
|
|
return function () {
|
|
|
resizeBar.removeEventListener('mousedown', onMouseDown);
|
|
|
document.removeEventListener('mousemove', onMouseMove);
|
|
|
document.removeEventListener('mouseup', onMouseUp);
|
|
|
};
|
|
|
}
|
|
|
}, [cm, resizeBarEl]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
setH(height);
|
|
|
}, [height]);
|
|
|
var fixedWidth = processSize(width);
|
|
|
var fixedHeight = processSize(h);
|
|
|
var style = {
|
|
|
width: fixedWidth,
|
|
|
height: fixedHeight
|
|
|
};
|
|
|
var saveTime = (0,_react_17_0_2_react.useMemo)(function () {
|
|
|
if (lastedUpdateTime) {
|
|
|
var d = new Date(lastedUpdateTime);
|
|
|
var _h = d.getHours();
|
|
|
var m = d.getMinutes();
|
|
|
var s = d.getSeconds();
|
|
|
_h = _h < 10 ? '0' + _h : _h;
|
|
|
m = m < 10 ? '0' + m : m;
|
|
|
s = s < 10 ? '0' + s : s;
|
|
|
return "".concat(_h, ":").concat(m, ":").concat(s);
|
|
|
}
|
|
|
return 0;
|
|
|
}, [lastedUpdateTime]);
|
|
|
var formatProgramFill = function formatProgramFill(str) {
|
|
|
var arr = [];
|
|
|
if (showNullProgramButton) {
|
|
|
var num = -1;
|
|
|
str = str.replace(/(@▁▁@|@▁@)/g, function (a, b, c) {
|
|
|
arr.push({
|
|
|
multiLine: !(a === ADD_SINGLE)
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
return arr;
|
|
|
};
|
|
|
function onCancelStorage() {
|
|
|
window.sessionStorage.removeItem(id);
|
|
|
setTip(false);
|
|
|
setLastedUpdateTime(0);
|
|
|
}
|
|
|
function onReset() {
|
|
|
setTip(false);
|
|
|
setLastedUpdateTime(0);
|
|
|
cm.setValue(window.sessionStorage.getItem(id));
|
|
|
}
|
|
|
function setValues(a, b) {
|
|
|
var content = cm.getValue();
|
|
|
content = content.replace(a, b);
|
|
|
setValue(content);
|
|
|
cm === null || cm === void 0 || cm.setValue(content);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "markdown-editor-wrapper",
|
|
|
ref: containerEl,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "markdown-editor-container ".concat(className, " ").concat(preview ? 'on-preview' : '', " ").concat(miniToolbar ? 'mini' : '', " ").concat(isFull ? 'full-screen' : ''),
|
|
|
style: style,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(toolbar, {
|
|
|
insertTemp: insertTemp,
|
|
|
watch: preview,
|
|
|
fullScreen: isFull,
|
|
|
showNullButton: showNullButton,
|
|
|
showNullProgramButton: showNullProgramButton,
|
|
|
onActionCallback: onActionCallback,
|
|
|
hidetoolBar: hidetoolBar,
|
|
|
uuid: uuidRef.current,
|
|
|
setOpenPhones: function setOpenPhones() {
|
|
|
openPhoneRef.current = true;
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "markdown-editor-body",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "codemirror-container",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("textarea", {
|
|
|
ref: cmEl,
|
|
|
placeholder: placeholder
|
|
|
})
|
|
|
}), preview ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
ref: previewEl,
|
|
|
className: "preview-container",
|
|
|
children: [mode === "stex" && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml_stex, {
|
|
|
value: value
|
|
|
}), mode !== "stex" && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
disabledFill: disabledFill,
|
|
|
showProgramFill: showNullProgramButton,
|
|
|
value: value
|
|
|
})]
|
|
|
}) : null]
|
|
|
})]
|
|
|
})
|
|
|
}), showResizeBar ? /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
ref: resizeBarEl,
|
|
|
className: "editor-resize"
|
|
|
}) : null, /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
children: TitleDesc[action] ? /*#__PURE__*/(0,jsx_runtime.jsx)(es_modal/* default */.Z, {
|
|
|
centered: true,
|
|
|
title: TitleDesc[action],
|
|
|
open: true,
|
|
|
onCancel: onCancel,
|
|
|
footer: null,
|
|
|
className: "markdown-popup-form",
|
|
|
children: PluginEl
|
|
|
}) : null
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 83016:
|
|
|
/*!**********************************!*\
|
|
|
!*** ./src/components/modal.tsx ***!
|
|
|
\**********************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ Z: function() { return /* binding */ Dialog; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/classCallCheck.js */ 94312);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/createClass.js */ 24127);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/inherits.js */ 93242);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/createSuper.js */ 10564);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ 59301);
|
|
|
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react-dom */ 4676);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Dialog = /*#__PURE__*/function (_React$Component) {
|
|
|
_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_2___default()(Dialog, _React$Component);
|
|
|
var _super = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_3___default()(Dialog);
|
|
|
function Dialog(props) {
|
|
|
var _this;
|
|
|
_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0___default()(this, Dialog);
|
|
|
_this = _super.call(this, props);
|
|
|
var doc = window.document;
|
|
|
_this.node = doc.createElement('div');
|
|
|
doc.body.appendChild(_this.node);
|
|
|
return _this;
|
|
|
}
|
|
|
_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_1___default()(Dialog, [{
|
|
|
key: "render",
|
|
|
value: function render() {
|
|
|
var children = this.props.children;
|
|
|
return /*#__PURE__*/(0,react_dom__WEBPACK_IMPORTED_MODULE_5__.createPortal)(children, this.node);
|
|
|
}
|
|
|
}, {
|
|
|
key: "componentWillUnmount",
|
|
|
value: function componentWillUnmount() {
|
|
|
window.document.body.removeChild(this.node);
|
|
|
}
|
|
|
}]);
|
|
|
return Dialog;
|
|
|
}(react__WEBPACK_IMPORTED_MODULE_4__.Component);
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 47169:
|
|
|
/*!****************************************!*\
|
|
|
!*** ./src/components/useInterval.tsx ***!
|
|
|
\****************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ Z: function() { return /* binding */ useInterval; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
|
|
|
|
|
|
function useInterval(callback, delay) {
|
|
|
var savedCallback = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
|
|
|
|
// 保存新回调
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
|
savedCallback.current = callback;
|
|
|
});
|
|
|
|
|
|
// 建立 interval
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
|
function tick() {
|
|
|
savedCallback.current();
|
|
|
}
|
|
|
if (delay !== null) {
|
|
|
var id = setInterval(tick, delay);
|
|
|
return function () {
|
|
|
return clearInterval(id);
|
|
|
};
|
|
|
}
|
|
|
}, [delay]);
|
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 90678:
|
|
|
/*!*****************************************************************!*\
|
|
|
!*** ./src/pages/MyProblem/TestCasePanel/index.tsx + 1 modules ***!
|
|
|
\*****************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
Y4: function() { return /* binding */ DetailCommitOut; },
|
|
|
Im: function() { return /* binding */ ExecuteDict; },
|
|
|
ZP: function() { return /* binding */ TestCasePanel; }
|
|
|
});
|
|
|
|
|
|
// UNUSED EXPORTS: getCommitOut
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(11006);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js
|
|
|
var regeneratorRuntime = __webpack_require__(10574);
|
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js
|
|
|
var asyncToGenerator = __webpack_require__(39343);
|
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(26801);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/defineProperty.js
|
|
|
var defineProperty = __webpack_require__(22060);
|
|
|
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
|
|
|
var input = __webpack_require__(1056);
|
|
|
// 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.2.6@@ant-design/icons/es/icons/DownOutlined.js + 1 modules
|
|
|
var DownOutlined = __webpack_require__(42884);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/UpOutlined.js + 1 modules
|
|
|
var UpOutlined = __webpack_require__(20114);
|
|
|
// EXTERNAL MODULE: ./src/pages/MyProblem/interface.ts
|
|
|
var MyProblem_interface = __webpack_require__(59820);
|
|
|
// EXTERNAL MODULE: ./node_modules/_js-base64@2.6.4@js-base64/base64.js
|
|
|
var base64 = __webpack_require__(24334);
|
|
|
;// CONCATENATED MODULE: ./src/pages/MyProblem/TestCasePanel/index.less
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
// EXTERNAL MODULE: ./src/components/Spinner/index.tsx + 1 modules
|
|
|
var Spinner = __webpack_require__(40807);
|
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules
|
|
|
var RenderHtml = __webpack_require__(11436);
|
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
|
var util = __webpack_require__(22739);
|
|
|
// EXTERNAL MODULE: ./node_modules/_xterm@4.8.1@xterm/lib/xterm.js
|
|
|
var xterm = __webpack_require__(34376);
|
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
|
var utils_fetch = __webpack_require__(91506);
|
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
|
|
|
var _umi_production_exports = __webpack_require__(45295);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/pages/MyProblem/TestCasePanel/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _ExecuteDict;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TextArea = input/* default */.Z.TextArea;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var initialState = {
|
|
|
visible: false,
|
|
|
tabIndex: '0'
|
|
|
};
|
|
|
var ExecuteDict = (_ExecuteDict = {}, defineProperty_default()(_ExecuteDict, MyProblem_interface/* ExecuteStatus */.h.NOMATCH, '测试用例结果不匹配'), defineProperty_default()(_ExecuteDict, MyProblem_interface/* ExecuteStatus */.h.OK, '调试通过'), defineProperty_default()(_ExecuteDict, 2, '调试超时'), defineProperty_default()(_ExecuteDict, 3, '调试pod失败'), defineProperty_default()(_ExecuteDict, 4, '编译失败'), defineProperty_default()(_ExecuteDict, 5, '执行失败'), _ExecuteDict);
|
|
|
var Types = /*#__PURE__*/function (Types) {
|
|
|
Types[Types["SET_VISIBLE"] = 0] = "SET_VISIBLE";
|
|
|
Types[Types["SET_TABINDEX"] = 1] = "SET_TABINDEX";
|
|
|
return Types;
|
|
|
}(Types || {});
|
|
|
function Reducer(state, action) {
|
|
|
switch (action.type) {
|
|
|
case Types.SET_VISIBLE:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
visible: action.payload
|
|
|
});
|
|
|
case Types.SET_TABINDEX:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
tabIndex: action.payload
|
|
|
});
|
|
|
default:
|
|
|
throw new Error();
|
|
|
}
|
|
|
}
|
|
|
function DetailCommitOut(debugResult) {
|
|
|
var status = debugResult.status,
|
|
|
error_msg = debugResult.error_msg,
|
|
|
output = debugResult.output,
|
|
|
input = debugResult.input,
|
|
|
expected_output = debugResult.expected_output,
|
|
|
is_file = debugResult.is_file,
|
|
|
input_file_url = debugResult.input_file_url,
|
|
|
output_file_url = debugResult.output_file_url,
|
|
|
expected_output_file_url = debugResult.expected_output_file_url,
|
|
|
setMonacoValue = debugResult.setMonacoValue,
|
|
|
setData = debugResult.setData;
|
|
|
var outputRef = (0,_react_17_0_2_react.useRef)();
|
|
|
var inputRef = (0,_react_17_0_2_react.useRef)();
|
|
|
var expectedOutputRef = (0,_react_17_0_2_react.useRef)();
|
|
|
var rs = null;
|
|
|
var mdStyle = {
|
|
|
minHeight: 150,
|
|
|
marginBottom: 10,
|
|
|
paddingLeft: 24,
|
|
|
background: '#070f19',
|
|
|
color: '#fff'
|
|
|
};
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (output && !is_file && outputRef.current) {
|
|
|
var term = new xterm.Terminal({
|
|
|
fontSize: 14,
|
|
|
letterSpacing: 1,
|
|
|
cols: 83,
|
|
|
rows: 10
|
|
|
});
|
|
|
term.open(outputRef.current);
|
|
|
var actual_output_format = (0,util/* findEndWhitespace */.pp)(base64.Base64.decode(output));
|
|
|
term.write(actual_output_format);
|
|
|
term.setOption('theme', {
|
|
|
background: '#1e1e1e'
|
|
|
});
|
|
|
}
|
|
|
if (input && !is_file && inputRef.current) {
|
|
|
var term2 = new xterm.Terminal({
|
|
|
fontSize: 14,
|
|
|
letterSpacing: 1,
|
|
|
cols: 83,
|
|
|
rows: 10
|
|
|
});
|
|
|
term2.open(inputRef.current);
|
|
|
term2.write((0,util/* findEndWhitespace */.pp)(input));
|
|
|
term2.setOption('theme', {
|
|
|
background: '#1e1e1e'
|
|
|
});
|
|
|
}
|
|
|
if (expected_output && !is_file && expectedOutputRef.current) {
|
|
|
var term3 = new xterm.Terminal({
|
|
|
fontSize: 14,
|
|
|
letterSpacing: 1,
|
|
|
cols: 83,
|
|
|
rows: 10
|
|
|
});
|
|
|
term3.open(expectedOutputRef.current);
|
|
|
term3.write((0,util/* findEndWhitespace */.pp)(base64.Base64.decode(expected_output)));
|
|
|
term3.setOption('theme', {
|
|
|
background: '#1e1e1e'
|
|
|
});
|
|
|
}
|
|
|
}, [output]);
|
|
|
switch (status) {
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.NOMATCH:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "c-red",
|
|
|
children: "\u5B9E\u9645\u8F93\u5165\uFF1A"
|
|
|
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
ref: inputRef
|
|
|
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: mdStyle,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
// href={input_file_url}
|
|
|
style: {
|
|
|
fontSize: '16px'
|
|
|
},
|
|
|
onClick: /*#__PURE__*/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:
|
|
|
_context.next = 2;
|
|
|
return fetch(input_file_url, {
|
|
|
method: "Get",
|
|
|
headers: {
|
|
|
"Content-Type": "application/octet-stream",
|
|
|
"Accept": "*/*"
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context.sent;
|
|
|
_context.t0 = setMonacoValue;
|
|
|
_context.next = 6;
|
|
|
return res.text();
|
|
|
case 6:
|
|
|
_context.t1 = _context.sent;
|
|
|
(0, _context.t0)(_context.t1);
|
|
|
setTimeout(function () {
|
|
|
setData(input_file_url);
|
|
|
}, 200);
|
|
|
// download(input_file_url, input)
|
|
|
case 9:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}))
|
|
|
// download={expected_output}
|
|
|
// target="_blank"
|
|
|
,
|
|
|
children: input
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "c-red",
|
|
|
children: "\u5B9E\u9645\u8F93\u51FA\uFF1A"
|
|
|
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
ref: outputRef
|
|
|
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: mdStyle,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
// href={output_file_url}
|
|
|
style: {
|
|
|
fontSize: '16px'
|
|
|
},
|
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.next = 2;
|
|
|
return (0,utils_fetch/* default */.ZP)(output_file_url, {
|
|
|
method: "Get",
|
|
|
headers: {
|
|
|
"Content-Type": "application/xml",
|
|
|
"Accept": "*/*"
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context2.sent;
|
|
|
setMonacoValue(res);
|
|
|
setTimeout(function () {
|
|
|
setData(output_file_url);
|
|
|
}, 200);
|
|
|
|
|
|
// download(output_file_url, output)
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}))
|
|
|
// download={expected_output} target="_blank"
|
|
|
,
|
|
|
children: output
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "c-red",
|
|
|
children: "\u9884\u671F\u8F93\u51FA\uFF1A"
|
|
|
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
ref: expectedOutputRef
|
|
|
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: mdStyle,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
// href={expected_output_file_url}
|
|
|
style: {
|
|
|
fontSize: '16px'
|
|
|
},
|
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
_context3.next = 2;
|
|
|
return fetch(expected_output_file_url, {
|
|
|
method: "Get",
|
|
|
headers: {
|
|
|
"Content-Type": "application/octet-stream",
|
|
|
"Accept": "*/*"
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context3.sent;
|
|
|
_context3.t0 = setMonacoValue;
|
|
|
_context3.next = 6;
|
|
|
return res.text();
|
|
|
case 6:
|
|
|
_context3.t1 = _context3.sent;
|
|
|
(0, _context3.t0)(_context3.t1);
|
|
|
setTimeout(function () {
|
|
|
setData(expected_output_file_url);
|
|
|
}, 200);
|
|
|
case 9:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}))
|
|
|
// download={expected_output} target="_blank"
|
|
|
,
|
|
|
children: expected_output
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.EXECUTEFAILURE:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
border: '1px #F6F7F9 solid'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
style: {
|
|
|
width: '100%',
|
|
|
height: 40,
|
|
|
background: '#F6F7F9',
|
|
|
lineHeight: '40px',
|
|
|
color: "#666666",
|
|
|
paddingLeft: '12px'
|
|
|
},
|
|
|
children: "\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"
|
|
|
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: input,
|
|
|
style: mdStyle
|
|
|
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: mdStyle,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
// href={input_file_url} style={{fontSize:'16px'}} target="_blank"
|
|
|
onClick: function onClick() {
|
|
|
return (0,util/* download */.LR)(input_file_url, input);
|
|
|
},
|
|
|
children: input
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
border: '1px #F6F7F9 solid',
|
|
|
marginTop: '10px'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
style: {
|
|
|
width: '100%',
|
|
|
height: 40,
|
|
|
background: '#F6F7F9',
|
|
|
lineHeight: '40px',
|
|
|
color: "#666666",
|
|
|
paddingLeft: '12px'
|
|
|
},
|
|
|
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("pre", {
|
|
|
className: "error",
|
|
|
style: {
|
|
|
color: '#E30000',
|
|
|
padding: '0 10px'
|
|
|
},
|
|
|
children: [base64.Base64.decode(error_msg), "111"]
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.COMPILEFAILURE:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"
|
|
|
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
ref: inputRef
|
|
|
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: mdStyle,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
// href={input_file_url} style={{fontSize:'16px'}} target="_blank"
|
|
|
onClick: function onClick() {
|
|
|
return (0,util/* download */.LR)(input_file_url, input);
|
|
|
},
|
|
|
children: input
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
className: "error",
|
|
|
children: base64.Base64.decode(error_msg)
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.PODFAILURE:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
|
|
|
});
|
|
|
break;
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.TIMEOUT:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
|
|
|
});
|
|
|
break;
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [" ", rs, " "]
|
|
|
});
|
|
|
}
|
|
|
function getCommitOut(debugResult) {
|
|
|
var status = debugResult.status,
|
|
|
error_msg = debugResult.error_msg,
|
|
|
execute_time = debugResult.execute_time,
|
|
|
output = debugResult.output,
|
|
|
input = debugResult.input,
|
|
|
expected_output = debugResult.expected_output,
|
|
|
is_file = debugResult.is_file,
|
|
|
input_file_url = debugResult.input_file_url,
|
|
|
output_file_url = debugResult.output_file_url,
|
|
|
expected_output_file_url = debugResult.expected_output_file_url;
|
|
|
var rs = null;
|
|
|
switch (status) {
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.OK:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u6267\u884C\u7528\u65F6\uFF1A", execute_time / 1000, "\u79D2"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u6267\u884C\u7ED3\u679C\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
children: base64.Base64.decode(output)
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.NOMATCH:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u8F93\u5165\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
children: input
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u8F93\u51FA\uFF1A", output && base64.Base64.decode(output)]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u9884\u671F\u8F93\u51FA\uFF1A", expected_output && base64.Base64.decode(expected_output)]
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.EXECUTEFAILURE:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
children: input
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
className: "error",
|
|
|
children: base64.Base64.decode(error_msg)
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.COMPILEFAILURE:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
children: input
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
className: "error",
|
|
|
children: base64.Base64.decode(error_msg)
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.PODFAILURE:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
|
|
|
});
|
|
|
break;
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.TIMEOUT:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
|
|
|
});
|
|
|
break;
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [" ", rs, " "]
|
|
|
});
|
|
|
}
|
|
|
/* harmony default export */ var TestCasePanel = (function (_ref4) {
|
|
|
var input = _ref4.input,
|
|
|
debuging = _ref4.debuging,
|
|
|
submitting = _ref4.submitting,
|
|
|
executingMessage = _ref4.executingMessage,
|
|
|
debugResult = _ref4.debugResult,
|
|
|
onChangeInput = _ref4.onChangeInput,
|
|
|
onDebugCode = _ref4.onDebugCode,
|
|
|
onSubmitCode = _ref4.onSubmitCode,
|
|
|
hack = _ref4.hack,
|
|
|
user = _ref4.user;
|
|
|
var _useReducer = (0,_react_17_0_2_react.useReducer)(Reducer, initialState),
|
|
|
_useReducer2 = slicedToArray_default()(_useReducer, 2),
|
|
|
state = _useReducer2[0],
|
|
|
dispatch = _useReducer2[1];
|
|
|
var visible = state.visible,
|
|
|
tabIndex = state.tabIndex;
|
|
|
var _useSearchParams = (0,_umi_production_exports.useSearchParams)(),
|
|
|
_useSearchParams2 = slicedToArray_default()(_useSearchParams, 1),
|
|
|
searchParams = _useSearchParams2[0];
|
|
|
function onTabIndexChange(e) {
|
|
|
var id = e.target.id;
|
|
|
dispatch({
|
|
|
type: Types.SET_TABINDEX,
|
|
|
payload: id
|
|
|
});
|
|
|
}
|
|
|
function onTriggerCollapse() {
|
|
|
dispatch({
|
|
|
type: Types.SET_VISIBLE,
|
|
|
payload: !visible
|
|
|
});
|
|
|
}
|
|
|
var executeResult = (0,_react_17_0_2_react.useMemo)(function () {
|
|
|
if (debugResult) {
|
|
|
var status = debugResult.status;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: getCommitOut(debugResult)
|
|
|
});
|
|
|
}
|
|
|
return null;
|
|
|
}, [debugResult]);
|
|
|
function onDebug() {
|
|
|
dispatch({
|
|
|
type: Types.SET_VISIBLE,
|
|
|
payload: true
|
|
|
});
|
|
|
dispatch({
|
|
|
type: Types.SET_TABINDEX,
|
|
|
payload: '1'
|
|
|
});
|
|
|
onDebugCode();
|
|
|
}
|
|
|
var skip = /*#__PURE__*/function () {
|
|
|
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4(text) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
_context4.next = 2;
|
|
|
return (0,utils_fetch/* default */.ZP)("/api/problems/".concat(text, "/start.json"), {
|
|
|
method: 'get',
|
|
|
params: {
|
|
|
hack_user_id: user === null || user === void 0 ? void 0 : user.user_id
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context4.sent;
|
|
|
if (res) {
|
|
|
window.location.href = "/myproblems/".concat(res === null || res === void 0 ? void 0 : res.identifier, "?type=1");
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
return function skip(_x) {
|
|
|
return _ref5.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "test-case-panel",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "test-case-panel-body ".concat(visible ? 'active' : ''),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
|
className: "s-navs",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
className: tabIndex === '0' ? 'active' : '',
|
|
|
id: "0",
|
|
|
onClick: onTabIndexChange,
|
|
|
children: "\u81EA\u5B9A\u4E49\u6D4B\u8BD5\u7528\u4F8B"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
className: tabIndex === '1' ? 'active' : '',
|
|
|
id: "1",
|
|
|
onClick: onTabIndexChange,
|
|
|
children: "\u4EE3\u7801\u6267\u884C\u7ED3\u679C"
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "tab-panel-body ".concat(tabIndex === '0' ? '' : 'hide'),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(TextArea, {
|
|
|
placeholder: "\u8BF7\u586B\u5199\u6D4B\u8BD5\u7528\u4F8B\u7684\u8F93\u5165\u503C\uFF0C\u70B9\u51FB\u201C\u8C03\u8BD5\u4EE3\u7801\u201D",
|
|
|
value: input,
|
|
|
onChange: onChangeInput
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "tab-panel-body ".concat(tabIndex === '1' ? '' : 'hide'),
|
|
|
children: debuging ? /*#__PURE__*/(0,jsx_runtime.jsx)(Spinner/* default */.Z, {
|
|
|
message: executingMessage
|
|
|
}) : debugResult ? /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
style: {
|
|
|
height: 200
|
|
|
},
|
|
|
children: [" ", executeResult, " "]
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "tip",
|
|
|
children: "\u8BF7\u586B\u5199\u6D4B\u8BD5\u7528\u4F8B\u7684\u8F93\u5165\u503C\uFF0C\u70B9\u51FB\u201C\u8C03\u8BD5\u4EE3\u7801\u201D"
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
className: "btn-collapse ".concat(visible ? 'up' : ''),
|
|
|
onClick: onTriggerCollapse,
|
|
|
children: visible ? /*#__PURE__*/(0,jsx_runtime.jsx)(DownOutlined/* default */.Z, {}) : /*#__PURE__*/(0,jsx_runtime.jsx)(UpOutlined/* default */.Z, {})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("footer", {
|
|
|
className: "footer",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u63A7\u5236\u53F0"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "flex-container",
|
|
|
children: [(hack === null || hack === void 0 ? void 0 : hack.is_program) && (hack === null || hack === void 0 ? void 0 : hack.above_question) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
onClick: function onClick() {
|
|
|
return skip(hack === null || hack === void 0 ? void 0 : hack.above_question);
|
|
|
},
|
|
|
id: "oj-prev",
|
|
|
className: "btn-blue",
|
|
|
type: "ghost",
|
|
|
children: "\u4E0A\u4E00\u9898"
|
|
|
}), (hack === null || hack === void 0 ? void 0 : hack.is_program) && (hack === null || hack === void 0 ? void 0 : hack.under_question) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
onClick: function onClick() {
|
|
|
return skip(hack === null || hack === void 0 ? void 0 : hack.under_question);
|
|
|
},
|
|
|
id: "oj-next",
|
|
|
className: "btn-blue",
|
|
|
type: "ghost",
|
|
|
children: "\u4E0B\u4E00\u9898"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
className: "btn-green",
|
|
|
type: "ghost",
|
|
|
loading: debuging,
|
|
|
onClick: onDebug,
|
|
|
children: "\u8C03\u8BD5\u4EE3\u7801"
|
|
|
}), searchParams.get("qtype") !== '8' && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "primary",
|
|
|
className: "custom-ant-disabled",
|
|
|
loading: submitting,
|
|
|
disabled: submitting,
|
|
|
onClick: function onClick() {
|
|
|
dispatch({
|
|
|
type: Types.SET_VISIBLE,
|
|
|
payload: false
|
|
|
});
|
|
|
// dispatch({
|
|
|
// type: Types.SET_TABINDEX,
|
|
|
// payload: '1'
|
|
|
// })
|
|
|
onSubmitCode();
|
|
|
},
|
|
|
children: "\u8BC4\u6D4B\u5E76\u63D0\u4EA4"
|
|
|
})]
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 59820:
|
|
|
/*!******************************************!*\
|
|
|
!*** ./src/pages/MyProblem/interface.ts ***!
|
|
|
\******************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ h: function() { return /* binding */ ExecuteStatus; }
|
|
|
/* harmony export */ });
|
|
|
// created_at: "2020-07-09T19:53:54.000+08:00"
|
|
|
// execute_memory: null
|
|
|
// execute_time: 0.269
|
|
|
// id: 872
|
|
|
// language: "C"
|
|
|
// status: 4
|
|
|
var ExecuteStatus = /*#__PURE__*/function (ExecuteStatus) {
|
|
|
ExecuteStatus[ExecuteStatus["NOMATCH"] = -1] = "NOMATCH";
|
|
|
ExecuteStatus[ExecuteStatus["OK"] = 0] = "OK";
|
|
|
ExecuteStatus[ExecuteStatus["TIMEOUT"] = 2] = "TIMEOUT";
|
|
|
ExecuteStatus[ExecuteStatus["PODFAILURE"] = 3] = "PODFAILURE";
|
|
|
ExecuteStatus[ExecuteStatus["COMPILEFAILURE"] = 4] = "COMPILEFAILURE";
|
|
|
ExecuteStatus[ExecuteStatus["EXECUTEFAILURE"] = 5] = "EXECUTEFAILURE";
|
|
|
return ExecuteStatus;
|
|
|
}({});
|
|
|
|
|
|
// "id": "1",
|
|
|
// "status": 2, # -1测试用例结果不匹配; 0: 评测通过; ;2 评测超时;3 创建pod失败; 4 编译失败;5 执行失败
|
|
|
// "error_line": 3, # 错误行数
|
|
|
// "error_msg": "error line 7 input.." , # 报错信息
|
|
|
// "input": "3 4", # 输入
|
|
|
// "output": "7", # 输出
|
|
|
// "execute_time": 3, #执行时间
|
|
|
// "execute_memory": 300, #消耗内存
|
|
|
// "expected_output": "7" # 如果提交模式 会多这个参数
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 43887:
|
|
|
/*!****************************************!*\
|
|
|
!*** ./src/pages/MyProblem/service.ts ***!
|
|
|
\****************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ H7: function() { return /* binding */ resetCode; },
|
|
|
/* harmony export */ MK: function() { return /* binding */ addNotes; },
|
|
|
/* harmony export */ MU: function() { return /* binding */ debugCode; },
|
|
|
/* harmony export */ X6: function() { return /* binding */ getRecordDetail; },
|
|
|
/* harmony export */ bM: function() { return /* binding */ sumbitCode; },
|
|
|
/* harmony export */ fi: function() { return /* binding */ syncCode; },
|
|
|
/* harmony export */ fu: function() { return /* binding */ getProgrammingTopic; },
|
|
|
/* harmony export */ n4: function() { return /* binding */ updateCode; },
|
|
|
/* harmony export */ rX: function() { return /* binding */ getOperationResult; },
|
|
|
/* harmony export */ vl: function() { return /* binding */ triggerPlus; },
|
|
|
/* harmony export */ zO: function() { return /* binding */ getSubmitRecords; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/utils/fetch.ts */ 91506);
|
|
|
|
|
|
|
|
|
function getProgrammingTopic(id, params) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .get */ .U2)("myproblems/".concat(id, ".json"), _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({
|
|
|
hidePopLogin: true
|
|
|
}, params || {}));
|
|
|
}
|
|
|
function sumbitCode(id, params) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/code_submit.json"), params);
|
|
|
}
|
|
|
function debugCode(id, params) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/code_debug.json"), params);
|
|
|
}
|
|
|
function getSubmitRecords(id, params) {
|
|
|
if (params.language) {
|
|
|
params.language = encodeURIComponent(params.language);
|
|
|
}
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .get */ .U2)("myproblems/".concat(id, "/submit_records.json"), params);
|
|
|
}
|
|
|
function getRecordDetail(id) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .get */ .U2)("myproblems/record_detail.json", {
|
|
|
id: id
|
|
|
});
|
|
|
}
|
|
|
function getOperationResult(id, mode) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .get */ .U2)("myproblems/".concat(id, "/result.json"), {
|
|
|
mode: mode
|
|
|
});
|
|
|
}
|
|
|
function addNotes(id, params) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/add_notes.json"), params);
|
|
|
}
|
|
|
function resetCode(id) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/restore_initial_code.json"));
|
|
|
}
|
|
|
function syncCode(id) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/sync_code.json"));
|
|
|
}
|
|
|
function updateCode(id, params) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/update_code.json"), params);
|
|
|
}
|
|
|
function triggerPlus(id, params) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("discusses/".concat(id, "/plus.json"), params);
|
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 70015:
|
|
|
/*!************************************************************************************************!*\
|
|
|
!*** ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepPreview/index.tsx + 12 modules ***!
|
|
|
\************************************************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
Z: function() { return /* binding */ StepPreview; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(26801);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js
|
|
|
var regeneratorRuntime = __webpack_require__(10574);
|
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js
|
|
|
var asyncToGenerator = __webpack_require__(39343);
|
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(11006);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepPreview/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var StepPreviewmodules = ({"flex_box_center":"flex_box_center___bZaL5","flex_space_between":"flex_space_between___oaJSq","flex_box_vertical_center":"flex_box_vertical_center____hsuP","flex_box_center_end":"flex_box_center_end___ZYbPQ","flex_box_column":"flex_box_column___nE_62","wrap":"wrap___ulhwR","left":"left___kyWln","title":"title___jsO1D","total":"total___GEhiU","list":"list___u9dBZ","name":"name___Wxggs","b":"b___Y15YO","r":"r___mKQoe","l":"l___uelFD","tag":"tag___Mpkbg","right":"right___mQ3dU","examName":"examName___Na1r8","t":"t___IgCWK","num":"num___CXI8j","topWarp":"topWarp___Kicpu","head":"head___jx3W8","so":"so___qYW7F","btn":"btn___EMJDz","content":"content___sHGsV","titleWrap":"titleWrap___I__GR","single":"single___K5iv9","analysis":"analysis___NoAuR","text":"text___xESW2","modalColumn":"modalColumn___I_tK_","modalRow":"modalRow___lyw_U","sup":"sup___HSz3Z","popover":"popover___kE8aI"});
|
|
|
// 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/tooltip/index.js + 3 modules
|
|
|
var tooltip = __webpack_require__(6848);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
|
|
|
var es_modal = __webpack_require__(43418);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input-number/index.js + 14 modules
|
|
|
var input_number = __webpack_require__(85731);
|
|
|
// 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/input/index.js + 5 modules
|
|
|
var input = __webpack_require__(1056);
|
|
|
// 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/button/index.js
|
|
|
var es_button = __webpack_require__(3113);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/pagination/index.js + 10 modules
|
|
|
var pagination = __webpack_require__(41867);
|
|
|
// 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/popover/index.js
|
|
|
var popover = __webpack_require__(60324);
|
|
|
;// CONCATENATED MODULE: ./src/assets/images/paper/zhong.svg
|
|
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
|
var __defProp = Object.defineProperty;
|
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
var __defNormalProp = function __defNormalProp(obj, key, value) {
|
|
|
return key in obj ? __defProp(obj, key, {
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true,
|
|
|
value: value
|
|
|
}) : obj[key] = value;
|
|
|
};
|
|
|
var __spreadValues = function __spreadValues(a, b) {
|
|
|
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
|
if (__getOwnPropSymbols) {
|
|
|
var _iterator = _createForOfIteratorHelper(__getOwnPropSymbols(b)),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prop = _step.value;
|
|
|
if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
}
|
|
|
return a;
|
|
|
};
|
|
|
|
|
|
var SvgZhong = function SvgZhong(props) {
|
|
|
return /* @__PURE__ */React.createElement("svg", __spreadValues({
|
|
|
width: 34,
|
|
|
height: 34,
|
|
|
xmlns: "http://www.w3.org/2000/svg"
|
|
|
}, props), /* @__PURE__ */React.createElement("title", null, "\u7F16\u7EC4 6"), /* @__PURE__ */React.createElement("g", {
|
|
|
fill: "none",
|
|
|
fillRule: "evenodd"
|
|
|
}, /* @__PURE__ */React.createElement("rect", {
|
|
|
fill: "#E4E6FD",
|
|
|
width: 34,
|
|
|
height: 34,
|
|
|
rx: 10
|
|
|
}), /* @__PURE__ */React.createElement("g", {
|
|
|
fillRule: "nonzero"
|
|
|
}, /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M13.808 11.448a.558.558 0 0 1 0 .788l-1.564 1.565a.558.558 0 1 1-.789-.79l1.564-1.563a.558.558 0 0 1 .79 0Zm9.882 2.462a.558.558 0 0 1-.789 0l-1.564-1.563a.558.558 0 1 1 .789-.789l1.564 1.564a.556.556 0 0 1 0 .788Z",
|
|
|
fill: "#6678EB"
|
|
|
}), /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M21.753 21.707a5.937 5.937 0 1 0-8.58.015l-.937.936a.558.558 0 1 0 .789.788l.995-.994a5.91 5.91 0 0 0 3.436 1.095c1.287 0 2.48-.41 3.452-1.106l.992.992a.558.558 0 1 0 .789-.789l-.936-.937Z",
|
|
|
fill: "#6678EB"
|
|
|
}), /* @__PURE__ */React.createElement("path", {
|
|
|
d: "m20.858 18.95-3.024-1.745v-2.054a.558.558 0 1 0-1.117 0v2.351c0 .064.011.126.031.184a.551.551 0 0 0 .258.33l3.293 1.9a.557.557 0 0 0 .559-.966Z",
|
|
|
fill: "#FFF"
|
|
|
}))));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ var zhong = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzQiIGhlaWdodD0iMzQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cmVjdCBmaWxsPSIjRTRFNkZEIiB3aWR0aD0iMzQiIGhlaWdodD0iMzQiIHJ4PSIxMCIvPjxnIGZpbGwtcnVsZT0ibm9uemVybyI+PHBhdGggZD0iTTEzLjgwOCAxMS40NDhhLjU1OC41NTggMCAwIDEgMCAuNzg4bC0xLjU2NCAxLjU2NWEuNTU4LjU1OCAwIDEgMS0uNzg5LS43OWwxLjU2NC0xLjU2M2EuNTU4LjU1OCAwIDAgMSAuNzkgMFptOS44ODIgMi40NjJhLjU1OC41NTggMCAwIDEtLjc4OSAwbC0xLjU2NC0xLjU2M2EuNTU4LjU1OCAwIDEgMSAuNzg5LS43ODlsMS41NjQgMS41NjRhLjU1Ni41NTYgMCAwIDEgMCAuNzg4WiIgZmlsbD0iIzY2NzhFQiIvPjxwYXRoIGQ9Ik0yMS43NTMgMjEuNzA3YTUuOTM3IDUuOTM3IDAgMSAwLTguNTguMDE1bC0uOTM3LjkzNmEuNTU4LjU1OCAwIDEgMCAuNzg5Ljc4OGwuOTk1LS45OTRhNS45MSA1LjkxIDAgMCAwIDMuNDM2IDEuMDk1YzEuMjg3IDAgMi40OC0uNDEgMy40NTItMS4xMDZsLjk5Mi45OTJhLjU1OC41NTggMCAxIDAgLjc4OS0uNzg5bC0uOTM2LS45MzdaIiBmaWxsPSIjNjY3OEVCIi8+PHBhdGggZD0ibTIwLjg1OCAxOC45NS0zLjAyNC0xLjc0NXYtMi4wNTRhLjU1OC41NTggMCAxIDAtMS4xMTcgMHYyLjM1MWMwIC4wNjQuMDExLjEyNi4wMzEuMTg0YS41NTEuNTUxIDAgMCAwIC4yNTguMzNsMy4yOTMgMS45YS41NTcuNTU3IDAgMCAwIC41NTktLjk2NloiIGZpbGw9IiNGRkYiLz48L2c+PC9nPjwvc3ZnPg==");
|
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules
|
|
|
var RenderHtml = __webpack_require__(11436);
|
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
|
|
|
var _umi_production_exports = __webpack_require__(45295);
|
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
|
var util = __webpack_require__(22739);
|
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
|
var fetch = __webpack_require__(91506);
|
|
|
;// CONCATENATED MODULE: ./src/assets/images/paper/xixi.svg
|
|
|
function xixi_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = xixi_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
function xixi_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return xixi_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return xixi_arrayLikeToArray(o, minLen); }
|
|
|
function xixi_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
|
var xixi_defProp = Object.defineProperty;
|
|
|
var xixi_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
var xixi_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
var xixi_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
var xixi_defNormalProp = function __defNormalProp(obj, key, value) {
|
|
|
return key in obj ? xixi_defProp(obj, key, {
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true,
|
|
|
value: value
|
|
|
}) : obj[key] = value;
|
|
|
};
|
|
|
var xixi_spreadValues = function __spreadValues(a, b) {
|
|
|
for (var prop in b || (b = {})) if (xixi_hasOwnProp.call(b, prop)) xixi_defNormalProp(a, prop, b[prop]);
|
|
|
if (xixi_getOwnPropSymbols) {
|
|
|
var _iterator = xixi_createForOfIteratorHelper(xixi_getOwnPropSymbols(b)),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prop = _step.value;
|
|
|
if (xixi_propIsEnum.call(b, prop)) xixi_defNormalProp(a, prop, b[prop]);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
}
|
|
|
return a;
|
|
|
};
|
|
|
|
|
|
var SvgXixi = function SvgXixi(props) {
|
|
|
return /* @__PURE__ */React.createElement("svg", xixi_spreadValues({
|
|
|
width: 34,
|
|
|
height: 34,
|
|
|
xmlns: "http://www.w3.org/2000/svg"
|
|
|
}, props), /* @__PURE__ */React.createElement("title", null, "\u7F16\u7EC4 12"), /* @__PURE__ */React.createElement("g", {
|
|
|
fill: "none",
|
|
|
fillRule: "evenodd"
|
|
|
}, /* @__PURE__ */React.createElement("rect", {
|
|
|
width: 34,
|
|
|
height: 34,
|
|
|
rx: 10,
|
|
|
fill: "#EAF3F4"
|
|
|
}), /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M25.905 15.37a.775.775 0 0 0-.626-.529l-4.814-.7-2.152-4.362a.776.776 0 0 0-1.392 0l-2.153 4.363-4.814.699a.775.775 0 0 0-.43 1.323l3.484 3.396-.823 4.794a.777.777 0 0 0 1.126.818l4.306-2.264 4.305 2.264a.778.778 0 0 0 .817-.059.777.777 0 0 0 .31-.759l-.823-4.794 3.483-3.396a.777.777 0 0 0 .196-.795Z",
|
|
|
fill: "#21C0A6",
|
|
|
fillRule: "nonzero"
|
|
|
})));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ var xixi = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzQiIGhlaWdodD0iMzQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cmVjdCB3aWR0aD0iMzQiIGhlaWdodD0iMzQiIHJ4PSIxMCIgZmlsbD0iI0VBRjNGNCIvPjxwYXRoIGQ9Ik0yNS45MDUgMTUuMzdhLjc3NS43NzUgMCAwIDAtLjYyNi0uNTI5bC00LjgxNC0uNy0yLjE1Mi00LjM2MmEuNzc2Ljc3NiAwIDAgMC0xLjM5MiAwbC0yLjE1MyA0LjM2My00LjgxNC42OTlhLjc3NS43NzUgMCAwIDAtLjQzIDEuMzIzbDMuNDg0IDMuMzk2LS44MjMgNC43OTRhLjc3Ny43NzcgMCAwIDAgMS4xMjYuODE4bDQuMzA2LTIuMjY0IDQuMzA1IDIuMjY0YS43NzguNzc4IDAgMCAwIC44MTctLjA1OS43NzcuNzc3IDAgMCAwIC4zMS0uNzU5bC0uODIzLTQuNzk0IDMuNDgzLTMuMzk2YS43NzcuNzc3IDAgMCAwIC4xOTYtLjc5NVoiIGZpbGw9IiMyMUMwQTYiIGZpbGwtcnVsZT0ibm9uemVybyIvPjwvZz48L3N2Zz4=");
|
|
|
;// CONCATENATED MODULE: ./src/assets/images/paper/bi.svg
|
|
|
function bi_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = bi_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
function bi_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return bi_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return bi_arrayLikeToArray(o, minLen); }
|
|
|
function bi_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
|
var bi_defProp = Object.defineProperty;
|
|
|
var bi_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
var bi_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
var bi_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
var bi_defNormalProp = function __defNormalProp(obj, key, value) {
|
|
|
return key in obj ? bi_defProp(obj, key, {
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true,
|
|
|
value: value
|
|
|
}) : obj[key] = value;
|
|
|
};
|
|
|
var bi_spreadValues = function __spreadValues(a, b) {
|
|
|
for (var prop in b || (b = {})) if (bi_hasOwnProp.call(b, prop)) bi_defNormalProp(a, prop, b[prop]);
|
|
|
if (bi_getOwnPropSymbols) {
|
|
|
var _iterator = bi_createForOfIteratorHelper(bi_getOwnPropSymbols(b)),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prop = _step.value;
|
|
|
if (bi_propIsEnum.call(b, prop)) bi_defNormalProp(a, prop, b[prop]);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
}
|
|
|
return a;
|
|
|
};
|
|
|
|
|
|
var SvgBi = function SvgBi(props) {
|
|
|
return /* @__PURE__ */React.createElement("svg", bi_spreadValues({
|
|
|
width: 34,
|
|
|
height: 34,
|
|
|
xmlns: "http://www.w3.org/2000/svg"
|
|
|
}, props), /* @__PURE__ */React.createElement("title", null, "\u9898\u76EE"), /* @__PURE__ */React.createElement("g", {
|
|
|
fill: "none",
|
|
|
fillRule: "evenodd"
|
|
|
}, /* @__PURE__ */React.createElement("rect", {
|
|
|
fill: "#E7F3FF",
|
|
|
width: 34,
|
|
|
height: 34,
|
|
|
rx: 10
|
|
|
}), /* @__PURE__ */React.createElement("g", {
|
|
|
fill: "#4C6FFF",
|
|
|
fillRule: "nonzero"
|
|
|
}, /* @__PURE__ */React.createElement("path", {
|
|
|
d: "m23.719 13.325-4.098-3.94c-.097-.13-.225-.162-.355-.162-.129 0-.258.064-.387.161l-7.55 7.753c-.065.065-.098.162-.13.227l-1.032 5.427c-.033.194.032.323.16.484.13.13.227.162.389.162h.096l4.776-1.099c.097-.032.194-.064.258-.161l7.841-8.108c.194-.162.194-.517.033-.744h-.001Zm-8.1 8.044a.534.534 0 0 1-.386.162.56.56 0 0 1-.388-.162l-3-2.81c-.226-.194-.226-.517-.033-.743.194-.227.517-.227.743-.033l3 2.811c.259.226.291.55.065.776ZM17 22.92h6.844v1.055H17z"
|
|
|
}))));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ var bi = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzQiIGhlaWdodD0iMzQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cmVjdCBmaWxsPSIjRTdGM0ZGIiB3aWR0aD0iMzQiIGhlaWdodD0iMzQiIHJ4PSIxMCIvPjxnIGZpbGw9IiM0QzZGRkYiIGZpbGwtcnVsZT0ibm9uemVybyI+PHBhdGggZD0ibTIzLjcxOSAxMy4zMjUtNC4wOTgtMy45NGMtLjA5Ny0uMTMtLjIyNS0uMTYyLS4zNTUtLjE2Mi0uMTI5IDAtLjI1OC4wNjQtLjM4Ny4xNjFsLTcuNTUgNy43NTNjLS4wNjUuMDY1LS4wOTguMTYyLS4xMy4yMjdsLTEuMDMyIDUuNDI3Yy0uMDMzLjE5NC4wMzIuMzIzLjE2LjQ4NC4xMy4xMy4yMjcuMTYyLjM4OS4xNjJoLjA5Nmw0Ljc3Ni0xLjA5OWMuMDk3LS4wMzIuMTk0LS4wNjQuMjU4LS4xNjFsNy44NDEtOC4xMDhjLjE5NC0uMTYyLjE5NC0uNTE3LjAzMy0uNzQ0aC0uMDAxWm0tOC4xIDguMDQ0YS41MzQuNTM0IDAgMCAxLS4zODYuMTYyLjU2LjU2IDAgMCAxLS4zODgtLjE2MmwtMy0yLjgxYy0uMjI2LS4xOTQtLjIyNi0uNTE3LS4wMzMtLjc0My4xOTQtLjIyNy41MTctLjIyNy43NDMtLjAzM2wzIDIuODExYy4yNTkuMjI2LjI5MS41NS4wNjUuNzc2Wk0xNyAyMi45Mmg2Ljg0NHYxLjA1NUgxN3oiLz48L2c+PC9nPjwvc3ZnPg==");
|
|
|
// EXTERNAL MODULE: ./src/assets/images/paper/jinshi.svg
|
|
|
var jinshi = __webpack_require__(235);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/toConsumableArray.js
|
|
|
var toConsumableArray = __webpack_require__(93923);
|
|
|
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectWithoutProperties.js
|
|
|
var objectWithoutProperties = __webpack_require__(27161);
|
|
|
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/checkbox/index.js + 3 modules
|
|
|
var es_checkbox = __webpack_require__(24905);
|
|
|
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 10 modules
|
|
|
var markdown_editor = __webpack_require__(83954);
|
|
|
// EXTERNAL MODULE: ./src/components/Editor/NullMDEditor.js
|
|
|
var NullMDEditor = __webpack_require__(69532);
|
|
|
// EXTERNAL MODULE: ./src/components/Editor/NullChildEditor/index.jsx + 1 modules
|
|
|
var NullChildEditor = __webpack_require__(7177);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepPreview/components/editor.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var editormodules = ({"wrap":"wrap___OIoOI","modal":"modal___Z3hfU","titleWrap":"titleWrap___aK3oG","required":"required___NHoO7","title":"title___uxb1R","colorGray":"colorGray___O8YPg","choiceWrap":"choiceWrap___t51sb","answer":"answer___vsBnh","activeAnswer":"activeAnswer___AJN4p","deleteIcon":"deleteIcon___WvOJZ","addIcon":"addIcon___UyeIs","editorWrap":"editorWrap___uqcFU","htmlWrap":"htmlWrap___GcBNL","radio":"radio___e8qQ5","color333":"color333___PLzVK","color999":"color999___v3EY0","fold":"fold___OfvPe","head":"head___EejYX"});
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepPreview/components/CompletionEditor/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["globalSetting", "loading", "dispatch", "isEdit", "editData"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var 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 globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
dispatch = _ref.dispatch,
|
|
|
isEdit = _ref.isEdit,
|
|
|
editData = _ref.editData,
|
|
|
props = objectWithoutProperties_default()(_ref, _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];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (!editData || !isEdit) {
|
|
|
return;
|
|
|
}
|
|
|
setTitle(editData === null || editData === void 0 ? void 0 : editData.name);
|
|
|
setAnalysis(editData === null || editData === void 0 ? void 0 : editData.analysis);
|
|
|
setChecked(editData === null || editData === void 0 ? void 0 : editData.is_ordered);
|
|
|
setFirstSetAnswerFlag(true);
|
|
|
}, [editData]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (!firstSetAnswerFlag) {
|
|
|
return;
|
|
|
}
|
|
|
var answer = editData === null || editData === void 0 ? void 0 : editData.standard_answer.map(function (item) {
|
|
|
return item.answer_text;
|
|
|
});
|
|
|
setAnswerList(answer);
|
|
|
setFirstSetAnswerFlag(false);
|
|
|
}, [firstSetAnswerFlag]);
|
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, function () {
|
|
|
return {
|
|
|
onSave: onSave,
|
|
|
Clear: Clear
|
|
|
};
|
|
|
});
|
|
|
var onSave = function onSave() {
|
|
|
var answerArray = [];
|
|
|
var isEmpty = false;
|
|
|
if (!title) {
|
|
|
message/* default */.ZP.info("请您输入题干");
|
|
|
return false;
|
|
|
}
|
|
|
answerList.forEach(function (answers, index) {
|
|
|
answerArray.push({
|
|
|
position: 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) {
|
|
|
return false;
|
|
|
}
|
|
|
if ((answerArray === null || answerArray === void 0 ? void 0 : answerArray.length) > 20) {
|
|
|
message/* default */.ZP.warning('填空题标准答案不能为空/不能超过20个!');
|
|
|
return false;
|
|
|
}
|
|
|
return {
|
|
|
name: title,
|
|
|
analysis: analysis,
|
|
|
standard_answers: answerArray,
|
|
|
is_ordered: checked
|
|
|
};
|
|
|
};
|
|
|
|
|
|
//清空数值
|
|
|
var Clear = function Clear() {
|
|
|
setTitle('');
|
|
|
setAnalysis('');
|
|
|
setAnswerList([]);
|
|
|
setChecked(false);
|
|
|
};
|
|
|
var handlePlaceholderChange = function handlePlaceholderChange(placeholderCountBefore, placeholderCountInRange, totalPlaceholderCount) {
|
|
|
var newStandardAnswers = answerList.slice();
|
|
|
if (placeholderCountInRange) {
|
|
|
newStandardAnswers.splice(placeholderCountBefore, placeholderCountInRange);
|
|
|
}
|
|
|
if (totalPlaceholderCount) {
|
|
|
for (var i = 0; i < totalPlaceholderCount; i++) {
|
|
|
newStandardAnswers.splice(placeholderCountBefore + i, 0, [""]);
|
|
|
}
|
|
|
}
|
|
|
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;
|
|
|
}
|
|
|
es_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) {
|
|
|
es_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);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: editormodules.wrap,
|
|
|
children: [/*#__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)("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,
|
|
|
flex: 1,
|
|
|
is_md: true,
|
|
|
activeOptionErrorIndex: activeOptionErrorIndex,
|
|
|
onAnswerChange: handleAnswerChange,
|
|
|
addChildAnswer: handleAddChildAnswer,
|
|
|
deleteChildAnswer: handleDeleteChildAnswer,
|
|
|
deleteChildAnswermain: handleDeleteChildAnswermain
|
|
|
}, index);
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt20",
|
|
|
children: (answerList === null || answerList === void 0 ? void 0 : 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.jsx)("p", {
|
|
|
className: editormodules.titleWrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: editormodules.title,
|
|
|
children: "\u9898\u76EE\u89E3\u6790\uFF1A"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
id: "single-question-answer",
|
|
|
watch: true,
|
|
|
height: 155,
|
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",
|
|
|
defaultValue: analysis,
|
|
|
onChange: function onChange(value) {
|
|
|
return setAnalysis(value);
|
|
|
}
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_CompletionEditor = ((0,_umi_production_exports.connect)(function (_ref2) {
|
|
|
var loading = _ref2.loading,
|
|
|
globalSetting = _ref2.globalSetting;
|
|
|
return {
|
|
|
globalSetting: globalSetting,
|
|
|
loading: loading.effects
|
|
|
};
|
|
|
}, null, null, {
|
|
|
forwardRef: true
|
|
|
})( /*#__PURE__*/(0,_react_17_0_2_react.forwardRef)(CompletionEditor)));
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/radio/index.js + 5 modules
|
|
|
var es_radio = __webpack_require__(5112);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepPreview/components/JudgmentEditor/index.tsx
|
|
|
|
|
|
|
|
|
var JudgmentEditor_excluded = ["globalSetting", "loading", "editData", "dispatch", "onRef", "isEdit"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var JudgmentEditor_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 JudgmentEditor = function JudgmentEditor(_ref, ref) {
|
|
|
var globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
editData = _ref.editData,
|
|
|
dispatch = _ref.dispatch,
|
|
|
_ref$onRef = _ref.onRef,
|
|
|
onRef = _ref$onRef === void 0 ? function () {} : _ref$onRef,
|
|
|
isEdit = _ref.isEdit,
|
|
|
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)(''),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
analysis = _useState6[0],
|
|
|
setAnalysis = _useState6[1];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (!editData || !isEdit) {
|
|
|
return;
|
|
|
}
|
|
|
setTitle(editData === null || editData === void 0 ? void 0 : editData.name);
|
|
|
setAnalysis(editData === null || editData === void 0 ? void 0 : editData.analysis);
|
|
|
var answer = editData === null || editData === void 0 ? void 0 : editData.choices.find(function (item) {
|
|
|
return item.is_answer;
|
|
|
});
|
|
|
setActiveAnswer(answer.choice_text === '正确' ? '0' : '1');
|
|
|
}, [editData]);
|
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, function () {
|
|
|
return {
|
|
|
onSave: onSave,
|
|
|
Clear: Clear
|
|
|
};
|
|
|
});
|
|
|
var onSave = function onSave() {
|
|
|
if (!title) {
|
|
|
message/* default */.ZP.info("请您输入题干");
|
|
|
return false;
|
|
|
}
|
|
|
if (!activeAnswer) {
|
|
|
message/* default */.ZP.info("请先点击选择本选择题的正确选项");
|
|
|
return false;
|
|
|
}
|
|
|
var choices = [{
|
|
|
choice_text: "正确",
|
|
|
is_answer: activeAnswer === "0" ? 1 : 0
|
|
|
}, {
|
|
|
choice_text: "错误",
|
|
|
is_answer: activeAnswer === "1" ? 1 : 0
|
|
|
}];
|
|
|
return {
|
|
|
name: title,
|
|
|
choices: choices,
|
|
|
analysis: analysis
|
|
|
};
|
|
|
};
|
|
|
|
|
|
//清空数值
|
|
|
var Clear = function Clear() {
|
|
|
setTitle('');
|
|
|
setAnalysis('');
|
|
|
setActiveAnswer('');
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: editormodules.wrap,
|
|
|
children: [/*#__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: "0",
|
|
|
className: "".concat(editormodules.radio, " mr40"),
|
|
|
children: "\u6B63\u786E"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Button */.ZP.Button, {
|
|
|
value: "1",
|
|
|
className: editormodules.radio,
|
|
|
children: "\u9519\u8BEF"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: editormodules.titleWrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: editormodules.title,
|
|
|
children: "\u9898\u76EE\u89E3\u6790\uFF1A"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
id: "single-question-answer",
|
|
|
watch: true,
|
|
|
height: 155,
|
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",
|
|
|
defaultValue: analysis,
|
|
|
onChange: function onChange(value) {
|
|
|
return setAnalysis(value);
|
|
|
}
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_JudgmentEditor = ((0,_umi_production_exports.connect)(function (_ref2) {
|
|
|
var loading = _ref2.loading,
|
|
|
globalSetting = _ref2.globalSetting;
|
|
|
return {
|
|
|
globalSetting: globalSetting,
|
|
|
loading: loading.effects
|
|
|
};
|
|
|
}, null, null, {
|
|
|
forwardRef: true
|
|
|
})( /*#__PURE__*/(0,_react_17_0_2_react.forwardRef)(JudgmentEditor)));
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepPreview/components/MultipleEditor/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
var MultipleEditor_excluded = ["editData", "globalSetting", "loading", "dispatch", "onRef", "isEdit"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var MultipleEditor_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 MultipleEditor = function MultipleEditor(_ref, ref) {
|
|
|
var editData = _ref.editData,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
dispatch = _ref.dispatch,
|
|
|
_ref$onRef = _ref.onRef,
|
|
|
onRef = _ref$onRef === void 0 ? function () {} : _ref$onRef,
|
|
|
isEdit = _ref.isEdit,
|
|
|
props = objectWithoutProperties_default()(_ref, MultipleEditor_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)(''),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
analysis = _useState10[0],
|
|
|
setAnalysis = _useState10[1];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
setQuestionChoiceList(['', '', '', '']);
|
|
|
}, []);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (!editData || !isEdit) {
|
|
|
return;
|
|
|
}
|
|
|
setTitle(editData === null || editData === void 0 ? void 0 : editData.name);
|
|
|
setAnalysis(editData === null || editData === void 0 ? void 0 : editData.analysis);
|
|
|
setQuestionChoiceList(editData === null || editData === void 0 ? void 0 : editData.choices.map(function (item) {
|
|
|
return item.choice_text;
|
|
|
}));
|
|
|
var answerIndexs = [];
|
|
|
editData === null || editData === void 0 || editData.choices.map(function (item, index) {
|
|
|
if (item.is_answer) {
|
|
|
answerIndexs.push(index);
|
|
|
}
|
|
|
});
|
|
|
setActiveAnswer(answerIndexs);
|
|
|
}, [editData]);
|
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, function () {
|
|
|
return {
|
|
|
onSave: onSave,
|
|
|
Clear: Clear
|
|
|
};
|
|
|
});
|
|
|
var onSave = function onSave() {
|
|
|
if (!title) {
|
|
|
message/* default */.ZP.info("请您输入题干");
|
|
|
return false;
|
|
|
}
|
|
|
var findNotAnswerIndex = questionChoiceList.findIndex(function (item) {
|
|
|
return !item;
|
|
|
});
|
|
|
if (findNotAnswerIndex > -1) {
|
|
|
message/* default */.ZP.info("\u8BF7\u5148\u8F93\u5165 ".concat(MultipleEditor_tagList[findNotAnswerIndex], " \u9009\u9879\u7684\u5185\u5BB9"));
|
|
|
return false;
|
|
|
}
|
|
|
if (!activeAnswer.length) {
|
|
|
message/* default */.ZP.info("请设置本题的正确答案,点击选项A/B...即可完成设置");
|
|
|
return false;
|
|
|
}
|
|
|
if (activeAnswer.length < 2) {
|
|
|
message/* default */.ZP.info("多选题最小正确选项为2个");
|
|
|
return false;
|
|
|
}
|
|
|
var choices = questionChoiceList.map(function (item, index) {
|
|
|
return {
|
|
|
choice_text: item,
|
|
|
is_answer: activeAnswer.includes(index) ? 1 : 0
|
|
|
};
|
|
|
});
|
|
|
return {
|
|
|
name: title,
|
|
|
choices: choices,
|
|
|
analysis: analysis
|
|
|
};
|
|
|
};
|
|
|
|
|
|
//清空数值
|
|
|
var Clear = function Clear() {
|
|
|
setQuestionChoiceList(['', '', '', '']);
|
|
|
setTitle('');
|
|
|
setAnalysis('');
|
|
|
setActiveAnswer('');
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: editormodules.wrap,
|
|
|
children: [/*#__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"
|
|
|
})]
|
|
|
})]
|
|
|
}), 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: MultipleEditor_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() {
|
|
|
setQuestionChoiceList(questionChoiceList.filter(function (_, key) {
|
|
|
return key !== index;
|
|
|
}));
|
|
|
if (activeAnswer.includes(index)) {
|
|
|
setActiveAnswer(activeAnswer.filter(function (item) {
|
|
|
return item !== index;
|
|
|
}));
|
|
|
} else {
|
|
|
setActiveAnswer([].concat(toConsumableArray_default()(activeAnswer), [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: editormodules.titleWrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: editormodules.title,
|
|
|
children: "\u9898\u76EE\u89E3\u6790\uFF1A"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
id: "single-question-answer",
|
|
|
watch: true,
|
|
|
height: 155,
|
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",
|
|
|
defaultValue: analysis,
|
|
|
onChange: function onChange(value) {
|
|
|
return setAnalysis(value);
|
|
|
}
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_MultipleEditor = ((0,_umi_production_exports.connect)(function (_ref2) {
|
|
|
var loading = _ref2.loading,
|
|
|
globalSetting = _ref2.globalSetting;
|
|
|
return {
|
|
|
globalSetting: globalSetting,
|
|
|
loading: loading.effects
|
|
|
};
|
|
|
}, null, null, {
|
|
|
forwardRef: true
|
|
|
})( /*#__PURE__*/(0,_react_17_0_2_react.forwardRef)(MultipleEditor)));
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepPreview/components/SingleEditor/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
var SingleEditor_excluded = ["editData", "globalSetting", "loading", "dispatch", "onRef", "isEdit"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 = function SingleEditor(_ref, ref) {
|
|
|
var editData = _ref.editData,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
dispatch = _ref.dispatch,
|
|
|
_ref$onRef = _ref.onRef,
|
|
|
onRef = _ref$onRef === void 0 ? function () {} : _ref$onRef,
|
|
|
isEdit = _ref.isEdit,
|
|
|
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)(''),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
analysis = _useState10[0],
|
|
|
setAnalysis = _useState10[1];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
setQuestionChoiceList(['', '', '', '']);
|
|
|
}, []);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (!editData || !isEdit) {
|
|
|
return;
|
|
|
}
|
|
|
setTitle(editData === null || editData === void 0 ? void 0 : editData.name);
|
|
|
setAnalysis(editData === null || editData === void 0 ? void 0 : editData.analysis);
|
|
|
setQuestionChoiceList(editData === null || editData === void 0 ? void 0 : editData.choices.map(function (item) {
|
|
|
return item.choice_text;
|
|
|
}));
|
|
|
setActiveAnswer(editData === null || editData === void 0 ? void 0 : editData.choices.findIndex(function (item) {
|
|
|
return item.is_answer;
|
|
|
}));
|
|
|
}, [editData]);
|
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, function () {
|
|
|
return {
|
|
|
onSave: onSave,
|
|
|
Clear: Clear
|
|
|
};
|
|
|
});
|
|
|
var onSave = function onSave() {
|
|
|
if (!title) {
|
|
|
message/* default */.ZP.info("请您输入题干");
|
|
|
return false;
|
|
|
}
|
|
|
var findNotAnswerIndex = questionChoiceList.findIndex(function (item) {
|
|
|
return !item;
|
|
|
});
|
|
|
if (findNotAnswerIndex > -1) {
|
|
|
message/* default */.ZP.info("\u8BF7\u5148\u8F93\u5165 ".concat(SingleEditor_tagList[findNotAnswerIndex], " \u9009\u9879\u7684\u5185\u5BB9"));
|
|
|
return false;
|
|
|
}
|
|
|
console.log("activeAnswer: ", activeAnswer);
|
|
|
if (!(typeof activeAnswer === "number")) {
|
|
|
message/* default */.ZP.info("请设置本题的正确答案,点击选项A/B...即可完成设置");
|
|
|
return false;
|
|
|
}
|
|
|
var choices = questionChoiceList.map(function (item, index) {
|
|
|
return {
|
|
|
choice_text: item,
|
|
|
is_answer: activeAnswer === index ? 1 : 0
|
|
|
};
|
|
|
});
|
|
|
return {
|
|
|
name: title,
|
|
|
choices: choices,
|
|
|
analysis: analysis
|
|
|
};
|
|
|
};
|
|
|
|
|
|
//清空数值
|
|
|
var Clear = function Clear() {
|
|
|
setQuestionChoiceList(['', '', '', '']);
|
|
|
setTitle('');
|
|
|
setAnalysis('');
|
|
|
setActiveAnswer('');
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: editormodules.wrap,
|
|
|
children: [/*#__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"
|
|
|
})]
|
|
|
})]
|
|
|
}), 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 === index ? editormodules.activeAnswer : ''),
|
|
|
onClick: function onClick() {
|
|
|
return setActiveAnswer(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,
|
|
|
isFocus: true,
|
|
|
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() {
|
|
|
setQuestionChoiceList(questionChoiceList.filter(function (_, key) {
|
|
|
return key !== index;
|
|
|
}));
|
|
|
if (index === activeAnswer) {
|
|
|
setActiveAnswer(null);
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
}), 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: editormodules.titleWrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: editormodules.title,
|
|
|
children: "\u9898\u76EE\u89E3\u6790\uFF1A"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
id: "single-question-answer",
|
|
|
watch: true,
|
|
|
height: 155,
|
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",
|
|
|
defaultValue: analysis,
|
|
|
onChange: function onChange(value) {
|
|
|
return setAnalysis(value);
|
|
|
}
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_SingleEditor = ((0,_umi_production_exports.connect)(function (_ref2) {
|
|
|
var loading = _ref2.loading,
|
|
|
globalSetting = _ref2.globalSetting;
|
|
|
return {
|
|
|
globalSetting: globalSetting,
|
|
|
loading: loading.effects
|
|
|
};
|
|
|
}, null, null, {
|
|
|
forwardRef: true
|
|
|
})( /*#__PURE__*/(0,_react_17_0_2_react.forwardRef)(SingleEditor)));
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepPreview/components/SubjectiveEditor/index.tsx
|
|
|
|
|
|
|
|
|
var SubjectiveEditor_excluded = ["editData", "globalSetting", "loading", "dispatch", "onRef", "isEdit"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 editData = _ref.editData,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
dispatch = _ref.dispatch,
|
|
|
_ref$onRef = _ref.onRef,
|
|
|
onRef = _ref$onRef === void 0 ? function () {} : _ref$onRef,
|
|
|
isEdit = _ref.isEdit,
|
|
|
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];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var _editData$answer_text;
|
|
|
if (!editData || !isEdit) {
|
|
|
return;
|
|
|
}
|
|
|
setTitle(editData === null || editData === void 0 ? void 0 : editData.name);
|
|
|
setAnalysis(editData === null || editData === void 0 ? void 0 : editData.analysis);
|
|
|
setAnswer(editData === null || editData === void 0 || (_editData$answer_text = editData.answer_texts) === null || _editData$answer_text === void 0 ? void 0 : _editData$answer_text[0]);
|
|
|
}, [editData]);
|
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, function () {
|
|
|
return {
|
|
|
onSave: onSave,
|
|
|
Clear: Clear
|
|
|
};
|
|
|
});
|
|
|
var onSave = function onSave() {
|
|
|
if (!title) {
|
|
|
message/* default */.ZP.info("请您输入题干");
|
|
|
return false;
|
|
|
}
|
|
|
if (!answer) {
|
|
|
message/* default */.ZP.info("请您输入参考答案");
|
|
|
return false;
|
|
|
}
|
|
|
return {
|
|
|
name: title,
|
|
|
answer_texts: [answer],
|
|
|
analysis: analysis
|
|
|
};
|
|
|
};
|
|
|
|
|
|
//清空数值
|
|
|
var Clear = function Clear() {
|
|
|
setTitle('');
|
|
|
setAnalysis('');
|
|
|
setAnswer('');
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: editormodules.wrap,
|
|
|
children: [/*#__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.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.jsx)("p", {
|
|
|
className: editormodules.titleWrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: editormodules.title,
|
|
|
children: "\u9898\u76EE\u89E3\u6790\uFF1A"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
id: "single-question-answer",
|
|
|
watch: true,
|
|
|
height: 155,
|
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",
|
|
|
defaultValue: analysis,
|
|
|
onChange: function onChange(value) {
|
|
|
return setAnalysis(value);
|
|
|
}
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_SubjectiveEditor = ((0,_umi_production_exports.connect)(function (_ref2) {
|
|
|
var loading = _ref2.loading,
|
|
|
globalSetting = _ref2.globalSetting;
|
|
|
return {
|
|
|
globalSetting: globalSetting,
|
|
|
loading: loading.effects
|
|
|
};
|
|
|
}, null, null, {
|
|
|
forwardRef: true
|
|
|
})( /*#__PURE__*/(0,_react_17_0_2_react.forwardRef)(SubjectiveEditor)));
|
|
|
// EXTERNAL MODULE: ./node_modules/_lodash@4.17.21@lodash/lodash.js
|
|
|
var lodash = __webpack_require__(89392);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepPreview/components/CombinationEditor/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
var CombinationEditor_excluded = ["globalSetting", "loading", "dispatch", "editData", "onRef", "isEdit"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var CombinationEditor_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 CombinationEditor = function CombinationEditor(_ref, ref) {
|
|
|
var globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
dispatch = _ref.dispatch,
|
|
|
editData = _ref.editData,
|
|
|
_ref$onRef = _ref.onRef,
|
|
|
onRef = _ref$onRef === void 0 ? function () {} : _ref$onRef,
|
|
|
isEdit = _ref.isEdit,
|
|
|
props = objectWithoutProperties_default()(_ref, CombinationEditor_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),
|
|
|
questionList = _useState4[0],
|
|
|
setQuestionList = _useState4[1];
|
|
|
console.log(questionList);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var _editData$sub_item_ba;
|
|
|
if (!editData || !isEdit) {
|
|
|
return;
|
|
|
}
|
|
|
setName(editData === null || editData === void 0 ? void 0 : editData.name);
|
|
|
var list = editData === null || editData === void 0 || (_editData$sub_item_ba = editData.sub_item_banks) === null || _editData$sub_item_ba === void 0 ? void 0 : _editData$sub_item_ba.map(function (k) {
|
|
|
var _k$choices, _ref2, _k$choices2;
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, k), {}, {
|
|
|
id: k.id,
|
|
|
open: false,
|
|
|
qusList: k === null || k === void 0 || (_k$choices = k.choices) === null || _k$choices === void 0 ? void 0 : _k$choices.map(function (e) {
|
|
|
return e.choice_text;
|
|
|
}),
|
|
|
activeQusEditor: null,
|
|
|
qusAnswer: (_ref2 = [k === null || k === void 0 || (_k$choices2 = k.choices) === null || _k$choices2 === void 0 ? void 0 : _k$choices2.findIndex(function (e) {
|
|
|
return e.is_answer;
|
|
|
})]) === null || _ref2 === void 0 ? void 0 : _ref2.filter(function (k) {
|
|
|
return k !== -1;
|
|
|
})
|
|
|
});
|
|
|
});
|
|
|
setQuestionList(list);
|
|
|
}, [editData]);
|
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, function () {
|
|
|
return {
|
|
|
onSave: onSave,
|
|
|
Clear: Clear
|
|
|
};
|
|
|
});
|
|
|
var onSave = function onSave() {
|
|
|
if (!name) {
|
|
|
message/* default */.ZP.info("请您输入题干");
|
|
|
return false;
|
|
|
}
|
|
|
if (questionList.length === 0) {
|
|
|
message/* default */.ZP.info("请您添加小题");
|
|
|
return false;
|
|
|
}
|
|
|
for (var i = 0; i < questionList.length; i++) {
|
|
|
var _param$qusList;
|
|
|
var param = questionList[i];
|
|
|
if (!(param !== null && param !== void 0 && param.name)) {
|
|
|
message/* default */.ZP.info("\u8BF7\u60A8\u8F93\u5165\u7B2C".concat(i + 1, "\u5C0F\u9898\u9898\u5E72"));
|
|
|
return false;
|
|
|
}
|
|
|
var findNotAnswerIndex = param === null || param === void 0 || (_param$qusList = param.qusList) === null || _param$qusList === void 0 ? void 0 : _param$qusList.findIndex(function (item) {
|
|
|
return !item;
|
|
|
});
|
|
|
if (findNotAnswerIndex > -1) {
|
|
|
message/* default */.ZP.info("\u8BF7\u5148\u8F93\u5165\u7B2C".concat(i + 1, "\u5C0F\u9898").concat(CombinationEditor_tagList[findNotAnswerIndex], "\u9009\u9879\u7684\u5185\u5BB9"));
|
|
|
return false;
|
|
|
}
|
|
|
if (!(param !== null && param !== void 0 && param.qusAnswer.length)) {
|
|
|
message/* default */.ZP.info("\u8BF7\u8BBE\u7F6E\u7B2C".concat(i + 1, "\u5C0F\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"));
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
var sub_item_banks = questionList.map(function (e) {
|
|
|
return {
|
|
|
id: e.id > 1 ? e.id : null,
|
|
|
name: e.name,
|
|
|
item_type: e.item_type,
|
|
|
analysis: e.analysis,
|
|
|
choices: e.qusList.map(function (h, i) {
|
|
|
return {
|
|
|
choice_text: h,
|
|
|
is_answer: e.qusAnswer[0] === i ? 1 : 0
|
|
|
};
|
|
|
})
|
|
|
};
|
|
|
});
|
|
|
return {
|
|
|
name: name,
|
|
|
sub_item_banks: sub_item_banks
|
|
|
};
|
|
|
};
|
|
|
|
|
|
//清空数值
|
|
|
var Clear = function Clear() {
|
|
|
setName('');
|
|
|
setQuestionList([]);
|
|
|
};
|
|
|
var handleAdd = function handleAdd() {
|
|
|
var param = {
|
|
|
id: Math.random(),
|
|
|
item_type: 'SINGLE',
|
|
|
open: false,
|
|
|
name: '',
|
|
|
qusList: ['', '', '', ''],
|
|
|
activeQusEditor: null,
|
|
|
qusAnswer: [],
|
|
|
analysis: ''
|
|
|
};
|
|
|
setQuestionList(questionList.concat(param));
|
|
|
};
|
|
|
var handleQuestionList = function handleQuestionList(type, i, value) {
|
|
|
var cloneQuestionList = (0,lodash.cloneDeep)(questionList);
|
|
|
if (type === 'open') {
|
|
|
cloneQuestionList[i].open = !cloneQuestionList[i].open;
|
|
|
}
|
|
|
if (type === 'delete') {
|
|
|
cloneQuestionList.splice(i, 1);
|
|
|
}
|
|
|
if (type === 'value') {
|
|
|
cloneQuestionList[i].name = value;
|
|
|
}
|
|
|
if (type === 'answer') {
|
|
|
cloneQuestionList[i].qusAnswer = [value];
|
|
|
}
|
|
|
if (type === 'edit') {
|
|
|
cloneQuestionList[i].activeQusEditor = value;
|
|
|
}
|
|
|
if (type === 'details') {
|
|
|
cloneQuestionList[i].qusList[cloneQuestionList[i].activeQusEditor] = value;
|
|
|
}
|
|
|
if (type === 'addQus') {
|
|
|
cloneQuestionList[i].qusList = cloneQuestionList[i].qusList.concat('');
|
|
|
}
|
|
|
if (type === 'deleteQus') {
|
|
|
var _cloneQuestionList$i$;
|
|
|
cloneQuestionList[i].qusList = cloneQuestionList[i].qusList.filter(function (_, c) {
|
|
|
return c !== value;
|
|
|
});
|
|
|
cloneQuestionList[i].qusAnswer = (_cloneQuestionList$i$ = cloneQuestionList[i].qusAnswer) === null || _cloneQuestionList$i$ === void 0 ? void 0 : _cloneQuestionList$i$.filter(function (k) {
|
|
|
return k !== value;
|
|
|
});
|
|
|
}
|
|
|
if (type === 'analysis') {
|
|
|
cloneQuestionList[i].analysis = value;
|
|
|
}
|
|
|
setQuestionList(cloneQuestionList);
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: editormodules.wrap,
|
|
|
children: [/*#__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: "combination-question-title",
|
|
|
watch: true,
|
|
|
height: 155,
|
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",
|
|
|
defaultValue: name,
|
|
|
onChange: function onChange(value) {
|
|
|
return setName(value);
|
|
|
}
|
|
|
}), questionList === null || questionList === void 0 ? void 0 : questionList.map(function (e, j) {
|
|
|
var _e$qusList;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: editormodules.fold,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
onClick: function onClick() {
|
|
|
return handleQuestionList('open', j);
|
|
|
},
|
|
|
className: editormodules.head,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-sanjiaoxing",
|
|
|
style: {
|
|
|
transform: e.open ? 'initial' : 'rotate(270deg) translate(2px, 4px)'
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: ["\u7B2C", j + 1, "\u5C0F\u9898\uFF08\u5355\u9009\u9898\uFF09"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("b", {
|
|
|
style: {
|
|
|
visibility: 'hidden'
|
|
|
},
|
|
|
onClick: function onClick(e) {
|
|
|
e.stopPropagation();
|
|
|
handleQuestionList('delete', j);
|
|
|
},
|
|
|
className: "iconfont icon-shanchu8"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "mb10",
|
|
|
style: {
|
|
|
display: e.open ? 'block' : 'none'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
watch: true,
|
|
|
height: 155,
|
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",
|
|
|
defaultValue: e === null || e === void 0 ? void 0 : e.name,
|
|
|
onChange: function onChange(value) {
|
|
|
return handleQuestionList('value', j, 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"
|
|
|
})]
|
|
|
})]
|
|
|
}), e === null || e === void 0 || (_e$qusList = e.qusList) === null || _e$qusList === void 0 ? void 0 : _e$qusList.map(function (item, index) {
|
|
|
var _e$qusAnswer, _e$qusList2;
|
|
|
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(e !== null && e !== void 0 && (_e$qusAnswer = e.qusAnswer) !== null && _e$qusAnswer !== void 0 && _e$qusAnswer.includes(index) ? editormodules.activeAnswer : ''),
|
|
|
onClick: function onClick() {
|
|
|
return handleQuestionList('answer', j, index);
|
|
|
},
|
|
|
children: CombinationEditor_tagList[index]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: editormodules.editorWrap,
|
|
|
children: (e === null || e === void 0 ? void 0 : e.activeQusEditor) === index ? /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
id: "single-question-option-".concat(index),
|
|
|
watch: true,
|
|
|
height: 155,
|
|
|
isFocus: true,
|
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9009\u9879",
|
|
|
defaultValue: item,
|
|
|
onChange: function onChange(value) {
|
|
|
return handleQuestionList('details', j, value);
|
|
|
}
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: editormodules.htmlWrap,
|
|
|
onClick: function onClick() {
|
|
|
return handleQuestionList('edit', j, 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 handleQuestionList('deleteQus', j, index);
|
|
|
}
|
|
|
})
|
|
|
}), index < 7 && index === (e === null || e === void 0 || (_e$qusList2 = e.qusList) === null || _e$qusList2 === void 0 ? void 0 : _e$qusList2.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 handleQuestionList('addQus', j);
|
|
|
}
|
|
|
})
|
|
|
})]
|
|
|
}, index);
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "mb10 mt10",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: editormodules.title,
|
|
|
children: "\u9898\u76EE\u89E3\u6790\uFF1A"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
id: "single-question-answer",
|
|
|
watch: true,
|
|
|
height: 155,
|
|
|
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",
|
|
|
defaultValue: e.analysis,
|
|
|
onChange: function onChange(value) {
|
|
|
return handleQuestionList('analysis', j, value);
|
|
|
}
|
|
|
})]
|
|
|
})]
|
|
|
}, e.id);
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_CombinationEditor = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
|
var loading = _ref3.loading,
|
|
|
globalSetting = _ref3.globalSetting;
|
|
|
return {
|
|
|
globalSetting: globalSetting,
|
|
|
loading: loading.effects
|
|
|
};
|
|
|
}, null, null, {
|
|
|
forwardRef: true
|
|
|
})( /*#__PURE__*/(0,_react_17_0_2_react.forwardRef)(CombinationEditor)));
|
|
|
// EXTERNAL MODULE: ./src/components/AsyncButton/index.tsx
|
|
|
var AsyncButton = __webpack_require__(75816);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepPreview/components/ExchangeModal.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ExchangeModal = function ExchangeModal(_ref) {
|
|
|
var visible = _ref.visible,
|
|
|
onCancel = _ref.onCancel,
|
|
|
onRandomExchange = _ref.onRandomExchange,
|
|
|
selectFromProblemSet = _ref.selectFromProblemSet,
|
|
|
questionParams = _ref.questionParams;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_modal/* default */.Z, {
|
|
|
title: "\u8BF7\u9009\u62E9\u66FF\u6362\u65B9\u5F0F",
|
|
|
open: visible,
|
|
|
onCancel: onCancel,
|
|
|
centered: true,
|
|
|
maskClosable: true,
|
|
|
footer: null,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "center",
|
|
|
className: "pb20",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(AsyncButton/* AsyncButton */.Z, {
|
|
|
onClick: onRandomExchange,
|
|
|
children: "\u968F\u673A\u66F4\u6362"
|
|
|
}), (questionParams === null || questionParams === void 0 ? void 0 : questionParams.type) !== 'PRACTICAL' && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
style: {
|
|
|
marginLeft: 24
|
|
|
},
|
|
|
onClick: selectFromProblemSet,
|
|
|
children: "\u4ECE\u9898\u5E93\u4E2D\u9009\u62E9"
|
|
|
})]
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_ExchangeModal = (ExchangeModal);
|
|
|
// EXTERNAL MODULE: ./src/components/ui-customization/index.tsx + 32 modules
|
|
|
var ui_customization = __webpack_require__(89200);
|
|
|
// EXTERNAL MODULE: ./src/components/QuestionEditor/index.tsx
|
|
|
var QuestionEditor = __webpack_require__(9205);
|
|
|
// EXTERNAL MODULE: ./node_modules/_js-base64@2.6.4@js-base64/base64.js
|
|
|
var base64 = __webpack_require__(24334);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepPreview/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Page = function Page(_ref) {
|
|
|
var _data$questionList2, _data$exam, _data$exam2, _data$exam3, _data$exam4, _data$questionList3, _data$exam5, _data$exam6, _data$exam7, _data$questionList4, _data$exam8;
|
|
|
var data = _ref.data,
|
|
|
submit = _ref.submit,
|
|
|
goBack = _ref.goBack,
|
|
|
loading = _ref.loading,
|
|
|
onTypeScore = _ref.onTypeScore,
|
|
|
_ref$editPreview = _ref.editPreview,
|
|
|
editPreview = _ref$editPreview === void 0 ? false : _ref$editPreview,
|
|
|
onSkipExamination = _ref.onSkipExamination,
|
|
|
selectValue = _ref.selectValue,
|
|
|
onExchange = _ref.onExchange;
|
|
|
var childrenRef = (0,_react_17_0_2_react.useRef)();
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(null),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
editId = _useState2[0],
|
|
|
setEditId = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
tooltipVisible = _useState4[0],
|
|
|
setTooltipVisible = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
exchangeModalVisible = _useState6[0],
|
|
|
setExchangeModalVisible = _useState6[1];
|
|
|
var exchangeQuestionParams = (0,_react_17_0_2_react.useRef)();
|
|
|
var _Form$useForm = es_form/* default */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
iscover = _useState8[0],
|
|
|
setcover = _useState8[1];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
setTooltipVisible(true);
|
|
|
}, []);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (!editPreview) {
|
|
|
(0,util/* setDocumentTitle */.Dk)('试卷预览');
|
|
|
}
|
|
|
}, [editPreview]);
|
|
|
|
|
|
//容易占位置用
|
|
|
var difficulty = ['容易', '简单', '适中', '困难'];
|
|
|
var End = ['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 renderQs = function renderQs(item) {
|
|
|
var _item$choices;
|
|
|
var answer = [];
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
|
className: StepPreviewmodules.single,
|
|
|
children: item === null || item === void 0 || (_item$choices = item.choices) === null || _item$choices === void 0 ? void 0 : _item$choices.map(function (e, i) {
|
|
|
if (e.is_answer) {
|
|
|
answer.push(End[i]);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: [End[i], "\u3001"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: e.choice_text
|
|
|
})
|
|
|
})]
|
|
|
}, i);
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.analysis,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u6B63\u786E\u7B54\u6848\uFF1A", answer.join(''), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "ml30",
|
|
|
children: ["\u96BE\u5EA6\uFF1A", difficulty[item.difficulty]]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: StepPreviewmodules.text,
|
|
|
children: "\u89E3\u6790:"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item.analysis ? item.analysis : '暂无解析'
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#007AFF',
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: '方向&课程:'
|
|
|
}), "".concat((item === null || item === void 0 ? void 0 : item.discipline_name) || "--", "/").concat(item === null || item === void 0 ? void 0 : item.sub_discipline_name)]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#5AB891',
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: '知识点:'
|
|
|
}), item === null || item === void 0 ? void 0 : item.tag_discipline_name]
|
|
|
})]
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var renderCompletion = function renderCompletion(item) {
|
|
|
var _item$standard_answer;
|
|
|
var answer = item === null || item === void 0 || (_item$standard_answer = item.standard_answer) === null || _item$standard_answer === void 0 ? void 0 : _item$standard_answer.map(function (k, index) {
|
|
|
var _k$answer_text;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u7B54\u6848\uFF08\u586B\u7A7A".concat(k.position, "\uFF09\uFF1A").concat(k === null || k === void 0 || (_k$answer_text = k.answer_text) === null || _k$answer_text === void 0 ? void 0 : _k$answer_text.join("、"))
|
|
|
}, index);
|
|
|
});
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(_react_17_0_2_react.Fragment, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.analysis,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
display: 'flex'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u6B63\u786E\u7B54\u6848\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: answer
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: StepPreviewmodules.text,
|
|
|
children: "\u89E3\u6790:"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item.analysis ? item.analysis : '暂无解析'
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#007AFF',
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: '方向&课程:'
|
|
|
}), "".concat((item === null || item === void 0 ? void 0 : item.discipline_name) || "--", "/").concat(item === null || item === void 0 ? void 0 : item.sub_discipline_name)]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#5AB891',
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: '知识点:'
|
|
|
}), item === null || item === void 0 ? void 0 : item.tag_discipline_name]
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
var renderBProgram = function renderBProgram(item) {
|
|
|
var _item$standard_answer2;
|
|
|
var answer = item === null || item === void 0 || (_item$standard_answer2 = item.standard_answer) === null || _item$standard_answer2 === void 0 ? void 0 : _item$standard_answer2.map(function (k, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u7B54\u6848\uFF08\u586B\u7A7A".concat(k.position || (k === null || k === void 0 ? void 0 : k.exercise_choice_id), "\uFF09\uFF1A").concat(k === null || k === void 0 ? void 0 : k.answer_text)
|
|
|
}, index);
|
|
|
});
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(_react_17_0_2_react.Fragment, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.analysis,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
display: 'flex'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u6B63\u786E\u7B54\u6848\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: answer
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: StepPreviewmodules.text,
|
|
|
children: "\u89E3\u6790:"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item.analysis ? item.analysis : '暂无解析'
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#007AFF',
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: '方向&课程:'
|
|
|
}), "".concat((item === null || item === void 0 ? void 0 : item.discipline_name) || "--", "/").concat(item === null || item === void 0 ? void 0 : item.sub_discipline_name)]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#5AB891',
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: '知识点:'
|
|
|
}), item === null || item === void 0 ? void 0 : item.tag_discipline_name]
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
var renderSubjective = function renderSubjective(item) {
|
|
|
var _item$answer_texts;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.analysis,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u6B63\u786E\u7B54\u6848\uFF1A", item === null || item === void 0 || (_item$answer_texts = item.answer_texts) === null || _item$answer_texts === void 0 ? void 0 : _item$answer_texts[0]]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: StepPreviewmodules.text,
|
|
|
children: "\u89E3\u6790:"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item.analysis ? item.analysis : '暂无解析'
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#007AFF',
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: '方向&课程:'
|
|
|
}), "".concat((item === null || item === void 0 ? void 0 : item.discipline_name) || "--", "/").concat(item === null || item === void 0 ? void 0 : item.sub_discipline_name)]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#5AB891',
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: '知识点:'
|
|
|
}), item === null || item === void 0 ? void 0 : item.tag_discipline_name]
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var renderProgram = function renderProgram(item) {
|
|
|
var _item$program_attr, _item$program_attr2;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.analysis,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: StepPreviewmodules.text,
|
|
|
children: "\u9884\u671F\u8F93\u51FA:"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item === null || item === void 0 || (_item$program_attr = item.program_attr) === null || _item$program_attr === void 0 ? void 0 : _item$program_attr.description
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
marginTop: 20
|
|
|
},
|
|
|
children: ["\u6B63\u786E\u7B54\u6848\uFF1A", (item === null || item === void 0 || (_item$program_attr2 = item.program_attr) === null || _item$program_attr2 === void 0 ? void 0 : _item$program_attr2.answer_text) || '--']
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: StepPreviewmodules.text,
|
|
|
children: "\u89E3\u6790:"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item.analysis ? item.analysis : '暂无解析'
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#007AFF',
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: '方向&课程:'
|
|
|
}), "".concat((item === null || item === void 0 ? void 0 : item.discipline_name) || "--", "/").concat(item === null || item === void 0 ? void 0 : item.sub_discipline_name)]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#5AB891',
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: '知识点:'
|
|
|
}), item === null || item === void 0 ? void 0 : item.tag_discipline_name]
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var renderCombination = function renderCombination(items, jndex) {
|
|
|
var _items$sub_item_banks;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: items === null || items === void 0 || (_items$sub_item_banks = items.sub_item_banks) === null || _items$sub_item_banks === void 0 ? void 0 : _items$sub_item_banks.map(function (item, index) {
|
|
|
var _item$choices2;
|
|
|
var answer = [];
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
marginLeft: 25,
|
|
|
fontSize: '16px',
|
|
|
color: '#333'
|
|
|
},
|
|
|
children: [jndex + 1 + '.' + (index + 1), "\uFF08\u5355\u9009\u9898\uFF09", item.name]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
|
className: StepPreviewmodules.single,
|
|
|
children: item === null || item === void 0 || (_item$choices2 = item.choices) === null || _item$choices2 === void 0 ? void 0 : _item$choices2.map(function (e, i) {
|
|
|
if (e.is_answer) {
|
|
|
answer.push(End[i]);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: [End[i], "\u3001"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: e.choice_text
|
|
|
})
|
|
|
})]
|
|
|
}, i);
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.analysis,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u6B63\u786E\u7B54\u6848\uFF1A", answer.join(''), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "ml30",
|
|
|
children: ["\u96BE\u5EA6\uFF1A", difficulty[item.difficulty]]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: StepPreviewmodules.text,
|
|
|
children: "\u89E3\u6790:"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item.analysis ? item.analysis : '暂无解析'
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#007AFF',
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: '方向&课程:'
|
|
|
}), "".concat((items === null || items === void 0 ? void 0 : items.discipline_name) || "--", "/").concat(items === null || items === void 0 ? void 0 : items.sub_discipline_name)]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#5AB891',
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: '知识点:'
|
|
|
}), items === null || items === void 0 ? void 0 : items.tag_discipline_name]
|
|
|
})]
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
})
|
|
|
});
|
|
|
// return <div className={styles.analysis}>
|
|
|
// <aside>
|
|
|
// <span className={styles.text}>预期输出:</span>
|
|
|
// <RenderHtml value={item?.program_attr?.description} />
|
|
|
// </aside>
|
|
|
// <ul>
|
|
|
// <li><span style={{ color: '#007AFF', marginRight: 10 }}>{'方向&课程:'}</span>{`${item?.discipline_name || "--"}/${item?.sub_discipline_name}`}</li>
|
|
|
// <li><span style={{ color: '#5AB891', marginRight: 10 }}>{'知识点:'}</span>{item?.tag_discipline_name}</li>
|
|
|
// </ul>
|
|
|
// </div>
|
|
|
};
|
|
|
|
|
|
var renderPractical = function renderPractical(items) {
|
|
|
var _items$shixun, _items$shixun2;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "mt5",
|
|
|
children: [items === null || items === void 0 || (_items$shixun = items.shixun) === null || _items$shixun === void 0 || (_items$shixun = _items$shixun.challenges) === null || _items$shixun === void 0 ? void 0 : _items$shixun.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "c-grey-666 font14 mb10 ml25",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "mr5",
|
|
|
children: ["\u7B2C", index + 1, "\u5173"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: item === null || item === void 0 ? void 0 : item.challenge_name,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: (0,util/* cutName */.Pq)(item === null || item === void 0 ? void 0 : item.challenge_name, 44)
|
|
|
})
|
|
|
}, index)]
|
|
|
});
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
|
style: {
|
|
|
"float": 'right'
|
|
|
},
|
|
|
target: "_blank",
|
|
|
to: "/shixuns/".concat(items === null || items === void 0 || (_items$shixun2 = items.shixun) === null || _items$shixun2 === void 0 ? void 0 : _items$shixun2.identifier, "/challenges"),
|
|
|
children: "\u5B9E\u8BAD\u8BE6\u60C5"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
clear: 'both'
|
|
|
}
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var handleSetScore = function handleSetScore(item) {
|
|
|
var score = item.questions_score / item.questions_count;
|
|
|
es_modal/* default */.Z.confirm({
|
|
|
icon: null,
|
|
|
centered: true,
|
|
|
title: '分数设置',
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: StepPreviewmodules.modalColumn,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.modalRow,
|
|
|
style: {
|
|
|
justifyContent: 'flex-start'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("sup", {
|
|
|
className: StepPreviewmodules.sup,
|
|
|
children: "*"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [item === null || item === void 0 ? void 0 : item.name, "\uFF1A"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
min: 0,
|
|
|
precision: 1,
|
|
|
defaultValue: score,
|
|
|
onChange: function onChange(value) {
|
|
|
score = value;
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "ml5",
|
|
|
children: "\u5206/\u9898"
|
|
|
})]
|
|
|
})
|
|
|
}),
|
|
|
okText: '确认',
|
|
|
cancelText: '取消',
|
|
|
onOk: function () {
|
|
|
var _onOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var _ref2;
|
|
|
var param;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
if (score) {
|
|
|
_context.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.warning('分数不能为空或为0');
|
|
|
return _context.abrupt("return", Promise.reject());
|
|
|
case 3:
|
|
|
param = {
|
|
|
type: item === null || item === void 0 ? void 0 : item.type,
|
|
|
score: score,
|
|
|
scoreTotal: Number((_ref2 = score * item.questions_count) === null || _ref2 === void 0 ? void 0 : _ref2.toFixed(1))
|
|
|
};
|
|
|
onTypeScore(param);
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
function onOk() {
|
|
|
return _onOk.apply(this, arguments);
|
|
|
}
|
|
|
return onOk;
|
|
|
}()
|
|
|
});
|
|
|
};
|
|
|
var handleSave = function handleSave() {
|
|
|
var name = '';
|
|
|
es_modal/* default */.Z.confirm({
|
|
|
icon: null,
|
|
|
centered: true,
|
|
|
title: '保存试卷',
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.modalColumn,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
color: '#676A6C',
|
|
|
display: 'flex',
|
|
|
alignItems: 'center'
|
|
|
},
|
|
|
className: "font14 mt20",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
style: {
|
|
|
marginRight: 5
|
|
|
},
|
|
|
src: jinshi/* default */.Z
|
|
|
}), "\u4FDD\u5B58\u540E\u5355\u72EC\u751F\u6210\u4E00\u4EFD\u4EBA\u5DE5\u7EC4\u5377\u7C7B\u578B\u7684\u56FA\u5B9A\u8BD5\u5377\u3002"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.modalRow,
|
|
|
style: {
|
|
|
marginTop: 20
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("sup", {
|
|
|
className: StepPreviewmodules.sup,
|
|
|
children: "*"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
flexShrink: 0
|
|
|
},
|
|
|
children: "\u8BD5\u5377\u540D\u79F0\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u8BD5\u5377\u540D\u79F0",
|
|
|
min: 0,
|
|
|
maxLength: 60,
|
|
|
defaultValue: name,
|
|
|
onChange: function onChange(e) {
|
|
|
name = e.target.value;
|
|
|
}
|
|
|
})]
|
|
|
})]
|
|
|
}),
|
|
|
okText: '确认',
|
|
|
cancelText: '取消',
|
|
|
onOk: function () {
|
|
|
var _onOk2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
var _data$questionList;
|
|
|
var item_bank_ids, item_bank_scores, combination_item_banks, shixun_ids, params;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
if (name) {
|
|
|
_context2.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.warning('试卷名称不能为空');
|
|
|
return _context2.abrupt("return", Promise.reject());
|
|
|
case 3:
|
|
|
item_bank_ids = [];
|
|
|
item_bank_scores = [];
|
|
|
combination_item_banks = [];
|
|
|
shixun_ids = [];
|
|
|
data === null || data === void 0 || (_data$questionList = data.questionList) === null || _data$questionList === void 0 || _data$questionList.forEach(function (item) {
|
|
|
var _item$questions;
|
|
|
(_item$questions = item.questions) === null || _item$questions === void 0 || _item$questions.forEach(function (e) {
|
|
|
var s = item.questions_score / item.questions_count;
|
|
|
s = s && s.toFixed(1);
|
|
|
if (item.type === 'COMBINATION') {
|
|
|
combination_item_banks.push({
|
|
|
id: e.id,
|
|
|
sub_item_bank_ids: e.sub_item_banks.map(function (item) {
|
|
|
return item.id;
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
if (item.type === 'PRACTICAL') {
|
|
|
shixun_ids.push(e.id);
|
|
|
} else {
|
|
|
item_bank_ids.push(e.id);
|
|
|
item_bank_scores.push(s);
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
console.log('-----', combination_item_banks);
|
|
|
params = {
|
|
|
item_bank_ids: item_bank_ids,
|
|
|
item_bank_scores: item_bank_scores,
|
|
|
name: name,
|
|
|
combination_item_banks: combination_item_banks,
|
|
|
shixun_ids: shixun_ids
|
|
|
};
|
|
|
_context2.next = 12;
|
|
|
return submit(params);
|
|
|
case 12:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
function onOk() {
|
|
|
return _onOk2.apply(this, arguments);
|
|
|
}
|
|
|
return onOk;
|
|
|
}()
|
|
|
});
|
|
|
};
|
|
|
var handleOnlyOne = function handleOnlyOne(id, type, index, item) {
|
|
|
var _item$questions2;
|
|
|
var currentUrl = "".concat(location.pathname).concat(location.search);
|
|
|
var ids = (_item$questions2 = item.questions) === null || _item$questions2 === void 0 ? void 0 : _item$questions2.map(function (k) {
|
|
|
return k.id;
|
|
|
});
|
|
|
if (currentUrl.includes('exercise')) {
|
|
|
exchangeQuestionParams.current = {
|
|
|
id: id,
|
|
|
ids: ids,
|
|
|
type: type,
|
|
|
index: index
|
|
|
};
|
|
|
setExchangeModalVisible(true);
|
|
|
} else {
|
|
|
var modal = es_modal/* default */.Z.confirm({
|
|
|
icon: null,
|
|
|
centered: true,
|
|
|
title: '温馨提示',
|
|
|
content: "\u786E\u8BA4\u8981\u66F4\u6362\u8BE5\u8BD5\u9898\u5417\uFF1F",
|
|
|
cancelButtonProps: {
|
|
|
disabled: false
|
|
|
},
|
|
|
maskClosable: true,
|
|
|
keyboard: false,
|
|
|
okText: '确认',
|
|
|
cancelText: '取消',
|
|
|
onOk: function () {
|
|
|
var _onOk3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
modal.update({
|
|
|
cancelButtonProps: {
|
|
|
disabled: true
|
|
|
}
|
|
|
});
|
|
|
_context3.next = 3;
|
|
|
return onExchange({
|
|
|
single_question_id: id,
|
|
|
seleted_item_bank_ids: ids
|
|
|
}, {
|
|
|
type: type,
|
|
|
index: index
|
|
|
});
|
|
|
case 3:
|
|
|
modal.update({
|
|
|
cancelButtonProps: {
|
|
|
disabled: false
|
|
|
}
|
|
|
});
|
|
|
message/* default */.ZP.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u8BD5\u9898");
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
function onOk() {
|
|
|
return _onOk3.apply(this, arguments);
|
|
|
}
|
|
|
return onOk;
|
|
|
}()
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
var handleOnlyType = function handleOnlyType(item) {
|
|
|
var _item$questions3;
|
|
|
var ids = (_item$questions3 = item.questions) === null || _item$questions3 === void 0 ? void 0 : _item$questions3.map(function (k) {
|
|
|
return k.id;
|
|
|
});
|
|
|
var typeName = item.name;
|
|
|
var modal = es_modal/* default */.Z.confirm({
|
|
|
icon: null,
|
|
|
centered: true,
|
|
|
title: '温馨提示',
|
|
|
content: "\u786E\u8BA4\u66F4\u6362".concat(typeName, "\u4E2D\u7684\u6240\u6709\u8BD5\u9898\u5417\uFF1F"),
|
|
|
cancelButtonProps: {
|
|
|
disabled: false
|
|
|
},
|
|
|
maskClosable: false,
|
|
|
keyboard: false,
|
|
|
okText: '确认',
|
|
|
cancelText: '取消',
|
|
|
onOk: function () {
|
|
|
var _onOk4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
modal.update({
|
|
|
cancelButtonProps: {
|
|
|
disabled: true
|
|
|
}
|
|
|
});
|
|
|
_context4.next = 3;
|
|
|
return onExchange({
|
|
|
seleted_item_bank_ids: ids
|
|
|
}, {
|
|
|
type: item.type
|
|
|
});
|
|
|
case 3:
|
|
|
modal.update({
|
|
|
cancelButtonProps: {
|
|
|
disabled: false
|
|
|
}
|
|
|
});
|
|
|
message/* default */.ZP.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210".concat(typeName, "\u8BD5\u9898"));
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
function onOk() {
|
|
|
return _onOk4.apply(this, arguments);
|
|
|
}
|
|
|
return onOk;
|
|
|
}()
|
|
|
});
|
|
|
};
|
|
|
var handleAllType = function handleAllType() {
|
|
|
var modal = es_modal/* default */.Z.confirm({
|
|
|
icon: null,
|
|
|
centered: true,
|
|
|
title: '温馨提示',
|
|
|
content: "\u786E\u8BA4\u66F4\u6362\u9884\u89C8\u4E2D\u7684\u6240\u6709\u8BD5\u9898\u5417\uFF1F",
|
|
|
cancelButtonProps: {
|
|
|
disabled: false
|
|
|
},
|
|
|
maskClosable: false,
|
|
|
keyboard: false,
|
|
|
okText: '确认',
|
|
|
cancelText: '取消',
|
|
|
onOk: function () {
|
|
|
var _onOk5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
|
|
|
while (1) switch (_context5.prev = _context5.next) {
|
|
|
case 0:
|
|
|
modal.update({
|
|
|
cancelButtonProps: {
|
|
|
disabled: true
|
|
|
}
|
|
|
});
|
|
|
_context5.next = 3;
|
|
|
return onExchange();
|
|
|
case 3:
|
|
|
modal.update({
|
|
|
cancelButtonProps: {
|
|
|
disabled: false
|
|
|
}
|
|
|
});
|
|
|
message/* default */.ZP.success('已重新随机生成整张试题');
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context5.stop();
|
|
|
}
|
|
|
}, _callee5);
|
|
|
}));
|
|
|
function onOk() {
|
|
|
return _onOk5.apply(this, arguments);
|
|
|
}
|
|
|
return onOk;
|
|
|
}()
|
|
|
});
|
|
|
};
|
|
|
var handleSelectChange = function handleSelectChange(key) {
|
|
|
console.log(key, 'key');
|
|
|
onSkipExamination(key - 1);
|
|
|
};
|
|
|
var renderSubject = function renderSubject(v, type) {
|
|
|
if (type === 'SINGLE') {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(components_SingleEditor, {
|
|
|
ref: childrenRef,
|
|
|
editData: v,
|
|
|
isEdit: true
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {})]
|
|
|
});
|
|
|
}
|
|
|
if (type === 'MULTIPLE') {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(components_MultipleEditor, {
|
|
|
ref: childrenRef,
|
|
|
editData: v,
|
|
|
isEdit: true
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {})]
|
|
|
});
|
|
|
}
|
|
|
if (type === 'JUDGMENT') {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(components_JudgmentEditor, {
|
|
|
ref: childrenRef,
|
|
|
editData: v,
|
|
|
isEdit: true
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {})]
|
|
|
});
|
|
|
}
|
|
|
if (type === 'COMPLETION') {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(components_CompletionEditor, {
|
|
|
ref: childrenRef,
|
|
|
editData: v,
|
|
|
isEdit: true
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {})]
|
|
|
});
|
|
|
}
|
|
|
if (type === 'SUBJECTIVE') {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(components_SubjectiveEditor, {
|
|
|
ref: childrenRef,
|
|
|
editData: v,
|
|
|
isEdit: true
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {})]
|
|
|
});
|
|
|
}
|
|
|
if (type === 'COMBINATION') {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(components_CombinationEditor, {
|
|
|
ref: childrenRef,
|
|
|
editData: v,
|
|
|
isEdit: true
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {})]
|
|
|
});
|
|
|
}
|
|
|
if (type === 'BPROGRAM') {
|
|
|
var _v$program_attr;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
|
|
|
form: form,
|
|
|
style: {
|
|
|
marginTop: 20
|
|
|
},
|
|
|
onFinishFailed: function onFinishFailed(errInfo) {
|
|
|
var _errInfo$errorFields;
|
|
|
if (errInfo.errorFields[0].name.includes("standard_answers")) {
|
|
|
message/* default */.ZP.error("填空项答案不能为空");
|
|
|
} else {
|
|
|
message/* default */.ZP.error(errInfo.errorFields[0].errors[0]);
|
|
|
}
|
|
|
// message.error(errInfo.errorFields[0].errors[0])
|
|
|
form.scrollToField(errInfo === null || errInfo === void 0 || (_errInfo$errorFields = errInfo.errorFields) === null || _errInfo$errorFields === void 0 || (_errInfo$errorFields = _errInfo$errorFields[0]) === null || _errInfo$errorFields === void 0 ? void 0 : _errInfo$errorFields.name, {
|
|
|
behavior: 'smooth',
|
|
|
block: 'center'
|
|
|
});
|
|
|
},
|
|
|
onFinish: /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6(values) {
|
|
|
var _values$hack_codes;
|
|
|
var body, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee6$(_context6) {
|
|
|
while (1) switch (_context6.prev = _context6.next) {
|
|
|
case 0:
|
|
|
body = objectSpread2_default()(objectSpread2_default()({
|
|
|
question_score: v.score
|
|
|
}, values), {}, {
|
|
|
question_type: 8,
|
|
|
hack: objectSpread2_default()(objectSpread2_default()({}, values.hack), {}, {
|
|
|
difficult: v.program_attr.difficult
|
|
|
}),
|
|
|
hack_codes: objectSpread2_default()(objectSpread2_default()({}, values.hack_codes), {}, {
|
|
|
code: base64.Base64.encode((_values$hack_codes = values.hack_codes) === null || _values$hack_codes === void 0 ? void 0 : _values$hack_codes.code)
|
|
|
})
|
|
|
});
|
|
|
if (iscover) {
|
|
|
// datas.is_cover = 1
|
|
|
body.is_cover = 1;
|
|
|
}
|
|
|
_context6.next = 4;
|
|
|
return (0,fetch/* default */.ZP)("/api/exercise_questions/".concat(v.id, ".json"), {
|
|
|
method: 'put',
|
|
|
body: body
|
|
|
});
|
|
|
case 4:
|
|
|
res = _context6.sent;
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
message/* default */.ZP.success('编辑成功');
|
|
|
handleSelectChange(selectValue + 1);
|
|
|
}
|
|
|
setEditId(null);
|
|
|
case 7:
|
|
|
case "end":
|
|
|
return _context6.stop();
|
|
|
}
|
|
|
}, _callee6);
|
|
|
}));
|
|
|
return function (_x) {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}(),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(QuestionEditor/* BProgramEditor */.tc, {
|
|
|
form: form,
|
|
|
questionTitlePlaceholder: "\u8BF7\u7F16\u8F91\u9898\u5E72\u5E76\u8BBE\u7F6E\u586B\u7A7A\u9879",
|
|
|
scoreByBlank: false,
|
|
|
hackidentifier: v === null || v === void 0 || (_v$program_attr = v.program_attr) === null || _v$program_attr === void 0 ? void 0 : _v$program_attr.identifier,
|
|
|
answerKey: "standard_answers"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {})]
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
if (type === 'PROGRAM') {
|
|
|
var _v$program_attr2;
|
|
|
_umi_production_exports.history.push("/problems/".concat(v === null || v === void 0 || (_v$program_attr2 = v.program_attr) === null || _v$program_attr2 === void 0 ? void 0 : _v$program_attr2.identifier, "/edit?type=exercises&express_id=").concat(params.categoryId, "&question_id=").concat(v === null || v === void 0 ? void 0 : v.id, "&score=").concat(v === null || v === void 0 ? void 0 : v.score, "&callback_url=").concat(location.pathname, "&select=").concat(selectValue, "&exercise=true"));
|
|
|
}
|
|
|
};
|
|
|
var handleEditSave = /*#__PURE__*/function () {
|
|
|
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee7(type, param, isok) {
|
|
|
var _childrenRef$current;
|
|
|
var editorData, body, _editorData$choices, question_choices, standard_answers, _editorData$standard_, _standard_answers, _editorData$sub_item_, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee7$(_context7) {
|
|
|
while (1) switch (_context7.prev = _context7.next) {
|
|
|
case 0:
|
|
|
_context7.next = 2;
|
|
|
return (_childrenRef$current = childrenRef.current) === null || _childrenRef$current === void 0 ? void 0 : _childrenRef$current.onSave();
|
|
|
case 2:
|
|
|
editorData = _context7.sent;
|
|
|
if (editorData) {
|
|
|
_context7.next = 5;
|
|
|
break;
|
|
|
}
|
|
|
return _context7.abrupt("return");
|
|
|
case 5:
|
|
|
body = {
|
|
|
question_score: param.score,
|
|
|
analysis: editorData.analysis
|
|
|
};
|
|
|
if (isok) {
|
|
|
// datas.is_cover = 1
|
|
|
body.is_cover = 1;
|
|
|
}
|
|
|
if (type === 'SINGLE' || type === 'MULTIPLE' || type === 'JUDGMENT') {
|
|
|
question_choices = [];
|
|
|
standard_answers = [];
|
|
|
body.question_type = type === 'JUDGMENT' ? 2 : 1;
|
|
|
body.question_title = editorData === null || editorData === void 0 ? void 0 : editorData.name;
|
|
|
editorData === null || editorData === void 0 || (_editorData$choices = editorData.choices) === null || _editorData$choices === void 0 || _editorData$choices.forEach(function (e, i) {
|
|
|
question_choices.push(e.choice_text);
|
|
|
if (e !== null && e !== void 0 && e.is_answer) {
|
|
|
standard_answers.push(i + 1);
|
|
|
}
|
|
|
});
|
|
|
body.question_choices = question_choices;
|
|
|
body.standard_answers = standard_answers;
|
|
|
}
|
|
|
if (type === 'COMPLETION') {
|
|
|
body.is_ordered = editorData.is_ordered;
|
|
|
body.question_title = editorData === null || editorData === void 0 ? void 0 : editorData.name;
|
|
|
body.question_type = 3;
|
|
|
_standard_answers = [];
|
|
|
editorData === null || editorData === void 0 || (_editorData$standard_ = editorData.standard_answers) === null || _editorData$standard_ === void 0 || _editorData$standard_.forEach(function (e, i) {
|
|
|
_standard_answers.push({
|
|
|
choice_id: e.position,
|
|
|
answer_text: e.answer_text
|
|
|
});
|
|
|
});
|
|
|
body.standard_answers = _standard_answers;
|
|
|
}
|
|
|
if (type === 'SUBJECTIVE') {
|
|
|
body.question_title = editorData === null || editorData === void 0 ? void 0 : editorData.name;
|
|
|
body.question_type = 3;
|
|
|
body.standard_answers = editorData === null || editorData === void 0 ? void 0 : editorData.answer_texts;
|
|
|
}
|
|
|
if (type === 'COMBINATION') {
|
|
|
body.question_title = editorData === null || editorData === void 0 ? void 0 : editorData.name;
|
|
|
body.question_type = 7;
|
|
|
body.sub_questions = editorData === null || editorData === void 0 || (_editorData$sub_item_ = editorData.sub_item_banks) === null || _editorData$sub_item_ === void 0 ? void 0 : _editorData$sub_item_.map(function (e, i) {
|
|
|
return {
|
|
|
id: e.id,
|
|
|
question_title: e.name,
|
|
|
question_type: 1,
|
|
|
question_choices: e.choices.map(function (k) {
|
|
|
return k.choice_text;
|
|
|
}),
|
|
|
standard_answers: [e.choices.findIndex(function (k) {
|
|
|
return k.is_answer;
|
|
|
}) + 1],
|
|
|
analysis: e.analysis
|
|
|
};
|
|
|
});
|
|
|
delete body.analysis;
|
|
|
}
|
|
|
_context7.next = 13;
|
|
|
return (0,fetch/* default */.ZP)("/api/exercise_questions/".concat(param.id, ".json"), {
|
|
|
method: 'put',
|
|
|
body: body
|
|
|
});
|
|
|
case 13:
|
|
|
res = _context7.sent;
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
message/* default */.ZP.success('编辑成功');
|
|
|
handleSelectChange(selectValue + 1);
|
|
|
}
|
|
|
setEditId(null);
|
|
|
case 16:
|
|
|
case "end":
|
|
|
return _context7.stop();
|
|
|
}
|
|
|
}, _callee7);
|
|
|
}));
|
|
|
return function handleEditSave(_x2, _x3, _x4) {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var updatePaper = /*#__PURE__*/function () {
|
|
|
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee8() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee8$(_context8) {
|
|
|
while (1) switch (_context8.prev = _context8.next) {
|
|
|
case 0:
|
|
|
(0,_umi_production_exports.getDvaApp)()._store.dispatch({
|
|
|
type: "globalSetting/setGlobalLoading",
|
|
|
payload: {
|
|
|
show: true,
|
|
|
text: '正在更新试卷,请稍后...'
|
|
|
}
|
|
|
});
|
|
|
_context8.next = 3;
|
|
|
return (0,fetch/* default */.ZP)("/api/exercises/".concat(params.categoryId, "/sync_random_question.json"), {
|
|
|
method: 'post'
|
|
|
});
|
|
|
case 3:
|
|
|
res = _context8.sent;
|
|
|
if (!(res.status === 0)) {
|
|
|
_context8.next = 8;
|
|
|
break;
|
|
|
}
|
|
|
_context8.next = 7;
|
|
|
return onSkipExamination(selectValue);
|
|
|
case 7:
|
|
|
message/* default */.ZP.success('更新成功');
|
|
|
case 8:
|
|
|
(0,_umi_production_exports.getDvaApp)()._store.dispatch({
|
|
|
type: "globalSetting/setGlobalLoading",
|
|
|
payload: {
|
|
|
show: false
|
|
|
}
|
|
|
});
|
|
|
case 9:
|
|
|
case "end":
|
|
|
return _context8.stop();
|
|
|
}
|
|
|
}, _callee8);
|
|
|
}));
|
|
|
return function updatePaper() {
|
|
|
return _ref5.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var score_total = data === null || data === void 0 || (_data$questionList2 = data.questionList) === null || _data$questionList2 === void 0 ? void 0 : _data$questionList2.reduce(function (a, b) {
|
|
|
return a + Number(b.questions_score);
|
|
|
}, 0);
|
|
|
var disabled = editPreview && (data === null || data === void 0 || (_data$exam = data.exam) === null || _data$exam === void 0 ? void 0 : _data$exam.exercise_status) !== 1;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: StepPreviewmodules.wrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
id: "id_left_preview",
|
|
|
className: StepPreviewmodules.left,
|
|
|
onMouseEnter: function onMouseEnter(e) {
|
|
|
var dom = document.getElementById('id_left_preview');
|
|
|
dom.style.overflowY = 'auto';
|
|
|
},
|
|
|
onMouseLeave: function onMouseLeave(e) {
|
|
|
var dom = document.getElementById('id_left_preview');
|
|
|
dom.style.overflowY = 'hidden';
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: StepPreviewmodules.title,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "body-overflow-initial",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("b", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u7B54\u9898\u5361"
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.total,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: xixi
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u9898\u6570(\u9053)"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
|
children: data === null || data === void 0 ? void 0 : data.all_questions_count
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "mr30 ml30",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: bi
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u603B\u5206(\u5206)"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
|
children: score_total && score_total.toFixed(1)
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: zhong
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u65F6\u957F(\u5206)"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
|
children: (data === null || data === void 0 || (_data$exam2 = data.exam) === null || _data$exam2 === void 0 ? void 0 : _data$exam2.time) === -1 || (data === null || data === void 0 || (_data$exam3 = data.exam) === null || _data$exam3 === void 0 ? void 0 : _data$exam3.time) === null ? '不限' : data === null || data === void 0 || (_data$exam4 = data.exam) === null || _data$exam4 === void 0 ? void 0 : _data$exam4.time
|
|
|
})]
|
|
|
})]
|
|
|
}), data === null || data === void 0 || (_data$questionList3 = data.questionList) === null || _data$questionList3 === void 0 ? void 0 : _data$questionList3.map(function (e, index) {
|
|
|
var _e$questions;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.list,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.name,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("b", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: e.name
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u5171", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: StepPreviewmodules.b,
|
|
|
children: e.questions_count
|
|
|
}), "\u9898 ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: StepPreviewmodules.l,
|
|
|
children: "|"
|
|
|
}), "\u5171", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: StepPreviewmodules.r,
|
|
|
children: e.questions_score
|
|
|
}), "\u5206"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: StepPreviewmodules.answerSheet,
|
|
|
children: e === null || e === void 0 || (_e$questions = e.questions) === null || _e$questions === void 0 ? void 0 : _e$questions.map(function (k, i) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
onClick: function onClick() {
|
|
|
var anchorName = "Anchor_".concat(k.id);
|
|
|
var anchorElement = document.getElementById(anchorName);
|
|
|
if (anchorElement) {
|
|
|
setTimeout(function () {
|
|
|
return anchorElement.scrollIntoView({
|
|
|
block: "center",
|
|
|
behavior: "smooth"
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
className: StepPreviewmodules.tag,
|
|
|
children: i + 1
|
|
|
}, k.id);
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
}, index);
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.right,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.examName,
|
|
|
id: "examName",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: StepPreviewmodules.name,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: data === null || data === void 0 || (_data$exam5 = data.exam) === null || _data$exam5 === void 0 ? void 0 : _data$exam5.name,
|
|
|
getPopupContainer: function getPopupContainer(trigger) {
|
|
|
return trigger.parentNode;
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: StepPreviewmodules.t,
|
|
|
children: data === null || data === void 0 || (_data$exam6 = data.exam) === null || _data$exam6 === void 0 ? void 0 : _data$exam6.name
|
|
|
})
|
|
|
})
|
|
|
}), editPreview && (data === null || data === void 0 || (_data$exam7 = data.exam) === null || _data$exam7 === void 0 ? void 0 : _data$exam7.exercise_status) === 1 && /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomButton */.op, {
|
|
|
openLoading: true,
|
|
|
shape: "default",
|
|
|
onClick: updatePaper,
|
|
|
type: "primary",
|
|
|
children: "\u66F4\u65B0\u8BD5\u5377"
|
|
|
}), !editPreview && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
onClick: handleAllType,
|
|
|
type: "primary",
|
|
|
children: "\u968F\u673A\u66F4\u6362"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: StepPreviewmodules.topWarp,
|
|
|
children: data === null || data === void 0 || (_data$questionList4 = data.questionList) === null || _data$questionList4 === void 0 ? void 0 : _data$questionList4.map(function (e, index) {
|
|
|
var _e$questions2, _e$questions3;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.head,
|
|
|
style: index === 0 ? {
|
|
|
border: 0,
|
|
|
marginTop: -16
|
|
|
} : {},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.name,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("b", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: e.name
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.so,
|
|
|
children: ["\u5171", /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: StepPreviewmodules.b,
|
|
|
children: [e.questions_count, " "]
|
|
|
}), "\u9898 ", e.type === 'COMBINATION' && "\uFF08\u5305\u542B".concat(e === null || e === void 0 || (_e$questions2 = e.questions) === null || _e$questions2 === void 0 ? void 0 : _e$questions2.map(function (item) {
|
|
|
var _item$sub_item_banks;
|
|
|
return item === null || item === void 0 || (_item$sub_item_banks = item.sub_item_banks) === null || _item$sub_item_banks === void 0 ? void 0 : _item$sub_item_banks.length;
|
|
|
}).reduce(function (x, y) {
|
|
|
return x + y;
|
|
|
}), "\u5C0F\u9898\uFF09"), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: StepPreviewmodules.l,
|
|
|
children: "|"
|
|
|
}), "\u5171", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: StepPreviewmodules.r,
|
|
|
children: e.questions_score
|
|
|
}), "\u5206"]
|
|
|
}), !editPreview && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.btn,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
onClick: function onClick() {
|
|
|
handleSetScore(e);
|
|
|
},
|
|
|
type: "primary",
|
|
|
ghost: true,
|
|
|
className: "mr20",
|
|
|
children: "\u8BBE\u7F6E\u5F97\u5206"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
onClick: function onClick() {
|
|
|
return handleOnlyType(e);
|
|
|
},
|
|
|
type: "primary",
|
|
|
ghost: true,
|
|
|
children: "\u968F\u673A\u66F4\u6362"
|
|
|
})]
|
|
|
})]
|
|
|
}), e === null || e === void 0 || (_e$questions3 = e.questions) === null || _e$questions3 === void 0 ? void 0 : _e$questions3.map(function (k, i) {
|
|
|
var _k$program_attr, _k$program_attr4;
|
|
|
if (editId === k.id) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
id: "Anchor_".concat(k.id),
|
|
|
className: StepPreviewmodules.content,
|
|
|
style: {
|
|
|
padding: 0,
|
|
|
marginTop: 10
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
"float": 'right',
|
|
|
marginTop: -6
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
onClick: function onClick() {
|
|
|
return setEditId(null);
|
|
|
},
|
|
|
className: "mr20",
|
|
|
type: "primary",
|
|
|
ghost: true,
|
|
|
children: "\u53D6\u6D88"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
onClick: function onClick() {
|
|
|
if ((k === null || k === void 0 ? void 0 : k.is_my) === 1) {
|
|
|
es_modal/* default */.Z.confirm({
|
|
|
title: '提示',
|
|
|
content: '此题目已存在于试题库,是否将修改后的题目覆盖试题库的原题?',
|
|
|
okText: '覆盖原题',
|
|
|
cancelText: '不覆盖',
|
|
|
keyboard: false,
|
|
|
onOk: function () {
|
|
|
var _onOk6 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee9() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee9$(_context9) {
|
|
|
while (1) switch (_context9.prev = _context9.next) {
|
|
|
case 0:
|
|
|
if (e.type === 'BPROGRAM') {
|
|
|
setcover(true);
|
|
|
form.submit();
|
|
|
} else {
|
|
|
handleEditSave(e === null || e === void 0 ? void 0 : e.type, k, true);
|
|
|
}
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context9.stop();
|
|
|
}
|
|
|
}, _callee9);
|
|
|
}));
|
|
|
function onOk() {
|
|
|
return _onOk6.apply(this, arguments);
|
|
|
}
|
|
|
return onOk;
|
|
|
}(),
|
|
|
onCancel: function () {
|
|
|
var _onCancel = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee10() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee10$(_context10) {
|
|
|
while (1) switch (_context10.prev = _context10.next) {
|
|
|
case 0:
|
|
|
if (e.type === 'BPROGRAM') {
|
|
|
setcover(false);
|
|
|
form.submit();
|
|
|
} else {
|
|
|
handleEditSave(e === null || e === void 0 ? void 0 : e.type, k, false);
|
|
|
}
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context10.stop();
|
|
|
}
|
|
|
}, _callee10);
|
|
|
}));
|
|
|
function onCancel() {
|
|
|
return _onCancel.apply(this, arguments);
|
|
|
}
|
|
|
return onCancel;
|
|
|
}()
|
|
|
});
|
|
|
} else {
|
|
|
if (e.type === 'BPROGRAM') {
|
|
|
setcover(false);
|
|
|
form.submit();
|
|
|
} else {
|
|
|
handleEditSave(e === null || e === void 0 ? void 0 : e.type, k, false);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
type: "primary",
|
|
|
children: "\u4FDD\u5B58"
|
|
|
})]
|
|
|
}), renderSubject(k, e.type)]
|
|
|
}, k.id);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
id: "Anchor_".concat(k.id),
|
|
|
className: StepPreviewmodules.content,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: StepPreviewmodules.titleWrap,
|
|
|
children: [(k === null || k === void 0 ? void 0 : k.item_type) === 'bprogram' ? /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
style: {
|
|
|
paddingRight: 10
|
|
|
},
|
|
|
value: i + 1 + '、' + ((_k$program_attr = k.program_attr) === null || _k$program_attr === void 0 ? void 0 : _k$program_attr.description)
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
style: {
|
|
|
paddingRight: 10
|
|
|
},
|
|
|
className: StepPreviewmodules.titleHtml,
|
|
|
value: i + 1 + '、' + "".concat((k === null || k === void 0 ? void 0 : k.item_type) === "combination" ? '(题干)' : '') + k.name
|
|
|
}), editPreview && e.type !== "PRACTICAL" && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
disabled: disabled,
|
|
|
onClick: function onClick() {
|
|
|
var _k$program_attr2, _k$hack_sets;
|
|
|
if (editId) {
|
|
|
message/* default */.ZP.warning('先保存或取消当前正在编辑的试题');
|
|
|
return;
|
|
|
}
|
|
|
form.setFieldsValue({
|
|
|
standard_answers: k.standard_answer,
|
|
|
hack: objectSpread2_default()(objectSpread2_default()({}, k), k.program_attr),
|
|
|
hack_codes: objectSpread2_default()(objectSpread2_default()({}, k.program_attr), {}, {
|
|
|
code: base64.Base64.decode(((_k$program_attr2 = k.program_attr) === null || _k$program_attr2 === void 0 ? void 0 : _k$program_attr2.code) || '')
|
|
|
}),
|
|
|
hack_sets: objectSpread2_default()({}, k === null || k === void 0 || (_k$hack_sets = k.hack_sets) === null || _k$hack_sets === void 0 ? void 0 : _k$hack_sets[0])
|
|
|
});
|
|
|
if (k.item_type == 'program') {
|
|
|
var _k$program_attr3;
|
|
|
_umi_production_exports.history.push("/problems/newedit/".concat(k === null || k === void 0 || (_k$program_attr3 = k.program_attr) === null || _k$program_attr3 === void 0 ? void 0 : _k$program_attr3.identifier, "?type=exercises&express_id=").concat(params.categoryId, "&question_id=").concat(k === null || k === void 0 ? void 0 : k.id, "&score=").concat(k === null || k === void 0 ? void 0 : k.score, "&exercise=true&callback_url=/classrooms/").concat(params.coursesId, "/exercise/").concat(params.categoryId, "/detail?random=true"));
|
|
|
} else {
|
|
|
setEditId(k.id);
|
|
|
}
|
|
|
},
|
|
|
type: "primary",
|
|
|
className: "mr20",
|
|
|
style: {
|
|
|
marginLeft: 'auto'
|
|
|
},
|
|
|
ghost: true,
|
|
|
children: "\u7F16\u8F91"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
disabled: disabled,
|
|
|
onClick: function onClick() {
|
|
|
return handleOnlyOne(k.id, e.type, i, e);
|
|
|
},
|
|
|
type: "primary",
|
|
|
ghost: true,
|
|
|
children: "\u6362\u4E00\u9898"
|
|
|
})]
|
|
|
}), (k === null || k === void 0 ? void 0 : k.item_type) === 'bprogram' && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
style: {
|
|
|
paddingRight: 10,
|
|
|
paddingLeft: 25
|
|
|
},
|
|
|
showProgramFill: true,
|
|
|
disabledFill: true,
|
|
|
className: StepPreviewmodules.titleHtml,
|
|
|
value: base64.Base64.decode(((_k$program_attr4 = k.program_attr) === null || _k$program_attr4 === void 0 ? void 0 : _k$program_attr4.code) || '')
|
|
|
}), (e.type === 'SINGLE' || e.type === "JUDGMENT" || e.type === "MULTIPLE") && renderQs(k), e.type === "COMPLETION" && renderCompletion(k), e.type === "SUBJECTIVE" && renderSubjective(k), e.type === "PROGRAM" && renderProgram(k), e.type === "BPROGRAM" && renderBProgram(k), e.type === "COMBINATION" && renderCombination(k, i), e.type === "PRACTICAL" && renderPractical(k), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {})]
|
|
|
}, k.id);
|
|
|
})]
|
|
|
}, index);
|
|
|
})
|
|
|
})]
|
|
|
}), editPreview ? /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* FixedBottom */.vr, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(pagination/* default */.Z, {
|
|
|
showTotal: util/* showTotal */.rU,
|
|
|
total: data === null || data === void 0 || (_data$exam8 = data.exam) === null || _data$exam8 === void 0 ? void 0 : _data$exam8.total_num,
|
|
|
pageSize: 1,
|
|
|
current: selectValue + 1,
|
|
|
showSizeChanger: false,
|
|
|
onChange: handleSelectChange,
|
|
|
showQuickJumper: false,
|
|
|
hideOnSinglePage: false
|
|
|
})
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* FixedBottom */.vr, {
|
|
|
LeftContent: /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomButton */.op, {
|
|
|
onClick: goBack,
|
|
|
shape: "default",
|
|
|
style: {
|
|
|
height: 38,
|
|
|
background: '#fff',
|
|
|
boxShadow: 'none'
|
|
|
},
|
|
|
children: "\u8FD4\u56DE"
|
|
|
}),
|
|
|
RightContent: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(popover/* default */.Z, {
|
|
|
color: "#55575D",
|
|
|
overlayClassName: StepPreviewmodules.popover,
|
|
|
open: tooltipVisible,
|
|
|
getPopupContainer: function getPopupContainer(trigger) {
|
|
|
return trigger === null || trigger === void 0 ? void 0 : trigger.parentNode;
|
|
|
},
|
|
|
content: "\u5982\u60A8\u5BF9\u6B64\u4EFD\u8BD5\u9898\u6EE1\u610F\uFF0C\u53EF\u5C06\u6B64\u4EFD\u8BD5\u9898\u4FDD\u5B58\u4E3A\u56FA\u5B9A\u8BD5\u5377",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomButton */.op, {
|
|
|
onMouseEnter: function onMouseEnter() {
|
|
|
return setTooltipVisible(true);
|
|
|
},
|
|
|
onMouseLeave: function onMouseLeave() {
|
|
|
return setTooltipVisible(false);
|
|
|
},
|
|
|
onClick: function onClick() {
|
|
|
return handleSave();
|
|
|
},
|
|
|
shape: "default",
|
|
|
style: {
|
|
|
height: 38,
|
|
|
background: '#fff',
|
|
|
boxShadow: 'none'
|
|
|
},
|
|
|
children: "\u4FDD\u5B58"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomButton */.op, {
|
|
|
shape: "default",
|
|
|
type: "primary",
|
|
|
onClick: function onClick() {
|
|
|
return submit();
|
|
|
},
|
|
|
style: {
|
|
|
height: 38,
|
|
|
marginLeft: 20
|
|
|
},
|
|
|
children: "\u63D0\u4EA4"
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(components_ExchangeModal, {
|
|
|
visible: exchangeModalVisible,
|
|
|
questionParams: exchangeQuestionParams.current,
|
|
|
onRandomExchange: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee11() {
|
|
|
var changeParams;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee11$(_context11) {
|
|
|
while (1) switch (_context11.prev = _context11.next) {
|
|
|
case 0:
|
|
|
changeParams = exchangeQuestionParams.current;
|
|
|
_context11.next = 3;
|
|
|
return onExchange({
|
|
|
single_question_id: changeParams.id,
|
|
|
seleted_item_bank_ids: changeParams.ids
|
|
|
}, {
|
|
|
type: changeParams.type,
|
|
|
index: changeParams.index
|
|
|
});
|
|
|
case 3:
|
|
|
setExchangeModalVisible(false);
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context11.stop();
|
|
|
}
|
|
|
}, _callee11);
|
|
|
})),
|
|
|
selectFromProblemSet: function selectFromProblemSet() {
|
|
|
var changeParams = exchangeQuestionParams.current;
|
|
|
var currentUrl = "".concat(location.pathname).concat(location.search);
|
|
|
if (currentUrl.includes('exercise')) {
|
|
|
//只支持教学课堂换一题
|
|
|
_umi_production_exports.history.push("/paperlibrary/exchangequestion?type=exercise&qid=".concat(changeParams.id, "&qtype=").concat(changeParams.type, "&exerciseid=").concat(params.categoryId, "&from=").concat(currentUrl));
|
|
|
}
|
|
|
},
|
|
|
onCancel: function onCancel() {
|
|
|
setExchangeModalVisible(false);
|
|
|
}
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var StepPreview = (Page);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 36970:
|
|
|
/*!*************************************************************************!*\
|
|
|
!*** ./src/pages/Paperlibrary/Random/PreviewEdit/index.tsx + 1 modules ***!
|
|
|
\*************************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// ESM COMPAT FLAG
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"default": function() { return /* binding */ PreviewEdit; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js
|
|
|
var regeneratorRuntime = __webpack_require__(10574);
|
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js
|
|
|
var asyncToGenerator = __webpack_require__(39343);
|
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(26801);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(11006);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
|
|
|
var _umi_production_exports = __webpack_require__(45295);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/PreviewEdit/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var PreviewEditmodules = ({"flex_box_center":"flex_box_center___kQBcj","flex_space_between":"flex_space_between___Znlbo","flex_box_vertical_center":"flex_box_vertical_center___CPD50","flex_box_center_end":"flex_box_center_end___jzPvK","flex_box_column":"flex_box_column___cvIBS","wrap":"wrap___lab8O","crumbs":"crumbs___qvTza"});
|
|
|
// EXTERNAL MODULE: ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepPreview/index.tsx + 12 modules
|
|
|
var StepPreview = __webpack_require__(70015);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/skeleton/index.js + 12 modules
|
|
|
var skeleton = __webpack_require__(59981);
|
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
|
var fetch = __webpack_require__(91506);
|
|
|
// EXTERNAL MODULE: ./node_modules/_lodash@4.17.21@lodash/lodash.js
|
|
|
var lodash = __webpack_require__(89392);
|
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
|
var util = __webpack_require__(22739);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/PreviewEdit/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var PaperlibraryPage = function PaperlibraryPage(_ref) {
|
|
|
var _useLocation, _userInfo$course;
|
|
|
var paperlibrary = _ref.paperlibrary,
|
|
|
user = _ref.user,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
dispatch = _ref.dispatch,
|
|
|
location = _ref.location;
|
|
|
var _useSearchParams = (0,_umi_production_exports.useSearchParams)(),
|
|
|
_useSearchParams2 = slicedToArray_default()(_useSearchParams, 1),
|
|
|
searchParams = _useSearchParams2[0];
|
|
|
var defaultSelectValue = searchParams.get("select") || 0;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
Sloading = _useState2[0],
|
|
|
setSloading = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(true),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
loading = _useState4[0],
|
|
|
setLoading = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(Number(defaultSelectValue)),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
selectValue = _useState6[0],
|
|
|
setSelectValue = _useState6[1];
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)({}),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
editData = _useState8[0],
|
|
|
setEditData = _useState8[1];
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var userInfo = user.userInfo;
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
dispatch({
|
|
|
type: 'globalSetting/footerToggle',
|
|
|
payload: false
|
|
|
});
|
|
|
return function () {
|
|
|
dispatch({
|
|
|
type: 'globalSetting/footerToggle',
|
|
|
payload: true
|
|
|
});
|
|
|
};
|
|
|
}, []);
|
|
|
|
|
|
//出现页面右侧悬浮按钮
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
dispatch({
|
|
|
type: 'globalSetting/onlyShowBackTopToggle',
|
|
|
payload: false
|
|
|
});
|
|
|
dispatch({
|
|
|
type: 'globalSetting/onlyShowBackTopIconToggle',
|
|
|
payload: false
|
|
|
});
|
|
|
dispatch({
|
|
|
type: 'exercise/getWorkSetting',
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
return function () {
|
|
|
dispatch({
|
|
|
type: 'globalSetting/onlyShowBackTopToggle',
|
|
|
payload: true
|
|
|
});
|
|
|
dispatch({
|
|
|
type: 'globalSetting/onlyShowBackTopIconToggle',
|
|
|
payload: true
|
|
|
});
|
|
|
};
|
|
|
}, []);
|
|
|
|
|
|
// useEffect(() => {
|
|
|
// document.body.setAttribute('data-custom', 'initial');
|
|
|
// return () => { document.body.removeAttribute('data-custom'); }
|
|
|
// }, []);
|
|
|
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
getEditData(selectValue);
|
|
|
}, []);
|
|
|
var getEditData = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var num,
|
|
|
res,
|
|
|
_args = arguments;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
num = _args.length > 0 && _args[0] !== undefined ? _args[0] : 0;
|
|
|
console.log(params);
|
|
|
// setLoading(true)
|
|
|
_context.next = 4;
|
|
|
return (0,fetch/* default */.ZP)("/api/exercises/".concat(params.categoryId, "/preview_random_exercise.json"), {
|
|
|
method: 'get',
|
|
|
params: {
|
|
|
num: num
|
|
|
}
|
|
|
});
|
|
|
case 4:
|
|
|
res = _context.sent;
|
|
|
setLoading(false);
|
|
|
setEditData((0,util/* formatRandomPaperData */.ad)(res));
|
|
|
case 7:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function getEditData() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleBack = function handleBack() {
|
|
|
_umi_production_exports.history.push("/classrooms/".concat(params.coursesId, "/exercise"));
|
|
|
};
|
|
|
|
|
|
//保存
|
|
|
var handleSubmit = function handleSubmit() {
|
|
|
alert('保存');
|
|
|
};
|
|
|
|
|
|
//换一题
|
|
|
var handleExchange = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(record, other) {
|
|
|
var res, _clonePreviewData$que, clonePreviewData;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.next = 2;
|
|
|
return (0,fetch/* default */.ZP)("/api/exercises/".concat(params.categoryId, "/toggle_random_question.json"), {
|
|
|
method: 'post',
|
|
|
body: {
|
|
|
question_id: record === null || record === void 0 ? void 0 : record.single_question_id
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context2.sent;
|
|
|
if (res !== null && res !== void 0 && res.question) {
|
|
|
clonePreviewData = (0,lodash.cloneDeep)(editData);
|
|
|
clonePreviewData.questionList = clonePreviewData === null || clonePreviewData === void 0 || (_clonePreviewData$que = clonePreviewData.questionList) === null || _clonePreviewData$que === void 0 ? void 0 : _clonePreviewData$que.map(function (e) {
|
|
|
if (e.type === other.type) {
|
|
|
var new_questions = (0,lodash.cloneDeep)(e === null || e === void 0 ? void 0 : e.questions);
|
|
|
new_questions.splice(other.index, 1, res === null || res === void 0 ? void 0 : res.question);
|
|
|
// console.log(e?.questions, new_questions, other.index, 'new_questions')
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, e), {}, {
|
|
|
questions: new_questions
|
|
|
});
|
|
|
}
|
|
|
return e;
|
|
|
});
|
|
|
setEditData(clonePreviewData);
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function handleExchange(_x, _x2) {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
|
|
|
//下上
|
|
|
var handleSkipExamination = /*#__PURE__*/function () {
|
|
|
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(num) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
document.body.scrollIntoView();
|
|
|
setSelectValue(num);
|
|
|
_context3.next = 4;
|
|
|
return getEditData(num);
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return function handleSkipExamination(_x3) {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
console.log((0,_umi_production_exports.useLocation)(), 'location333');
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
|
className: PreviewEditmodules.wrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(skeleton/* default */.Z, {
|
|
|
loading: loading,
|
|
|
active: true,
|
|
|
paragraph: {
|
|
|
rows: 5
|
|
|
},
|
|
|
children: [((_useLocation = (0,_umi_production_exports.useLocation)()) === null || _useLocation === void 0 || (_useLocation = _useLocation.pathname) === null || _useLocation === void 0 ? void 0 : _useLocation.includes('preview')) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: PreviewEditmodules.crumbs,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("b", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "current",
|
|
|
onClick: function onClick() {
|
|
|
return _umi_production_exports.history.push("/classrooms/".concat(params.coursesId, "/exercise"));
|
|
|
},
|
|
|
children: "".concat(userInfo === null || userInfo === void 0 || (_userInfo$course = userInfo.course) === null || _userInfo$course === void 0 ? void 0 : _userInfo$course.course_name, ">")
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "current",
|
|
|
onClick: function onClick() {
|
|
|
return _umi_production_exports.history.push("/classrooms/".concat(params.coursesId, "/exercise"));
|
|
|
},
|
|
|
children: '试卷列表>'
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: "#bebebe"
|
|
|
},
|
|
|
children: '预览'
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(StepPreview/* default */.Z, {
|
|
|
loading: Sloading,
|
|
|
submit: handleSubmit,
|
|
|
goBack: handleBack,
|
|
|
data: editData,
|
|
|
selectValue: selectValue,
|
|
|
editPreview: true,
|
|
|
onExchange: handleExchange,
|
|
|
onSkipExamination: handleSkipExamination
|
|
|
})]
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var PreviewEdit = ((0,_umi_production_exports.connect)(function (_ref5) {
|
|
|
var paperlibrary = _ref5.paperlibrary,
|
|
|
user = _ref5.user,
|
|
|
globalSetting = _ref5.globalSetting;
|
|
|
return {
|
|
|
paperlibrary: paperlibrary,
|
|
|
user: user,
|
|
|
globalSetting: globalSetting
|
|
|
};
|
|
|
})(PaperlibraryPage));
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 235:
|
|
|
/*!********************************************!*\
|
|
|
!*** ./src/assets/images/paper/jinshi.svg ***!
|
|
|
\********************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* unused harmony export ReactComponent */
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
|
|
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
|
var __defProp = Object.defineProperty;
|
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
var __defNormalProp = function __defNormalProp(obj, key, value) {
|
|
|
return key in obj ? __defProp(obj, key, {
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true,
|
|
|
value: value
|
|
|
}) : obj[key] = value;
|
|
|
};
|
|
|
var __spreadValues = function __spreadValues(a, b) {
|
|
|
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
|
if (__getOwnPropSymbols) {
|
|
|
var _iterator = _createForOfIteratorHelper(__getOwnPropSymbols(b)),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prop = _step.value;
|
|
|
if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
}
|
|
|
return a;
|
|
|
};
|
|
|
|
|
|
var SvgJinshi = function SvgJinshi(props) {
|
|
|
return /* @__PURE__ */React.createElement("svg", __spreadValues({
|
|
|
width: 14,
|
|
|
height: 14,
|
|
|
xmlns: "http://www.w3.org/2000/svg"
|
|
|
}, props), /* @__PURE__ */React.createElement("title", null, "\u7F16\u7EC4 18"), /* @__PURE__ */React.createElement("g", {
|
|
|
fill: "none",
|
|
|
fillRule: "evenodd"
|
|
|
}, /* @__PURE__ */React.createElement("circle", {
|
|
|
fill: "#FCB041",
|
|
|
cx: 7,
|
|
|
cy: 7,
|
|
|
r: 7
|
|
|
}), /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M7.531 9.638a.616.616 0 1 1-1.231 0v-.02a.616.616 0 1 1 1.231 0v.02Zm0-2.25a.616.616 0 1 1-1.231 0V4.117a.616.616 0 1 1 1.231 0v3.273Z",
|
|
|
fill: "#FFF",
|
|
|
fillRule: "nonzero"
|
|
|
})));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ __webpack_exports__.Z = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48Y2lyY2xlIGZpbGw9IiNGQ0IwNDEiIGN4PSI3IiBjeT0iNyIgcj0iNyIvPjxwYXRoIGQ9Ik03LjUzMSA5LjYzOGEuNjE2LjYxNiAwIDEgMS0xLjIzMSAwdi0uMDJhLjYxNi42MTYgMCAxIDEgMS4yMzEgMHYuMDJabTAtMi4yNWEuNjE2LjYxNiAwIDEgMS0xLjIzMSAwVjQuMTE3YS42MTYuNjE2IDAgMSAxIDEuMjMxIDB2My4yNzNaIiBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L2c+PC9zdmc+");
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 70992:
|
|
|
/*!**********************************************************!*\
|
|
|
!*** ./src/components/QuestionEditor/index.less?modules ***!
|
|
|
\**********************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__) {
|
|
|
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ __webpack_exports__.Z = ({"wrap":"wrap___ilWvf","deleteIcon":"deleteIcon___JBDG8","keywordTag":"keywordTag___iieCb","questionTitleEditorWrap":"questionTitleEditorWrap___MHB5s","choiceWrap":"choiceWrap___QFkTc","choiceIndex":"choiceIndex___Mr2YO","judgementIndex":"judgementIndex___fUVWK","setAnswerBtn":"setAnswerBtn___Whox5","activeAnswer":"activeAnswer___fGU6Y","activeJudgementAnswer":"activeJudgementAnswer___wJv8P","actionWrapper":"actionWrapper___ERQ7k","addIcon":"addIcon___L9TE0","inputBorder":"inputBorder___Q5tRE","placeholder":"placeholder___p9sFY","blankWrapper":"blankWrapper___nC45e","blankInput":"blankInput___pEHsx","blankInputNumberWrapper":"blankInputNumberWrapper___uEHb0","addBtn":"addBtn___WR5ZI","blankIndex":"blankIndex___x9Pny","baseInputWrapper":"baseInputWrapper___eVsG7","collapseWrapper":"collapseWrapper___ZTysU","panelHeader":"panelHeader___QSN9g","open":"open___B6FU9","close":"close___QX19r","hide":"hide___mn25n"});
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
}]); |