You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1601 lines
96 KiB
1601 lines
96 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[8687],{
|
|
|
|
/***/ 3921:
|
|
/*!**********************************************************!*\
|
|
!*** ./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"});
|
|
|
|
/***/ }),
|
|
|
|
/***/ 18476:
|
|
/*!*****************************************************!*\
|
|
!*** ./src/components/MathsLatexKeybords/index.tsx ***!
|
|
\*****************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.less?modules */ 67373);
|
|
/* harmony import */ var mathlatex__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! mathlatex */ 48136);
|
|
/* harmony import */ var _keybords__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./keybords */ 23010);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd */ 43418);
|
|
/* provided dependency */ var React = __webpack_require__(/*! react */ 59301);
|
|
|
|
|
|
|
|
|
|
|
|
const MathsLatex = (0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(({ callback, width, onChange, disabled, readOnly, type = "", value = "" }, ref) => {
|
|
const GraphicsRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
const KeybordsRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
const getData = () => {
|
|
var dom = document.createElement("div");
|
|
dom.innerHTML = GraphicsRef.current.getValue();
|
|
var str = dom.innerText;
|
|
callback && callback(str);
|
|
return str;
|
|
};
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle)(ref, () => ({
|
|
getData
|
|
}));
|
|
const showInput = () => {
|
|
if (disabled || readOnly)
|
|
return;
|
|
antd__WEBPACK_IMPORTED_MODULE_4__["default"].confirm({
|
|
content: /* @__PURE__ */ React.createElement(_keybords__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, { value, ref: KeybordsRef, onChange, showSaveButton: false }),
|
|
width: 860,
|
|
icon: null,
|
|
title: "\u8F93\u5165LATEX\u516C\u5F0F",
|
|
onOk: () => {
|
|
const val = KeybordsRef.current.getData();
|
|
GraphicsRef.current.setValue(val);
|
|
onChange(val);
|
|
}
|
|
});
|
|
};
|
|
return /* @__PURE__ */ React.createElement("div", { style: { width: width || "100%" }, className: `${_index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.mathFillWrap} ${disabled || readOnly ? "cursorDefault" : ""}`, onClick: () => showInput() }, /* @__PURE__ */ React.createElement("math-field", { disabled, locale: "zh_cn", class: `${_index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.mathField} ${type}`, readOnly, placeholder: "\u8BF7\u8F93\u5165latex\u516C\u5F0F", ref: GraphicsRef, style: { width: "100%", fontSize: value ? 18 : 14 }, value: value || "" }));
|
|
});
|
|
/* harmony default export */ __webpack_exports__.Z = (MathsLatex);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 46858:
|
|
/*!**********************************************************!*\
|
|
!*** ./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 react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! antd */ 20008);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! antd */ 78241);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd */ 43418);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! antd */ 95237);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! antd */ 43604);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! antd */ 96971);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! antd */ 57809);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! antd */ 5112);
|
|
/* harmony import */ var _MdEditorInForm__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./MdEditorInForm */ 98243);
|
|
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! umi */ 23852);
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./index.less?modules */ 3921);
|
|
/* harmony import */ var _Buttonloading__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Buttonloading */ 7337);
|
|
/* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ant-design/icons */ 6246);
|
|
var __defProp = Object.defineProperty;
|
|
var __defProps = Object.defineProperties;
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
var __objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && __getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { TextArea } = antd__WEBPACK_IMPORTED_MODULE_5__["default"];
|
|
const 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" }
|
|
];
|
|
const ReversedSwitch = ({ value, onChange }) => {
|
|
return /* @__PURE__ */ React.createElement(
|
|
Switch,
|
|
{
|
|
checked: value,
|
|
onChange: (checked) => {
|
|
onChange(checked);
|
|
}
|
|
}
|
|
);
|
|
};
|
|
const NULL_CH = "@\u2581@";
|
|
const NULL_CH1 = "@\u2581\u2581@";
|
|
const BProgramEditor = ({
|
|
questionTitlePlaceholder,
|
|
form,
|
|
scoreByBlank = false,
|
|
hackidentifier,
|
|
answerKey
|
|
}) => {
|
|
const [editAnalysis, setEditAnalysis] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
|
|
const [isloading, setloading] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
|
|
const param = (0,umi__WEBPACK_IMPORTED_MODULE_2__.useParams)();
|
|
const isEdit = param.type === "edit";
|
|
const getChCountBeforeCursor = (cm, cursor) => {
|
|
const currentLine = cursor.line;
|
|
let placeholderCountBefore = 0;
|
|
for (let _line = 0; _line < currentLine; _line++) {
|
|
placeholderCountBefore += cm.getLine(_line).split(NULL_CH).length - 1;
|
|
}
|
|
for (let _line = 0; _line < currentLine; _line++) {
|
|
placeholderCountBefore += cm.getLine(_line).split(NULL_CH1).length - 1;
|
|
}
|
|
const currentLineStringBeforeCursor = cm.getLine(currentLine).substring(0, cursor.ch);
|
|
placeholderCountBefore += currentLineStringBeforeCursor.split(NULL_CH).length - 1;
|
|
placeholderCountBefore += currentLineStringBeforeCursor.split(NULL_CH1).length - 1;
|
|
return placeholderCountBefore;
|
|
};
|
|
const onCMBeforeChange = (cm, change, addBlank2, removeBlank2) => {
|
|
const rangeText = cm.getRange(change.from, change.to);
|
|
let newBlankNum = 0;
|
|
change.text.forEach((item) => {
|
|
newBlankNum += item.split(NULL_CH).length - 1;
|
|
});
|
|
change.text.forEach((item) => {
|
|
newBlankNum += item.split(NULL_CH1).length - 1;
|
|
});
|
|
if (change.origin === "setValue") {
|
|
return;
|
|
}
|
|
if (rangeText && (rangeText.indexOf(NULL_CH) !== -1 || rangeText.indexOf(NULL_CH1) !== -1)) {
|
|
const placeholderCountInRange = rangeText.split(NULL_CH).length - 1 + rangeText.split(NULL_CH1).length - 1;
|
|
const placeholderCountBefore = getChCountBeforeCursor(
|
|
cm,
|
|
change.from
|
|
);
|
|
console.log(
|
|
`\u5220\u9664${placeholderCountInRange}\u4E2A\uFF0C \u524D\u9762\u6709${placeholderCountBefore}\u4E2A\uFF0C\u65B0\u589E${newBlankNum}\u4E2A`
|
|
);
|
|
if (placeholderCountInRange > 1) {
|
|
const indexArray = Array.from({ length: placeholderCountInRange }, (item, index) => placeholderCountBefore + index);
|
|
removeBlank2(indexArray);
|
|
} else {
|
|
removeBlank2(placeholderCountBefore);
|
|
}
|
|
} else if (newBlankNum > 0) {
|
|
const placeholderCountBefore = getChCountBeforeCursor(
|
|
cm,
|
|
change.from
|
|
);
|
|
console.log(
|
|
`\u65B0\u589E${newBlankNum}\u4E2A\uFF0C\u4E4B\u524D\u6709${placeholderCountBefore}\u4E2A`
|
|
);
|
|
addBlank2(newBlankNum, placeholderCountBefore);
|
|
}
|
|
};
|
|
const rewritePosition = () => {
|
|
const preAnswerData = form.getFieldValue(answerKey);
|
|
form.setFieldsValue({ [answerKey]: preAnswerData == null ? void 0 : preAnswerData.map((item, index) => __spreadProps(__spreadValues({}, item), { position: index + 1 })) });
|
|
};
|
|
const addFnRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
const addBlank = (addNum, insertIndex) => {
|
|
for (let i = 0; i < addNum; i++) {
|
|
addFnRef.current({ position: null, answer_text: "" }, insertIndex + i);
|
|
}
|
|
rewritePosition();
|
|
};
|
|
const removeFnRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
const removeBlank = (deleteIndex) => {
|
|
removeFnRef.current(deleteIndex);
|
|
rewritePosition();
|
|
};
|
|
const standardAnswersValue = antd__WEBPACK_IMPORTED_MODULE_6__["default"].useWatch(answerKey, form);
|
|
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { className: _index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.wrap }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item, { label: "\u8BD5\u9898\u63CF\u8FF0", name: ["hack", "description"], style: { display: "table" }, className: "w100", labelCol: { span: 24 }, rules: [{ required: true }] }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
_MdEditorInForm__WEBPACK_IMPORTED_MODULE_1__/* .MdEditorInForm */ .h,
|
|
{
|
|
scrollId: "name",
|
|
watch: true,
|
|
height: 140
|
|
}
|
|
)), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { className: _index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.questionTitleEditorWrap }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item, { label: "\u7A0B\u5E8F\u4EE3\u7801", name: ["hack_codes", "code"], labelCol: { span: 24 }, rules: [{ required: true }] }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
_MdEditorInForm__WEBPACK_IMPORTED_MODULE_1__/* .MdEditorInForm */ .h,
|
|
{
|
|
scrollId: "name",
|
|
watch: true,
|
|
height: 400,
|
|
showNullProgramButton: true,
|
|
onChange: (a, b) => {
|
|
const preAnswerData = form.getFieldValue(answerKey);
|
|
console.log("--preAnswerData", preAnswerData, b);
|
|
form.setFieldsValue({ [answerKey]: preAnswerData == null ? void 0 : preAnswerData.map((item, index) => {
|
|
var _a;
|
|
return __spreadProps(__spreadValues({}, item), { position: index + 1, multi_line: (_a = b == null ? void 0 : b[index]) == null ? void 0 : _a.multiLine });
|
|
}) });
|
|
},
|
|
placeholder: questionTitlePlaceholder,
|
|
onCMBeforeChange: (cm, change) => {
|
|
onCMBeforeChange(cm, change, addBlank, removeBlank);
|
|
}
|
|
}
|
|
))), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_6__["default"].List,
|
|
{
|
|
name: answerKey,
|
|
rules: [{
|
|
validator(rule, values) {
|
|
if ((values == null ? void 0 : values.length) === 0) {
|
|
return Promise.reject(new Error("\u7B54\u6848\u4E0D\u80FD\u4E3A\u7A7A"));
|
|
}
|
|
for (const item of values) {
|
|
const { answer_text } = item || {};
|
|
if ((answer_text == null ? void 0 : answer_text.length) === 0) {
|
|
return Promise.reject(new Error("\u586B\u7A7A\u9879\u7B54\u6848\u4E0D\u80FD\u4E3A\u7A7A"));
|
|
}
|
|
}
|
|
return Promise.resolve();
|
|
}
|
|
}]
|
|
},
|
|
(fields, { add, remove }, { errors }) => {
|
|
addFnRef.current = add;
|
|
removeFnRef.current = remove;
|
|
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" } }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item, { label: "\u586B\u7A7A\u9879\u7B54\u6848", required: true, labelCol: { span: 24 } }), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { onClick: () => {
|
|
antd__WEBPACK_IMPORTED_MODULE_7__["default"].warning({
|
|
title: "\u7ED9\u5206\u8BF4\u660E",
|
|
icon: null,
|
|
width: 700,
|
|
centered: true,
|
|
content: /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", null, "1.\u5B66\u751F\u586B\u5199\u7B54\u6848\u4E4B\u540E\uFF0C\u5FC5\u987B\u63D0\u4EA4\u4EE3\u7801\u8FDB\u884C\u8BC4\u6D4B\u624D\u80FD\u5F97\u5206\u3002"), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { style: { marginTop: 10 } }, "2.\u81EA\u52A8\u8BC4\u9605\u65F6\uFF0C\u7CFB\u7EDF\u5C06\u5224\u9898\u7A0B\u5E8F\u91CC\u7684\u6240\u6709\u7A7A\u66FF\u6362\u6210\u5B66\u751F\u63D0\u4EA4\u7684\u5185\u5BB9\uFF0C\u8FD0\u884C\u7A0B\u5E8F\u3002\u7A0B\u5E8F\u8BFB\u6D4B\u8BD5\u8F93\u5165\u6570\u636E\uFF0C\u4EA7\u751F\u8F93\u51FA\uFF0C\u4E0E\u6D4B\u8BD5\u8F93\u51FA\u6570\u636E\u6309\u9010\u4E2A\u6BD4\u5BF9\uFF0C\u5B8C\u5168\u6B63\u786E\u5219\u5F97\u6EE1\u5206\uFF1B\u82E5\u4E0D\u5B8C\u5168\u6B63\u786E\uFF0C\u5219\u4F9D\u6B21\u5C06\u6BCF\u4E2A\u7A7A\u6362\u6210\u5B66\u751F\u63D0\u4EA4\u7684\u5185\u5BB9\uFF0C\u540C\u65F6\u5C06\u5176\u4ED6\u7A7A\u66FF\u6362\u6210\u6807\u51C6\u7B54\u6848\uFF0C\u8FD0\u884C\u7A0B\u5E8F\u3002\u5982\u679C\u8FD9\u4E2A\u7A7A\u7684\u5B66\u751F\u63D0\u4EA4\u4E0E\u6807\u51C6\u7B54\u6848\u7ED3\u5408\u80FD\u5F97\u5230\u6B63\u786E\u8F93\u51FA\uFF0C\u5219\u8FD9\u4E2A\u7A7A\u5F97\u5230\u8BE5\u7A7A\u7684\u6EE1\u5206\u3002\u5426\u5219\u8BE5\u7A7A\u5F97 0 \u5206\u3002"))
|
|
});
|
|
}, style: { minHeight: 32, color: "#3061D0", cursor: "pointer" } }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ant_design_icons__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, { style: { marginRight: 3, color: "#3061D0" } }), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", null, " \u7ED9\u5206\u8BF4\u660E"))), fields.map((_a, index) => {
|
|
var _b = _a, { key, name } = _b, restField = __objRest(_b, ["key", "name"]);
|
|
var _a2, _b2;
|
|
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, { className: `mb20`, key, align: "middle", wrap: false }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z, { flex: "0 0 auto", className: `${_index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.blankIndex}` }, "\u586B\u7A7A\u9879", index + 1), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z, { flex: 1 }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, { align: "top", justify: "space-between", wrap: false }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item, __spreadProps(__spreadValues({}, restField), { name: [name, "answer_text"], noStyle: true }), ((_a2 = standardAnswersValue == null ? void 0 : standardAnswersValue[name]) == null ? void 0 : _a2.multi_line) || ((_b2 = standardAnswersValue == null ? void 0 : standardAnswersValue[name]) == null ? void 0 : _b2.multiLine) ? /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(TextArea, { spellCheck: false, style: { marginLeft: 10, width: 550 } }) : /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_5__["default"],
|
|
{
|
|
style: { marginLeft: 10, width: 550 },
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.blankInput,
|
|
size: "large",
|
|
maxLength: 1e3,
|
|
onBlur: (e) => {
|
|
}
|
|
}
|
|
))), scoreByBlank && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z, { flex: "224px" }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item, __spreadProps(__spreadValues({}, restField), { name: [name, "score"], label: "\u5206\u503C", rules: [{ required: true }] }), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z, { size: "large", className: _index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.blankInput, min: 0.1, max: 100, precision: 1, style: { width: "100%" }, placeholder: "\u8BF7\u8F93\u5165\u5206\u503C" }))))));
|
|
}));
|
|
}
|
|
), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { onClick: () => setEditAnalysis(true) }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item, { name: ["hack", "analysis"], label: "\u9898\u76EE\u89E3\u6790", labelCol: { span: 24 } }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_1__/* .RegularInput */ .x, { placeholder: "\u8BF7\u7F16\u8F91\u9898\u76EE\u89E3\u6790\uFF08\u975E\u5FC5\u586B\uFF09", isEdit: editAnalysis }))), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item,
|
|
{
|
|
label: "\u7F16\u7A0B\u8BED\u8A00",
|
|
style: { marginTop: 30 },
|
|
name: ["hack_codes", "language"],
|
|
labelCol: { span: 24 },
|
|
rules: [{ required: true, message: "\u8BF7\u9009\u62E9\u7F16\u7A0B\u8BED\u8A00" }]
|
|
},
|
|
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_12__["default"],
|
|
{
|
|
size: "large"
|
|
},
|
|
language.map((item) => /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_12__["default"].Option, { key: item.title, value: item.key }, " ", item.title))
|
|
)
|
|
), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item,
|
|
{
|
|
label: "\u6700\u5927\u8BC4\u6D4B\u65F6\u957F\uFF08\u79D2\uFF09",
|
|
style: { marginTop: 30 },
|
|
labelCol: { span: 24 },
|
|
required: true
|
|
},
|
|
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item,
|
|
{
|
|
name: ["hack", "time_limit"],
|
|
rules: [{ required: true, message: "\u8BF7\u8F93\u5165\u5355\u4E2A\u6D4B\u8BD5\u96C6\u8BC4\u6D4B\u65F6\u957F\u9650\u5236" }, {
|
|
type: "number",
|
|
min: 3,
|
|
message: "\u6700\u5C0F\u9650\u5236\u65F6\u95F4\u662F3\u79D2"
|
|
}],
|
|
noStyle: true
|
|
},
|
|
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z, { precision: 0, max: 10, min: 3, size: "large", style: { width: "97%" } })
|
|
),
|
|
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", { className: "ml10 font14" }, "\u79D2")
|
|
), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item,
|
|
{
|
|
label: "\u5B66\u751F\u7B54\u6848\u7684\u7A7A\u683C\u5904\u7406\u65B9\u5F0F",
|
|
style: { marginTop: 30 },
|
|
name: ["hack", "submit_rule"],
|
|
labelCol: { span: 24 },
|
|
rules: [{ required: true, message: "\u8BF7\u9009\u62E9\u5B66\u751F\u7B54\u6848\u7684\u7A7A\u683C\u5904\u7406\u65B9\u5F0F" }]
|
|
},
|
|
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"].Group */ .ZP.Group, { style: { marginTop: -10 } }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .ZP, { value: 0 }, "\u4E0D\u5FFD\u7565\u7A7A\u683C"), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .ZP, { value: 1 }, "\u5FFD\u7565\u9996\u5C3E\u7A7A\u683C"), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .ZP, { value: 2 }, "\u5FFD\u7565\u6240\u6709\u7A7A\u683C"))
|
|
), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item,
|
|
{
|
|
label: "\u6D4B\u8BD5\u7528\u4F8B",
|
|
required: true,
|
|
style: { marginTop: 30 }
|
|
}
|
|
), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { style: { background: "#F6F7F9", padding: 15 } }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item,
|
|
{
|
|
label: "\u8F93\u5165",
|
|
labelCol: { span: 24 },
|
|
name: ["hack_sets", "input"]
|
|
},
|
|
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
TextArea,
|
|
{
|
|
rows: 4
|
|
}
|
|
)
|
|
), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item,
|
|
{
|
|
label: "\u8F93\u51FA",
|
|
labelCol: { span: 24 },
|
|
name: ["hack_sets", "output"],
|
|
rules: [{ required: true, message: "\u8BF7\u8F93\u5165\u8F93\u51FA\u5185\u5BB9" }]
|
|
},
|
|
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
TextArea,
|
|
{
|
|
rows: 4
|
|
}
|
|
)
|
|
)), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(_Buttonloading__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, { answerKey, hackidentifier, ButtonText: "\u81EA\u6D4B\u8FD0\u884C", ButtonProps: {
|
|
ghost: true,
|
|
icon: /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("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 }));
|
|
};
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7337:
|
|
/*!*********************************************************!*\
|
|
!*** ./src/components/QuestionEditor/Buttonloading.tsx ***!
|
|
\*********************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! umi */ 23852);
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ 59301);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd */ 8591);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! antd */ 3113);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! antd */ 43418);
|
|
/* harmony import */ var js_base64__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! js-base64 */ 24334);
|
|
/* harmony import */ var js_base64__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(js_base64__WEBPACK_IMPORTED_MODULE_2__);
|
|
/* harmony import */ var _utils_fetch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/utils/fetch */ 64841);
|
|
/* harmony import */ var _pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/pages/MyProblem/service */ 29128);
|
|
/* harmony import */ var _pages_MyProblem_TestCasePanel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/pages/MyProblem/TestCasePanel */ 43459);
|
|
/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! moment */ 9498);
|
|
/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_6__);
|
|
/* provided dependency */ var React = __webpack_require__(/*! react */ 59301);
|
|
var __defProp = Object.defineProperty;
|
|
var __defProps = Object.defineProperties;
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
var __async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ButtonLoading = ({ ButtonProps, ButtonText, form, answerKey, hackidentifier = "", items = {}, setIsSubmitCode }) => {
|
|
const [isloading, setisloading] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false);
|
|
let [identifier, setidentifier] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)("");
|
|
const param = (0,umi__WEBPACK_IMPORTED_MODULE_0__.useParams)();
|
|
const [modalshow, setmodalshow] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)({});
|
|
const isEdit = param.type === "edit";
|
|
const type = window.location.href.includes("problemset") ? 1 : 2;
|
|
(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
|
|
if (isEdit || hackidentifier) {
|
|
setidentifier(hackidentifier || param.id);
|
|
}
|
|
}, [param]);
|
|
(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
|
|
return () => {
|
|
sessionStorage.removeItem("projectFill");
|
|
};
|
|
}, []);
|
|
function onUpdateCode(re, id) {
|
|
return __async(this, null, function* () {
|
|
var _a;
|
|
let code = form.getFieldValue("hack_codes");
|
|
let stats = form.getFieldValue(answerKey);
|
|
if (!code.code) {
|
|
antd__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP.info("\u7A0B\u5E8F\u4EE3\u7801\u4E0D\u80FD\u4E3A\u7A7A\uFF01");
|
|
return;
|
|
}
|
|
if (!code.language) {
|
|
antd__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP.info("\u7F16\u7A0B\u8BED\u8A00\u4E0D\u80FD\u4E3A\u7A7A\uFF01");
|
|
return;
|
|
}
|
|
if (stats.length > 0 && ((_a = stats.filter((item) => !item.answer_text)) == null ? void 0 : _a.length) > 0) {
|
|
antd__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP.info("\u586B\u7A7A\u9879\u4E0D\u80FD\u4E3A\u7A7A\uFF01");
|
|
return;
|
|
}
|
|
let codes = code.code;
|
|
if (stats.length > 0) {
|
|
stats == null ? void 0 : stats.map((item) => {
|
|
if (item.multi_line) {
|
|
codes = codes.substring(0, codes.indexOf("@\u2581\u2581@")) + item.answer_text + codes.substring(codes.indexOf("@\u2581\u2581@") + 4);
|
|
} else {
|
|
codes = codes.substring(0, codes.indexOf("@\u2581@")) + item.answer_text + codes.substring(codes.indexOf("@\u2581@") + 3);
|
|
}
|
|
});
|
|
}
|
|
const response = yield (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_4__/* .updateCode */ .n4)(id, re ? re : { code: js_base64__WEBPACK_IMPORTED_MODULE_2__.Base64.encode(codes), language: code.language, answers: stats == null ? void 0 : stats.map((item) => item.answer_text) });
|
|
return response;
|
|
});
|
|
}
|
|
function onUpdateCodes(re, id) {
|
|
return __async(this, null, function* () {
|
|
let stats = items.userAnswer;
|
|
let codes = js_base64__WEBPACK_IMPORTED_MODULE_2__.Base64.decode(items.code);
|
|
if (stats.length > 0) {
|
|
stats == null ? void 0 : stats.map((item) => {
|
|
if (item.multi_line) {
|
|
codes = codes.substring(0, codes.indexOf("@\u2581\u2581@")) + item.value + codes.substring(codes.indexOf("@\u2581\u2581@") + 4);
|
|
} else {
|
|
codes = codes.substring(0, codes.indexOf("@\u2581@")) + item.value + codes.substring(codes.indexOf("@\u2581@") + 3);
|
|
}
|
|
});
|
|
}
|
|
const response = yield (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_4__/* .updateCode */ .n4)(id, re ? re : { code: js_base64__WEBPACK_IMPORTED_MODULE_2__.Base64.encode(codes), language: items.language, answers: stats == null ? void 0 : stats.map((item) => item.value) });
|
|
return response;
|
|
});
|
|
}
|
|
function getTimeStamp() {
|
|
return (/* @__PURE__ */ new Date()).getTime();
|
|
}
|
|
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .ZP, __spreadProps(__spreadValues({ loading: isloading }, ButtonProps), { onClick: () => __async(void 0, null, function* () {
|
|
var _a, _b, _c, _d;
|
|
if (ButtonText === "\u63D0\u4EA4\u4EE3\u7801") {
|
|
setisloading(true);
|
|
if (isloading) {
|
|
return;
|
|
}
|
|
let res12 = yield (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)(`/api/problems/${identifier}/start.json`, {
|
|
method: "get"
|
|
});
|
|
const response2 = yield onUpdateCodes(null, res12 == null ? void 0 : res12.identifier);
|
|
if ((response2 == null ? void 0 : response2.status) === 0) {
|
|
const startTime = getTimeStamp();
|
|
yield (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_4__/* .sumbitCode */ .bM)(res12 == null ? void 0 : res12.identifier, {});
|
|
function executeCode() {
|
|
return __async(this, null, function* () {
|
|
var _a2;
|
|
const { status, message: message2, data } = yield (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_4__/* .getOperationResult */ .rX)(res12 == null ? void 0 : res12.identifier, "submit");
|
|
const executeTime = getTimeStamp();
|
|
const isTimeOut = executeTime - startTime > 10 * 1e3 * ((_a2 = items == null ? void 0 : items.userAnswer) == null ? void 0 : _a2.length);
|
|
if (status !== 0 && !isTimeOut) {
|
|
setTimeout(executeCode, 1e3);
|
|
}
|
|
if (isTimeOut) {
|
|
antd__WEBPACK_IMPORTED_MODULE_9__["default"].error({
|
|
centered: true,
|
|
okText: "\u77E5\u9053\u5566",
|
|
title: "\u8C03\u8BD5\u4EE3\u7801\u8D85\u65F6"
|
|
});
|
|
setisloading(false);
|
|
return;
|
|
}
|
|
if (status === 0) {
|
|
setisloading(false);
|
|
setmodalshow(data);
|
|
if (data.status === 2) {
|
|
setisloading(false);
|
|
antd__WEBPACK_IMPORTED_MODULE_9__["default"].error({
|
|
centered: true,
|
|
okText: "\u77E5\u9053\u5566",
|
|
title: "\u8C03\u8BD5\u4EE3\u7801\u8D85\u65F6"
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
executeCode();
|
|
} else {
|
|
setisloading(false);
|
|
}
|
|
!!setIsSubmitCode && setIsSubmitCode(true);
|
|
return;
|
|
}
|
|
let aa = true;
|
|
yield form.validateFields().then(() => {
|
|
aa = false;
|
|
}, (errInfo) => {
|
|
var _a2, _b2, _c2;
|
|
if (errInfo.errorFields[0].name.includes("standard_answers")) {
|
|
antd__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP.error("\u586B\u7A7A\u9879\u7B54\u6848\u4E0D\u80FD\u4E3A\u7A7A");
|
|
} else {
|
|
antd__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP.error(errInfo.errorFields[0].errors[0]);
|
|
}
|
|
if (((_a2 = errInfo.errorFields) == null ? void 0 : _a2.length) === 0) {
|
|
aa = false;
|
|
}
|
|
form.scrollToField((_c2 = (_b2 = errInfo == null ? void 0 : errInfo.errorFields) == null ? void 0 : _b2[0]) == null ? void 0 : _c2.name, { behavior: "smooth", block: "center" });
|
|
aa = true;
|
|
});
|
|
if (aa) {
|
|
return;
|
|
}
|
|
setisloading(true);
|
|
if (isloading) {
|
|
return;
|
|
}
|
|
let res = "";
|
|
let formValues = form.getFieldsValue();
|
|
if (!identifier) {
|
|
res = yield (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)(`/api/problems.json`, {
|
|
method: "post",
|
|
body: __spreadProps(__spreadValues({}, formValues), {
|
|
hack: __spreadProps(__spreadValues({}, formValues == null ? void 0 : formValues.hack), {
|
|
sub_discipline_id: (_b = (_a = formValues == null ? void 0 : formValues.hack) == null ? void 0 : _a.sub_discipline_id) == null ? void 0 : _b[1],
|
|
difficult: formValues.difficulty,
|
|
item_banks_group_id: formValues.item_banks_group_id
|
|
}),
|
|
hack_codes: __spreadProps(__spreadValues({}, formValues.hack_codes), {
|
|
code: js_base64__WEBPACK_IMPORTED_MODULE_2__.Base64.encode(formValues.hack_codes.code)
|
|
}),
|
|
hack_sets: [__spreadValues({}, formValues.hack_sets)],
|
|
is_blank: true
|
|
})
|
|
});
|
|
identifier = res == null ? void 0 : res.identifier;
|
|
sessionStorage.projectFill = identifier;
|
|
setidentifier(identifier);
|
|
} else {
|
|
res = yield (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)(`/api/problems/${identifier}.json`, {
|
|
method: "put",
|
|
body: __spreadProps(__spreadValues({}, formValues), {
|
|
hack: __spreadProps(__spreadValues({}, formValues == null ? void 0 : formValues.hack), {
|
|
sub_discipline_id: (_d = (_c = formValues == null ? void 0 : formValues.hack) == null ? void 0 : _c.sub_discipline_id) == null ? void 0 : _d[1],
|
|
difficult: formValues.difficulty,
|
|
item_banks_group_id: formValues.item_banks_group_id
|
|
}),
|
|
hack_codes: __spreadProps(__spreadValues({}, formValues.hack_codes), {
|
|
code: js_base64__WEBPACK_IMPORTED_MODULE_2__.Base64.encode(formValues.hack_codes.code)
|
|
}),
|
|
update_hack_sets: [__spreadValues({}, formValues.hack_sets)],
|
|
is_blank: true
|
|
})
|
|
});
|
|
}
|
|
let res1 = yield (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)(`/api/problems/${identifier}/start.json`, {
|
|
method: "get"
|
|
});
|
|
const response = yield onUpdateCode(null, res1 == null ? void 0 : res1.identifier);
|
|
if ((response == null ? void 0 : response.status) === 0) {
|
|
const startTime = getTimeStamp();
|
|
yield (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_4__/* .sumbitCode */ .bM)(res1 == null ? void 0 : res1.identifier, {});
|
|
function executeCode() {
|
|
return __async(this, null, function* () {
|
|
var _a2;
|
|
const { status, message: message2, data } = yield (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_4__/* .getOperationResult */ .rX)(res1 == null ? void 0 : res1.identifier, "submit");
|
|
const executeTime = getTimeStamp();
|
|
const isTimeOut = executeTime - startTime > (formValues.hack.time_limit + 3) * 1e3 * ((_a2 = formValues == null ? void 0 : formValues.standard_answers) == null ? void 0 : _a2.length);
|
|
if (status !== 0 && !isTimeOut) {
|
|
setTimeout(executeCode, 1e3);
|
|
}
|
|
if (isTimeOut) {
|
|
antd__WEBPACK_IMPORTED_MODULE_9__["default"].error({
|
|
centered: true,
|
|
okText: "\u77E5\u9053\u5566",
|
|
title: "\u8C03\u8BD5\u4EE3\u7801\u8D85\u65F6"
|
|
});
|
|
setisloading(false);
|
|
return;
|
|
}
|
|
if (status === 0) {
|
|
setisloading(false);
|
|
setmodalshow(data);
|
|
if (data.status === 2) {
|
|
setisloading(false);
|
|
antd__WEBPACK_IMPORTED_MODULE_9__["default"].error({
|
|
centered: true,
|
|
okText: "\u77E5\u9053\u5566",
|
|
title: "\u8C03\u8BD5\u4EE3\u7801\u8D85\u65F6"
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
executeCode();
|
|
} else {
|
|
setisloading(false);
|
|
}
|
|
}) }), ButtonText), (modalshow == null ? void 0 : modalshow.id) && modalshow.status !== 2 && /* @__PURE__ */ React.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_9__["default"],
|
|
{
|
|
open: (modalshow == null ? void 0 : modalshow.id) && modalshow.status !== 2,
|
|
title: "\u8FD0\u884C\u7ED3\u679C",
|
|
width: 1100,
|
|
footer: false,
|
|
onOk: () => {
|
|
setmodalshow({});
|
|
},
|
|
onCancel: () => {
|
|
setmodalshow({});
|
|
}
|
|
},
|
|
/* @__PURE__ */ React.createElement("div", { style: { maxHeight: 600, overflow: "auto", marginBottom: 15 } }, /* @__PURE__ */ React.createElement("div", { style: { marginBottom: 20, display: "flex", justifyContent: "space-between", fontSize: 14 } }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("span", { style: { color: "#666666" } }, "\u72B6\u6001"), /* @__PURE__ */ React.createElement("span", { style: { marginLeft: 12, color: modalshow.status !== 0 && "#E30000" } }, _pages_MyProblem_TestCasePanel__WEBPACK_IMPORTED_MODULE_5__/* .ExecuteDict */ .Im[modalshow.status])), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("span", { style: { color: "#666666" } }, "\u63D0\u4EA4\u65F6\u95F4"), /* @__PURE__ */ React.createElement("span", { style: { marginLeft: 12 } }, moment__WEBPACK_IMPORTED_MODULE_6___default()(modalshow.created_at).format("YYYY-MM-DD HH:mm:ss"))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("span", { style: { color: "#666666" } }, "\u8BED\u8A00"), /* @__PURE__ */ React.createElement("span", { style: { marginLeft: 12 } }, modalshow.language)), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("span", { style: { color: "#666666" } }, "\u6267\u884C\u7528\u65F6"), /* @__PURE__ */ React.createElement("span", { style: { marginLeft: 12 } }, modalshow.execute_time, "ms"))), /* @__PURE__ */ React.createElement(
|
|
_pages_MyProblem_TestCasePanel__WEBPACK_IMPORTED_MODULE_5__/* .DetailCommitOut */ .Y4,
|
|
__spreadValues({}, modalshow)
|
|
))
|
|
));
|
|
};
|
|
/* harmony default export */ __webpack_exports__.Z = (ButtonLoading);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2149:
|
|
/*!****************************************************************!*\
|
|
!*** ./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 react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! antd */ 95237);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd */ 43604);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! antd */ 6848);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! antd */ 78241);
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.less?modules */ 3921);
|
|
/* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ant-design/icons */ 10064);
|
|
/* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ant-design/icons */ 21567);
|
|
/* harmony import */ var _MdEditorInForm__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./MdEditorInForm */ 98243);
|
|
var __defProp = Object.defineProperty;
|
|
var __defProps = Object.defineProperties;
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
var __objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && __getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const tagList = [
|
|
"A",
|
|
"B",
|
|
"C",
|
|
"D",
|
|
"E",
|
|
"F",
|
|
"G",
|
|
"H",
|
|
"I",
|
|
"J",
|
|
"K",
|
|
"L",
|
|
"M",
|
|
"N",
|
|
"O",
|
|
"P",
|
|
"Q",
|
|
"R",
|
|
"S",
|
|
"T",
|
|
"U",
|
|
"V",
|
|
"W",
|
|
"X",
|
|
"Y",
|
|
"Z"
|
|
];
|
|
const ChoiceQuestionItem = ({
|
|
value,
|
|
onChange,
|
|
choiceTextKey,
|
|
answerKey,
|
|
index,
|
|
isEdit,
|
|
setInputActive,
|
|
form,
|
|
choiceOptionsPath,
|
|
allowChangeMode,
|
|
showAddIcon,
|
|
addItem,
|
|
deleteItem
|
|
}) => {
|
|
const isActiveAnswer = (value == null ? void 0 : value[answerKey]) === 1;
|
|
const setAllOptionsToFalse = () => {
|
|
const options = form.getFieldValue(choiceOptionsPath);
|
|
form.setFieldValue(choiceOptionsPath, options.map((item) => __spreadProps(__spreadValues({}, item), { [answerKey]: 0 })));
|
|
};
|
|
const setActiveAnswer = () => {
|
|
if (isActiveAnswer) {
|
|
onChange(__spreadProps(__spreadValues({}, value), { [answerKey]: 0 }));
|
|
} else {
|
|
if (!allowChangeMode) {
|
|
setAllOptionsToFalse();
|
|
}
|
|
onChange(__spreadProps(__spreadValues({}, value), { [answerKey]: 1 }));
|
|
}
|
|
};
|
|
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, { className: _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.choiceWrap, align: "middle", wrap: false }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, { onClick: setActiveAnswer, className: `${_index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.choiceIndex} ${isActiveAnswer ? _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.activeAnswer : ""}` }, tagList[index]), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, { flex: 1, className: `${_index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.editorWrap} ml15`, onClick: setInputActive }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_2__/* .RegularInput */ .x, { height: 155, placeholder: "\u8BF7\u60A8\u8F93\u5165\u9009\u9879", isEdit, value: value == null ? void 0 : value[choiceTextKey], onChange: (v) => {
|
|
onChange(__spreadProps(__spreadValues({}, value), { [choiceTextKey]: v }));
|
|
} })), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z,
|
|
{
|
|
flex: "0 0 auto",
|
|
className: "ml15"
|
|
},
|
|
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
"div",
|
|
{
|
|
onClick: setActiveAnswer,
|
|
className: `${_index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.setAnswerBtn} ${isActiveAnswer ? _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.activeAnswer : ""}`
|
|
},
|
|
isActiveAnswer ? "\u6B63\u786E\u7B54\u6848" : "\u8BBE\u4E3A\u7B54\u6848"
|
|
)
|
|
), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, { className: _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.actionWrapper }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, { title: "\u65B0\u589E\u53C2\u8003\u7B54\u6848" }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
_ant_design_icons__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z,
|
|
{
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.addIcon,
|
|
onClick: addItem,
|
|
style: { visibility: showAddIcon ? "visible" : "hidden" }
|
|
}
|
|
)), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, { title: "\u5220\u9664" }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
_ant_design_icons__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z,
|
|
{
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.deleteIcon,
|
|
onClick: deleteItem,
|
|
style: { visibility: index > 1 ? "visible" : "hidden" }
|
|
}
|
|
))));
|
|
};
|
|
const ChoiceQuestionEditor = ({
|
|
questionTitlePlaceholder,
|
|
titleKey,
|
|
choiceKey,
|
|
analysisKey,
|
|
choiceTextKey,
|
|
answerKey,
|
|
choiceOptionsPath,
|
|
allowChangeMode = true,
|
|
form,
|
|
showAnalysis = true
|
|
}) => {
|
|
const [activeEditor, setActiveEditor] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)();
|
|
const [editAnalysis, setEditAnalysis] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
|
|
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { className: _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.wrap }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { className: _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.questionTitleEditorWrap }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_8__["default"].Item, { label: "\u9898\u5E72", name: titleKey, labelCol: { span: 24 }, rules: [{ required: true }] }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
_MdEditorInForm__WEBPACK_IMPORTED_MODULE_2__/* .MdEditorInForm */ .h,
|
|
{
|
|
scrollId: Array.isArray(titleKey) ? titleKey.join("_") : `${titleKey}`,
|
|
watch: true,
|
|
height: 140,
|
|
placeholder: questionTitlePlaceholder
|
|
}
|
|
))), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_8__["default"].Item, { label: "\u7B54\u6848\u9009\u9879", required: true, labelCol: { span: 24 } }), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_8__["default"].List,
|
|
{
|
|
name: choiceKey,
|
|
rules: [{
|
|
validator(rule, values) {
|
|
const hasAnswer = values.some((option) => option[answerKey] === 1);
|
|
const emptyAnswerIndex = values.findIndex((option) => {
|
|
var _a;
|
|
return ((_a = option[choiceTextKey]) == null ? void 0 : _a.length) <= 0;
|
|
});
|
|
if (emptyAnswerIndex !== -1) {
|
|
return Promise.reject(new Error(`\u8BF7\u5148\u8F93\u5165${tagList[emptyAnswerIndex]}\u9009\u9879\u7684\u5185\u5BB9`));
|
|
}
|
|
if (!hasAnswer) {
|
|
return Promise.reject(new Error("\u8BF7\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"));
|
|
}
|
|
return Promise.resolve();
|
|
}
|
|
}]
|
|
},
|
|
(fields, { add, remove }) => /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { id: Array.isArray(choiceOptionsPath) ? choiceOptionsPath.join("_") : `${choiceOptionsPath}` }, fields.map((_a, index) => {
|
|
var _b = _a, { key, name } = _b, restField = __objRest(_b, ["key", "name"]);
|
|
const isEdit = activeEditor === key;
|
|
const setInputActive = () => {
|
|
setActiveEditor(key);
|
|
};
|
|
const showAddIcon = index < 7 && index === fields.length - 1;
|
|
const addItem = () => add({ [choiceTextKey]: "", [answerKey]: 0 });
|
|
const deleteItem = () => remove(name);
|
|
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_8__["default"].Item, __spreadProps(__spreadValues({}, restField), { key, name, noStyle: true }), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
ChoiceQuestionItem,
|
|
{
|
|
choiceTextKey,
|
|
answerKey,
|
|
index,
|
|
isEdit,
|
|
setInputActive,
|
|
form,
|
|
choiceOptionsPath,
|
|
allowChangeMode,
|
|
showAddIcon,
|
|
addItem,
|
|
deleteItem
|
|
}
|
|
));
|
|
}), fields.length < 8 && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { className: `${_index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.addBtn} mb30`, onClick: () => add({ [choiceTextKey]: "", [answerKey]: 0 }) }, "\u6DFB\u52A0\u9009\u9879"))
|
|
), showAnalysis && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { onClick: () => setEditAnalysis(true) }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_8__["default"].Item, { name: analysisKey, label: "\u9898\u76EE\u89E3\u6790", labelCol: { span: 24 } }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_2__/* .RegularInput */ .x, { placeholder: "\u8BF7\u7F16\u8F91\u9898\u76EE\u89E3\u6790\uFF08\u975E\u5FC5\u586B\uFF09", isEdit: editAnalysis }))));
|
|
};
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 47467:
|
|
/*!********************************************************************!*\
|
|
!*** ./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 react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd */ 43418);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! antd */ 95237);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! antd */ 43604);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd */ 20008);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! antd */ 6848);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! antd */ 78673);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! antd */ 78241);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! antd */ 5112);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! antd */ 96971);
|
|
/* harmony import */ var _MdEditorInForm__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./MdEditorInForm */ 98243);
|
|
/* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @ant-design/icons */ 21567);
|
|
/* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @ant-design/icons */ 55079);
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./index.less?modules */ 3921);
|
|
/* harmony import */ var _components_MathsLatexKeybords__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/components/MathsLatexKeybords */ 18476);
|
|
/* provided dependency */ var React = __webpack_require__(/*! react */ 59301);
|
|
var __defProp = Object.defineProperty;
|
|
var __defProps = Object.defineProperties;
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
var __objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && __getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const BlankEditor = ({ value, onChange }) => {
|
|
const handleDelete = (index) => {
|
|
antd__WEBPACK_IMPORTED_MODULE_4__["default"].confirm({
|
|
centered: true,
|
|
okText: "\u786E\u5B9A",
|
|
cancelText: "\u53D6\u6D88",
|
|
title: "\u63D0\u793A",
|
|
content: "\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.modal,
|
|
onOk: () => {
|
|
const valueCopy = [...value];
|
|
valueCopy.splice(index, 1);
|
|
onChange(valueCopy);
|
|
}
|
|
});
|
|
};
|
|
const handleAdd = () => {
|
|
const valueCopy = [...value];
|
|
valueCopy.push("");
|
|
onChange(valueCopy);
|
|
};
|
|
return /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, { align: "middle", className: "ml20", gutter: [40, 20] }, value == null ? void 0 : value.map((v, index) => {
|
|
return /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, { key: `${v}_${index}`, className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.blankWrapper }, /* @__PURE__ */ React.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_7__["default"],
|
|
{
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.blankInput,
|
|
defaultValue: v,
|
|
maxLength: 1e3,
|
|
onBlur: (e) => {
|
|
const valueCopy = [...value];
|
|
const inputTrimValue = e.target.value.trim();
|
|
valueCopy[index] = inputTrimValue;
|
|
onChange(valueCopy);
|
|
}
|
|
}
|
|
), /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, { title: "\u5220\u9664" }, /* @__PURE__ */ React.createElement(
|
|
_ant_design_icons__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z,
|
|
{
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.deleteIcon,
|
|
style: { marginLeft: 15, visibility: index > 0 ? "visible" : "hidden" },
|
|
onClick: () => handleDelete(index)
|
|
}
|
|
)));
|
|
}), /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, null, /* @__PURE__ */ React.createElement("div", { className: `${_index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.addBtn}`, onClick: () => {
|
|
handleAdd();
|
|
} }, "\u65B0\u589E\u7B54\u6848")));
|
|
};
|
|
const BlankEditors = ({ value, onChange }) => {
|
|
const handleDelete = (index) => {
|
|
antd__WEBPACK_IMPORTED_MODULE_4__["default"].confirm({
|
|
centered: true,
|
|
okText: "\u786E\u5B9A",
|
|
cancelText: "\u53D6\u6D88",
|
|
title: "\u63D0\u793A",
|
|
content: "\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.modal,
|
|
onOk: () => {
|
|
const valueCopy = [...value];
|
|
valueCopy.splice(index, 1);
|
|
onChange(valueCopy);
|
|
}
|
|
});
|
|
};
|
|
const handleAdd = () => {
|
|
const valueCopy = [...value];
|
|
valueCopy.push("");
|
|
onChange(valueCopy);
|
|
};
|
|
return /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, { align: "middle", className: "ml20", gutter: [40, 20] }, value == null ? void 0 : value.map((v, index) => {
|
|
return /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, { key: `${v}_${index}`, className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.blankWrapper }, /* @__PURE__ */ React.createElement(
|
|
_components_MathsLatexKeybords__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z,
|
|
{
|
|
value: v,
|
|
width: "180px",
|
|
onChange: (e) => {
|
|
const valueCopy = [...value];
|
|
valueCopy[index] = e;
|
|
onChange(valueCopy);
|
|
}
|
|
}
|
|
), /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, { title: "\u5220\u9664" }, /* @__PURE__ */ React.createElement(
|
|
_ant_design_icons__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z,
|
|
{
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.deleteIcon,
|
|
style: { marginLeft: 15, visibility: index > 0 ? "visible" : "hidden" },
|
|
onClick: () => handleDelete(index)
|
|
}
|
|
)));
|
|
}), /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, null, /* @__PURE__ */ React.createElement("div", { className: `${_index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.addBtn}`, onClick: () => {
|
|
handleAdd();
|
|
} }, "\u65B0\u589E\u516C\u5F0F")));
|
|
};
|
|
const ReversedSwitch = ({ value = true, onChange }) => {
|
|
return /* @__PURE__ */ React.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z,
|
|
{
|
|
checked: !value,
|
|
onChange: (checked) => {
|
|
onChange(!checked);
|
|
}
|
|
}
|
|
);
|
|
};
|
|
const NULL_CH = "\u2581";
|
|
const CompletionQuestionEditor = ({
|
|
questionTitlePlaceholder,
|
|
form,
|
|
scoreByBlank = false,
|
|
answerKey
|
|
}) => {
|
|
const [editAnalysis, setEditAnalysis] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
|
|
const getChCountBeforeCursor = (cm, cursor) => {
|
|
const currentLine = cursor.line;
|
|
let placeholderCountBefore = 0;
|
|
for (let _line = 0; _line < currentLine; _line++) {
|
|
placeholderCountBefore += cm.getLine(_line).split(NULL_CH).length - 1;
|
|
}
|
|
const currentLineStringBeforeCursor = cm.getLine(currentLine).substring(0, cursor.ch);
|
|
placeholderCountBefore += currentLineStringBeforeCursor.split(NULL_CH).length - 1;
|
|
return placeholderCountBefore;
|
|
};
|
|
const onCMBeforeChange = (cm, change, addBlank2, removeBlank2) => {
|
|
const rangeText = cm.getRange(change.from, change.to);
|
|
let newBlankNum = 0;
|
|
change.text.forEach((item) => {
|
|
newBlankNum += item.split(NULL_CH).length - 1;
|
|
});
|
|
if (change.origin === "setValue") {
|
|
return;
|
|
}
|
|
if (rangeText && rangeText.indexOf(NULL_CH) !== -1) {
|
|
const placeholderCountInRange = rangeText.split(NULL_CH).length - 1;
|
|
const placeholderCountBefore = getChCountBeforeCursor(
|
|
cm,
|
|
change.from
|
|
);
|
|
console.log(
|
|
`\u5220\u9664${placeholderCountInRange}\u4E2A\uFF0C \u524D\u9762\u6709${placeholderCountBefore}\u4E2A\uFF0C\u65B0\u589E${newBlankNum}\u4E2A`
|
|
);
|
|
if (placeholderCountInRange > 1) {
|
|
const indexArray = Array.from({ length: placeholderCountInRange }, (item, index) => placeholderCountBefore + index);
|
|
removeBlank2(indexArray);
|
|
} else {
|
|
removeBlank2(placeholderCountBefore);
|
|
}
|
|
} else if (newBlankNum > 0) {
|
|
const placeholderCountBefore = getChCountBeforeCursor(
|
|
cm,
|
|
change.from
|
|
);
|
|
console.log(
|
|
`\u65B0\u589E${newBlankNum}\u4E2A\uFF0C\u4E4B\u524D\u6709${placeholderCountBefore}\u4E2A`
|
|
);
|
|
addBlank2(newBlankNum, placeholderCountBefore);
|
|
}
|
|
};
|
|
const rewritePosition = () => {
|
|
const preAnswerData = form.getFieldValue(answerKey);
|
|
form.setFieldsValue({ [answerKey]: preAnswerData.map((item, index) => __spreadProps(__spreadValues({}, item), { position: index + 1 })) });
|
|
};
|
|
const addFnRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
const addBlank = (addNum, insertIndex) => {
|
|
for (let i = 0; i < addNum; i++) {
|
|
addFnRef.current({ position: null, answer_text: [""], model: 1 }, insertIndex + i);
|
|
}
|
|
rewritePosition();
|
|
};
|
|
const removeFnRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
const removeBlank = (deleteIndex) => {
|
|
removeFnRef.current(deleteIndex);
|
|
rewritePosition();
|
|
};
|
|
const standardAnswersValue = antd__WEBPACK_IMPORTED_MODULE_11__["default"].useWatch(answerKey, form);
|
|
return /* @__PURE__ */ React.createElement("div", { className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.wrap }, /* @__PURE__ */ React.createElement("div", { className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.questionTitleEditorWrap }, /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_11__["default"].Item, { label: "\u9898\u5E72", name: "name", labelCol: { span: 24 }, rules: [{ required: true }] }, /* @__PURE__ */ React.createElement(
|
|
_MdEditorInForm__WEBPACK_IMPORTED_MODULE_1__/* .MdEditorInForm */ .h,
|
|
{
|
|
scrollId: "name",
|
|
watch: true,
|
|
height: 140,
|
|
placeholder: questionTitlePlaceholder,
|
|
showNullButton: true,
|
|
onCMBeforeChange: (cm, change) => {
|
|
onCMBeforeChange(cm, change, addBlank, removeBlank);
|
|
}
|
|
}
|
|
))), /* @__PURE__ */ React.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_11__["default"].List,
|
|
{
|
|
name: answerKey,
|
|
rules: [{
|
|
validator(rule, values) {
|
|
if ((values == null ? void 0 : values.length) === 0) {
|
|
return Promise.reject(new Error("\u7B54\u6848\u4E0D\u80FD\u4E3A\u7A7A"));
|
|
}
|
|
for (const item of values) {
|
|
const { answer_text } = item || {};
|
|
if (answer_text == null ? void 0 : answer_text.some((text) => (text == null ? void 0 : text.length) === 0)) {
|
|
return Promise.reject(new Error("\u586B\u7A7A\u9879\u7B54\u6848\u4E0D\u80FD\u4E3A\u7A7A"));
|
|
}
|
|
}
|
|
return Promise.resolve();
|
|
}
|
|
}]
|
|
},
|
|
(fields, { add, remove }, { errors }) => {
|
|
addFnRef.current = add;
|
|
removeFnRef.current = remove;
|
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_11__["default"].Item, { label: "\u7B54\u6848\u9009\u9879", required: true, labelCol: { span: 24 } }), fields.map((_a, index) => {
|
|
var _b = _a, { key, name } = _b, restField = __objRest(_b, ["key", "name"]);
|
|
var _a2, _b2;
|
|
return /* @__PURE__ */ React.createElement("div", { style: { marginBottom: 10 }, key }, /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, { className: `mb20`, align: "middle", wrap: false }, /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, { style: { marginRight: 10 }, flex: "0 0 auto", className: `${_index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.blankIndex}` }, "\u586B\u7A7A\u9879", index + 1), /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_11__["default"].Item, __spreadProps(__spreadValues({}, restField), { name: [name, "model"], noStyle: true }), /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"].Group */ .ZP.Group, { onChange: () => {
|
|
const preAnswerData = form.getFieldValue(answerKey);
|
|
form.setFieldsValue({ [answerKey]: preAnswerData.map((item, index2) => __spreadProps(__spreadValues({}, item), { answer_text: name === index2 ? [""] : item.answer_text })) });
|
|
} }, /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP, { value: 1 }, "\u6587\u672C\u6A21\u5F0F ", /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, { title: "\u5B66\u751F\u7B54\u9898\u65F6\uFF0C\u9700\u8981\u5728\u6587\u672C\u6846\u4E2D\u586B\u5199\u6587\u672C\u7B54\u6848" }, /* @__PURE__ */ React.createElement(_ant_design_icons__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z, null))), /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP, { value: 2 }, "\u6570\u5B66\u516C\u5F0F\u6A21\u5F0F ", /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, { title: "\u5B66\u751F\u7B54\u9898\u65F6\uFF0C\u9700\u8981\u7F16\u5199\u6570\u5B66\u516C\u5F0F\u4F5C\u4E3A\u7B54\u6848" }, /* @__PURE__ */ React.createElement(_ant_design_icons__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z, null)))))), /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, { style: { marginLeft: 20 }, align: "middle", wrap: false }, /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, { flex: 1 }, /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, { align: "top", justify: "space-between", wrap: false }, /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, null, /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_11__["default"].Item, __spreadProps(__spreadValues({}, restField), { name: [name, "answer_text"], noStyle: true }), ((_b2 = (_a2 = form.getFieldValue(answerKey)) == null ? void 0 : _a2[name]) == null ? void 0 : _b2.model) === 1 ? /* @__PURE__ */ React.createElement(BlankEditor, null) : /* @__PURE__ */ React.createElement(BlankEditors, null))), scoreByBlank && /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, { flex: "224px" }, /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_11__["default"].Item, __spreadProps(__spreadValues({}, restField), { name: [name, "score"], label: "\u5206\u503C", rules: [{ required: true }], className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.blankInputNumberWrapper }), /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, { className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.blankInput, min: 0.1, max: 100, precision: 1, style: { width: "100%" }, placeholder: "\u6309\u7A7A\u7ED9\u5206\u8BF7\u8F93\u5165\u5206\u503C" })))), /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_11__["default"].Item, __spreadProps(__spreadValues({}, restField), { name: [name, "position"], noStyle: true }), /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_7__["default"], { type: "hidden" })))));
|
|
}));
|
|
}
|
|
), /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, { align: "middle" }, /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_11__["default"].Item, { name: "downcase", valuePropName: "checked" }, /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z, null)), /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, { className: "ml10" }, "\u5224\u5206\u65F6\u5FFD\u7565\u7B54\u6848\u4E2D\u7684\u5B57\u6BCD\u5927\u5C0F\u5199")), /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, { align: "middle" }, /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_11__["default"].Item, { name: "no_space", valuePropName: "checked" }, /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z, null)), /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, { className: "ml10" }, "\u5224\u5206\u65F6\u5FFD\u7565\u7B54\u6848\u4E2D\u7684\u7A7A\u683C")), (standardAnswersValue == null ? void 0 : standardAnswersValue.length) > 1 && /* @__PURE__ */ React.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z,
|
|
{
|
|
align: "middle",
|
|
className: (standardAnswersValue == null ? void 0 : standardAnswersValue.length) > 1 ? "mb30" : `${_index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.hide}`
|
|
},
|
|
/* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_11__["default"].Item, { name: "is_ordered" }, /* @__PURE__ */ React.createElement(ReversedSwitch, null)),
|
|
/* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, { className: "ml10" }, "\u5141\u8BB8\u5B66\u751F\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u4E0E\u6807\u51C6\u7B54\u6848\u7684\u987A\u5E8F\u4E0D\u4E00\u81F4")
|
|
), /* @__PURE__ */ React.createElement("div", { onClick: () => setEditAnalysis(true) }, /* @__PURE__ */ React.createElement(antd__WEBPACK_IMPORTED_MODULE_11__["default"].Item, { name: "analysis", label: "\u9898\u76EE\u89E3\u6790", labelCol: { span: 24 } }, /* @__PURE__ */ React.createElement(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_1__/* .RegularInput */ .x, { placeholder: "\u8BF7\u7F16\u8F91\u9898\u76EE\u89E3\u6790\uFF08\u975E\u5FC5\u586B\uFF09", isEdit: editAnalysis }))));
|
|
};
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 69429:
|
|
/*!******************************************************************!*\
|
|
!*** ./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 react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! antd */ 95237);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd */ 43604);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! antd */ 78241);
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.less?modules */ 3921);
|
|
/* harmony import */ var _MdEditorInForm__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./MdEditorInForm */ 98243);
|
|
var __defProp = Object.defineProperty;
|
|
var __defProps = Object.defineProperties;
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
var __objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && __getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
|
|
|
|
|
|
|
|
const tagMap = {
|
|
["\u6B63\u786E"]: "T",
|
|
["\u9519\u8BEF"]: "F"
|
|
};
|
|
const JudgmentQuestionItem = ({ value, onChange, form }) => {
|
|
const isActiveAnswer = (value == null ? void 0 : value.is_answer) === 1;
|
|
const judgementText = value == null ? void 0 : value.choice_text;
|
|
const setActiveAnswer = () => {
|
|
const formListValue = form.getFieldsValue().choices.map((choice) => ({ choice_text: choice.choice_text, is_answer: 0 }));
|
|
form.setFieldsValue({ choices: formListValue });
|
|
onChange(__spreadProps(__spreadValues({}, value), { is_answer: 1 }));
|
|
};
|
|
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, { className: _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.choiceWrap, align: "middle", wrap: false }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, { onClick: setActiveAnswer, className: `${_index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.choiceIndex} ${_index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.judgementIndex} ${isActiveAnswer ? _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.activeAnswer : ""}` }, tagMap[judgementText]), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, { flex: 1, className: `${_index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.editorWrap} ml15` }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { className: `${_index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.inputBorder} ${_index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.placeholder} ${isActiveAnswer ? _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.activeJudgementAnswer : ""}` }, judgementText)), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z,
|
|
{
|
|
flex: "0 0 auto",
|
|
className: "ml15"
|
|
},
|
|
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
"div",
|
|
{
|
|
onClick: setActiveAnswer,
|
|
className: `${_index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.setAnswerBtn} ${isActiveAnswer ? _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.activeAnswer : ""}`
|
|
},
|
|
isActiveAnswer ? "\u6B63\u786E\u7B54\u6848" : "\u8BBE\u4E3A\u7B54\u6848"
|
|
)
|
|
));
|
|
};
|
|
const JudgmentQuestionEditor = ({
|
|
questionTitlePlaceholder,
|
|
choiceKey,
|
|
form
|
|
}) => {
|
|
const [editAnalysis, setEditAnalysis] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
|
|
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { className: _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.wrap }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { className: _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.questionTitleEditorWrap }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_5__["default"].Item, { label: "\u9898\u5E72", name: "name", labelCol: { span: 24 }, rules: [{ required: true }] }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
_MdEditorInForm__WEBPACK_IMPORTED_MODULE_2__/* .MdEditorInForm */ .h,
|
|
{
|
|
scrollId: "name",
|
|
watch: true,
|
|
height: 140,
|
|
placeholder: questionTitlePlaceholder
|
|
}
|
|
))), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_5__["default"].Item, { label: "\u7B54\u6848\u9009\u9879", required: true, labelCol: { span: 24 } }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_5__["default"].List,
|
|
{
|
|
name: "choices",
|
|
rules: [{
|
|
validator(rule, values) {
|
|
const hasAnswer = values.some((option) => (option == null ? void 0 : option.is_answer) === 1);
|
|
if (hasAnswer) {
|
|
return Promise.resolve();
|
|
}
|
|
return Promise.reject(new Error("\u8BF7\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"));
|
|
}
|
|
}]
|
|
},
|
|
(fields) => /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { id: "choices" }, fields.map((_a) => {
|
|
var _b = _a, { key, name } = _b, restField = __objRest(_b, ["key", "name"]);
|
|
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_5__["default"].Item, __spreadProps(__spreadValues({}, restField), { key, name, noStyle: true }), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(JudgmentQuestionItem, { form }));
|
|
}))
|
|
)), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { onClick: () => setEditAnalysis(true) }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_5__["default"].Item, { name: "analysis", label: "\u9898\u76EE\u89E3\u6790", labelCol: { span: 24 } }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_2__/* .RegularInput */ .x, { placeholder: "\u8BF7\u7F16\u8F91\u9898\u76EE\u89E3\u6790\uFF08\u975E\u5FC5\u586B\uFF09", isEdit: editAnalysis }))));
|
|
};
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 98243:
|
|
/*!**********************************************************!*\
|
|
!*** ./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 _components_markdown_editor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/markdown-editor */ 16393);
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.less?modules */ 3921);
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ 59301);
|
|
/* harmony import */ var _components_RenderHtml__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/components/RenderHtml */ 92936);
|
|
var __defProp = Object.defineProperty;
|
|
var __defProps = Object.defineProperties;
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
var __objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && __getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
|
|
|
|
|
|
|
|
const MdEditorInForm = (_a) => {
|
|
var _b = _a, { value, onChange, scrollId } = _b, props = __objRest(_b, ["value", "onChange", "scrollId"]);
|
|
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_2__.createElement("div", { id: scrollId || "" }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_2__.createElement(
|
|
_components_markdown_editor__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z,
|
|
__spreadProps(__spreadValues({}, props), {
|
|
defaultValue: value,
|
|
onChange: (a, b) => {
|
|
console.log("a:", a, b);
|
|
if (!!(b == null ? void 0 : b.length))
|
|
onChange(a, b);
|
|
else
|
|
onChange(a);
|
|
}
|
|
})
|
|
));
|
|
};
|
|
const RegularInput = ({ value, onChange, placeholder, height = 140, isEdit }) => {
|
|
return isEdit ? /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_2__.createElement(
|
|
_components_markdown_editor__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z,
|
|
{
|
|
watch: true,
|
|
isFocus: true,
|
|
height,
|
|
placeholder,
|
|
defaultValue: value,
|
|
onChange
|
|
}
|
|
) : /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_2__.createElement("div", { style: { cursor: "pointer" } }, value ? /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_2__.createElement(_components_RenderHtml__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, { className: _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.inputBorder, value }) : /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_2__.createElement("div", { className: `${_index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.inputBorder} ${_index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.placeholder}` }, placeholder));
|
|
};
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 24996:
|
|
/*!********************************************************************!*\
|
|
!*** ./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 react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd */ 8591);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! antd */ 12563);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! antd */ 78241);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd */ 78673);
|
|
/* 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_12__ = __webpack_require__(/*! antd */ 20008);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! antd */ 96971);
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.less?modules */ 3921);
|
|
/* harmony import */ var _MdEditorInForm__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./MdEditorInForm */ 98243);
|
|
/* harmony import */ var _components_markdown_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/components/markdown-editor */ 16393);
|
|
/* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @ant-design/icons */ 55079);
|
|
var __defProp = Object.defineProperty;
|
|
var __defProps = Object.defineProperties;
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
var __objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && __getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const AnswerTextFormItem = (_a) => {
|
|
var _b = _a, { value, onChange } = _b, props = __objRest(_b, ["value", "onChange"]);
|
|
const handleChange = (v) => {
|
|
onChange([v]);
|
|
};
|
|
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
_components_markdown_editor__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z,
|
|
__spreadProps(__spreadValues({}, props), {
|
|
defaultValue: value == null ? void 0 : value[0],
|
|
onChange: handleChange
|
|
})
|
|
);
|
|
};
|
|
const test = (str) => {
|
|
if (!str) {
|
|
return false;
|
|
}
|
|
if (/^s*$/.test(str) || str.trim() === "") {
|
|
antd__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .ZP.warning("\u5173\u952E\u8BCD\u4E0D\u80FD\u5168\u4E3A\u7A7A\u683C");
|
|
return;
|
|
}
|
|
let containSpecial = new RegExp("[ `~!@#$^&*()={}':;,\\[\\].<>/?~\uFF01@#\uFFE5\u2026\u2026&*\uFF08\uFF09\u2014\u3010\u3011\u2018\uFF1B\uFF1A\u201D\u201C\u3002\uFF0C\u3001\uFF1F\u300C\u300D\u300E\u300F_\\+\\-\xB7%\u300A\u300B]|[\\\\/]");
|
|
if (str === "|") {
|
|
antd__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .ZP.warning("\u5173\u952E\u8BCD\u4E0D\u80FD\u53EA\u8F93\u5165\u4E00\u4E2A\u201C|\u201D\u5B57\u7B26\uFF01");
|
|
return false;
|
|
}
|
|
return true;
|
|
};
|
|
const KeywordTag = ({ value = [], onClose }) => {
|
|
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_5__["default"], { closable: true, onClose, className: _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.keywordTag }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("pre", { style: { margin: "0px", whiteSpace: "pre-wrap" } }, value.join(" \u6216 ")));
|
|
};
|
|
const SubjectiveQuestionEditor = ({
|
|
questionTitlePlaceholder,
|
|
form,
|
|
showKeywords,
|
|
isMustKeyWords = showKeywords
|
|
}) => {
|
|
const [editAnalysis, setEditAnalysis] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
|
|
const [keywordsInput, setKeywordsInput] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)("");
|
|
const useKeywordsValue = antd__WEBPACK_IMPORTED_MODULE_6__["default"].useWatch("use_keywords", form);
|
|
const questionScore = antd__WEBPACK_IMPORTED_MODULE_6__["default"].useWatch("question_score", form);
|
|
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { className: _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.wrap }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { className: _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.questionTitleEditorWrap }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item, { label: "\u9898\u5E72", name: "name", labelCol: { span: 24 }, rules: [{ required: true }] }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
_MdEditorInForm__WEBPACK_IMPORTED_MODULE_2__/* .MdEditorInForm */ .h,
|
|
{
|
|
scrollId: "name",
|
|
watch: true,
|
|
height: 140,
|
|
placeholder: questionTitlePlaceholder
|
|
}
|
|
))), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item, { label: "\u53C2\u8003\u7B54\u6848", name: "answer_texts", labelCol: { span: 24 } }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
AnswerTextFormItem,
|
|
{
|
|
watch: true,
|
|
height: 140,
|
|
placeholder: "\u8BF7\u7F16\u8F91\u53C2\u8003\u7B54\u6848\uFF08\u975E\u5FC5\u586B\uFF09"
|
|
}
|
|
)), showKeywords && !isMustKeyWords && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item, { hidden: true, name: "use_keywords", valuePropName: "checked" }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, { defaultChecked: true })), showKeywords && isMustKeyWords && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, { align: "middle", className: "mb30" }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item, { name: "use_keywords", valuePropName: "checked" }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, null)), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, { className: "ml10" }, "\u5F00\u542F\u5173\u952E\u8BCD\u81EA\u52A8\u5224\u5206"), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_10__/* ["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"
|
|
},
|
|
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ant_design_icons__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z, { style: { color: "#3061D0", marginLeft: 6, cursor: "pointer" } })
|
|
))), (useKeywordsValue || !isMustKeyWords) && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_6__["default"].List, { name: "keywords", rules: [{
|
|
validator(rule, values) {
|
|
if (!isMustKeyWords) {
|
|
return Promise.resolve();
|
|
}
|
|
if (!(values == null ? void 0 : values.length)) {
|
|
return Promise.reject(new Error("\u8BF7\u8F93\u5165\u5173\u952E\u8BCD"));
|
|
}
|
|
const keywordsScoreSum = values == null ? void 0 : values.reduce((pre, cur) => pre + cur.score, 0);
|
|
if (keywordsScoreSum > parseFloat(questionScore)) {
|
|
return Promise.reject(new Error("\u6240\u6709\u5173\u952E\u8BCD\u7684\u5206\u503C\u4E4B\u548C\u5FC5\u987B\u5C0F\u4E8E\u7B49\u4E8E\u8BE5\u5C0F\u9898\u7684\u5206\u503C"));
|
|
}
|
|
return Promise.resolve();
|
|
}
|
|
}] }, (fields, { add, remove }) => /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { className: `${_index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.title} mb10` }, !isMustKeyWords ? /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", { style: { color: "#9096A3" } }, "\u5224\u5206\u5173\u952E\u8BCD") : "\u5173\u952E\u8BCD"), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, { align: "middle", className: "font14 mb30" }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, { flex: 1 }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
|
|
antd__WEBPACK_IMPORTED_MODULE_12__["default"],
|
|
{
|
|
value: keywordsInput,
|
|
onChange: (e) => {
|
|
setKeywordsInput(e.target.value);
|
|
},
|
|
maxLength: 50,
|
|
allowClear: true,
|
|
onPressEnter: (e) => {
|
|
var _a, _b, _c, _d;
|
|
const v = `${(_a = e.target) == null ? void 0 : _a.value}`;
|
|
const keywordArr = (_c = (_b = v == null ? void 0 : v.split("|")) == null ? void 0 : _b.filter((k) => !!k)) == null ? void 0 : _c.map((item) => item == null ? void 0 : item.trim());
|
|
const currentKeywordsValue = form.getFieldValue("keywords");
|
|
const existKeywords = ((_d = currentKeywordsValue == null ? void 0 : currentKeywordsValue.map((item) => item == null ? void 0 : item.keyword)) == null ? void 0 : _d.flat()) || [];
|
|
for (const word of keywordArr) {
|
|
if (existKeywords.includes(word)) {
|
|
antd__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .ZP.error("\u4E3A\u907F\u514D\u5224\u5206\u9519\u8BEF\uFF0C\u8BF7\u52FF\u8BBE\u7F6E\u76F8\u540C\u7684\u5173\u952E\u8BCD");
|
|
return;
|
|
}
|
|
}
|
|
if (test(v)) {
|
|
add({ keyword: keywordArr, score: 1 });
|
|
setKeywordsInput("");
|
|
}
|
|
},
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["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__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, { flex: "148px", style: { textAlign: "right", color: "#9096A3" } }, "\u201C\u56DE\u8F66\u952E\u201D\u4FDD\u5B58\u5173\u952E\u8BCD")), fields.map((_a) => {
|
|
var _b = _a, { key, name } = _b, restField = __objRest(_b, ["key", "name"]);
|
|
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, { key, className: "mb20", style: { marginRight: 148 } }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, { flex: 1 }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, { align: "middle", justify: "space-between" }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item, __spreadProps(__spreadValues({}, restField), { name: [name, "keyword"] }), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(KeywordTag, { onClose: () => remove(name) })), isMustKeyWords && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item, __spreadProps(__spreadValues({}, restField), { name: [name, "score"], label: "\u5206\u503C", rules: [{ required: true }], className: _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.blankInputNumberWrapper }), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z, { className: _index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.blankInput, min: 0.1, max: 100, precision: 1, style: { width: "100%" }, placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u5206\u6570" })))));
|
|
}))), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { onClick: () => setEditAnalysis(true) }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_6__["default"].Item, { name: "analysis", label: "\u9898\u76EE\u89E3\u6790", labelCol: { span: 24 } }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(_MdEditorInForm__WEBPACK_IMPORTED_MODULE_2__/* .RegularInput */ .x, { placeholder: "\u8BF7\u7F16\u8F91\u9898\u76EE\u89E3\u6790\uFF08\u975E\u5FC5\u586B\uFF09", isEdit: editAnalysis }))));
|
|
};
|
|
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |