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.
809 lines
48 KiB
809 lines
48 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[3326],{
|
|
|
|
/***/ 62659:
|
|
/*!*************************************************************!*\
|
|
!*** ./src/components/QuestionEditor/index.tsx + 4 modules ***!
|
|
\*************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
tc: function() { return /* reexport */ BProgramEditor/* BProgramEditor */.t; },
|
|
uh: function() { return /* reexport */ ChoiceQuestionEditor/* ChoiceQuestionEditor */.u; },
|
|
rL: function() { return /* reexport */ CombinationQuestionEditor; },
|
|
u8: function() { return /* reexport */ CompletionQuestionEditor/* CompletionQuestionEditor */.u; },
|
|
ZZ: function() { return /* reexport */ JudgmentQuestionEditor/* JudgmentQuestionEditor */.Z; },
|
|
Wk: function() { return /* reexport */ SubjectiveQuestionEditor/* SubjectiveQuestionEditor */.W; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./src/components/QuestionEditor/ChoiceQuestionEditor.tsx
|
|
var ChoiceQuestionEditor = __webpack_require__(2149);
|
|
// EXTERNAL MODULE: ./src/components/QuestionEditor/JudgmentQuestionEditor.tsx
|
|
var JudgmentQuestionEditor = __webpack_require__(69429);
|
|
// EXTERNAL MODULE: ./src/components/QuestionEditor/CompletionQuestionEditor.tsx
|
|
var CompletionQuestionEditor = __webpack_require__(47467);
|
|
// EXTERNAL MODULE: ./src/components/QuestionEditor/SubjectiveQuestionEditor.tsx
|
|
var SubjectiveQuestionEditor = __webpack_require__(24996);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/collapse/index.js + 8 modules
|
|
var collapse = __webpack_require__(74997);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/form/index.js + 19 modules
|
|
var es_form = __webpack_require__(78241);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/row/index.js
|
|
var row = __webpack_require__(95237);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input-number/index.js + 14 modules
|
|
var input_number = __webpack_require__(96971);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tooltip/index.js + 3 modules
|
|
var tooltip = __webpack_require__(6848);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/dropdown/index.js + 1 modules
|
|
var dropdown = __webpack_require__(38854);
|
|
// EXTERNAL MODULE: ./src/components/QuestionEditor/index.less?modules
|
|
var QuestionEditormodules = __webpack_require__(3921);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.1@@ant-design/icons/es/icons/MinusCircleOutlined.js + 1 modules
|
|
var MinusCircleOutlined = __webpack_require__(21567);
|
|
// EXTERNAL MODULE: ./src/components/QuestionEditor/MdEditorInForm.tsx
|
|
var MdEditorInForm = __webpack_require__(98243);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
|
|
var modal = __webpack_require__(43418);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/col/index.js
|
|
var col = __webpack_require__(43604);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
|
|
var input = __webpack_require__(20008);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/switch/index.js + 2 modules
|
|
var es_switch = __webpack_require__(78673);
|
|
;// CONCATENATED MODULE: ./src/components/QuestionEditor/CombinationCompletionQuestionEditor.tsx
|
|
/* 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) => {
|
|
modal["default"].confirm({
|
|
centered: true,
|
|
okText: "\u786E\u5B9A",
|
|
cancelText: "\u53D6\u6D88",
|
|
title: "\u63D0\u793A",
|
|
content: "\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",
|
|
className: QuestionEditormodules/* 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(row/* default */.Z, { align: "middle", className: "ml20", gutter: [40, 20] }, value == null ? void 0 : value.map((v, index) => {
|
|
return /* @__PURE__ */ React.createElement(col/* default */.Z, { key: `${v}_${index}`, className: QuestionEditormodules/* default */.Z.blankWrapper }, /* @__PURE__ */ React.createElement(
|
|
input["default"],
|
|
{
|
|
className: QuestionEditormodules/* 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(tooltip/* default */.Z, { title: "\u5220\u9664" }, /* @__PURE__ */ React.createElement(
|
|
MinusCircleOutlined/* default */.Z,
|
|
{
|
|
className: QuestionEditormodules/* default */.Z.deleteIcon,
|
|
style: { marginLeft: 15, visibility: index > 0 ? "visible" : "hidden" },
|
|
onClick: () => handleDelete(index)
|
|
}
|
|
)));
|
|
}), /* @__PURE__ */ React.createElement(col/* default */.Z, null, /* @__PURE__ */ React.createElement("div", { className: `${QuestionEditormodules/* default */.Z.addBtn}`, onClick: () => {
|
|
handleAdd();
|
|
} }, "\u65B0\u589E\u7B54\u6848")));
|
|
};
|
|
const ReversedSwitch = ({ value = true, onChange }) => {
|
|
return /* @__PURE__ */ React.createElement(
|
|
es_switch/* default */.Z,
|
|
{
|
|
checked: !value,
|
|
onChange: (checked) => {
|
|
onChange(!checked);
|
|
}
|
|
}
|
|
);
|
|
};
|
|
const NULL_CH = "\u2581";
|
|
const CombinationCompletionQuestionEditor_CompletionQuestionEditor = ({
|
|
questionTitlePlaceholder,
|
|
form,
|
|
name,
|
|
scoreByBlank = false,
|
|
answerKey,
|
|
titleKey = "name",
|
|
analysisKey = "analysis",
|
|
isOrdered = "is_ordered"
|
|
}) => {
|
|
var _a, _b;
|
|
const [editAnalysis, setEditAnalysis] = (0,_react_17_0_2_react.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(["sub_item_banks", ...answerKey]);
|
|
form.setFieldValue(
|
|
["sub_item_banks", ...answerKey],
|
|
preAnswerData == null ? void 0 : preAnswerData.map((item, index) => __spreadProps(__spreadValues({}, item), { position: index + 1 }))
|
|
);
|
|
};
|
|
const addFnRef = (0,_react_17_0_2_react.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_17_0_2_react.useRef)();
|
|
const removeBlank = (deleteIndex) => {
|
|
removeFnRef.current(deleteIndex);
|
|
rewritePosition();
|
|
};
|
|
const standardAnswersValue = (_b = (_a = form.getFieldValue("sub_item_banks")) == null ? void 0 : _a[answerKey == null ? void 0 : answerKey[0]]) == null ? void 0 : _b[answerKey == null ? void 0 : answerKey[1]];
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
console.log("========", form.getFieldsValue());
|
|
}, [form]);
|
|
return /* @__PURE__ */ React.createElement("div", { className: QuestionEditormodules/* default */.Z.wrap }, /* @__PURE__ */ React.createElement("div", { className: QuestionEditormodules/* default */.Z.questionTitleEditorWrap }, /* @__PURE__ */ React.createElement(es_form["default"].Item, { label: "\u9898\u5E72", name: titleKey, labelCol: { span: 24 }, rules: [{ required: true }] }, /* @__PURE__ */ React.createElement(
|
|
MdEditorInForm/* MdEditorInForm */.h,
|
|
{
|
|
scrollId: "name",
|
|
watch: true,
|
|
height: 140,
|
|
placeholder: questionTitlePlaceholder,
|
|
showNullButton: true,
|
|
onCMBeforeChange: (cm, change) => {
|
|
onCMBeforeChange(cm, change, addBlank, removeBlank);
|
|
}
|
|
}
|
|
))), /* @__PURE__ */ React.createElement(
|
|
es_form["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(es_form["default"].Item, { label: "\u7B54\u6848\u9009\u9879", required: true, labelCol: { span: 24 } }), fields.map((_a2, index) => {
|
|
var _b2 = _a2, { key, name: name2 } = _b2, restField = __objRest(_b2, ["key", "name"]);
|
|
return /* @__PURE__ */ React.createElement(row/* default */.Z, { className: `mb20`, key, align: "middle", wrap: false }, /* @__PURE__ */ React.createElement(col/* default */.Z, { flex: "0 0 auto", className: `${QuestionEditormodules/* default */.Z.blankIndex}` }, "\u586B\u7A7A\u9879", index + 1), /* @__PURE__ */ React.createElement(col/* default */.Z, { flex: 1 }, /* @__PURE__ */ React.createElement(row/* default */.Z, { align: "top", justify: "space-between", wrap: false }, /* @__PURE__ */ React.createElement(col/* default */.Z, null, /* @__PURE__ */ React.createElement(es_form["default"].Item, __spreadProps(__spreadValues({}, restField), { name: [name2, "answer_text"], noStyle: true }), /* @__PURE__ */ React.createElement(BlankEditor, null))), scoreByBlank && /* @__PURE__ */ React.createElement(col/* default */.Z, { flex: "224px" }, /* @__PURE__ */ React.createElement(es_form["default"].Item, __spreadProps(__spreadValues({}, restField), { name: [name2, "score"], label: "\u5206\u503C", rules: [{ required: true }], className: QuestionEditormodules/* default */.Z.blankInputNumberWrapper }), /* @__PURE__ */ React.createElement(input_number/* default */.Z, { className: QuestionEditormodules/* 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(es_form["default"].Item, __spreadProps(__spreadValues({}, restField), { name: [name2, "position"], noStyle: true }), /* @__PURE__ */ React.createElement(input["default"], { type: "hidden" }))));
|
|
}));
|
|
}
|
|
), /* @__PURE__ */ React.createElement(row/* default */.Z, { align: "middle" }, /* @__PURE__ */ React.createElement(es_form["default"].Item, { name: [name, "downcase"], valuePropName: "checked" }, /* @__PURE__ */ React.createElement(es_switch/* default */.Z, null)), /* @__PURE__ */ React.createElement(col/* default */.Z, { className: "ml10" }, "\u5224\u5206\u65F6\u5FFD\u7565\u7B54\u6848\u4E2D\u7684\u5B57\u6BCD\u5927\u5C0F\u5199")), /* @__PURE__ */ React.createElement(row/* default */.Z, { align: "middle" }, /* @__PURE__ */ React.createElement(es_form["default"].Item, { name: [name, "no_space"], valuePropName: "checked" }, /* @__PURE__ */ React.createElement(es_switch/* default */.Z, null)), /* @__PURE__ */ React.createElement(col/* 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(
|
|
row/* default */.Z,
|
|
{
|
|
align: "middle",
|
|
className: (standardAnswersValue == null ? void 0 : standardAnswersValue.length) > 1 ? "mb30" : `${QuestionEditormodules/* default */.Z.hide}`
|
|
},
|
|
/* @__PURE__ */ React.createElement(es_form["default"].Item, { name: isOrdered }, /* @__PURE__ */ React.createElement(ReversedSwitch, null)),
|
|
/* @__PURE__ */ React.createElement(col/* 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(es_form["default"].Item, { name: analysisKey, label: "\u9898\u76EE\u89E3\u6790", labelCol: { span: 24 } }, /* @__PURE__ */ React.createElement(MdEditorInForm/* RegularInput */.x, { placeholder: "\u8BF7\u7F16\u8F91\u9898\u76EE\u89E3\u6790\uFF08\u975E\u5FC5\u586B\uFF09", isEdit: editAnalysis }))));
|
|
};
|
|
|
|
|
|
;// CONCATENATED MODULE: ./src/components/QuestionEditor/CombinationJudgmentQuestionEditor.tsx
|
|
var CombinationJudgmentQuestionEditor_defProp = Object.defineProperty;
|
|
var CombinationJudgmentQuestionEditor_defProps = Object.defineProperties;
|
|
var CombinationJudgmentQuestionEditor_getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var CombinationJudgmentQuestionEditor_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var CombinationJudgmentQuestionEditor_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var CombinationJudgmentQuestionEditor_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var CombinationJudgmentQuestionEditor_defNormalProp = (obj, key, value) => key in obj ? CombinationJudgmentQuestionEditor_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var CombinationJudgmentQuestionEditor_spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (CombinationJudgmentQuestionEditor_hasOwnProp.call(b, prop))
|
|
CombinationJudgmentQuestionEditor_defNormalProp(a, prop, b[prop]);
|
|
if (CombinationJudgmentQuestionEditor_getOwnPropSymbols)
|
|
for (var prop of CombinationJudgmentQuestionEditor_getOwnPropSymbols(b)) {
|
|
if (CombinationJudgmentQuestionEditor_propIsEnum.call(b, prop))
|
|
CombinationJudgmentQuestionEditor_defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var CombinationJudgmentQuestionEditor_spreadProps = (a, b) => CombinationJudgmentQuestionEditor_defProps(a, CombinationJudgmentQuestionEditor_getOwnPropDescs(b));
|
|
var CombinationJudgmentQuestionEditor_objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (CombinationJudgmentQuestionEditor_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && CombinationJudgmentQuestionEditor_getOwnPropSymbols)
|
|
for (var prop of CombinationJudgmentQuestionEditor_getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && CombinationJudgmentQuestionEditor_propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
|
|
|
|
|
|
|
|
const tagMap = {
|
|
["\u6B63\u786E"]: "T",
|
|
["\u9519\u8BEF"]: "F"
|
|
};
|
|
const JudgmentQuestionItem = ({ value, onChange, form, choiceKey }) => {
|
|
const isActiveAnswer = (value == null ? void 0 : value.is_answer) === 1;
|
|
const judgementText = value == null ? void 0 : value.choice_text;
|
|
const setActiveAnswer = () => {
|
|
var _a;
|
|
const formListValue = (_a = form == null ? void 0 : form.getFieldValue(["sub_item_banks", ...choiceKey])) == null ? void 0 : _a.map((choice) => ({ choice_text: choice.choice_text, is_answer: 0 }));
|
|
form == null ? void 0 : form.setFieldValue(["sub_item_banks", ...choiceKey], formListValue);
|
|
onChange(CombinationJudgmentQuestionEditor_spreadProps(CombinationJudgmentQuestionEditor_spreadValues({}, value), { is_answer: 1 }));
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { className: QuestionEditormodules/* default */.Z.choiceWrap, align: "middle", wrap: false }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { onClick: setActiveAnswer, className: `${QuestionEditormodules/* default */.Z.choiceIndex} ${QuestionEditormodules/* default */.Z.judgementIndex} ${isActiveAnswer ? QuestionEditormodules/* default */.Z.activeAnswer : ""}` }, tagMap[judgementText]), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: 1, className: `${QuestionEditormodules/* default */.Z.editorWrap} ml15` }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: `${QuestionEditormodules/* default */.Z.inputBorder} ${QuestionEditormodules/* default */.Z.placeholder} ${isActiveAnswer ? QuestionEditormodules/* default */.Z.activeJudgementAnswer : ""}` }, judgementText)), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
col/* default */.Z,
|
|
{
|
|
flex: "0 0 auto",
|
|
className: "ml15"
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"div",
|
|
{
|
|
onClick: setActiveAnswer,
|
|
className: `${QuestionEditormodules/* default */.Z.setAnswerBtn} ${isActiveAnswer ? QuestionEditormodules/* default */.Z.activeAnswer : ""}`
|
|
},
|
|
isActiveAnswer ? "\u6B63\u786E\u7B54\u6848" : "\u8BBE\u4E3A\u7B54\u6848"
|
|
)
|
|
));
|
|
};
|
|
const CombinationJudgmentQuestionEditor_JudgmentQuestionEditor = ({
|
|
questionTitlePlaceholder,
|
|
choiceKey = "choices",
|
|
form,
|
|
titleKey = "name",
|
|
analysisKey = "analysis"
|
|
}) => {
|
|
const [editAnalysis, setEditAnalysis] = (0,_react_17_0_2_react.useState)(false);
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: QuestionEditormodules/* default */.Z.wrap }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: QuestionEditormodules/* default */.Z.questionTitleEditorWrap }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { label: "\u9898\u5E72", name: titleKey, labelCol: { span: 24 }, rules: [{ required: true }] }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
MdEditorInForm/* MdEditorInForm */.h,
|
|
{
|
|
scrollId: "name",
|
|
watch: true,
|
|
height: 140,
|
|
placeholder: questionTitlePlaceholder
|
|
}
|
|
))), /* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { label: "\u7B54\u6848\u9009\u9879", required: true, labelCol: { span: 24 } }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
es_form["default"].List,
|
|
{
|
|
name: choiceKey,
|
|
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_17_0_2_react.createElement("div", { id: "choices" }, fields.map((_a) => {
|
|
var _b = _a, { key, name } = _b, restField = CombinationJudgmentQuestionEditor_objRest(_b, ["key", "name"]);
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, CombinationJudgmentQuestionEditor_spreadProps(CombinationJudgmentQuestionEditor_spreadValues({}, restField), { key, name, noStyle: true }), /* @__PURE__ */ _react_17_0_2_react.createElement(JudgmentQuestionItem, { form, choiceKey }));
|
|
}))
|
|
)), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { onClick: () => setEditAnalysis(true) }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { name: analysisKey, label: "\u9898\u76EE\u89E3\u6790", labelCol: { span: 24 } }, /* @__PURE__ */ _react_17_0_2_react.createElement(MdEditorInForm/* RegularInput */.x, { placeholder: "\u8BF7\u7F16\u8F91\u9898\u76EE\u89E3\u6790\uFF08\u975E\u5FC5\u586B\uFF09", isEdit: editAnalysis }))));
|
|
};
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
|
|
var message = __webpack_require__(8591);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tag/index.js + 5 modules
|
|
var tag = __webpack_require__(12563);
|
|
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 15 modules
|
|
var markdown_editor = __webpack_require__(16393);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.1@@ant-design/icons/es/icons/QuestionCircleOutlined.js + 1 modules
|
|
var QuestionCircleOutlined = __webpack_require__(55079);
|
|
;// CONCATENATED MODULE: ./src/components/QuestionEditor/CombinationSubjectiveQuestionEditor.tsx
|
|
var CombinationSubjectiveQuestionEditor_defProp = Object.defineProperty;
|
|
var CombinationSubjectiveQuestionEditor_defProps = Object.defineProperties;
|
|
var CombinationSubjectiveQuestionEditor_getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var CombinationSubjectiveQuestionEditor_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var CombinationSubjectiveQuestionEditor_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var CombinationSubjectiveQuestionEditor_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var CombinationSubjectiveQuestionEditor_defNormalProp = (obj, key, value) => key in obj ? CombinationSubjectiveQuestionEditor_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var CombinationSubjectiveQuestionEditor_spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (CombinationSubjectiveQuestionEditor_hasOwnProp.call(b, prop))
|
|
CombinationSubjectiveQuestionEditor_defNormalProp(a, prop, b[prop]);
|
|
if (CombinationSubjectiveQuestionEditor_getOwnPropSymbols)
|
|
for (var prop of CombinationSubjectiveQuestionEditor_getOwnPropSymbols(b)) {
|
|
if (CombinationSubjectiveQuestionEditor_propIsEnum.call(b, prop))
|
|
CombinationSubjectiveQuestionEditor_defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var CombinationSubjectiveQuestionEditor_spreadProps = (a, b) => CombinationSubjectiveQuestionEditor_defProps(a, CombinationSubjectiveQuestionEditor_getOwnPropDescs(b));
|
|
var CombinationSubjectiveQuestionEditor_objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (CombinationSubjectiveQuestionEditor_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && CombinationSubjectiveQuestionEditor_getOwnPropSymbols)
|
|
for (var prop of CombinationSubjectiveQuestionEditor_getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && CombinationSubjectiveQuestionEditor_propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const AnswerTextFormItem = (_a) => {
|
|
var _b = _a, { value, onChange } = _b, props = CombinationSubjectiveQuestionEditor_objRest(_b, ["value", "onChange"]);
|
|
const handleChange = (v) => {
|
|
onChange([v]);
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
markdown_editor/* default */.Z,
|
|
CombinationSubjectiveQuestionEditor_spreadProps(CombinationSubjectiveQuestionEditor_spreadValues({}, props), {
|
|
defaultValue: value == null ? void 0 : value[0],
|
|
onChange: handleChange
|
|
})
|
|
);
|
|
};
|
|
const test = (str) => {
|
|
if (!str) {
|
|
return false;
|
|
}
|
|
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 === "|") {
|
|
message/* 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_17_0_2_react.createElement(tag["default"], { closable: true, onClose, className: QuestionEditormodules/* default */.Z.keywordTag }, /* @__PURE__ */ _react_17_0_2_react.createElement("pre", { style: { margin: "0px", whiteSpace: "pre-wrap" } }, value.join(" \u6216 ")));
|
|
};
|
|
const CombinationSubjectiveQuestionEditor_SubjectiveQuestionEditor = ({
|
|
questionTitlePlaceholder,
|
|
form,
|
|
showKeywords,
|
|
isMustKeyWords = showKeywords,
|
|
titleKey = "name",
|
|
analysisKey = "analysis",
|
|
answerTexts = "answer_texts",
|
|
keywords = "keywords",
|
|
useKeywords = "use_keywords",
|
|
indexs
|
|
}) => {
|
|
const [editAnalysis, setEditAnalysis] = (0,_react_17_0_2_react.useState)(false);
|
|
const [keywordsInput, setKeywordsInput] = (0,_react_17_0_2_react.useState)("");
|
|
const [useKeywordsValue, setuseKeywordsValue] = (0,_react_17_0_2_react.useState)(false);
|
|
const questionScore = es_form["default"].useWatch("question_score", form);
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: QuestionEditormodules/* default */.Z.wrap }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: QuestionEditormodules/* default */.Z.questionTitleEditorWrap }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { label: "\u9898\u5E72", name: titleKey, labelCol: { span: 24 }, rules: [{ required: true }] }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
MdEditorInForm/* MdEditorInForm */.h,
|
|
{
|
|
scrollId: "name",
|
|
watch: true,
|
|
height: 140,
|
|
placeholder: questionTitlePlaceholder
|
|
}
|
|
))), /* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { label: "\u53C2\u8003\u7B54\u6848", name: answerTexts, labelCol: { span: 24 } }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
AnswerTextFormItem,
|
|
{
|
|
watch: true,
|
|
height: 140,
|
|
placeholder: "\u8BF7\u7F16\u8F91\u53C2\u8003\u7B54\u6848\uFF08\u975E\u5FC5\u586B\uFF09"
|
|
}
|
|
)), showKeywords && !isMustKeyWords && /* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { hidden: true, name: useKeywords, valuePropName: "checked" }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_switch/* default */.Z, { defaultChecked: true })), showKeywords && isMustKeyWords && /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { align: "middle", className: "mb30" }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { name: useKeywords, valuePropName: "checked" }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_switch/* default */.Z, { onChange: () => {
|
|
var _a, _b, _c, _d, _e, _f;
|
|
console.log(form.getFieldsValue());
|
|
setuseKeywordsValue((_c = (_b = (_a = form.getFieldsValue()) == null ? void 0 : _a.sub_item_banks) == null ? void 0 : _b[indexs]) == null ? void 0 : _c.use_keywords);
|
|
console.log((_f = (_e = (_d = form.getFieldsValue()) == null ? void 0 : _d.sub_item_banks) == null ? void 0 : _e[indexs]) == null ? void 0 : _f.use_keywords);
|
|
console.log(useKeywordsValue);
|
|
} })), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { className: "ml10" }, "\u5F00\u542F\u5173\u952E\u8BCD\u81EA\u52A8\u5224\u5206"), /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, null, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
tooltip/* 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_17_0_2_react.createElement(QuestionCircleOutlined/* default */.Z, { style: { color: "#3061D0", marginLeft: 6, cursor: "pointer" } })
|
|
))), (useKeywordsValue || !isMustKeyWords) && /* @__PURE__ */ _react_17_0_2_react.createElement(es_form["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_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: `${QuestionEditormodules/* default */.Z.title} mb10` }, !isMustKeyWords ? /* @__PURE__ */ _react_17_0_2_react.createElement("span", { style: { color: "#9096A3" } }, "\u5224\u5206\u5173\u952E\u8BCD") : "\u5173\u952E\u8BCD"), /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { align: "middle", className: "font14 mb30" }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: 1 }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
input["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(["sub_item_banks", ...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)) {
|
|
message/* 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: QuestionEditormodules/* 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_17_0_2_react.createElement(col/* 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 = CombinationSubjectiveQuestionEditor_objRest(_b, ["key", "name"]);
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { key, className: "mb20", style: { marginRight: 148 } }, /* @__PURE__ */ _react_17_0_2_react.createElement(col/* default */.Z, { flex: 1 }, /* @__PURE__ */ _react_17_0_2_react.createElement(row/* default */.Z, { align: "middle", justify: "space-between" }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, CombinationSubjectiveQuestionEditor_spreadProps(CombinationSubjectiveQuestionEditor_spreadValues({}, restField), { name: [name, "keyword"] }), /* @__PURE__ */ _react_17_0_2_react.createElement(KeywordTag, { onClose: () => remove(name) })), isMustKeyWords && /* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, CombinationSubjectiveQuestionEditor_spreadProps(CombinationSubjectiveQuestionEditor_spreadValues({}, restField), { name: [name, "score"], label: "\u5206\u503C", rules: [{ required: true }], className: QuestionEditormodules/* default */.Z.blankInputNumberWrapper }), /* @__PURE__ */ _react_17_0_2_react.createElement(input_number/* default */.Z, { className: QuestionEditormodules/* default */.Z.blankInput, min: 0.1, max: 100, precision: 1, style: { width: "100%" }, placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u5206\u6570" })))));
|
|
}))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { onClick: () => setEditAnalysis(true) }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { name: analysisKey, label: "\u9898\u76EE\u89E3\u6790", labelCol: { span: 24 } }, /* @__PURE__ */ _react_17_0_2_react.createElement(MdEditorInForm/* RegularInput */.x, { placeholder: "\u8BF7\u7F16\u8F91\u9898\u76EE\u89E3\u6790\uFF08\u975E\u5FC5\u586B\uFF09", isEdit: editAnalysis }))));
|
|
};
|
|
|
|
|
|
;// CONCATENATED MODULE: ./src/components/QuestionEditor/CombinationQuestionEditor.tsx
|
|
/* provided dependency */ var CombinationQuestionEditor_React = __webpack_require__(/*! react */ 59301);
|
|
var CombinationQuestionEditor_defProp = Object.defineProperty;
|
|
var CombinationQuestionEditor_defProps = Object.defineProperties;
|
|
var CombinationQuestionEditor_getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var CombinationQuestionEditor_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var CombinationQuestionEditor_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var CombinationQuestionEditor_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var CombinationQuestionEditor_defNormalProp = (obj, key, value) => key in obj ? CombinationQuestionEditor_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var CombinationQuestionEditor_spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (CombinationQuestionEditor_hasOwnProp.call(b, prop))
|
|
CombinationQuestionEditor_defNormalProp(a, prop, b[prop]);
|
|
if (CombinationQuestionEditor_getOwnPropSymbols)
|
|
for (var prop of CombinationQuestionEditor_getOwnPropSymbols(b)) {
|
|
if (CombinationQuestionEditor_propIsEnum.call(b, prop))
|
|
CombinationQuestionEditor_defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var CombinationQuestionEditor_spreadProps = (a, b) => CombinationQuestionEditor_defProps(a, CombinationQuestionEditor_getOwnPropDescs(b));
|
|
var CombinationQuestionEditor_objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (CombinationQuestionEditor_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && CombinationQuestionEditor_getOwnPropSymbols)
|
|
for (var prop of CombinationQuestionEditor_getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && CombinationQuestionEditor_propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { Panel } = collapse["default"];
|
|
const CombinationQuestionEditor = ({
|
|
questionTitlePlaceholder,
|
|
choiceKey,
|
|
form,
|
|
withScore
|
|
}) => {
|
|
const [activeKey, setActiveKey] = (0,_react_17_0_2_react.useState)([]);
|
|
const handleCollapseChange = (keys) => {
|
|
setActiveKey(keys);
|
|
};
|
|
return /* @__PURE__ */ CombinationQuestionEditor_React.createElement("div", { className: QuestionEditormodules/* default */.Z.wrap }, /* @__PURE__ */ CombinationQuestionEditor_React.createElement("div", { className: QuestionEditormodules/* default */.Z.questionTitleEditorWrap }, /* @__PURE__ */ CombinationQuestionEditor_React.createElement(es_form["default"].Item, { label: "\u9898\u5E72", name: "name", labelCol: { span: 24 }, rules: [{ required: true }] }, /* @__PURE__ */ CombinationQuestionEditor_React.createElement(
|
|
MdEditorInForm/* MdEditorInForm */.h,
|
|
{
|
|
scrollId: "name",
|
|
watch: true,
|
|
height: 140,
|
|
placeholder: questionTitlePlaceholder
|
|
}
|
|
))), /* @__PURE__ */ CombinationQuestionEditor_React.createElement(es_form["default"].Item, { label: "\u5C0F\u9898", required: true, labelCol: { span: 24 } }), /* @__PURE__ */ CombinationQuestionEditor_React.createElement(es_form["default"].List, { name: "sub_item_banks", rules: [{
|
|
validator(rule, values) {
|
|
if (!values) {
|
|
return Promise.reject(new Error("\u8BF7\u6DFB\u52A0\u5C0F\u9898"));
|
|
}
|
|
return Promise.resolve();
|
|
}
|
|
}] }, (fields, { add, remove }) => {
|
|
const item_list = form.getFieldValue("sub_item_banks");
|
|
return /* @__PURE__ */ CombinationQuestionEditor_React.createElement(CombinationQuestionEditor_React.Fragment, null, /* @__PURE__ */ CombinationQuestionEditor_React.createElement(
|
|
collapse["default"],
|
|
{
|
|
className: fields.length > 0 ? QuestionEditormodules/* default */.Z.collapseWrapper : "",
|
|
bordered: false,
|
|
activeKey,
|
|
onChange: handleCollapseChange,
|
|
expandIcon: ({ isActive }) => /* @__PURE__ */ CombinationQuestionEditor_React.createElement("i", { className: `iconfont icon-weizhankai ${isActive ? QuestionEditormodules/* default */.Z.open : QuestionEditormodules/* default */.Z.close}`, style: { fontSize: 14, transition: "all .2s" } })
|
|
},
|
|
fields.map((_a, index) => {
|
|
var _b = _a, { key, name } = _b, restField = CombinationQuestionEditor_objRest(_b, ["key", "name"]);
|
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
return /* @__PURE__ */ CombinationQuestionEditor_React.createElement(
|
|
Panel,
|
|
{
|
|
className: QuestionEditormodules/* default */.Z.panel,
|
|
forceRender: true,
|
|
header: /* @__PURE__ */ CombinationQuestionEditor_React.createElement("div", { className: QuestionEditormodules/* default */.Z.panelHeader }, "\u7B2C", index + 1, "\u5C0F\u9898", /* @__PURE__ */ CombinationQuestionEditor_React.createElement("span", null, "\uFF08", ((_a2 = item_list == null ? void 0 : item_list[name]) == null ? void 0 : _a2.item_type) == "SINGLE" ? "\u5355\u9009\u9898" : ((_b2 = item_list == null ? void 0 : item_list[name]) == null ? void 0 : _b2.item_type) == "MULTIPLE" ? "\u591A\u9009\u9898" : ((_c = item_list == null ? void 0 : item_list[name]) == null ? void 0 : _c.item_type) == "COMPLETION" ? "\u586B\u7A7A\u9898" : ((_d = item_list == null ? void 0 : item_list[name]) == null ? void 0 : _d.item_type) == "JUDGMENT" ? "\u5224\u65AD\u9898" : "\u7B80\u7B54\u9898", "\uFF09")),
|
|
key: name,
|
|
extra: /* @__PURE__ */ CombinationQuestionEditor_React.createElement(row/* default */.Z, { align: "middle", onClick: (e) => e.stopPropagation() }, withScore && /* @__PURE__ */ CombinationQuestionEditor_React.createElement(es_form["default"].Item, CombinationQuestionEditor_spreadProps(CombinationQuestionEditor_spreadValues({}, restField), { rules: [{ required: true, message: "\u8BF7\u8F93\u5165\u5C0F\u9898\u5206\u503C" }], label: "\u5206\u503C", name: [name, "question_score"], className: QuestionEditormodules/* default */.Z.blankInputNumberWrapper }), /* @__PURE__ */ CombinationQuestionEditor_React.createElement(input_number/* default */.Z, { className: QuestionEditormodules/* default */.Z.blankInput, placeholder: "\u8BF7\u8F93\u5165\u5F53\u524D\u5C0F\u9898\u5206\u6570", min: 0.1, precision: 1, max: 100, style: { width: 150 } })), /* @__PURE__ */ CombinationQuestionEditor_React.createElement(tooltip/* default */.Z, { title: "\u5220\u9664" }, /* @__PURE__ */ CombinationQuestionEditor_React.createElement(
|
|
MinusCircleOutlined/* default */.Z,
|
|
{
|
|
className: `${QuestionEditormodules/* default */.Z.deleteIcon} ml40`,
|
|
onClick: () => remove(name)
|
|
}
|
|
)))
|
|
},
|
|
/* @__PURE__ */ CombinationQuestionEditor_React.createElement(
|
|
es_form["default"].Item,
|
|
CombinationQuestionEditor_spreadProps(CombinationQuestionEditor_spreadValues({}, restField), {
|
|
name
|
|
}),
|
|
(((_e = item_list == null ? void 0 : item_list[name]) == null ? void 0 : _e.item_type) == "SINGLE" || ((_f = item_list == null ? void 0 : item_list[name]) == null ? void 0 : _f.item_type) == "MULTIPLE") && /* @__PURE__ */ CombinationQuestionEditor_React.createElement(
|
|
ChoiceQuestionEditor/* ChoiceQuestionEditor */.u,
|
|
{
|
|
questionTitlePlaceholder: "\u8BF7\u7F16\u8F91\u9009\u62E9\u9898\u9898\u5E72\u5185\u5BB9",
|
|
allowChangeMode: ((_g = item_list == null ? void 0 : item_list[name]) == null ? void 0 : _g.item_type) == "MULTIPLE" ? true : false,
|
|
form,
|
|
choiceKey: [name, "choices"],
|
|
titleKey: [name, "name"],
|
|
analysisKey: [name, "analysis"],
|
|
choiceOptionsPath: ["sub_item_banks", name, "choices"],
|
|
choiceTextKey: "choice_text",
|
|
answerKey: "is_answer"
|
|
}
|
|
),
|
|
((_h = item_list == null ? void 0 : item_list[name]) == null ? void 0 : _h.item_type) == "COMPLETION" && /* @__PURE__ */ CombinationQuestionEditor_React.createElement(
|
|
CombinationCompletionQuestionEditor_CompletionQuestionEditor,
|
|
{
|
|
form,
|
|
questionTitlePlaceholder: "\u8BF7\u7F16\u8F91\u9898\u5E72\u5E76\u8BBE\u7F6E\u586B\u7A7A\u9879",
|
|
scoreByBlank: false,
|
|
name,
|
|
titleKey: [name, "name"],
|
|
analysisKey: [name, "analysis"],
|
|
isOrdered: [name, "is_ordered"],
|
|
answerKey: [name, "standard_answers"]
|
|
}
|
|
),
|
|
((_i = item_list == null ? void 0 : item_list[name]) == null ? void 0 : _i.item_type) == "JUDGMENT" && /* @__PURE__ */ CombinationQuestionEditor_React.createElement(
|
|
CombinationJudgmentQuestionEditor_JudgmentQuestionEditor,
|
|
{
|
|
form,
|
|
questionTitlePlaceholder: "\u8BF7\u7F16\u8F91\u5224\u65AD\u9898\u9898\u5E72\u5185\u5BB9",
|
|
titleKey: [name, "name"],
|
|
analysisKey: [name, "analysis"],
|
|
choiceKey: [name, "choices"]
|
|
}
|
|
),
|
|
((_j = item_list == null ? void 0 : item_list[name]) == null ? void 0 : _j.item_type) == "SUBJECTIVE" && /* @__PURE__ */ CombinationQuestionEditor_React.createElement(
|
|
CombinationSubjectiveQuestionEditor_SubjectiveQuestionEditor,
|
|
{
|
|
showKeywords: true,
|
|
isMustKeyWords: false,
|
|
form,
|
|
titleKey: [name, "name"],
|
|
analysisKey: [name, "analysis"],
|
|
answerTexts: [name, "answer_texts"],
|
|
useKeywords: [name, "use_keywords"],
|
|
keywords: [name, "keywords"],
|
|
indexs: name,
|
|
questionTitlePlaceholder: "\u8BF7\u7F16\u8F91\u7B80\u7B54\u9898\u9898\u5E72\u5185\u5BB9"
|
|
}
|
|
)
|
|
)
|
|
);
|
|
})
|
|
), fields.length < 20 && /* @__PURE__ */ CombinationQuestionEditor_React.createElement(
|
|
dropdown/* default */.Z,
|
|
{
|
|
menu: {
|
|
items: [
|
|
{
|
|
label: /* @__PURE__ */ CombinationQuestionEditor_React.createElement("div", { onClick: () => {
|
|
add({
|
|
name: "",
|
|
choices: Array.from({ length: 4 }, () => ({ choice_text: "", is_answer: 0 })),
|
|
analysis: "",
|
|
item_type: "SINGLE"
|
|
});
|
|
setActiveKey([fields == null ? void 0 : fields.length, ...activeKey]);
|
|
} }, "\u5355\u9009\u9898"),
|
|
key: "1",
|
|
show: true
|
|
},
|
|
{
|
|
label: /* @__PURE__ */ CombinationQuestionEditor_React.createElement("div", { onClick: () => {
|
|
add({
|
|
name: "",
|
|
choices: Array.from({ length: 4 }, () => ({ choice_text: "", is_answer: 0 })),
|
|
analysis: "",
|
|
item_type: "MULTIPLE"
|
|
});
|
|
setActiveKey([fields == null ? void 0 : fields.length, ...activeKey]);
|
|
} }, "\u591A\u9009\u9898"),
|
|
key: "2",
|
|
show: true
|
|
},
|
|
{
|
|
label: /* @__PURE__ */ CombinationQuestionEditor_React.createElement("div", { onClick: () => {
|
|
add({
|
|
name: "",
|
|
choices: [{ choice_text: "\u6B63\u786E", is_answer: 0 }, { choice_text: "\u9519\u8BEF", is_answer: 0 }],
|
|
analysis: "",
|
|
item_type: "JUDGMENT"
|
|
});
|
|
setActiveKey([fields == null ? void 0 : fields.length, ...activeKey]);
|
|
} }, "\u5224\u65AD\u9898"),
|
|
key: "3",
|
|
show: true
|
|
},
|
|
{
|
|
label: /* @__PURE__ */ CombinationQuestionEditor_React.createElement("div", { onClick: () => {
|
|
add({
|
|
name: "",
|
|
analysis: "",
|
|
is_ordered: true,
|
|
standard_answers: [],
|
|
item_type: "COMPLETION",
|
|
downcase: true,
|
|
no_space: true
|
|
});
|
|
setActiveKey([fields == null ? void 0 : fields.length, ...activeKey]);
|
|
} }, "\u586B\u7A7A\u9898"),
|
|
key: "4",
|
|
show: true
|
|
},
|
|
{
|
|
label: /* @__PURE__ */ CombinationQuestionEditor_React.createElement("div", { onClick: () => {
|
|
add({
|
|
name: "",
|
|
answer_texts: [],
|
|
keywords: [],
|
|
use_keywords: true,
|
|
analysis: "",
|
|
item_type: "SUBJECTIVE"
|
|
});
|
|
setActiveKey([fields == null ? void 0 : fields.length, ...activeKey]);
|
|
} }, "\u7B80\u7B54\u9898"),
|
|
key: "5",
|
|
show: true
|
|
}
|
|
].filter((item) => item.show).map((item) => ({ label: item.label, key: item.key }))
|
|
}
|
|
},
|
|
/* @__PURE__ */ CombinationQuestionEditor_React.createElement("div", { className: `${QuestionEditormodules/* default */.Z.addBtn}` }, "\u6DFB\u52A0\u5C0F\u9898")
|
|
));
|
|
}));
|
|
};
|
|
|
|
|
|
// EXTERNAL MODULE: ./src/components/QuestionEditor/BProgramEditor.tsx
|
|
var BProgramEditor = __webpack_require__(46858);
|
|
;// CONCATENATED MODULE: ./src/components/QuestionEditor/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |