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.
NewEduCoderBuild/p__Classrooms__Lists__Exerc...

10590 lines
472 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[292,39547,93211,15490],{
/***/ 95338:
/*!*********************************!*\
!*** ./src/pages/tasks/util.js ***!
\*********************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Ax: function() { return /* binding */ processTreeData; },
/* harmony export */ Ds: function() { return /* binding */ debounce; },
/* harmony export */ KI: function() { return /* binding */ apiPref; },
/* harmony export */ SI: function() { return /* binding */ getTreeData; },
/* harmony export */ f1: function() { return /* binding */ isCompileOk; }
/* harmony export */ });
/* unused harmony export isProd */
/* harmony import */ var _utils_env__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/utils/env */ 2367);
function isCompileOk(rs) {
var flag = true;
if (rs.length > 0) {
for (var i = 0; i < rs.length; i++) {
if (rs[i].compile_success == 0 || !rs[i].compile_success) {
flag = false;
break;
}
}
} else {
flag = false;
}
return flag;
}
function getTreeData(data) {
var parentKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var result = [];
for (var i = 0; i < data.length; i++) {
var item = data[i];
var key = parentKey ? "".concat(parentKey, "/").concat(item.name) : "".concat(item.name);
result.push({
title: item.name,
isLeaf: item.type === 'tree' ? false : true,
key: key
});
}
return result;
}
function processTreeData(repos, key, newData) {
for (var i = 0; i < repos.length; i++) {
var item = repos[i];
if (item.key === key) {
item.children = newData;
break;
}
if (item.children) {
processTreeData(item.children, key, newData);
}
}
return repos;
}
function debounce(func, wait, immediate) {
var timeout;
return function () {
var context = this,
args = arguments;
var later = function later() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
}
var isProd = true;
var apiPref = _utils_env__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.API_SERVER;
// export const isProd =
// window.location.href.indexOf('test-') > 0 ||
// window.location.href.indexOf('localhost') > 0
// ? false
// : true;
// export const apiPref = isProd
// ? 'https://www.educoder.net'
// : 'https://test-newweb.educoder.net';
/***/ }),
/***/ 8354:
/*!***********************************************************!*\
!*** ./src/components/DigitalLabel/index.tsx + 1 modules ***!
\***********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ components_DigitalLabel; }
});
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
;// CONCATENATED MODULE: ./src/components/DigitalLabel/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var DigitalLabelmodules = ({"digitalLabel":"digitalLabel___tImKs","active":"active___Ck70Q"});
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/components/DigitalLabel/index.tsx
var DigitalLabel = function DigitalLabel(_ref) {
var number = _ref.number,
active = _ref.active,
className = _ref.className;
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "".concat(DigitalLabelmodules.digitalLabel, " ").concat(active ? DigitalLabelmodules.active : '', " ").concat(className),
children: number
});
};
/* harmony default export */ var components_DigitalLabel = (DigitalLabel);
/***/ }),
/***/ 15490:
/*!***************************************************************!*\
!*** ./src/components/ReuseShixunModal/index.tsx + 1 modules ***!
\***************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ components_ReuseShixunModal; },
P: function() { return /* binding */ useReuseModal; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/toConsumableArray.js
var toConsumableArray = __webpack_require__(37205);
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectWithoutProperties.js
var objectWithoutProperties = __webpack_require__(39647);
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(7557);
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
var objectSpread2 = __webpack_require__(82242);
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(41498);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(79800);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./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/modal/index.js + 16 modules
var modal = __webpack_require__(43418);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/radio/index.js + 5 modules
var es_radio = __webpack_require__(5112);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
var input = __webpack_require__(62680);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/table/index.js + 85 modules
var table = __webpack_require__(90508);
;// CONCATENATED MODULE: ./src/components/ReuseShixunModal/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var ReuseShixunModalmodules = ({"brief":"brief___LOzpE","contentTitle":"contentTitle___xkdcN","content":"content___Vtri0","tips":"tips___tuAtH","antdTable":"antdTable___s8T2N","tableCell":"tableCell___kN9Fw","antdModal":"antdModal___WVBk3","orangeColor":"orangeColor___ryB2u"});
// EXTERNAL MODULE: ./src/service/shixuns.ts
var shixuns = __webpack_require__(17782);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/components/ReuseShixunModal/index.tsx
var _excluded = ["isImportMultipleCourse"];
var StudentInfo = function StudentInfo(_ref) {
var studentNames = _ref.studentNames,
total = _ref.total;
var Map = ['', '一', '两', '三'];
return total > 3 ? /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: ["\u8BFE\u5802\u5185\u6709", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: ReuseShixunModalmodules.orangeColor,
children: studentNames === null || studentNames === void 0 ? void 0 : studentNames.join('、')
}), "\u7B49", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: ReuseShixunModalmodules.orangeColor,
children: total
}), "\u540D\u5B66\u751F"]
}) : /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: ["\u8BFE\u5802\u5185\u6709", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: ReuseShixunModalmodules.orangeColor,
children: studentNames === null || studentNames === void 0 ? void 0 : studentNames.join('、')
}), Map[total], "\u540D\u5B66\u751F"]
});
};
//根据使用场景区分文案
var generateBrief = function generateBrief(_ref2) {
var used = _ref2.used,
copy = _ref2.copy,
canNotCopy = _ref2.canNotCopy,
studentNames = _ref2.studentNames,
studentCount = _ref2.studentCount,
inPaper = _ref2.inPaper,
_ref2$is_random = _ref2.is_random,
is_random = _ref2$is_random === void 0 ? false : _ref2$is_random,
_ref2$position = _ref2.position,
position = _ref2$position === void 0 ? '' : _ref2$position;
var copyStatusDescribe = function copyStatusDescribe() {
if (copy > 0 && canNotCopy > 0) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: ["\u5176\u4E2D", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: ReuseShixunModalmodules.orangeColor,
children: copy
}), "\u4E2A\u9879\u76EE\u652F\u6301\u590D\u5236\uFF0C", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: ReuseShixunModalmodules.orangeColor,
children: canNotCopy
}), "\u4E2A\u9879\u76EE\u4E0D\u652F\u6301\u590D\u5236"]
});
} else if (copy > 0 && canNotCopy === 0) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: ["\u5176\u4E2D", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: ReuseShixunModalmodules.orangeColor,
children: copy
}), "\u4E2A\u9879\u76EE\u652F\u6301\u590D\u5236"]
});
} else if (copy === 0 && canNotCopy > 0) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: ["\u5176\u4E2D", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: ReuseShixunModalmodules.orangeColor,
children: canNotCopy
}), "\u4E2A\u9879\u76EE\u4E0D\u652F\u6301\u590D\u5236"]
});
}
};
var currentPosition = position || (inPaper ? '试卷' : '课程');
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(StudentInfo, {
studentNames: studentNames,
total: studentCount
}), "\u5B66\u4E60\u8FC7", currentPosition, "\u4E2D\u7684", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: ReuseShixunModalmodules.orangeColor,
children: used
}), "\u4E2A\u9879\u76EE\uFF0C", copyStatusDescribe(), "\u3002\u8BF7\u9009\u62E9", is_random ? '' : '是否继续使用和', "\u662F\u5426\u590D\u5236\u4E3A\u65B0\u9879\u76EE\u53D1\u9001\u81F3\u8BFE\u5802\u4E2D\uFF1F"]
});
};
//单个实训时的情况
var ReuseSingleShixunModal = function ReuseSingleShixunModal(_ref3) {
var onCancel = _ref3.onCancel,
onOk = _ref3.onOk,
visible = _ref3.visible,
inPaper = _ref3.inPaper,
renderData = _ref3.renderData,
type = _ref3.type,
_ref3$isMultipleCours = _ref3.isMultipleCourse,
isMultipleCourse = _ref3$isMultipleCours === void 0 ? false : _ref3$isMultipleCours;
var _Form$useForm = es_form/* default */.Z.useForm(),
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
form = _Form$useForm2[0];
var _useState = (0,_react_17_0_2_react.useState)(1),
_useState2 = slicedToArray_default()(_useState, 2),
radioValue = _useState2[0],
setRadioValue = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(false),
_useState4 = slicedToArray_default()(_useState3, 2),
confirmLoading = _useState4[0],
setConfirmLoading = _useState4[1];
var canCopy = (0,_react_17_0_2_react.useMemo)(function () {
return (renderData === null || renderData === void 0 ? void 0 : renderData.total_num) === 1 && (renderData === null || renderData === void 0 ? void 0 : renderData.can_copy_num) === 1;
}, [renderData]);
var courseDataList = (0,_react_17_0_2_react.useMemo)(function () {
var _renderData$course_da;
return renderData === null || renderData === void 0 || (_renderData$course_da = renderData.course_data_list) === null || _renderData$course_da === void 0 ? void 0 : _renderData$course_da.filter(function (e) {
return e.is_show;
});
}, [renderData]);
return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
children: canCopy ? /*#__PURE__*/(0,jsx_runtime.jsxs)(modal/* default */.Z, {
centered: true,
closable: true,
open: visible,
destroyOnClose: true,
title: "\u63D0\u793A",
className: ReuseShixunModalmodules.antdModal,
width: 682,
confirmLoading: confirmLoading,
onCancel: onCancel,
onOk: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var data, _renderData$course_da2, param;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
setConfirmLoading(true);
data = radioValue;
if (isMultipleCourse) {
param = objectSpread2_default()({}, form.getFieldsValue());
data = renderData === null || renderData === void 0 || (_renderData$course_da2 = renderData.course_data_list) === null || _renderData$course_da2 === void 0 ? void 0 : _renderData$course_da2.map(function (e) {
if (param[e.id] !== undefined) {
return objectSpread2_default()(objectSpread2_default()({}, e), {}, {
is_copy: param[e.id]
});
}
return e;
});
}
_context.next = 5;
return onOk(data);
case 5:
setConfirmLoading(false);
case 6:
case "end":
return _context.stop();
}
}, _callee);
})),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: ReuseShixunModalmodules.content,
style: {
marginBottom: 20
},
children: isMultipleCourse ? '检测到以下课堂已在教学课堂中使用,请问是否复制成新的实训发送至教学课堂中?' : /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(StudentInfo, {
studentNames: renderData === null || renderData === void 0 ? void 0 : renderData.student_names,
total: renderData === null || renderData === void 0 ? void 0 : renderData.student_count
}), "\u5B66\u4E60\u8FC7\u8BE5\u5B9E\u8DF5\u9879\u76EE\u3002\u8BE5\u9879\u76EE\u652F\u6301\u590D\u5236\uFF0C\u8BF7\u9009\u62E9\u662F\u5426\u5C06\u8BE5\u9879\u76EE\u590D\u5236\u4E3A\u65B0\u9879\u76EE\u53D1\u9001\u81F3\u8BFE\u5802\u4E2D\uFF1F"]
})
}), isMultipleCourse ? /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z, {
form: form,
preserve: false,
children: courseDataList === null || courseDataList === void 0 ? void 0 : courseDataList.map(function (item) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("h3", {
className: "ml15 mb5",
children: item.name
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: item.id,
initialValue: 1,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default.Group */.ZP.Group, {
className: ReuseShixunModalmodules.content,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: 1,
style: {
color: '#464f66'
},
children: "\u590D\u5236\u5B9E\u8BAD"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: 0,
style: {
color: '#464f66'
},
children: "\u4E0D\u590D\u5236\u5B9E\u8BAD"
})]
})
})]
}, item.id);
})
}) : /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default.Group */.ZP.Group, {
value: radioValue,
onChange: function onChange(e) {
return setRadioValue(e.target.value);
},
className: ReuseShixunModalmodules.content,
style: {
marginBottom: 30
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: 1,
style: {
color: '#464f66'
},
children: "\u590D\u5236"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: 0,
style: {
color: '#464f66'
},
children: "\u4E0D\u590D\u5236"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: ReuseShixunModalmodules.content,
style: {
marginBottom: 10
},
children: "* \u8BF4\u660E\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: ReuseShixunModalmodules.content,
style: {
marginBottom: 20
},
children: "1\u3001\u590D\u5236\uFF1A\u7CFB\u7EDF\u5C06\u590D\u5236\u5E76\u521B\u5EFA\u4E00\u4E2A\u65B0\u7684\u9879\u76EE\u53D1\u9001\u5230\u8BFE\u5802\u4E2D\u4F7F\u7528\uFF08\u4E0D\u4F1A\u590D\u5236\u5B66\u751F\u7684\u6311\u6218\u8BB0\u5F55\uFF09\uFF0C\u65B0\u7684\u9879\u76EE\u652F\u6301\u8FDB\u884C\u7F16\u8F91\u5E76\u4E0E\u539F\u9879\u76EE\u4FE1\u606F\u4E92\u4E0D\u5F71\u54CD\u3002"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "".concat(ReuseShixunModalmodules.content, " ").concat(ReuseShixunModalmodules.orangeColor),
children: "2\u3001\u4E0D\u590D\u5236\uFF1A\u5F53\u524D\u9879\u76EE\u4F1A\u88AB\u76F4\u63A5\u53D1\u9001\u5230\u8BFE\u5802\u4E2D\u4F7F\u7528\uFF0C\u6311\u6218\u8FC7\u8BE5\u9879\u76EE\u7684\u5B66\u751F\u518D\u6B21\u8FDB\u5165\u9879\u76EE\u5F00\u542F\u6311\u6218\u65F6\uFF0C\u4F1A\u6E05\u7A7A\u4E4B\u524D\u7684\u6311\u6218\u8BB0\u5F55\u3002"
})]
})]
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
centered: true,
closable: true,
destroyOnClose: true,
open: visible,
confirmLoading: confirmLoading,
title: "\u63D0\u793A",
width: 682,
onCancel: onCancel,
onOk: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
var data, _renderData$course_da3, param;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
setConfirmLoading(true);
data = 0;
if (isMultipleCourse) {
param = objectSpread2_default()({}, form.getFieldsValue());
data = renderData === null || renderData === void 0 || (_renderData$course_da3 = renderData.course_data_list) === null || _renderData$course_da3 === void 0 ? void 0 : _renderData$course_da3.map(function (e) {
if (param[e.id] !== undefined) {
return objectSpread2_default()(objectSpread2_default()({}, e), {}, {
is_use: param[e.id]
});
}
return e;
});
}
_context2.next = 5;
return onOk(data);
case 5:
setConfirmLoading(false);
case 6:
case "end":
return _context2.stop();
}
}, _callee2);
})),
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: ReuseShixunModalmodules.content,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(StudentInfo, {
studentNames: renderData === null || renderData === void 0 ? void 0 : renderData.student_names,
total: renderData === null || renderData === void 0 ? void 0 : renderData.student_count
}), "\u5B66\u4E60\u8FC7\u8BE5\u5B9E\u8DF5\u9879\u76EE\u3002", isMultipleCourse ? /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
form: form,
preserve: false,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("h3", {
children: "\u5F53\u524D\u5B9E\u8BAD\u4E0D\u53EF\u590D\u5236\uFF0C\u5DF2\u7ECF\u68C0\u6D4B\u5230\u4EE5\u4E0B\u8BFE\u5802\u5B58\u5728\u8BE5\u5B9E\u8BAD\uFF0C\u540C\u4E00\u5B9E\u8BAD\u5728\u8BFE\u5802\u4E2D\u91CD\u590D\u4F7F\u7528\u65F6\uFF0C\u4F1A\u5BFC\u81F4\u6210\u7EE9\u4E92\u76F8\u5F71\u54CD\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u7EE7\u7EED\u4F7F\u7528"
}), courseDataList === null || courseDataList === void 0 ? void 0 : courseDataList.map(function (item) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("h3", {
className: "ml15 mb5",
children: item.name
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: item.id,
initialValue: 1,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default.Group */.ZP.Group, {
className: ReuseShixunModalmodules.content,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: 1,
style: {
color: '#464f66'
},
children: "\u7EE7\u7EED\u4F7F\u7528"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: 0,
style: {
color: '#464f66'
},
children: "\u4E0D\u4F7F\u7528"
})]
})
})]
}, item.id);
})]
}) : /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: ["\u8BE5\u9879\u76EE\u4E0D\u652F\u6301\u590D\u5236\uFF0C\u82E5\u786E\u8BA4\u7EE7\u7EED\u53D1\u9001\uFF0C", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: ReuseShixunModalmodules.orangeColor,
children: "\u5F53\u524D\u9879\u76EE\u4F1A\u88AB\u76F4\u63A5\u53D1\u9001\u5230\u8BFE\u5802\u4E2D\u4F7F\u7528\uFF0C\u6311\u6218\u8FC7\u8BE5\u9879\u76EE\u7684\u5B66\u751F\u518D\u6B21\u8FDB\u5165\u9879\u76EE\u5F00\u542F\u6311\u6218\u65F6\uFF0C\u4F1A\u6E05\u7A7A\u4E4B\u524D\u7684\u6311\u6218\u8BB0\u5F55\u3002"
}), "\uFF08\u5982\u679C\u4E0D\u60F3\u6E05\u7A7A\u5B66\u751F\u4E4B\u524D\u7684\u6311\u6218\u8BB0\u5F55\uFF0C\u5EFA\u8BAE\u53C2\u7167\u8BE5\u5B9E\u8DF5\u9879\u76EE\u7684\u5185\u5BB9\u81EA\u884C\u521B\u5EFA\u4E00\u4E2A\u65B0\u7684\u9879\u76EE\uFF0C\u6216\u8005\u5C1D\u8BD5\u8054\u7CFB\u9879\u76EE\u521B\u5EFA\u4EBA\u5F00\u653E\u672C\u9879\u76EE\u7684\u590D\u5236\u6743\u9650\uFF09\u3002"]
})]
})
})
});
};
var useReuseModal = function useReuseModal() {
var _useState5 = (0,_react_17_0_2_react.useState)(false),
_useState6 = slicedToArray_default()(_useState5, 2),
modalVisible = _useState6[0],
setModalVisible = _useState6[1];
var _useState7 = (0,_react_17_0_2_react.useState)(),
_useState8 = slicedToArray_default()(_useState7, 2),
renderData = _useState8[0],
setRenderData = _useState8[1];
var closeModalFn = function closeModalFn() {
return setModalVisible(false);
};
var showModal = /*#__PURE__*/function () {
var _ref6 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(reqParams) {
var _reqParams$isImportMu, isImportMultipleCourse, param, res, _res$course_data_list, isModalVisible;
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
_reqParams$isImportMu = reqParams.isImportMultipleCourse, isImportMultipleCourse = _reqParams$isImportMu === void 0 ? false : _reqParams$isImportMu, param = objectWithoutProperties_default()(reqParams, _excluded);
_context3.next = 3;
return (0,shixuns/* checkShixunCopy */.Tr)(param);
case 3:
res = _context3.sent;
if (!('status' in res)) {
_context3.next = 6;
break;
}
return _context3.abrupt("return", false);
case 6:
if (!isImportMultipleCourse) {
_context3.next = 13;
break;
}
isModalVisible = res === null || res === void 0 || (_res$course_data_list = res.course_data_list) === null || _res$course_data_list === void 0 ? void 0 : _res$course_data_list.some(function (e) {
return e.is_show;
});
if (!isModalVisible) {
_context3.next = 12;
break;
}
setRenderData(res);
setModalVisible(true);
return _context3.abrupt("return", true);
case 12:
return _context3.abrupt("return", res.course_data_list || []);
case 13:
if (!(res.student_count === 0)) {
_context3.next = 15;
break;
}
return _context3.abrupt("return", false);
case 15:
setRenderData(res);
setModalVisible(true);
return _context3.abrupt("return", true);
case 18:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return function showModal(_x) {
return _ref6.apply(this, arguments);
};
}();
return [modalVisible, closeModalFn, renderData, showModal];
};
//多个实训时的情况
var ReuseMultipleShixunModal = function ReuseMultipleShixunModal(props) {
var _Form$useForm3 = es_form/* default */.Z.useForm(),
_Form$useForm4 = slicedToArray_default()(_Form$useForm3, 1),
form = _Form$useForm4[0];
var _useState9 = (0,_react_17_0_2_react.useState)(false),
_useState10 = slicedToArray_default()(_useState9, 2),
confirmLoading = _useState10[0],
setConfirmLoading = _useState10[1];
var onCancel = props.onCancel,
onOk = props.onOk,
visible = props.visible,
_props$inPaper = props.inPaper,
inPaper = _props$inPaper === void 0 ? false : _props$inPaper,
renderData = props.renderData,
type = props.type,
_props$isMultipleCour = props.isMultipleCourse,
isMultipleCourse = _props$isMultipleCour === void 0 ? false : _props$isMultipleCour,
position = props.position;
var reproducibleShixunColumns = (0,_react_17_0_2_react.useMemo)(function () {
return inPaper ? [{
title: '实践项目名称',
dataIndex: 'name',
width: 424,
align: 'center',
ellipsis: true,
className: ReuseShixunModalmodules.tableCell,
render: function render(text, record) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
href: "/shixuns/".concat(record.identifier, "/challenges"),
target: "_blank",
children: text
});
}
}, {
title: '是否复制',
dataIndex: 'is_copy',
align: 'center',
render: function render(value, record) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: ["".concat(type === 'subject' ? record.stage_shixun_id : record.shixun_course_id || record.id), 'is_copy'],
initialValue: 1,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default.Group */.ZP.Group, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: 1,
children: "\u662F"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: 0,
children: "\u5426"
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: ["".concat(type === 'subject' ? record === null || record === void 0 ? void 0 : record.stage_shixun_id : record.shixun_course_id || record.id), 'is_use'],
hidden: true,
initialValue: 1,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
type: "hidden"
})
})]
});
}
}] : [{
title: '实践项目名称',
dataIndex: 'name',
width: 424,
align: 'center',
ellipsis: true,
className: ReuseShixunModalmodules.tableCell,
render: function render(text, record) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
href: "/shixuns/".concat(record.identifier, "/challenges"),
target: "_blank",
children: text
});
}
}, {
title: '是否使用',
dataIndex: 'is_use',
align: 'center',
render: function render(value, record) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: ["".concat(type === 'subject' ? record.stage_shixun_id : record.shixun_course_id || record.id), 'is_use'],
initialValue: 1,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default.Group */.ZP.Group, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: 1,
children: "\u662F"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: 0,
children: "\u5426"
})]
})
});
}
}, {
title: '是否复制',
dataIndex: 'is_copy',
align: 'center',
render: function render(value, record) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: ["".concat(type === 'subject' ? record.stage_shixun_id : record.shixun_course_id || record.id), 'is_copy'],
initialValue: 1,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default.Group */.ZP.Group, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: 1,
children: "\u662F"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: 0,
children: "\u5426"
})]
})
});
}
}];
}, [inPaper]);
var irreproducibleShixunColumns = (0,_react_17_0_2_react.useMemo)(function () {
return inPaper ? [{
title: '实践项目名称',
dataIndex: 'name',
width: 424,
className: ReuseShixunModalmodules.tableCell,
align: 'center',
ellipsis: true,
render: function render(value, record) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("a", {
href: "/shixuns/".concat(record.identifier, "/challenges"),
target: "_blank",
children: value
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: ["".concat(type === 'subject' ? record === null || record === void 0 ? void 0 : record.stage_shixun_id : record.shixun_course_id || record.id), 'is_copy'],
hidden: true,
initialValue: 0,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
type: "hidden"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: ["".concat(type === 'subject' ? record === null || record === void 0 ? void 0 : record.stage_shixun_id : record.shixun_course_id || record.id), 'is_use'],
hidden: true,
initialValue: 1,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
type: "hidden"
})
})]
});
}
}] : [{
title: '实践项目名称',
dataIndex: 'name',
width: 424,
className: ReuseShixunModalmodules.tableCell,
ellipsis: true,
align: 'center',
render: function render(text, record) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
href: "/shixuns/".concat(record.identifier, "/challenges"),
target: "_blank",
children: text
});
}
}, {
title: '是否使用',
dataIndex: 'is_use',
align: 'center',
render: function render(value, record) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: ["".concat(type === 'subject' ? record === null || record === void 0 ? void 0 : record.stage_shixun_id : record.shixun_course_id || record.id), 'is_use'],
initialValue: 0,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default.Group */.ZP.Group, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: 1,
children: "\u662F"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: 0,
children: "\u5426"
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: ["".concat(type === 'subject' ? record === null || record === void 0 ? void 0 : record.stage_shixun_id : record.shixun_course_id || record.id), 'is_copy'],
hidden: true,
initialValue: 0,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
type: "hidden"
})
})]
});
}
}];
}, [inPaper]);
//可以选择多个课堂的时候
if (isMultipleCourse) {
var param = {
title: '课堂名称',
ellipsis: true,
dataIndex: 'course_name',
width: 190,
align: 'center',
className: ReuseShixunModalmodules.tableCell,
render: function render(text, record) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
href: "/classrooms/".concat(record.course_id),
children: text
});
}
};
reproducibleShixunColumns = [param].concat(toConsumableArray_default()(reproducibleShixunColumns));
irreproducibleShixunColumns = [param].concat(toConsumableArray_default()(irreproducibleShixunColumns));
}
var dynamicBrief = (0,_react_17_0_2_react.useMemo)(function () {
return generateBrief({
used: renderData === null || renderData === void 0 ? void 0 : renderData.repeat_shixun_num,
copy: renderData === null || renderData === void 0 ? void 0 : renderData.can_copy_num,
canNotCopy: renderData === null || renderData === void 0 ? void 0 : renderData.no_copy_num,
studentNames: renderData === null || renderData === void 0 ? void 0 : renderData.student_names,
studentCount: renderData === null || renderData === void 0 ? void 0 : renderData.student_count,
is_random: renderData === null || renderData === void 0 ? void 0 : renderData.is_random,
inPaper: inPaper,
position: position
});
}, [renderData, inPaper, position]);
return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
title: "\u63D0\u793A",
centered: true,
open: visible,
confirmLoading: confirmLoading,
onOk: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
var formValues, ids;
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
setConfirmLoading(true);
formValues = form.getFieldsValue();
ids = Object.keys(formValues).map(function (key) {
return {
id: parseInt(key.split('_')[0]),
course_id: parseInt(key.split('_')[1]),
is_use: formValues[key].is_use,
is_copy: formValues[key].is_copy
};
});
_context4.next = 5;
return onOk(ids);
case 5:
setConfirmLoading(false);
case 6:
case "end":
return _context4.stop();
}
}, _callee4);
})),
onCancel: onCancel,
width: 880,
okText: "\u786E\u8BA4",
className: ReuseShixunModalmodules.antdModal,
destroyOnClose: true,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
form: form,
preserve: false,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: ReuseShixunModalmodules.brief,
children: dynamicBrief
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
marginBottom: 30
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
marginBottom: 20
},
children: "* \u8BF4\u660E"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
marginBottom: 20
},
children: "1\u3001\u590D\u5236\uFF1A\u7CFB\u7EDF\u5C06\u590D\u5236\u5E76\u521B\u5EFA\u4E00\u4E2A\u65B0\u7684\u9879\u76EE\u53D1\u9001\u5230\u8BFE\u5802\u4E2D\u4F7F\u7528\uFF08\u4E0D\u4F1A\u590D\u5236\u5B66\u751F\u7684\u6311\u6218\u8BB0\u5F55\uFF09\uFF0C\u65B0\u7684\u9879\u76EE\u652F\u6301\u8FDB\u884C\u7F16\u8F91\u5E76\u4E0E\u539F\u9879\u76EE\u4FE1\u606F\u4E92\u4E0D\u5F71\u54CD\u3002"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: ReuseShixunModalmodules.orangeColor,
children: "2\u3001\u4E0D\u590D\u5236\uFF1A\u5F53\u524D\u9879\u76EE\u4F1A\u88AB\u76F4\u63A5\u53D1\u9001\u5230\u8BFE\u5802\u4E2D\u4F7F\u7528\uFF0C\u6311\u6218\u8FC7\u8BE5\u9879\u76EE\u7684\u5B66\u751F\u518D\u6B21\u8FDB\u5165\u9879\u76EE\u5F00\u542F\u6311\u6218\u65F6\uFF0C\u4F1A\u6E05\u7A7A\u4E4B\u524D\u7684\u6311\u6218\u8BB0\u5F55\u3002"
})]
}), (renderData === null || renderData === void 0 ? void 0 : renderData.can_copy_num) > 0 && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: ReuseShixunModalmodules.contentTitle,
children: "\u652F\u6301\u590D\u5236\u7684\u9879\u76EE"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
columns: reproducibleShixunColumns,
className: ReuseShixunModalmodules.antdTable,
dataSource: renderData === null || renderData === void 0 ? void 0 : renderData.can_copy_list,
rowKey: type === 'subject' ? "stage_shixun_id" : 'id',
pagination: false,
scroll: {
y: 240
},
bordered: true
})]
}), (renderData === null || renderData === void 0 ? void 0 : renderData.no_copy_num) > 0 && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: ReuseShixunModalmodules.contentTitle,
children: "\u4E0D\u652F\u6301\u590D\u5236\u7684\u9879\u76EE"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
columns: irreproducibleShixunColumns,
className: ReuseShixunModalmodules.antdTable,
dataSource: renderData === null || renderData === void 0 ? void 0 : renderData.no_copy_list,
rowKey: type === 'subject' ? "stage_shixun_id" : 'id',
pagination: false,
scroll: {
y: 200
},
bordered: true
})]
}), (renderData === null || renderData === void 0 ? void 0 : renderData.no_use_list.length) > 0 && (renderData === null || renderData === void 0 ? void 0 : renderData.no_use_list.map(function (record) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: ["".concat(type === 'subject' ? record === null || record === void 0 ? void 0 : record.stage_shixun_id : record.shixun_course_id || record.id), 'is_copy'],
hidden: true,
initialValue: 0,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
type: "hidden"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: ["".concat(type === 'subject' ? record === null || record === void 0 ? void 0 : record.stage_shixun_id : record.shixun_course_id || record.id), 'is_use'],
hidden: true,
initialValue: 1,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
type: "hidden"
})
})]
}, type === 'subject' ? record.stage_shixun_id : record.shixun_course_id || record.id);
}))]
})
});
};
var ReuseShixunModal = function ReuseShixunModal(props) {
var modalType = props.modalType;
return modalType === 'multiple' ? /*#__PURE__*/(0,jsx_runtime.jsx)(ReuseMultipleShixunModal, objectSpread2_default()({}, props)) : /*#__PURE__*/(0,jsx_runtime.jsx)(ReuseSingleShixunModal, objectSpread2_default()({}, props));
};
/* harmony default export */ var components_ReuseShixunModal = (ReuseShixunModal);
/***/ }),
/***/ 34130:
/*!*************************************************************!*\
!*** ./src/components/markdown-editor/code-block/index.tsx ***!
\*************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ h: function() { return /* binding */ MyCodeMirror; }
/* harmony export */ });
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js */ 82242);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js */ 79800);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ 59301);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd */ 57809);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! antd */ 78241);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! antd */ 3113);
/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! codemirror */ 89780);
/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(codemirror__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var codemirror_lib_codemirror_css__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! codemirror/lib/codemirror.css */ 61586);
/* harmony import */ var codemirror_theme_blackboard_css__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! codemirror/theme/blackboard.css */ 11960);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
var Option = antd__WEBPACK_IMPORTED_MODULE_7__["default"].Option;
//https://github.com/codemirror/CodeMirror/issues/4838
var formItemLayout = {
labelCol: {
span: 4
},
wrapperCol: {
span: 20
}
};
var LanguageDesc = {
asp: ['ASP', 'vbscript'],
actionscript: ['ActionScript(3.0)/Flash/Flex', 'clike'],
bash: ['Bash/Bat', 'shell'],
css: ['CSS', 'css'],
c: ['C', 'clike'],
cpp: ['C++', 'clike'],
csharp: ['C#', 'clike'],
coffeescript: ['CoffeeScript', 'coffeescript'],
d: ['D', 'd'],
dart: ['Dart', 'dart'],
delphi: ['Delphi/Pascal', 'pascal'],
erlang: ['Erlang', 'erlang'],
go: ['Golang', 'go'],
groovy: ['Groovy', 'groovy'],
html: ['HTML', 'text/html'],
java: ['Java', 'clike'],
json: ['JSON', 'text/json'],
javascript: ['Javascript', 'javascript'],
lua: ['Lua', 'lua'],
less: ['LESS', 'css'],
markdown: ['Markdown', 'gfm'],
'objective-c': ['Objective-C', 'clike'],
php: ['PHP', 'php'],
perl: ['Perl', 'perl'],
python: ['Python', 'python'],
r: ['R', 'r'],
rst: ['reStructedText', 'rst'],
ruby: ['Ruby', 'ruby'],
sql: ['SQL', 'sql'],
sass: ['SASS/SCSS', 'sass'],
shell: ['Shell', 'shell'],
scala: ['Scala', 'clike'],
swift: ['Swift', 'clike'],
vb: ['VB/VBScript', 'vb'],
xml: ['XML', 'text/xml'],
yaml: ['YAML', 'yaml']
};
/* harmony default export */ __webpack_exports__.Z = (function (_ref) {
var callback = _ref.callback,
onCancel = _ref.onCancel;
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)('python'),
_useState2 = _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState, 2),
mode = _useState2[0],
setMode = _useState2[1];
function onSetMode(value) {
setMode(LanguageDesc[value][1]);
}
function onSubmit(values) {
callback(values);
}
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formItemLayout), {}, {
className: "code-block-panel",
initialValues: {
language: 'python',
content: ''
},
onFinish: onSubmit,
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.Item, {
label: "\u4EE3\u7801\u8BED\u8A00",
name: "language",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_7__["default"], {
getPopupContainer: function getPopupContainer(trigger) {
return trigger.parentNode;
},
onChange: onSetMode,
children: Object.keys(LanguageDesc).map(function (item) {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(Option, {
value: item,
children: LanguageDesc[item][0]
}, item);
})
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.Item, {
label: "\u4EE3\u7801\u5185\u5BB9",
name: "content",
rules: [{
required: true,
message: '请输入代码内容'
}],
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(MyCodeMirror, {
mode: mode
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", {
className: "flex-container flex-end",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .ZP, {
type: "primary",
htmlType: "submit",
style: {
marginRight: 10
},
children: "\u786E\u5B9A"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .ZP, {
type: "ghost",
onClick: onCancel,
children: "\u53D6\u6D88"
})]
})]
}));
});
function MyCodeMirror(_ref2) {
var value = _ref2.value,
onChange = _ref2.onChange,
mode = _ref2.mode,
_ref2$options = _ref2.options,
options = _ref2$options === void 0 ? {} : _ref2$options;
var el = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)();
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(),
_useState4 = _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState3, 2),
cm = _useState4[0],
setCm = _useState4[1];
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
if (cm) {
var onChangeHandler = function onChangeHandler(cm) {
var content = cm.getValue();
onChange && onChange(content);
};
cm.on('change', onChangeHandler);
return function () {
cm.off('change', onChangeHandler);
};
}
}, [cm, onChange]);
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
if (cm) {
cm.setOption('mode', mode);
}
}, [cm, mode]);
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
if (cm) {
if (value !== cm.getValue() || value === '') {
setTimeout(function () {
cm.setValue(value || '');
}, 300);
}
}
}, [cm, value]);
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
if (el.current && !cm) {
var instance = codemirror__WEBPACK_IMPORTED_MODULE_3___default().fromTextArea(el.current, _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({
mode: mode,
lineNumbers: true,
lineWrapping: true,
autoCloseBrackets: true,
tabSize: 4,
autofocus: true,
autoCloseTags: true,
matchBrackets: true,
styleActiveLine: true
}, options));
setCm(instance);
}
}, [el.current, cm]);
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", {
className: "my-codemirror-container",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("textarea", {
ref: el
})
});
}
/***/ }),
/***/ 32679:
/*!***************************************************************!*\
!*** ./src/components/markdown-editor/index.tsx + 10 modules ***!
\***************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ markdown_editor; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/createForOfIteratorHelper.js
var createForOfIteratorHelper = __webpack_require__(91232);
var createForOfIteratorHelper_default = /*#__PURE__*/__webpack_require__.n(createForOfIteratorHelper);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(7557);
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(41498);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(79800);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/defineProperty.js
var defineProperty = __webpack_require__(85573);
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/lib/codemirror.js
var codemirror = __webpack_require__(89780);
var codemirror_default = /*#__PURE__*/__webpack_require__.n(codemirror);
// EXTERNAL MODULE: ./node_modules/_resize-observer-polyfill@1.5.1@resize-observer-polyfill/dist/ResizeObserver.es.js
var ResizeObserver_es = __webpack_require__(76374);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/lib/codemirror.css
var lib_codemirror = __webpack_require__(61586);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/addon/edit/closetag.js
var closetag = __webpack_require__(6313);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/addon/edit/closebrackets.js
var closebrackets = __webpack_require__(25717);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/addon/display/placeholder.js
var placeholder = __webpack_require__(99498);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/mode/markdown/markdown.js
var markdown = __webpack_require__(25419);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/mode/stex/stex.js
var stex = __webpack_require__(67549);
;// CONCATENATED MODULE: ./src/components/markdown-editor/index.less
// extracted by mini-css-extract-plugin
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 2 modules
var RenderHtml = __webpack_require__(70917);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/components/RenderHtml/stex.tsx
// const latexjs = require('latex-l.js/dist/latex.js');
// import "latex-l.js/dist/css/base.css"
/* harmony default export */ var RenderHtml_stex = (function (_ref) {
var _ref$value = _ref.value,
value = _ref$value === void 0 ? '' : _ref$value,
className = _ref.className,
showTextOnly = _ref.showTextOnly,
showLines = _ref.showLines,
_ref$style = _ref.style,
style = _ref$style === void 0 ? {} : _ref$style;
var html = (0,_react_17_0_2_react.useMemo)(function () {
// try {
// const latex = value || 'This is some text';
// let generator = new latexjs.default.HtmlGenerator({ hyphenate: true })
// let doc = latexjs.default.parse(latex, { generator: generator }).htmlDocument()
// return doc.body.innerHTML
// }catch(e){
// console.log("e:",e)
// return "错误的latex语法请检查"
// }
return "";
}, [value]);
return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
dangerouslySetInnerHTML: {
__html: html
}
})
});
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
var objectSpread2 = __webpack_require__(82242);
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
;// CONCATENATED MODULE: ./src/components/markdown-editor/toolbar/index.less
// extracted by mini-css-extract-plugin
;// CONCATENATED MODULE: ./src/components/markdown-editor/css/iconfont.css
// extracted by mini-css-extract-plugin
;// CONCATENATED MODULE: ./src/components/markdown-editor/toolbar/index.tsx
var DEFAULTICONS = [{
title: '粗体',
icon: 'icon-bold',
actionName: 'bold'
}, {
title: '斜体',
icon: 'icon-italic',
actionName: 'italic'
}, '|', {
title: '无序列表',
icon: 'icon-unorder-list',
actionName: 'list-ul'
}, {
title: '有序列表',
icon: 'icon-order-list',
actionName: 'list-ol'
}, '|', {
title: '行内代码',
icon: 'icon-code',
actionName: 'code'
}, {
title: '代码块(多语言风格)',
icon: 'icon-file-code',
actionName: 'code-block'
}, {
title: '链接',
icon: 'icon-link',
actionName: 'link'
}, '|', {
title: '行内公式',
icon: 'icon-sum',
actionName: 'inline-latex'
}, {
title: '多行公式',
icon: 'icon-formula',
actionName: 'latex'
}, '|', {
title: '添加图片',
icon: 'icon-picture',
actionName: 'upload-image'
}, {
title: '表格',
icon: 'icon-table',
actionName: 'add-table'
}, '|', {
title: '换行',
icon: 'icon-minus',
actionName: 'line-break'
}, {
title: '清空',
icon: 'icon-eraser',
actionName: 'eraser'
}];
function AButton(_ref) {
var onActionCallback = _ref.onActionCallback,
title = _ref.title,
icon = _ref.icon,
actionName = _ref.actionName,
_ref$className = _ref.className,
className = _ref$className === void 0 ? '' : _ref$className,
children = _ref.children;
function onAction() {
onActionCallback(actionName);
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
title: title,
className: className,
onClick: onAction,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "md-iconfont ".concat(icon)
}), children]
});
}
/* harmony default export */ var toolbar = (function (_ref2) {
var watch = _ref2.watch,
showNullButton = _ref2.showNullButton,
showNullProgramButton = _ref2.showNullProgramButton,
onActionCallback = _ref2.onActionCallback,
fullScreen = _ref2.fullScreen,
insertTemp = _ref2.insertTemp,
hidetoolBar = _ref2.hidetoolBar;
var icons = [].concat(DEFAULTICONS, [{
title: "".concat(watch ? '关闭实时预览' : '开启实时预览'),
icon: "".concat(watch ? 'icon-eye-slash' : 'icon-eye'),
actionName: 'trigger-watch'
}]);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
className: "markdown-toolbar-container",
children: [!hidetoolBar && icons.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: item.actionName ? /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, objectSpread2_default()(objectSpread2_default()({}, item), {}, {
onActionCallback: onActionCallback
})) : /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "v-line"
})
}, index);
}), showNullButton ? /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
icon: "icon-edit insert-blank",
className: "btn-null",
title: "\u589E\u52A0\u586B\u7A7A",
actionName: "add-null-ch",
onActionCallback: onActionCallback,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "fill-tip",
children: "\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"
})
})
}) : null, showNullProgramButton ? /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
icon: "icon-edit insert-blank",
className: "btn-null",
title: "\u589E\u52A0\u586B\u7A7A",
actionName: "add-signal",
onActionCallback: onActionCallback,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "fill-tip",
children: "\u6DFB\u52A0\u5355\u884C\u586B\u7A7A\u9879"
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
icon: "icon-uniE900 insert-blank",
className: "btn-null",
title: "\u589E\u52A0\u586B\u7A7A",
actionName: "add-multiple",
onActionCallback: onActionCallback,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "fill-tip",
children: "\u6DFB\u52A0\u591A\u884C\u586B\u7A7A\u9879"
})
})
})]
}) : null, insertTemp && /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
icon: "icon-edit",
className: "btn-null",
title: "\u63D2\u5165\u6A21\u677F",
actionName: "inster-template-".concat(insertTemp),
onActionCallback: onActionCallback,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "fill-tip",
children: "\u63D2\u5165\u6A21\u677F"
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
className: "btn-full-screen",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
icon: "".concat(fullScreen ? 'icon-shrink' : 'icon-enlarge'),
title: fullScreen ? '关闭全屏' : '开启全屏',
actionName: "trigger-full-screen",
onActionCallback: onActionCallback
})
})]
});
});
// EXTERNAL MODULE: ./src/components/modal.tsx
var modal = __webpack_require__(17437);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/form/index.js + 19 modules
var es_form = __webpack_require__(78241);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
var input = __webpack_require__(62680);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
var es_button = __webpack_require__(3113);
;// CONCATENATED MODULE: ./src/components/markdown-editor/link/index.tsx
var formItemLayout = {
labelCol: {
span: 4
},
wrapperCol: {
span: 20
}
};
/* harmony default export */ var markdown_editor_link = (function (_ref) {
var callback = _ref.callback,
onCancel = _ref.onCancel;
function onSubmit(values) {
callback(values);
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, objectSpread2_default()(objectSpread2_default()({}, formItemLayout), {}, {
initialValues: {
link: 'http://',
title: ''
},
className: "link-panel",
onFinish: onSubmit,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u94FE\u63A5\u5730\u5740",
name: "link",
rules: [{
required: true,
message: '请输入链接地址'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u94FE\u63A5\u6807\u9898",
name: "title",
rules: [{
required: true,
message: '请输入链接标题'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "flex-container flex-end",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "primary",
htmlType: "submit",
style: {
marginRight: 10
},
children: "\u786E\u5B9A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "ghost",
onClick: onCancel,
children: "\u53D6\u6D88"
})]
})]
}));
});
// EXTERNAL MODULE: ./src/components/markdown-editor/code-block/index.tsx
var code_block = __webpack_require__(34130);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
var message = __webpack_require__(8591);
;// CONCATENATED MODULE: ./src/components/markdown-editor/upload-image/index.less
// extracted by mini-css-extract-plugin
// EXTERNAL MODULE: ./src/pages/tasks/util.js
var util = __webpack_require__(95338);
;// CONCATENATED MODULE: ./src/components/markdown-editor/upload-image/index.tsx
var useForm = es_form/* default */.Z.useForm;
var style = {
width: 280,
marginRight: 10
};
var upload_image_formItemLayout = {
labelCol: {
span: 5
},
wrapperCol: {
span: 19
}
};
/* harmony default export */ var upload_image = (function (_ref) {
var callback = _ref.callback,
onCancel = _ref.onCancel;
var _useForm = useForm(),
_useForm2 = slicedToArray_default()(_useForm, 1),
form = _useForm2[0];
var nameRef = (0,_react_17_0_2_react.useRef)();
function onSubmit(values) {
callback(objectSpread2_default()(objectSpread2_default()({}, values), {}, {
name: nameRef.current
}));
}
function onAddUrl(data, file) {
if (data.status === -1) {
message/* default */.ZP.error(data.message);
return;
}
form.setFieldsValue({
src: "/api/attachments/".concat(data.id),
type: file.type
});
}
function onFileChange(e) {
var file = e.target.files[0];
nameRef.current = file.name;
uploadImage(file, onAddUrl);
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, objectSpread2_default()(objectSpread2_default()({
form: form
}, upload_image_formItemLayout), {}, {
className: "upload-image-panel",
onFinish: onSubmit,
style: {
width: 470,
overflow: "hidden"
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u56FE\u7247\u5730\u5740",
required: true,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "flex-container",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
noStyle: true,
name: "src",
rules: [{
required: true,
message: '请输入文件地址'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
style: style
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(UploadButton, {
onFileChange: onFileChange
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u56FE\u7247\u63CF\u8FF0",
name: "alt"
// rules={[{ required: true, message: '请输入图片描述' }]}
,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
style: {
width: 264
}
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z.Item, {
style: {
textAlign: "right"
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "primary",
htmlType: "submit",
style: {
marginRight: 10
},
children: "\u786E\u5B9A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "default",
onClick: onCancel,
children: "\u53D6\u6D88"
})]
})]
}));
});
function UploadButton(_ref2) {
var onFileChange = _ref2.onFileChange;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("label", {
className: "upload-button",
style: {
cursor: "pointer"
},
children: ["\u672C\u5730\u4E0A\u4F20", /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
type: "file",
onChange: onFileChange
})]
});
}
function uploadImage(file, callback) {
if (!file) {
throw new String('没有文件');
return;
}
var formData = new FormData();
formData.append('editormd-image-file', file);
formData.append('file_param_name', 'editormd-image-file');
formData.append('byxhr', 'true');
var xhr = new window.XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('load', function (response) {
callback(JSON.parse(response.target.responseText), file);
}, false);
xhr.addEventListener('error', function (error) {
console.error(error);
}, false);
xhr.open('POST', "".concat(util/* apiPref */.KI, "/api/attachments.json"));
xhr.send(formData);
}
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/radio/index.js + 5 modules
var es_radio = __webpack_require__(5112);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input-number/index.js + 14 modules
var input_number = __webpack_require__(97913);
;// CONCATENATED MODULE: ./src/components/markdown-editor/add-table-panel/index.tsx
var RadioGroup = es_radio/* default.Group */.ZP.Group;
var add_table_panel_style = {
margin: '0 8px'
};
/* harmony default export */ var add_table_panel = (function (_ref) {
var callback = _ref.callback,
onCancel = _ref.onCancel;
function onSubmit(values) {
callback(values);
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
className: "add-table-panel",
initialValues: {
row: 3,
col: 2,
align: 'default'
},
onFinish: onSubmit,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "flex-container",
style: {
alignItems: "baseline"
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: add_table_panel_style,
children: "\u5355\u5143\u683C\u6570\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: add_table_panel_style,
children: "\u884C\u6570"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "row",
rules: [{
required: true,
message: '请输入行数'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: add_table_panel_style,
children: "\u5217\u6570"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "col",
rules: [{
required: true,
message: '请输入列数'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "flex-container",
style: {
marginTop: 12,
alignItems: "baseline"
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: add_table_panel_style,
children: "\u5BF9\u9F50\u65B9\u5F0F\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "align",
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(RadioGroup, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: "default",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "fa fa-align-justify"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: "left",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "fa fa-align-left"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: "center",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "fa fa-align-center"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: "right",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "fa fa-align-right"
})
})]
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "flex-container flex-end",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "primary",
htmlType: "submit",
style: {
marginRight: 10
},
children: "\u786E\u5B9A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "ghost",
onClick: onCancel,
children: "\u53D6\u6D88"
})]
})]
});
});
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
var env = __webpack_require__(2367);
// EXTERNAL MODULE: ./src/utils/fetch.ts
var fetch = __webpack_require__(56648);
// EXTERNAL MODULE: ./node_modules/_uuid@8.3.0@uuid/dist/esm-browser/v4.js + 4 modules
var v4 = __webpack_require__(1012);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
var es_modal = __webpack_require__(43418);
;// CONCATENATED MODULE: ./src/components/markdown-editor/constant.ts
var LINK = 'link';
var UPLOAD_IMAGE = 'upload-image';
var CODE_BLOCK = 'code-block';
var ADD_TABLE = 'add-table';
var HRLINE = '------------';
var ALIGNSIGN = {
"default": HRLINE,
left: ":".concat(HRLINE),
center: ":".concat(HRLINE, ":"),
right: "".concat(HRLINE, ":")
};
// EXTERNAL MODULE: ./src/components/useInterval.tsx
var useInterval = __webpack_require__(76587);
;// CONCATENATED MODULE: ./src/components/markdown-editor/index.tsx
function noop() {}
var pending = 0;
var StorageTimeTicket = 10000;
var NULL_CH = '▁';
var ADD_MULTI = '@▁▁@';
var ADD_SINGLE = '@▁@';
var TEMP1 = '\n**模板标题**\n模板正文内容可输入文本内容和粘贴图片等操作'; //课程须知模板
function processSize(size) {
return !/^\d+$/.test(size) ? size : "".concat(size, "px");
}
var isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
var key = isMac ? 'Cmd' : 'Ctrl';
var officeSix = ["pptm", "pptx", "ppt", "pot", "pps", "ppa", "potx", "ppsx", "ppam", "pptm", "potm", "ppsm", "doc", "docx", "dot", "dotx", "docm", "dotm", "xls", "xlsx", "csv", "xlt", "xla", "xltx", "xlsm", "xltm", "xlam", "xlsb"];
var DEFAULTKEYMAP = defineProperty_default()(defineProperty_default()({}, key + '-B', 'bold'), key + '-I', 'italic');
var TitleDesc = defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()({}, LINK, '添加链接'), CODE_BLOCK, '添加代码块'), UPLOAD_IMAGE, '添加文件'), ADD_TABLE, '添加表格');
//https://codemirror.net/demo
//The height can be set through CSS (by giving the .CodeMirror class a height property), or by calling the cm's setSize method.
/* harmony default export */ var markdown_editor = (function (_ref) {
var _ref$defaultValue = _ref.defaultValue,
defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
onChange = _ref.onChange,
_ref$width = _ref.width,
width = _ref$width === void 0 ? '100%' : _ref$width,
_ref$height = _ref.height,
height = _ref$height === void 0 ? 400 : _ref$height,
_ref$miniToolbar = _ref.miniToolbar,
miniToolbar = _ref$miniToolbar === void 0 ? false : _ref$miniToolbar,
_ref$isFocus = _ref.isFocus,
isFocus = _ref$isFocus === void 0 ? false : _ref$isFocus,
watch = _ref.watch,
insertTemp = _ref.insertTemp,
_ref$mode = _ref.mode,
mode = _ref$mode === void 0 ? "markdown" : _ref$mode,
_ref$id = _ref.id,
id = _ref$id === void 0 ? 'markdown-editor-id' : _ref$id,
_ref$showResizeBar = _ref.showResizeBar,
showResizeBar = _ref$showResizeBar === void 0 ? false : _ref$showResizeBar,
_ref$noStorage = _ref.noStorage,
noStorage = _ref$noStorage === void 0 ? false : _ref$noStorage,
_ref$showNullButton = _ref.showNullButton,
showNullButton = _ref$showNullButton === void 0 ? false : _ref$showNullButton,
_ref$showNullProgramB = _ref.showNullProgramButton,
showNullProgramButton = _ref$showNullProgramB === void 0 ? false : _ref$showNullProgramB,
_ref$hidetoolBar = _ref.hidetoolBar,
hidetoolBar = _ref$hidetoolBar === void 0 ? false : _ref$hidetoolBar,
_ref$fullScreen = _ref.fullScreen,
fullScreen = _ref$fullScreen === void 0 ? false : _ref$fullScreen,
onBlur = _ref.onBlur,
onCMBeforeChange = _ref.onCMBeforeChange,
onFullScreen = _ref.onFullScreen,
_ref$className = _ref.className,
className = _ref$className === void 0 ? '' : _ref$className,
_ref$disablePaste = _ref.disablePaste,
disablePaste = _ref$disablePaste === void 0 ? false : _ref$disablePaste,
_ref$disabled = _ref.disabled,
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
_ref$disabledFill = _ref.disabledFill,
disabledFill = _ref$disabledFill === void 0 ? false : _ref$disabledFill,
_ref$placeholder = _ref.placeholder,
placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
_ref$values = _ref.values,
values = _ref$values === void 0 ? '' : _ref$values;
var _useState = (0,_react_17_0_2_react.useState)(null),
_useState2 = slicedToArray_default()(_useState, 2),
cm = _useState2[0],
setCm = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(defaultValue),
_useState4 = slicedToArray_default()(_useState3, 2),
value = _useState4[0],
setValue = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)(watch),
_useState6 = slicedToArray_default()(_useState5, 2),
preview = _useState6[0],
setPreview = _useState6[1];
var _useState7 = (0,_react_17_0_2_react.useState)(fullScreen),
_useState8 = slicedToArray_default()(_useState7, 2),
isFull = _useState8[0],
setIsFull = _useState8[1];
var _useState9 = (0,_react_17_0_2_react.useState)(''),
_useState10 = slicedToArray_default()(_useState9, 2),
action = _useState10[0],
setAction = _useState10[1];
var _useState11 = (0,_react_17_0_2_react.useState)(0),
_useState12 = slicedToArray_default()(_useState11, 2),
lastedUpdateTime = _useState12[0],
setLastedUpdateTime = _useState12[1];
var _useState13 = (0,_react_17_0_2_react.useState)(height),
_useState14 = slicedToArray_default()(_useState13, 2),
h = _useState14[0],
setH = _useState14[1];
var _useState15 = (0,_react_17_0_2_react.useState)(false),
_useState16 = slicedToArray_default()(_useState15, 2),
tip = _useState16[0],
setTip = _useState16[1];
var uuidRef = (0,_react_17_0_2_react.useRef)((0,v4/* default */.Z)());
var openPhoneRef = (0,_react_17_0_2_react.useRef)(false);
var timer = (0,_react_17_0_2_react.useRef)();
var cmEl = (0,_react_17_0_2_react.useRef)();
var containerEl = (0,_react_17_0_2_react.useRef)();
var resizeBarEl = (0,_react_17_0_2_react.useRef)();
var previewEl = (0,_react_17_0_2_react.useRef)();
var checkFiles = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var _res$attachments;
var res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return (0,fetch/* default */.ZP)("/api/attachments/distinct_hash_val.json", {
method: "post",
body: {
hash_val: uuidRef.current
}
});
case 2:
res = _context.sent;
if (!!(res !== null && res !== void 0 && (_res$attachments = res.attachments) !== null && _res$attachments !== void 0 && _res$attachments.length)) {
console.log("cm:", cm, cmEl);
res.attachments.map(function (item) {
if (item.content_type.indexOf("image") > -1) {
cm.replaceSelection("![,](/api/attachments/".concat(item.id, "?type=").concat(item.content_type, ")"));
} else if (item.content_type.indexOf("video") > -1) {
cm.replaceSelection("<video width=\"100%\" controls src=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "\"></video>"));
} else if (item.content_type.indexOf("pdf") > -1) {
cm.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(item.id, "?type=").concat(item.content_type, "&disposition=inline\" target=\"_blank\">").concat(item.name, "</a>"));
} else {
cm.replaceSelection("[".concat(item.name, "](").concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(item.id, "?type=").concat(item.content_type, ")"));
}
});
}
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
return function checkFiles() {
return _ref2.apply(this, arguments);
};
}();
// useEffect(() => {
// setValue(defaultValue)
// cm?.setValue(defaultValue)
// },[])
(0,_react_17_0_2_react.useEffect)(function () {
var scrollTop = window.scrollY || window.pageYOffset;
setValue(values);
cm === null || cm === void 0 || cm.setValue(values);
window.scrollTo(0, scrollTop);
}, [values]);
(0,_react_17_0_2_react.useEffect)(function () {
onFullScreen === null || onFullScreen === void 0 || onFullScreen(isFull);
}, [isFull]);
(0,_react_17_0_2_react.useEffect)(function () {
if (cmEl.current) {
var onPaste = function onPaste(_, e) {
if (disablePaste) {
e.preventDefault();
return;
}
var clipboardData = e.clipboardData;
if (clipboardData) {
var types = clipboardData.types.toString();
var items = clipboardData.items;
if (types === 'Files' || clipboardData.types.indexOf("Files") > -1) {
e.preventDefault();
if (mode == "stex") return;
try {
var _items$;
var item = items[1];
if (((_items$ = items[0]) === null || _items$ === void 0 ? void 0 : _items$.kind) === 'file') {
item = items[0];
}
var file = item.getAsFile();
var fileSix = file.name.split(".").pop();
// console.log("item:", item, file, item?.type?.match(/^video\//i))
uploadImage(file, function (data) {
if (data.id) {
var _file$type, _file$type2, _file$type3;
if ((file === null || file === void 0 || (_file$type = file.type) === null || _file$type === void 0 ? void 0 : _file$type.indexOf("image")) > -1) {
instance.replaceSelection("![,](/api/attachments/".concat(data.id, "?type=").concat(data.content_type, ")"));
} else if ((file === null || file === void 0 || (_file$type2 = file.type) === null || _file$type2 === void 0 ? void 0 : _file$type2.indexOf("video")) > -1) {
instance.replaceSelection("<video width=\"100%\" controls src=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "\"></video>"));
} else if ((file === null || file === void 0 || (_file$type3 = file.type) === null || _file$type3 === void 0 ? void 0 : _file$type3.indexOf("pdf")) > -1) {
instance.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=").concat(file.type, "&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
} else if (officeSix.includes(fileSix)) {
instance.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=office&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
} else {
instance.replaceSelection("[".concat(file.name, "](").concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=").concat(data.content_type, ")"));
}
} else {
if ((data === null || data === void 0 ? void 0 : data.status) === 401) document.location.href = '/user/login';
}
});
} catch (e) {
message/* default */.ZP.warning("请使用chrome浏览器粘贴");
}
return true;
} else {
//toMarkdown ?
// let html = clipboardData.getData('text/html')
return true;
}
}
return true;
};
var instance = codemirror_default().fromTextArea(cmEl.current, {
mode: mode,
// inputStyle: 'contenteditable',
lineNumbers: miniToolbar ? false : true,
lineWrapping: true,
value: defaultValue,
autoCloseTags: showNullProgramButton ? false : true,
autoCloseBrackets: true
});
instance.on("keyup", function (cm, event) {
if (event.keyCode === 8) {
if (cm.getValue() == "") {
instance.setOption("placeholder", placeholder);
} else {
instance.setOption("placeholder", null);
}
}
});
instance.on("keydown", function (cm, event) {
if (event.keyCode === 8) {
var pos = deleteAtSymbol(cm);
if (pos) {
event.preventDefault();
}
}
});
isFocus && instance.focus();
instance.on('paste', onPaste);
instance.on('dragleave', function (data, e) {
containerEl.current.classList.remove("mouse-hover-md");
});
instance.on('dragover', function (data, e) {
containerEl.current.classList.add("mouse-hover-md");
});
instance.on('drop', function (data, e) {
containerEl.current.classList.add("mouse-hover-md");
// var file;
var files;
// Check if files were dropped
files = e.dataTransfer.files;
if (files.length > 0) {
e.preventDefault();
e.stopPropagation();
// file = files[0];
// alert('File: ' + file.name);
// return false;
var _loop = function _loop() {
var file = files[i];
var fileSix = file.name.split(".").pop();
uploadImage(file, function (data) {
if (data.id) {
var _file$type4, _file$type5, _file$type6;
if ((file === null || file === void 0 || (_file$type4 = file.type) === null || _file$type4 === void 0 ? void 0 : _file$type4.indexOf("image")) > -1) {
instance.replaceSelection("![,](/api/attachments/".concat(data.id, "?type=").concat(data.content_type, ")"));
} else if ((file === null || file === void 0 || (_file$type5 = file.type) === null || _file$type5 === void 0 ? void 0 : _file$type5.indexOf("video")) > -1) {
instance.replaceSelection("<video width=\"100%\" controls src=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "\"></video>"));
} else if ((file === null || file === void 0 || (_file$type6 = file.type) === null || _file$type6 === void 0 ? void 0 : _file$type6.indexOf("pdf")) > -1) {
instance.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=").concat(file.type, "&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
} else if (officeSix.includes(fileSix)) {
instance.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=office&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
} else {
instance.replaceSelection("[".concat(file.name, "](").concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=").concat(data.content_type, ")"));
}
} else {
if ((data === null || data === void 0 ? void 0 : data.status) === 401) document.location.href = '/user/login';
}
});
};
for (var i = 0; i < files.length; i++) {
_loop();
}
// files.map((file:any) => {
// })
}
});
if (disabled) {
instance.on("beforeChange", function (instances, change) {
if (change.origin === "paste" || change.origin === "+input") {
change.cancel();
}
});
}
setCm(instance);
return function () {
instance.off('paste', onPaste);
};
}
}, []);
var resizeEditorBodyHeight = (0,_react_17_0_2_react.useCallback)(function () {
if (containerEl.current) {
try {
// let toolH = containerEl.current.getElementsByClassName('markdown-toolbar-container')[0].offsetHeight
// let mdBody = containerEl.current.getElementsByClassName('markdown-editor-body')[0]
// if (!isFull) {
// mdBody.style.height = `${h - toolH}px`
// } else {
// mdBody.style.height = `calc(100vh - ${toolH}px)`
// }
} catch (error) {
console.log(error, '---- to set md editor body height');
}
}
}, [h, containerEl, isFull]);
(0,_react_17_0_2_react.useEffect)(function () {
function onLayout() {
var ro = new ResizeObserver_es/* default */.Z(function (entries) {
var _iterator = createForOfIteratorHelper_default()(entries),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var entry = _step.value;
if (entry.target.offsetHeight > 0 || entry.target.offsetWidth > 0) {
resizeEditorBodyHeight();
cm.setSize('100%', '100%');
cm.refresh();
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
});
ro.observe(cmEl.current.parentElement);
return ro;
}
if (cm) {
var ro = onLayout();
return function () {
var _cmEl$current, _cmEl$current2;
if ((_cmEl$current = cmEl.current) !== null && _cmEl$current !== void 0 && _cmEl$current.parentElement) ro.unobserve((_cmEl$current2 = cmEl.current) === null || _cmEl$current2 === void 0 ? void 0 : _cmEl$current2.parentElement);
};
}
}, [cm, resizeEditorBodyHeight]);
//keymap
(0,_react_17_0_2_react.useEffect)(function () {
if (cm) {
var keymap = [];
var _loop2 = function _loop2() {
var _Object$entries$_i = slicedToArray_default()(_Object$entries[_i], 2),
k = _Object$entries$_i[0],
value = _Object$entries$_i[1];
var map = defineProperty_default()({}, k, function () {
onActionCallback(value);
});
keymap.push(map);
cm.addKeyMap(map);
};
for (var _i = 0, _Object$entries = Object.entries(DEFAULTKEYMAP); _i < _Object$entries.length; _i++) {
_loop2();
}
timer.current = setInterval(function () {
if (openPhoneRef.current) {
checkFiles();
}
}, 4000);
return function () {
clearInterval(timer.current);
for (var _i2 = 0, _keymap = keymap; _i2 < _keymap.length; _i2++) {
var m = _keymap[_i2];
cm.removeKeyMap(m);
}
};
}
}, [cm]);
(0,_react_17_0_2_react.useEffect)(function () {
if (fullScreen !== isFull) {
setIsFull(fullScreen);
}
}, [fullScreen]);
(0,useInterval/* default */.Z)(function () {
if (!noStorage && lastedUpdateTime > 0) {
var currentTime = new Date().getTime();
var lastedValue = window.sessionStorage.getItem(id);
if (currentTime >= lastedUpdateTime + StorageTimeTicket && (!lastedValue || lastedValue !== value)) {
window.sessionStorage.setItem(id, value);
setTip(true);
}
}
}, StorageTimeTicket);
(0,_react_17_0_2_react.useEffect)(function () {
setPreview(watch);
}, [cm, watch]);
(0,_react_17_0_2_react.useEffect)(function () {
if (cm) {
isFocus && cm.focus();
}
}, [cm, isFocus]);
(0,_react_17_0_2_react.useEffect)(function () {
if (preview && cm) {
var syncScroll = function syncScroll(e) {
var target = e.target;
if (previewEl.current) {
var ratio = target.scrollTop / target.scrollHeight;
previewEl.current.scrollTop = previewEl.current.scrollHeight * ratio;
}
};
var scrollEl = cm.getScrollerElement();
scrollEl.addEventListener('scroll', syncScroll);
return function () {
scrollEl.removeEventListener('scroll', syncScroll);
};
}
}, [cm, preview]);
(0,_react_17_0_2_react.useEffect)(function () {
if (cm && onCMBeforeChange) {
var onChangeHandler = function onChangeHandler(cm, change) {
onCMBeforeChange(cm, change);
};
cm.on('beforeChange', onChangeHandler);
return function () {
cm.off('beforeChange', onChangeHandler);
};
}
}, [cm, onCMBeforeChange]);
(0,_react_17_0_2_react.useEffect)(function () {
if (cm && onBlur) {
var onBlurHandler = function onBlurHandler() {
onBlur(cm.getValue());
};
cm.on('blur', onBlurHandler);
return function () {
cm.off('blur', onBlurHandler);
};
}
}, [cm, onBlur]);
function deleteAtSymbol(cm, change) {
var doc = cm.getDoc();
var cursor = doc.getCursor();
var line = doc.getLine(cursor.line);
var ch = line.charAt(cursor.ch - 1);
var p1 = line.lastIndexOf("@▁@", cursor.ch);
var p2 = line.lastIndexOf("@▁▁@", cursor.ch);
var posStart = p1 > p2 ? p1 : p2;
var n = p1 > p2 ? 3 : 4;
if (ADD_MULTI.indexOf(ch) === -1) return null;
console.log("change1:", change, cm, line, cursor, posStart, p1, p2, ch);
if (posStart >= 0 && cursor.ch - posStart < 5) {
var posEnd = posStart + n;
doc.replaceRange("", {
line: cursor.line,
ch: posStart
}, {
line: cursor.line,
ch: posEnd
});
return {
line: cursor.line,
ch: posEnd
};
}
return null;
}
(0,_react_17_0_2_react.useEffect)(function () {
if (cm) {
var onChangeHandler = function onChangeHandler(cm, change) {
var content = cm.getValue();
setValue(content);
setLastedUpdateTime(new Date().getTime());
cm.getScrollerElement().dispatchEvent(new CustomEvent('scroll'));
if (onChange) {
if (showNullProgramButton) {
onChange(content, formatProgramFill(content));
} else {
onChange(content);
}
}
};
cm.on('change', onChangeHandler);
return function () {
cm.off('change', onChangeHandler);
};
}
}, [cm, onChange]);
(0,_react_17_0_2_react.useEffect)(function () {
if (cm) {
// isFocus && cm.focus()
if (defaultValue === null || defaultValue === undefined) {
cm.setValue('');
setValue('');
} else {
var scrollTop = window.scrollY || window.pageYOffset;
if (defaultValue !== cm.getValue()) {
cm.setValue(defaultValue);
setValue(defaultValue);
cm.setCursor(disabled ? 1 : cm.lineCount(), 0);
window.scrollTo(0, scrollTop);
}
}
}
}, [cm, defaultValue]);
var onActionCallback = (0,_react_17_0_2_react.useCallback)(function (actionName) {
var cursor = cm.getCursor();
var selection = cm.getSelection();
var selectionText = selection.split('\n');
switch (actionName) {
case 'bold':
cm.replaceSelection('**' + selection + '**');
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch + 2);
}
return cm.focus();
case 'italic':
cm.replaceSelection('*' + selection + '*');
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch + 1);
}
return cm.focus();
case 'code':
cm.replaceSelection('`' + selection + '`');
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch + 1);
}
return cm.focus();
case 'inline-latex':
cm.replaceSelection('`$$' + selection + '$$`');
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch + 3);
}
return cm.focus();
case 'latex':
cm.replaceSelection("```latex\n" + selection + "\n```");
cm.setCursor(cursor.line + 1, selection.length + 1);
return cm.focus();
case 'line-break':
cm.replaceSelection('<br/>\n');
return cm.focus();
case 'list-ul':
if (selection === '') {
cm.replaceSelection('- ' + selection);
} else {
cm.replaceSelection(selectionText.map(function (item) {
return item === '' ? '' : "- ".concat(item);
}).join('\n'));
}
return cm.focus();
case 'list-ol':
if (selection === '') {
cm.replaceSelection('1. ' + selection);
} else {
cm.replaceSelection(selectionText.map(function (item, index) {
return item === '' ? '' : "".concat(index + 1, ". ").concat(item);
}).join('\n'));
}
return cm.focus();
case 'add-null-ch':
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch);
}
cm.replaceSelection(NULL_CH);
return cm.focus();
case 'add-signal':
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch);
}
cm.replaceSelection(ADD_SINGLE);
return cm.focus();
case 'add-multiple':
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch);
}
cm.replaceSelection(ADD_MULTI);
return cm.focus();
case 'inster-template-1':
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch);
}
cm.replaceSelection(TEMP1);
return cm.focus();
case 'eraser':
cm.setValue('');
return cm.focus();
case 'trigger-watch':
setPreview(!preview);
return cm.focus();
case 'trigger-full-screen':
setIsFull(!isFull);
return cm.focus();
case LINK:
setAction(LINK);
return;
case CODE_BLOCK:
setAction(CODE_BLOCK);
return;
case UPLOAD_IMAGE:
setAction(UPLOAD_IMAGE);
return;
case ADD_TABLE:
setAction(ADD_TABLE);
return;
default:
throw new Error();
}
}, [cm, preview, isFull]);
var ExecutePluginAction = (0,_react_17_0_2_react.useCallback)(function (values) {
setAction('');
switch (action) {
case LINK:
var title = values.title,
link = values.link;
cm.replaceSelection("[".concat(title, "](").concat(link, ")"));
return cm.focus();
case CODE_BLOCK:
var language = values.language,
content = values.content;
cm.replaceSelection(['```' + language, content, '```'].join('\n'));
return cm.focus();
case UPLOAD_IMAGE:
var src = values.src,
alt = values.alt;
if (alt) {
cm.replaceSelection("![ ".concat(alt, " ]( ").concat(src, " \"").concat(alt, "\" )"));
} else {
cm.replaceSelection("![,](".concat(src, ")"));
}
return cm.focus();
case ADD_TABLE:
var row = values.row,
col = values.col,
align = values.align;
var table = '\n';
for (var r = 0; r < row; r++) {
var rows = [];
var heads = [];
for (var c = 0; c < col; c++) {
if (r === 1) {
heads.push(ALIGNSIGN[align]);
}
rows.push(' ');
}
if (r === 1) {
table += "| ".concat(heads.join(' | '), " |\n");
}
table += "| ".concat(rows.join(col === 1 ? '' : ' | '), " |\n");
}
cm.replaceSelection(table + '\n');
return cm.focus();
default:
throw new Error();
}
}, [cm, action]);
var PluginEl = (0,_react_17_0_2_react.useMemo)(function () {
switch (action) {
case LINK:
return /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor_link, {
callback: ExecutePluginAction,
onCancel: onCancel
});
case CODE_BLOCK:
return /*#__PURE__*/(0,jsx_runtime.jsx)(code_block/* default */.Z, {
callback: ExecutePluginAction,
onCancel: onCancel
});
case UPLOAD_IMAGE:
return /*#__PURE__*/(0,jsx_runtime.jsx)(upload_image, {
callback: ExecutePluginAction,
onCancel: onCancel
});
case ADD_TABLE:
return /*#__PURE__*/(0,jsx_runtime.jsx)(add_table_panel, {
callback: ExecutePluginAction,
onCancel: onCancel
});
default:
return null;
}
}, [action]);
function onCancel() {
setAction('');
}
(0,_react_17_0_2_react.useEffect)(function () {
if (resizeBarEl.current) {
var onMouseDown = function onMouseDown(e) {
dragging = true;
startY = e.pageY;
};
var onMouseUp = function onMouseUp() {
dragging = false;
};
var onMouseMove = function onMouseMove(e) {
if (dragging) {
var delta = e.pageY - startY;
if (delta < 0) {
delta = 0;
}
if (delta > 300) {
delta = 300;
}
var resizeH = height + delta + 'px';
setH(resizeH);
}
};
var resizeBar = resizeBarEl.current;
var dragging = false;
var startY = 0;
resizeBar.addEventListener('mousedown', onMouseDown);
document.addEventListener('mousemove', onMouseMove);
document.addEventListener('mouseup', onMouseUp);
return function () {
resizeBar.removeEventListener('mousedown', onMouseDown);
document.removeEventListener('mousemove', onMouseMove);
document.removeEventListener('mouseup', onMouseUp);
};
}
}, [cm, resizeBarEl]);
(0,_react_17_0_2_react.useEffect)(function () {
setH(height);
}, [height]);
var fixedWidth = processSize(width);
var fixedHeight = processSize(h);
var style = {
width: fixedWidth,
height: fixedHeight
};
var saveTime = (0,_react_17_0_2_react.useMemo)(function () {
if (lastedUpdateTime) {
var d = new Date(lastedUpdateTime);
var _h = d.getHours();
var m = d.getMinutes();
var s = d.getSeconds();
_h = _h < 10 ? '0' + _h : _h;
m = m < 10 ? '0' + m : m;
s = s < 10 ? '0' + s : s;
return "".concat(_h, ":").concat(m, ":").concat(s);
}
return 0;
}, [lastedUpdateTime]);
var formatProgramFill = function formatProgramFill(str) {
var arr = [];
if (showNullProgramButton) {
var num = -1;
str = str.replace(/(@▁▁@|@▁@)/g, function (a, b, c) {
arr.push({
multiLine: !(a === ADD_SINGLE)
});
});
}
return arr;
};
function onCancelStorage() {
window.sessionStorage.removeItem(id);
setTip(false);
setLastedUpdateTime(0);
}
function onReset() {
setTip(false);
setLastedUpdateTime(0);
cm.setValue(window.sessionStorage.getItem(id));
}
function setValues(a, b) {
var content = cm.getValue();
content = content.replace(a, b);
setValue(content);
cm === null || cm === void 0 || cm.setValue(content);
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "markdown-editor-wrapper",
ref: containerEl,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "markdown-editor-container ".concat(className, " ").concat(preview ? 'on-preview' : '', " ").concat(miniToolbar ? 'mini' : '', " ").concat(isFull ? 'full-screen' : ''),
style: style,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(toolbar, {
insertTemp: insertTemp,
watch: preview,
fullScreen: isFull,
showNullButton: showNullButton,
showNullProgramButton: showNullProgramButton,
onActionCallback: onActionCallback,
hidetoolBar: hidetoolBar,
uuid: uuidRef.current,
setOpenPhones: function setOpenPhones() {
openPhoneRef.current = true;
}
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "markdown-editor-body",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "codemirror-container",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("textarea", {
ref: cmEl,
placeholder: placeholder
})
}), preview ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
ref: previewEl,
className: "preview-container",
children: [mode === "stex" && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml_stex, {
value: value
}), mode !== "stex" && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
disabledFill: disabledFill,
showProgramFill: showNullProgramButton,
value: value
})]
}) : null]
})]
})
}), showResizeBar ? /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
ref: resizeBarEl,
className: "editor-resize"
}) : null, /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
children: TitleDesc[action] ? /*#__PURE__*/(0,jsx_runtime.jsx)(es_modal/* default */.Z, {
centered: true,
title: TitleDesc[action],
open: true,
onCancel: onCancel,
footer: null,
className: "markdown-popup-form",
children: PluginEl
}) : null
})]
});
});
/***/ }),
/***/ 17437:
/*!**********************************!*\
!*** ./src/components/modal.tsx ***!
\**********************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Z: function() { return /* binding */ Dialog; }
/* harmony export */ });
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/classCallCheck.js */ 82100);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/createClass.js */ 29186);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/inherits.js */ 80619);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/createSuper.js */ 47074);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ 59301);
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react-dom */ 4676);
var Dialog = /*#__PURE__*/function (_React$Component) {
_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_2___default()(Dialog, _React$Component);
var _super = _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_3___default()(Dialog);
function Dialog(props) {
var _this;
_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0___default()(this, Dialog);
_this = _super.call(this, props);
var doc = window.document;
_this.node = doc.createElement('div');
doc.body.appendChild(_this.node);
return _this;
}
_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_1___default()(Dialog, [{
key: "render",
value: function render() {
var children = this.props.children;
return /*#__PURE__*/(0,react_dom__WEBPACK_IMPORTED_MODULE_5__.createPortal)(children, this.node);
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
window.document.body.removeChild(this.node);
}
}]);
return Dialog;
}(react__WEBPACK_IMPORTED_MODULE_4__.Component);
/***/ }),
/***/ 76587:
/*!****************************************!*\
!*** ./src/components/useInterval.tsx ***!
\****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Z: function() { return /* binding */ useInterval; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
function useInterval(callback, delay) {
var savedCallback = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
// 保存新回调
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
savedCallback.current = callback;
});
// 建立 interval
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
function tick() {
savedCallback.current();
}
if (delay !== null) {
var id = setInterval(tick, delay);
return function () {
return clearInterval(id);
};
}
}, [delay]);
}
/***/ }),
/***/ 84793:
/*!************************************************************************!*\
!*** ./src/pages/Classrooms/Lists/Exercise/Add/index.tsx + 23 modules ***!
\************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ Add; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
var objectSpread2 = __webpack_require__(82242);
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(7557);
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(41498);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(79800);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectWithoutProperties.js
var objectWithoutProperties = __webpack_require__(39647);
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
var _umi_production_exports = __webpack_require__(19086);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/form/index.js + 19 modules
var es_form = __webpack_require__(78241);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
var message = __webpack_require__(8591);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/breadcrumb/index.js + 6 modules
var breadcrumb = __webpack_require__(66104);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
var input = __webpack_require__(62680);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/cascader/index.js + 18 modules
var cascader = __webpack_require__(19842);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/radio/index.js + 5 modules
var es_radio = __webpack_require__(5112);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input-number/index.js + 14 modules
var input_number = __webpack_require__(97913);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
var es_button = __webpack_require__(3113);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var Addmodules = ({"flex_box_center":"flex_box_center___aPGWN","flex_space_between":"flex_space_between___MQNX5","flex_box_vertical_center":"flex_box_vertical_center___Z7QdK","flex_box_center_end":"flex_box_center_end___JQl5O","flex_box_column":"flex_box_column___IhYhx","bg":"bg___Kg8x_","title":"title___UhsVG","titleLeft":"titleLeft___NPVwn","titleRight":"titleRight___UGtmZ","formWrap":"formWrap___Jowb2","baseLineHeight":"baseLineHeight___N68WX","radioBtnWrapper":"radioBtnWrapper___bX7Pi","radiogroup":"radiogroup___ukf8u","easy":"easy___ZHYPU","medium":"medium___piewx","hard":"hard___HMXyt","selectdiv":"selectdiv___gkuBG","divitem":"divitem___vNm0q","bottmodiv":"bottmodiv___assW5","cancelBtn":"cancelBtn___Nl6Pi","confirmBtn":"confirmBtn___BNoFU","baseFormItem":"baseFormItem___ILZ2V","cascaderPopup":"cascaderPopup___QPxW3"});
// 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/date-picker/index.js + 66 modules
var date_picker = __webpack_require__(92641);
// EXTERNAL MODULE: ./node_modules/_dayjs@1.11.10@dayjs/dayjs.min.js
var dayjs_min = __webpack_require__(9498);
var dayjs_min_default = /*#__PURE__*/__webpack_require__.n(dayjs_min);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/components/ExerciseModel/index.tsx
var ShixunsListPage = function ShixunsListPage(_ref) {
var user = _ref.user,
dispatch = _ref.dispatch,
classroomList = _ref.classroomList,
onModalOk = _ref.onModalOk,
setsubloading = _ref.setsubloading;
var params = (0,_umi_production_exports.useParams)();
var _useState = (0,_react_17_0_2_react.useState)(),
_useState2 = slicedToArray_default()(_useState, 2),
time = _useState2[0],
setTime = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(false),
_useState4 = slicedToArray_default()(_useState3, 2),
btnLoading = _useState4[0],
setBtnLoading = _useState4[1];
function disabledDate(current) {
return current && current < dayjs_min_default()().subtract(1, "days");
}
return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
title: "\u6E29\u99A8\u63D0\u793A"
// open={true}
,
afterClose: function afterClose() {
setBtnLoading(false);
},
zIndex: 8888,
destroyOnClose: true,
footer: null,
maskClosable: false,
keyboard: false,
open: classroomList.actionTabs.key === '预约弹窗' ? true : false,
onCancel: function onCancel() {
if (btnLoading) {
message/* default */.ZP.warning('正在请求数据中...');
return;
}
setsubloading(false);
dispatch({
type: 'classroomList/setActionTabs',
payload: {}
});
},
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "EduCoder\u6CE8\u610F\u5230\u60A8\u7684\u8BFE\u5802\u4E2D\u5B66\u751F\u4EBA\u6570\u8F83\u591A\u3002\u4E3A\u66F4\u597D\u5730\u4E3A\u60A8\u548C\u60A8\u7684\u5B66\u751F\u670D\u52A1\uFF0C\u7ED9\u540C\u5B66\u4EEC\u5E26\u6765\u66F4\u597D\u7684\u8003\u8BD5\u4F53\u9A8C\uFF0C\u6211\u4EEC\u5C06\u63D0\u524D\u4E3A\u60A8\u548C\u60A8\u7684\u5B66\u751F\u51C6\u5907\u597D\u670D\u52A1\u5668\u8D44\u6E90\u3002 \u8BF7\u60A8\u544A\u77E5\u6211\u4EEC\uFF0C\u8FD9\u4EFD\u8BD5\u5377\u7684\u9884\u8BA1\u8003\u8BD5\u65F6\u95F4\u662F\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsx)(date_picker["default"], {
popupStyle: {
zIndex: 9999
},
style: {
marginTop: '10px',
marginBottom: '10px'
},
disabledDate: disabledDate,
format: "YYYY-MM-DD HH:mm:ss",
onChange: function onChange(date, dateString) {
// console.log(date,dateString);
setTime(dateString);
},
showTime: {
defaultValue: dayjs_min_default()('00:00:00', 'HH:mm:ss')
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u611F\u8C22\u60A8\u7684\u914D\u5408"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
textAlign: 'end'
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
loading: btnLoading,
type: "primary",
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
setBtnLoading(true);
onModalOk(time, function () {
dispatch({
type: 'classroomList/setActionTabs',
payload: {}
});
});
case 2:
case "end":
return _context.stop();
}
}, _callee);
})),
children: "\u786E\u8BA4"
})
})]
})
});
};
/* harmony default export */ var ExerciseModel = ((0,_umi_production_exports.connect)(function (_ref3) {
var user = _ref3.user,
classroomList = _ref3.classroomList;
return {
user: user,
classroomList: classroomList
};
})(ShixunsListPage));
// EXTERNAL MODULE: ./src/utils/fetch.ts
var fetch = __webpack_require__(56648);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/toConsumableArray.js
var toConsumableArray = __webpack_require__(37205);
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.5@@ant-design/icons/es/icons/PlusCircleOutlined.js + 1 modules
var PlusCircleOutlined = __webpack_require__(8877);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.5@@ant-design/icons/es/icons/MinusCircleOutlined.js + 1 modules
var MinusCircleOutlined = __webpack_require__(73364);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EngineeringPoints/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var EngineeringPointsmodules = ({"wrap":"wrap___Ww0Ti","itemWarp":"itemWarp___LMLjd","addIcon":"addIcon___xmRLl","deleteIcon":"deleteIcon___gjwgO"});
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/select/index.js
var es_select = __webpack_require__(57809);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EngineeringPoints/item.tsx
var Item = function Item(_ref) {
var _params$zydatas, _params$zydatas2, _params$jbdatas, _params$jbdatas2, _params$kcdatas, _params$kcdatas2, _params$zsdatas, _params$zsdatas2;
var setitem = _ref.setitem,
item = _ref.item,
rz = _ref.rz;
var _useState = (0,_react_17_0_2_react.useState)({
zydatas: [],
jbdatas: [],
kcdatas: [],
zsdatas: [],
page: 1,
per_page: 20
}),
_useState2 = slicedToArray_default()(_useState, 2),
params = _useState2[0],
setparams = _useState2[1];
var _Form$useForm = es_form/* default */.Z.useForm(),
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
form = _Form$useForm2[0];
var _useState3 = (0,_react_17_0_2_react.useState)(false),
_useState4 = slicedToArray_default()(_useState3, 2),
init = _useState4[0],
setInit = _useState4[1];
(0,_react_17_0_2_react.useEffect)(function () {
if (rz && !init) {
params.zydatas = rz;
setparams(objectSpread2_default()({}, params));
setInit(true);
if (item !== null && item !== void 0 && item.ec_course_id) {
setdata();
}
}
}, [item, rz, init]);
console.log(params, 'params');
function setdata() {
return _setdata.apply(this, arguments);
} //获取认证届别
function _setdata() {
_setdata = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return getjb(item === null || item === void 0 ? void 0 : item.ec_major_school_id);
case 2:
_context3.next = 4;
return getcourse(item === null || item === void 0 ? void 0 : item.ec_year_id);
case 4:
_context3.next = 6;
return getec_points(item === null || item === void 0 ? void 0 : item.ec_course_id);
case 6:
form.setFieldsValue({
ec_course_id: item === null || item === void 0 ? void 0 : item.ec_course_id,
ec_major_school_id: item === null || item === void 0 ? void 0 : item.ec_major_school_id,
ec_point_ids: item === null || item === void 0 ? void 0 : item.ec_point_ids,
ec_year_id: item === null || item === void 0 ? void 0 : item.ec_year_id
});
case 7:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return _setdata.apply(this, arguments);
}
function getjb(_x) {
return _getjb.apply(this, arguments);
} //获取关联课程
function _getjb() {
_getjb = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4(key) {
var res;
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
_context4.next = 2;
return (0,fetch/* default */.ZP)("/api/ec_major_schools/".concat(key, "/ec_years/get_year_list.json"), {
method: 'get'
});
case 2:
res = _context4.sent;
params.jbdatas = res === null || res === void 0 ? void 0 : res.data;
setparams(objectSpread2_default()({}, params));
form.setFieldsValue({
ec_year_id: '',
ec_course_id: '',
ec_point_ids: []
});
case 6:
case "end":
return _context4.stop();
}
}, _callee4);
}));
return _getjb.apply(this, arguments);
}
function getcourse(_x2) {
return _getcourse.apply(this, arguments);
} //获取知识点
function _getcourse() {
_getcourse = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5(key) {
var res;
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
_context5.next = 2;
return (0,fetch/* default */.ZP)("/api/ec_years/".concat(key, "/ec_courses/get_courses.json"), {
method: 'get'
});
case 2:
res = _context5.sent;
params.kcdatas = res === null || res === void 0 ? void 0 : res.data;
setparams(objectSpread2_default()({}, params));
form.setFieldsValue({
ec_course_id: '',
ec_point_ids: []
});
case 6:
case "end":
return _context5.stop();
}
}, _callee5);
}));
return _getcourse.apply(this, arguments);
}
var getec_points = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(record) {
var res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return (0,fetch/* default */.ZP)("/api/ec_courses/".concat(record, "/ec_points.json"), {
method: 'get',
params: {
ec_course_id: record
}
});
case 2:
res = _context.sent;
params.zsdatas = res === null || res === void 0 ? void 0 : res.data;
setparams(objectSpread2_default()({}, params));
case 5:
case "end":
return _context.stop();
}
}, _callee);
}));
return function getec_points(_x3) {
return _ref2.apply(this, arguments);
};
}();
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: EngineeringPointsmodules.from,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
form: form,
layout: "inline",
onValuesChange: function onValuesChange(value) {
console.log('----', value);
if (value.ec_major_school_id) {
params.jbdatas = [];
params.kcdatas = [];
params.zsdatas = [];
setparams(objectSpread2_default()({}, params));
getjb(value.ec_major_school_id);
}
if (value.ec_year_id) {
params.kcdatas = [];
params.zsdatas = [];
setparams(objectSpread2_default()({}, params));
getcourse(value.ec_year_id);
}
if (value.ec_course_id) {
params.zsdatas = [];
setparams(objectSpread2_default()({}, params));
getec_points(value.ec_course_id);
}
},
onFinish: ( /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(value) {
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
setitem(value);
case 1:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function (_x4) {
return _ref3.apply(this, arguments);
};
}()),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
// label="认证专业"
name: "ec_major_school_id",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"], {
style: {
width: 160
},
disabled: ((_params$zydatas = params.zydatas) === null || _params$zydatas === void 0 ? void 0 : _params$zydatas.length) <= 0,
placeholder: "\u8BF7\u9009\u62E9\u8BA4\u8BC1\u4E13\u4E1A",
children: params === null || params === void 0 || (_params$zydatas2 = params.zydatas) === null || _params$zydatas2 === void 0 ? void 0 : _params$zydatas2.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
value: item === null || item === void 0 ? void 0 : item.ec_major_school_id,
children: item === null || item === void 0 ? void 0 : item.name
}, index);
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
// label="认证届别"
name: "ec_year_id",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"], {
style: {
width: 160
},
disabled: ((_params$jbdatas = params.jbdatas) === null || _params$jbdatas === void 0 ? void 0 : _params$jbdatas.length) <= 0,
placeholder: "\u8BF7\u9009\u62E9\u8BA4\u8BC1\u5C4A\u522B",
children: params === null || params === void 0 || (_params$jbdatas2 = params.jbdatas) === null || _params$jbdatas2 === void 0 ? void 0 : _params$jbdatas2.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
value: item === null || item === void 0 ? void 0 : item.ec_year_id,
children: item === null || item === void 0 ? void 0 : item.year
}, index);
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
// label="课程"
name: "ec_course_id",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"], {
style: {
width: 208
},
disabled: ((_params$kcdatas = params.kcdatas) === null || _params$kcdatas === void 0 ? void 0 : _params$kcdatas.length) <= 0,
placeholder: "\u8BF7\u9009\u62E9\u8BFE\u7A0B",
children: params === null || params === void 0 || (_params$kcdatas2 = params.kcdatas) === null || _params$kcdatas2 === void 0 ? void 0 : _params$kcdatas2.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
value: item === null || item === void 0 ? void 0 : item.id,
children: item === null || item === void 0 ? void 0 : item.name
}, index);
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
// label="知识点"
name: "ec_point_ids",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"], {
onChange: function onChange() {
form.submit();
},
style: {
width: 160
},
maxTagCount: 1,
maxTagTextLength: 7,
mode: "multiple",
disabled: ((_params$zsdatas = params.zsdatas) === null || _params$zsdatas === void 0 ? void 0 : _params$zsdatas.length) <= 0,
placeholder: "\u8BF7\u9009\u62E9\u77E5\u8BC6\u70B9",
children: params === null || params === void 0 || (_params$zsdatas2 = params.zsdatas) === null || _params$zsdatas2 === void 0 ? void 0 : _params$zsdatas2.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
value: item === null || item === void 0 ? void 0 : item.id,
children: item === null || item === void 0 ? void 0 : item.name
}, index);
})
})
})]
})
});
};
/* harmony default export */ var EngineeringPoints_item = (Item);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EngineeringPoints/index.tsx
var EngineeringPoints = function EngineeringPoints(_ref) {
var _user$userInfo2, _user$userInfo$course;
var user = _ref.user,
_ref$exercise_id = _ref.exercise_id,
exercise_id = _ref$exercise_id === void 0 ? null : _ref$exercise_id,
_ref$homework_common_ = _ref.homework_common_id,
homework_common_id = _ref$homework_common_ === void 0 ? null : _ref$homework_common_,
_setitem = _ref.setitem;
var _useState = (0,_react_17_0_2_react.useState)([{
id: Math.random()
}]),
_useState2 = slicedToArray_default()(_useState, 2),
datas = _useState2[0],
setdatas = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(null),
_useState4 = slicedToArray_default()(_useState3, 2),
rz = _useState4[0],
setrz = _useState4[1];
function getdatas() {
return _getdatas.apply(this, arguments);
}
function _getdatas() {
_getdatas = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var _res$data;
var res, _res$data2, _res$data3, _res$data4, ec_point_ids;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return (0,fetch/* default */.ZP)("/api/ec_courses/".concat(0, "/ec_points/get_work_points.json"), {
method: 'get',
params: {
exercise_id: exercise_id,
homework_common_id: homework_common_id
}
});
case 2:
res = _context.sent;
if ((res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.length) > 0) {
ec_point_ids = [];
res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 || _res$data2.map(function (ite) {
var _ite$ec_point_ids3;
ite === null || ite === void 0 || (_ite$ec_point_ids3 = ite.ec_point_ids) === null || _ite$ec_point_ids3 === void 0 || _ite$ec_point_ids3.map(function (j) {
ec_point_ids.push(j);
});
});
_setitem(objectSpread2_default()(objectSpread2_default()({}, res === null || res === void 0 || (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3[0]), {}, {
ec_point_ids: ec_point_ids
}));
setdatas(res === null || res === void 0 || (_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : _res$data4.map(function (e) {
return objectSpread2_default()(objectSpread2_default()({}, e), {}, {
id: Math.random()
});
}));
}
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
return _getdatas.apply(this, arguments);
}
(0,_react_17_0_2_react.useEffect)(function () {
var _user$userInfo;
if (user !== null && user !== void 0 && (_user$userInfo = user.userInfo) !== null && _user$userInfo !== void 0 && (_user$userInfo = _user$userInfo.course) !== null && _user$userInfo !== void 0 && _user$userInfo.course_school_id) {
getrz();
}
}, [user === null || user === void 0 || (_user$userInfo2 = user.userInfo) === null || _user$userInfo2 === void 0 || (_user$userInfo2 = _user$userInfo2.course) === null || _user$userInfo2 === void 0 ? void 0 : _user$userInfo2.course_school_id]);
function getrz() {
return _getrz.apply(this, arguments);
}
function _getrz() {
_getrz = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
var _user$userInfo3;
var res;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return (0,fetch/* default */.ZP)("/api/schools/".concat(user === null || user === void 0 || (_user$userInfo3 = user.userInfo) === null || _user$userInfo3 === void 0 || (_user$userInfo3 = _user$userInfo3.course) === null || _user$userInfo3 === void 0 ? void 0 : _user$userInfo3.course_school_id, "/ec_majors/get_major_list.json"), {
method: 'get'
});
case 2:
res = _context2.sent;
setrz(res === null || res === void 0 ? void 0 : res.data);
if (homework_common_id || exercise_id) {
getdatas();
}
case 5:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _getrz.apply(this, arguments);
}
console.log(datas, rz, 'datas');
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
display: (_user$userInfo$course = user.userInfo.course) !== null && _user$userInfo$course !== void 0 && _user$userInfo$course.is_openengineering ? '' : 'none'
},
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EngineeringPointsmodules.wrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
children: ["\u5DE5\u7A0B\u8BA4\u8BC1", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u8003\u6838\u77E5\u8BC6\u70B9"]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: EngineeringPointsmodules.itemWarp,
children: datas === null || datas === void 0 ? void 0 : datas.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'center',
marginBottom: 20
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(EngineeringPoints_item, {
rz: rz,
item: item,
setitem: function setitem(value) {
value = objectSpread2_default()(objectSpread2_default()({}, datas === null || datas === void 0 ? void 0 : datas[index]), value);
datas.splice(index, 1, value);
setdatas(toConsumableArray_default()(datas));
var ec_point_ids = [];
datas === null || datas === void 0 || datas.map(function (ite) {
var _ite$ec_point_ids;
ite === null || ite === void 0 || (_ite$ec_point_ids = ite.ec_point_ids) === null || _ite$ec_point_ids === void 0 || _ite$ec_point_ids.map(function (j) {
ec_point_ids.push(j);
});
});
_setitem(objectSpread2_default()(objectSpread2_default()({}, value), {}, {
ec_point_ids: ec_point_ids
}));
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)(PlusCircleOutlined/* default */.Z, {
className: EngineeringPointsmodules.addIcon,
onClick: function onClick() {
datas.push({
id: Math.random()
});
setdatas(toConsumableArray_default()(datas));
}
}), index != 0 && /*#__PURE__*/(0,jsx_runtime.jsx)(MinusCircleOutlined/* default */.Z, {
className: EngineeringPointsmodules.deleteIcon,
onClick: function onClick() {
datas.splice(index, 1);
var ec_point_ids = [];
datas === null || datas === void 0 || datas.map(function (ite) {
var _ite$ec_point_ids2;
ite === null || ite === void 0 || (_ite$ec_point_ids2 = ite.ec_point_ids) === null || _ite$ec_point_ids2 === void 0 || _ite$ec_point_ids2.map(function (j) {
ec_point_ids.push(j);
});
});
_setitem(objectSpread2_default()(objectSpread2_default()({}, datas[index - 1]), {}, {
ec_point_ids: ec_point_ids
}));
setdatas(toConsumableArray_default()(datas));
}
})]
}, item.id);
})
})]
})
});
};
/* harmony default export */ var Add_EngineeringPoints = ((0,_umi_production_exports.connect)(function (_ref2) {
var user = _ref2.user;
return {
user: user
};
})(EngineeringPoints));
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/menu/index.js + 11 modules
var menu = __webpack_require__(20834);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/spin/index.js + 1 modules
var spin = __webpack_require__(71418);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/affix/index.js + 2 modules
var affix = __webpack_require__(81228);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/skeleton/index.js + 12 modules
var skeleton = __webpack_require__(84578);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/dropdown/index.js + 1 modules
var dropdown = __webpack_require__(38854);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EditPotin/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var EditPotinmodules = ({"flex_box_center":"flex_box_center___zCnVx","flex_space_between":"flex_space_between___BBiQD","flex_box_vertical_center":"flex_box_vertical_center___KzPui","flex_box_center_end":"flex_box_center_end___zJokd","flex_box_column":"flex_box_column___Grsys","moreSpan":"moreSpan___VJeLv","bg":"bg___oBBHW","title":"title___xV4Rt","bottomdiv":"bottomdiv___rPfwr","spanBtn":"spanBtn___eJxID","addQuestionBtn":"addQuestionBtn___RPRiP","saveBtn":"saveBtn___y9nNf","left":"left___Q3Qf4","scrollWrapper":"scrollWrapper___a3Wdq","Button":"Button___r00OP","iconWrapper":"iconWrapper___wofW_","up":"up___a9RQm","down":"down___x6RAl","disabled":"disabled___mkEME","titleleft":"titleleft___WZ83K","more_style":"more_style___ZXYnN","qcount":"qcount___o6F1k","score":"score___Gy6jr","qtitle":"qtitle___KF7pa","qcountclick":"qcountclick___kvoyc","right":"right___Nfa70","edit":"edit___RVRSb","delete":"delete___J9BAT","shixun":"shixun___YkjdZ","scoreByBlankRadio":"scoreByBlankRadio___QYQY5","modalconfirm":"modalconfirm___dmWFe","scoremodal":"scoremodal___CDA7w","close":"close___jdUWv","content":"content___HPqUf","items":"items___YkyQL","bottom":"bottom___mzpp4","yes":"yes___Xio6z","no":"no___hbicD","formcenter":"formcenter___kN8Ax","radiogroup":"radiogroup___htjtc","easy":"easy____g1mR","medium":"medium___vPAsn","hard":"hard___c6tcf","formcenterselect":"formcenterselect___B88vb","selectitems":"selectitems___wUGKF","morebottom":"morebottom___F5cFQ","scoreinput":"scoreinput___S9Fbv","titleTooltip":"titleTooltip___J0i26","exercise_styles":"exercise_styles___BJAZm"});
// EXTERNAL MODULE: ./src/utils/util.tsx
var util = __webpack_require__(73400);
// EXTERNAL MODULE: ./src/components/NoData/index.tsx
var NoData = __webpack_require__(56971);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tooltip/index.js + 3 modules
var tooltip = __webpack_require__(6848);
// EXTERNAL MODULE: ./node_modules/_react-beautiful-dnd@13.0.0@react-beautiful-dnd/dist/react-beautiful-dnd.esm.js + 27 modules
var react_beautiful_dnd_esm = __webpack_require__(3256);
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 2 modules
var RenderHtml = __webpack_require__(70917);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EditPotin/components/LeftItems.tsx
var DragQuestions = function DragQuestions(_ref) {
var Itemid = _ref.Itemid,
setqitem = _ref.setqitem,
qitem = _ref.qitem,
data = _ref.data,
getdata = _ref.getdata,
bigitem = _ref.bigitem,
setBigqitem = _ref.setBigqitem,
isedit = _ref.isedit;
var _useState = (0,_react_17_0_2_react.useState)([]),
_useState2 = slicedToArray_default()(_useState, 2),
list = _useState2[0],
setList = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(false),
_useState4 = slicedToArray_default()(_useState3, 2),
loading = _useState4[0],
setLoading = _useState4[1];
//过滤函数
var reorder = function reorder(list, startIndex, endIndex) {
var result = Array.from(list);
var _result$splice = result.splice(startIndex, 1),
_result$splice2 = slicedToArray_default()(_result$splice, 1),
removed = _result$splice2[0];
result.splice(endIndex, 0, removed);
return result;
};
(0,_react_17_0_2_react.useEffect)(function () {
if (data.length > 0) {
setList(toConsumableArray_default()(data) || []);
}
}, [data]);
var handleDragEnd = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(result, list) {
var items, res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (result.destination) {
_context.next = 2;
break;
}
return _context.abrupt("return");
case 2:
if (!isedit) {
_context.next = 5;
break;
}
message/* default */.ZP.info('请先保存或取消当前正在编辑的试题。');
return _context.abrupt("return");
case 5:
items = reorder(list, result.source.index, result.destination.index);
setLoading(true);
_context.next = 9;
return (0,fetch/* default */.ZP)("/api/exercises/".concat(Itemid, "/adjust_position.json"), {
method: 'post',
body: {
id: Itemid,
question_ids: items === null || items === void 0 ? void 0 : items.map(function (item) {
return item.question_id;
})
}
});
case 9:
res = _context.sent;
setLoading(false);
if (res.status === 0) {
getdata({
id: list === null || list === void 0 ? void 0 : list[result.source.index].question_id
});
}
case 12:
case "end":
return _context.stop();
}
}, _callee);
}));
return function handleDragEnd(_x, _x2) {
return _ref2.apply(this, arguments);
};
}();
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(react_beautiful_dnd_esm/* DragDropContext */.Z5, {
onDragEnd: function onDragEnd(result) {
return handleDragEnd(result, list);
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(react_beautiful_dnd_esm/* Droppable */.bK, {
droppableId: "droppable",
children: function children(provided, snapshot) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", objectSpread2_default()(objectSpread2_default()({
ref: provided.innerRef
}, provided.droppableProps), {}, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
spinning: loading,
children: list.map(function (item, k) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(react_beautiful_dnd_esm/* Draggable */._l, {
draggableId: k.toString(),
index: k,
children: function children(provided, snapshot) {
var _item$program_attr;
return /*#__PURE__*/(0,jsx_runtime.jsx)("aside", objectSpread2_default()(objectSpread2_default()(objectSpread2_default()({
ref: provided.innerRef
}, provided.draggableProps), provided.dragHandleProps), {}, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: item.question_title || item.description
}),
color: "#fff",
placement: "left",
overlayClassName: EditPotinmodules.titleTooltip,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
onClick: function onClick() {
if (isedit) {
message/* default */.ZP.info('请先保存或取消当前正在编辑的试题。');
return;
}
setqitem(objectSpread2_default()(objectSpread2_default()({}, item), {}, {
index: k + 1
}));
setBigqitem(bigitem);
(0,util/* scrollToTop */.k3)();
},
className: "".concat(EditPotinmodules.qcount, " ").concat(item.question_id === (qitem === null || qitem === void 0 ? void 0 : qitem.question_id) ? EditPotinmodules.qcountclick : ''),
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: EditPotinmodules.score,
children: [item === null || item === void 0 ? void 0 : item.question_score, "\u5206"]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: EditPotinmodules.qtitle,
children: [k + 1, "\u3001", /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: (item === null || item === void 0 ? void 0 : item.question_type) === 8 ? item === null || item === void 0 || (_item$program_attr = item.program_attr) === null || _item$program_attr === void 0 ? void 0 : _item$program_attr.description : item.question_title,
showTextOnly: true
})]
})]
})
})
}));
}
}, k);
})
}), provided.placeholder]
}));
}
})
})
});
};
/* harmony default export */ var LeftItems = (DragQuestions);
// EXTERNAL MODULE: ./src/components/QuestionEditor/ChoiceQuestionEditor.tsx
var ChoiceQuestionEditor = __webpack_require__(75780);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/switch/index.js + 2 modules
var es_switch = __webpack_require__(78673);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.5@@ant-design/icons/es/icons/DownOutlined.js + 1 modules
var DownOutlined = __webpack_require__(42137);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.5@@ant-design/icons/es/icons/UpOutlined.js + 1 modules
var UpOutlined = __webpack_require__(40641);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.5@@ant-design/icons/es/icons/QuestionCircleOutlined.js + 1 modules
var QuestionCircleOutlined = __webpack_require__(34033);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.5@@ant-design/icons/es/icons/ExclamationCircleOutlined.js + 1 modules
var ExclamationCircleOutlined = __webpack_require__(21040);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EditPotin/components/MoreSetting.tsx
var AddModal = function AddModal(_ref) {
var _TagDiscipline$tag_di;
var form = _ref.form,
TagDiscipline = _ref.TagDiscipline,
exerciseitem = _ref.exerciseitem,
qitem = _ref.qitem,
getTagData = _ref.getTagData;
var _useState = (0,_react_17_0_2_react.useState)(false),
_useState2 = slicedToArray_default()(_useState, 2),
isshow = _useState2[0],
seetisshow = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(false),
_useState4 = slicedToArray_default()(_useState3, 2),
showmodal = _useState4[0],
setshowmodal = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)(''),
_useState6 = slicedToArray_default()(_useState5, 2),
values = _useState6[0],
setvalues = _useState6[1];
(0,_react_17_0_2_react.useEffect)(function () {
form.setFieldsValue({
difficulty: qitem.difficulty || 2,
tag_discipline_ids: qitem.tag_discipline_ids,
repeat_answer: !qitem.repeat_answer
});
}, []);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
onClick: function onClick() {
seetisshow(!isshow);
},
style: {
width: '100%',
textAlign: 'center',
color: "#3061D0",
marginTop: 50,
cursor: 'pointer'
},
children: ["\u66F4\u591A\u8BBE\u7F6E ", !isshow ? /*#__PURE__*/(0,jsx_runtime.jsx)(DownOutlined/* default */.Z, {}) : /*#__PURE__*/(0,jsx_runtime.jsx)(UpOutlined/* default */.Z, {})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
marginTop: 30,
height: isshow ? '100%' : '0px',
overflow: 'hidden'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
className: EditPotinmodules.formcenter,
rules: [{
required: true,
message: '请先选择难度'
}],
label: "\u96BE\u5EA6",
name: "difficulty",
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default.Group */.ZP.Group, {
className: EditPotinmodules.radiogroup,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Button */.ZP.Button, {
className: EditPotinmodules.easy,
value: 1,
children: "\u7B80\u5355"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Button */.ZP.Button, {
className: EditPotinmodules.medium,
value: 2,
children: "\u9002\u4E2D"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Button */.ZP.Button, {
className: EditPotinmodules.hard,
value: 3,
children: "\u56F0\u96BE"
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
className: EditPotinmodules.formcenterselect,
label: "\u77E5\u8BC6\u70B9",
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'center'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "tag_discipline_ids",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"], {
className: EditPotinmodules.selectitems,
showSearch: true,
listHeight: 200,
placeholder: "\u8BF7\u9009\u62E9\u77E5\u8BC6\u70B9\uFF0C\u652F\u6301\u9009\u62E9\u591A\u4E2A",
mode: "multiple",
dropdownStyle: {
zIndex: 9
},
allowClear: true,
optionFilterProp: "children",
filterOption: function filterOption(input, option) {
return option.key.indexOf(input.toLowerCase()) >= 0;
},
children: TagDiscipline === null || TagDiscipline === void 0 || (_TagDiscipline$tag_di = TagDiscipline.tag_disciplines) === null || _TagDiscipline$tag_di === void 0 ? void 0 : _TagDiscipline$tag_di.map(function (item) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
value: item.id,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'center'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
overflow: "hidden",
whiteSpace: "nowrap",
textOverflow: "ellipsis"
},
children: item.name
}), (item === null || item === void 0 ? void 0 : item.type) === 'personal' && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
marginLeft: '5px',
border: '1px solid #24C074',
color: '#24C074',
padding: "0 4px",
borderRadius: '2px',
fontSize: "12px",
height: '20px',
lineHeight: '20px'
},
children: "\u81EA\u7528"
})]
})
}, item.name + item.id);
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
marginLeft: 20,
marginTop: '-16px',
lineHeight: '48px',
height: 48,
fontSize: 14
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u6CA1\u6709\u5408\u9002\u7684\u77E5\u8BC6\u70B9\uFF1F"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
onClick: function onClick() {
setshowmodal(true);
},
style: {
marginLeft: 3,
color: '#3061D0'
},
children: "\u65B0\u5EFA\u77E5\u8BC6\u70B9"
})]
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
className: EditPotinmodules.formcenterselect,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'center'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "repeat_answer",
valuePropName: "checked",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_switch/* default */.Z, {})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
marginLeft: 10,
marginTop: '-16px',
lineHeight: '48px',
height: 48,
color: '#000000'
},
children: ["\u4E0D\u5141\u8BB8\u5B66\u751F\u91CD\u590D\u7B54\u9898", /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
placement: "right",
title: "\u9009\u4E2D\u540E\uFF0C\u5B66\u751F\u5FC5\u987B\u4F5C\u7B54\u5B8C\u6210\u624D\u80FD\u8FDB\u5165\u4E0B\u4E00\u9898\uFF0C\u4E14\u8FDB\u5165\u4E0B\u4E00\u9898\u4E4B\u540E\u4E0D\u5141\u8BB8\u518D\u4FEE\u6539\u8BE5\u9898\u7B54\u6848",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(QuestionCircleOutlined/* default */.Z, {
style: {
color: '#3061D0',
marginLeft: 6,
cursor: 'pointer'
}
})
})]
})]
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(modal/* default */.Z, {
title: false,
footer: false,
open: showmodal,
width: 640,
centered: true,
closable: false,
className: EditPotinmodules.scoremodal,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'center',
marginBottom: 40
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: EditPotinmodules.title,
children: "\u65B0\u5EFA\u77E5\u8BC6\u70B9"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
onClick: function onClick() {
return setshowmodal(false);
},
className: EditPotinmodules.close,
children: "X"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ExclamationCircleOutlined/* default */.Z, {
style: {
color: '#FF8C29',
marginRight: 10
}
}), "\u65B0\u5EFA\u7684\u77E5\u8BC6\u70B9\u4EC5\u672C\u4EBA\u53EF\u89C1\uFF0C\u5E73\u53F0\u5BA1\u6838\u5217\u5165\u516C\u5F00\u77E5\u8BC6\u70B9\u540E\uFF0C\u5BF9\u6240\u6709\u7528\u6237\u53EF\u89C1\u3002 \u5E73\u53F0\u6709\u6743\u5220\u9664\u4E0D\u5408\u9002\u7684\u77E5\u8BC6\u70B9\uFF0C\u8BF7\u8BA4\u771F\u586B\u5199\u77E5\u8BC6\u70B9\u540D\u79F0\u3002"]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
style: {
marginBottom: 30,
marginTop: 30,
height: 46
},
showCount: true,
maxLength: 20,
onChange: function onChange(e) {
setvalues(e.target.value);
},
placeholder: "\u8BF7\u8F93\u5165\u77E5\u8BC6\u70B9\u540D\u79F0"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.bottom,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.no,
onClick: function onClick() {
setshowmodal(false);
},
children: "\u53D6\u6D88"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.yes,
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var _exerciseitem$exercis;
var res, _exerciseitem$exercis2;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (values) {
_context.next = 3;
break;
}
message/* default */.ZP.info('知识点名称不能为空');
return _context.abrupt("return");
case 3:
_context.next = 5;
return (0,fetch/* default */.ZP)("/api/tag_disciplines.json", {
method: 'post',
body: {
name: values,
sub_discipline_id: exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis = exerciseitem.exercise) === null || _exerciseitem$exercis === void 0 ? void 0 : _exerciseitem$exercis.sub_discipline_id
}
});
case 5:
res = _context.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
form.setFieldsValue({
knowledge: values
});
getTagData((_exerciseitem$exercis2 = exerciseitem.exercise) === null || _exerciseitem$exercis2 === void 0 ? void 0 : _exerciseitem$exercis2.sub_discipline_id);
}
setshowmodal(false);
case 8:
case "end":
return _context.stop();
}
}, _callee);
})),
children: "\u786E\u8BA4"
})]
})]
})]
});
};
/* harmony default export */ var MoreSetting = (AddModal);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EditPotin/components/Questions/SingleEditor.tsx
var SingleEditor_DragQuestions = function DragQuestions(_ref) {
var _exerciseitem$exercis;
var qitem = _ref.qitem,
setisedit = _ref.setisedit,
TagDiscipline = _ref.TagDiscipline,
exerciseitem = _ref.exerciseitem,
seveeditor = _ref.seveeditor,
deleteitem = _ref.deleteitem,
getTagData = _ref.getTagData,
init = _ref.init;
var _Form$useForm = es_form/* default */.Z.useForm(),
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
form = _Form$useForm2[0];
(0,_react_17_0_2_react.useEffect)(function () {
var _qitem$question_choic;
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
name: qitem === null || qitem === void 0 ? void 0 : qitem.question_title,
choices: qitem === null || qitem === void 0 || (_qitem$question_choic = qitem.question_choices) === null || _qitem$question_choic === void 0 ? void 0 : _qitem$question_choic.map(function (item) {
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
standard_boolean: item !== null && item !== void 0 && item.standard_boolean ? 1 : 0
});
}),
repeat_answer: !(qitem !== null && qitem !== void 0 && qitem.repeat_answer)
}));
}, [qitem]);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
form: form,
colon: false,
onFinish: function onFinish(values) {
var _values$choices, _values$choices$map, _values$choices2, _values$choices2$map, _values$choices3;
var items = values === null || values === void 0 || (_values$choices = values.choices) === null || _values$choices === void 0 || (_values$choices$map = _values$choices.map) === null || _values$choices$map === void 0 ? void 0 : _values$choices$map.call(_values$choices, function (item, index) {
if ((item === null || item === void 0 ? void 0 : item.standard_boolean) === 1) {
return index + 1;
}
});
var datas = objectSpread2_default()(objectSpread2_default()({}, values), {}, {
item_type: qitem === null || qitem === void 0 ? void 0 : qitem.question_type,
question_choices: values === null || values === void 0 || (_values$choices2 = values.choices) === null || _values$choices2 === void 0 || (_values$choices2$map = _values$choices2.map) === null || _values$choices2$map === void 0 ? void 0 : _values$choices2$map.call(_values$choices2, function (item) {
return item.choice_text;
}),
standard_answers: items.filter(function (item) {
return item;
}),
choices: values === null || values === void 0 || (_values$choices3 = values.choices) === null || _values$choices3 === void 0 ? void 0 : _values$choices3.map(function (item) {
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
is_answer: item.standard_boolean
});
})
});
// console.log('-----',{...qitem,...datas});
seveeditor(objectSpread2_default()(objectSpread2_default()({}, qitem), datas));
},
onFinishFailed: ( /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(errInfo) {
var _errInfo$errorFields;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
message/* default */.ZP.error(errInfo.errorFields[0].errors[0]);
form.scrollToField(errInfo === null || errInfo === void 0 || (_errInfo$errorFields = errInfo.errorFields) === null || _errInfo$errorFields === void 0 || (_errInfo$errorFields = _errInfo$errorFields[0]) === null || _errInfo$errorFields === void 0 ? void 0 : _errInfo$errorFields.name, {
behavior: 'smooth',
block: 'center'
});
case 2:
case "end":
return _context.stop();
}
}, _callee);
}));
return function (_x) {
return _ref2.apply(this, arguments);
};
}()),
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'center'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
flex: 1
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
display: 'inline-flex',
border: '1px solid #9096A3',
borderRadius: '50%',
width: 10,
height: 10,
marginRight: 5,
background: '#9096A3'
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 1 ? '多选题' : '单选题'
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
className: EditPotinmodules.scoreinput,
name: "question_score",
label: "\u5206\u503C",
rules: [{
required: true,
message: '请输入分值'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
style: {
width: 150
},
placeholder: "\u8BF7\u8F93\u5165\u5F53\u524D\u5C0F\u9898\u5206\u6570",
max: 100,
min: 0.1
})
}), (exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis = exerciseitem.exercise) === null || _exerciseitem$exercis === void 0 ? void 0 : _exerciseitem$exercis.exercise_status) == 1 && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
marginLeft: 20,
color: 'red',
cursor: 'pointer'
},
onClick: function onClick() {
deleteitem();
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-piliangshanchu3",
style: {
fontSize: 14,
marginRight: 6
}
}), "\u5220\u9664"]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(ChoiceQuestionEditor/* ChoiceQuestionEditor */.u, {
form: form,
questionTitlePlaceholder: "\u8BF7\u7F16\u8F91\u9009\u62E9\u9898\u9898\u5E72\u5185\u5BB9",
titleKey: "question_title",
choiceKey: "choices",
analysisKey: "analysis",
choiceOptionsPath: "choices",
choiceTextKey: "choice_text"
// allowChangeMode={qitem?.question_type===1?true:false}
,
answerKey: "standard_boolean"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(MoreSetting, {
getTagData: getTagData,
qitem: qitem,
exerciseitem: exerciseitem,
TagDiscipline: TagDiscipline,
form: form
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.morebottom,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.no,
onClick: function onClick() {
var _qitem$question_choic2;
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
name: qitem === null || qitem === void 0 ? void 0 : qitem.question_title,
choices: qitem === null || qitem === void 0 || (_qitem$question_choic2 = qitem.question_choices) === null || _qitem$question_choic2 === void 0 ? void 0 : _qitem$question_choic2.map(function (item) {
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
standard_boolean: item !== null && item !== void 0 && item.standard_boolean ? 1 : 0
});
}),
repeat_answer: !(qitem !== null && qitem !== void 0 && qitem.repeat_answer)
}));
},
children: "\u91CD\u7F6E"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.no,
onClick: function onClick() {
if (!qitem.isadd) {
var _qitem$question_choic3;
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
name: qitem === null || qitem === void 0 ? void 0 : qitem.question_title,
choices: qitem === null || qitem === void 0 || (_qitem$question_choic3 = qitem.question_choices) === null || _qitem$question_choic3 === void 0 ? void 0 : _qitem$question_choic3.map(function (item) {
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
standard_boolean: item !== null && item !== void 0 && item.standard_boolean ? 1 : 0
});
}),
repeat_answer: !(qitem !== null && qitem !== void 0 && qitem.repeat_answer)
}));
setisedit(false);
} else {
setisedit(false);
init();
}
},
children: "\u53D6\u6D88"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.yes,
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
form.submit();
// await form.validateFields()
// let values=form.getFieldsValue()
case 1:
case "end":
return _context2.stop();
}
}, _callee2);
})),
children: "\u4FDD\u5B58\u9898\u76EE"
})]
})]
});
};
/* harmony default export */ var SingleEditor = (SingleEditor_DragQuestions);
// EXTERNAL MODULE: ./src/components/QuestionEditor/CompletionQuestionEditor.tsx
var CompletionQuestionEditor = __webpack_require__(65736);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EditPotin/components/Questions/CombinationEditor.tsx
var CombinationEditor_DragQuestions = function DragQuestions(_ref) {
var _exerciseitem$exercis;
var qitem = _ref.qitem,
TagDiscipline = _ref.TagDiscipline,
exerciseitem = _ref.exerciseitem,
setisedit = _ref.setisedit,
seveeditor = _ref.seveeditor,
deleteitem = _ref.deleteitem,
getTagData = _ref.getTagData,
init = _ref.init;
var _Form$useForm = es_form/* default */.Z.useForm(),
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
form = _Form$useForm2[0];
var scoreByBlank = es_form/* default */.Z.useWatch('use_blank_score', form);
(0,_react_17_0_2_react.useEffect)(function () {
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
standard_answers: qitem.standard_answer || [],
name: qitem.question_title,
repeat_answer: !qitem.repeat_answer
}));
}, [qitem]);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
form: form,
colon: false,
onValuesChange: function onValuesChange(values, value) {
if (values !== null && values !== void 0 && values.standard_answers) {
var _form$getFieldValue, _form$getFieldValue2;
var items = ((_form$getFieldValue = form.getFieldValue('standard_answers')) === null || _form$getFieldValue === void 0 ? void 0 : _form$getFieldValue.length) > 0 && ((_form$getFieldValue2 = form.getFieldValue('standard_answers')) === null || _form$getFieldValue2 === void 0 || (_form$getFieldValue2 = _form$getFieldValue2.map(function (item) {
return item.score;
})) === null || _form$getFieldValue2 === void 0 ? void 0 : _form$getFieldValue2.filter(function (item) {
return item;
}));
// let itemsnumber=items.reduce((a:any,b:any)=>a+b)
if ((items === null || items === void 0 ? void 0 : items.length) > 0) {
var _items$reduce;
form.setFieldsValue({
question_score: (items === null || items === void 0 ? void 0 : items.length) > 0 && ((_items$reduce = items.reduce(function (a, b) {
return a + b;
})) === null || _items$reduce === void 0 ? void 0 : _items$reduce.toFixed(1))
});
}
}
},
onFinish: function onFinish(values) {
seveeditor(objectSpread2_default()(objectSpread2_default()(objectSpread2_default()({}, qitem), values), {}, {
item_type: qitem === null || qitem === void 0 ? void 0 : qitem.question_type,
standard_answers: values.standard_answers,
standard_answer: undefined,
question_title: values.name
}));
},
onFinishFailed: ( /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(errInfo) {
var _errInfo$errorFields;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
message/* default */.ZP.error(errInfo.errorFields[0].errors[0]);
form.scrollToField(errInfo === null || errInfo === void 0 || (_errInfo$errorFields = errInfo.errorFields) === null || _errInfo$errorFields === void 0 || (_errInfo$errorFields = _errInfo$errorFields[0]) === null || _errInfo$errorFields === void 0 ? void 0 : _errInfo$errorFields.name, {
behavior: 'smooth',
block: 'center'
});
case 2:
case "end":
return _context.stop();
}
}, _callee);
}));
return function (_x) {
return _ref2.apply(this, arguments);
};
}()),
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'center'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
flex: 1
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
display: 'inline-flex',
border: '1px solid #9096A3',
borderRadius: '50%',
width: 10,
height: 10,
marginRight: 5,
background: '#9096A3'
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: '填空题'
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "use_blank_score",
noStyle: true,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Group */.ZP.Group, {
className: EditPotinmodules.scoreByBlankRadio,
optionType: "button",
options: [{
label: '按空给分',
value: true
}, {
label: '按题给分',
value: false
}]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
className: EditPotinmodules.scoreinput,
name: "question_score",
label: "\u5206\u503C",
rules: [{
required: true,
message: '请输入分值'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
style: {
width: 150
},
placeholder: "\u8BF7\u8F93\u5165\u5F53\u524D\u5C0F\u9898\u5206\u6570",
disabled: scoreByBlank,
max: 100,
min: 0.1
})
}), (exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis = exerciseitem.exercise) === null || _exerciseitem$exercis === void 0 ? void 0 : _exerciseitem$exercis.exercise_status) == 1 && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
marginLeft: 20,
color: 'red',
cursor: 'pointer'
},
onClick: function onClick() {
deleteitem();
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-piliangshanchu3",
style: {
fontSize: 14,
marginRight: 6
}
}), "\u5220\u9664"]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(CompletionQuestionEditor/* CompletionQuestionEditor */.u, {
form: form,
questionTitlePlaceholder: "\u8BF7\u7F16\u8F91\u586B\u7A7A\u9898\u9898\u5E72\u5185\u5BB9",
scoreByBlank: scoreByBlank,
answerKey: "standard_answers"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(MoreSetting, {
getTagData: getTagData,
qitem: qitem,
exerciseitem: exerciseitem,
TagDiscipline: TagDiscipline,
form: form
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.morebottom,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.no,
onClick: function onClick() {
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
standard_answers: qitem.standard_answer || [],
name: qitem.question_title,
repeat_answer: !qitem.repeat_answer
}));
},
children: "\u91CD\u7F6E"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.no,
onClick: function onClick() {
if (!qitem.isadd) {
//编辑时回到原题目
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
standard_answers: qitem.standard_answer || [],
name: qitem.question_title,
repeat_answer: !qitem.repeat_answer
}));
setisedit(false);
} else {
setisedit(false);
init();
}
},
children: "\u53D6\u6D88"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.yes,
onClick: function onClick() {
form.submit();
},
children: "\u4FDD\u5B58\u9898\u76EE"
})]
})]
});
};
/* harmony default export */ var CombinationEditor = (CombinationEditor_DragQuestions);
// EXTERNAL MODULE: ./src/components/QuestionEditor/JudgmentQuestionEditor.tsx
var JudgmentQuestionEditor = __webpack_require__(94248);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EditPotin/components/Questions/JudgmentQuestionEditor.tsx
var JudgmentQuestionEditor_DragQuestions = function DragQuestions(_ref) {
var _exerciseitem$exercis;
var qitem = _ref.qitem,
setisedit = _ref.setisedit,
TagDiscipline = _ref.TagDiscipline,
exerciseitem = _ref.exerciseitem,
seveeditor = _ref.seveeditor,
deleteitem = _ref.deleteitem,
getTagData = _ref.getTagData,
init = _ref.init;
var _Form$useForm = es_form/* default */.Z.useForm(),
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
form = _Form$useForm2[0];
(0,_react_17_0_2_react.useEffect)(function () {
var _qitem$question_choic;
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
name: qitem.question_title,
repeat_answer: !qitem.repeat_answer,
choices: qitem === null || qitem === void 0 || (_qitem$question_choic = qitem.question_choices) === null || _qitem$question_choic === void 0 ? void 0 : _qitem$question_choic.map(function (item) {
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
is_answer: item !== null && item !== void 0 && item.standard_boolean ? 1 : 0
});
})
}));
}, [qitem]);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
form: form,
colon: false,
onFinish: function onFinish(values) {
var _values$choices, _values$choices$map, _values$choices2, _values$choices2$map;
var items = values === null || values === void 0 || (_values$choices = values.choices) === null || _values$choices === void 0 || (_values$choices$map = _values$choices.map) === null || _values$choices$map === void 0 ? void 0 : _values$choices$map.call(_values$choices, function (item, index) {
if ((item === null || item === void 0 ? void 0 : item.is_answer) === 1) {
return index + 1;
}
});
seveeditor(objectSpread2_default()(objectSpread2_default()(objectSpread2_default()({}, qitem), values), {}, {
question_title: values.name,
standard_answers: items.filter(function (item) {
return item;
}),
question_choices: values === null || values === void 0 || (_values$choices2 = values.choices) === null || _values$choices2 === void 0 || (_values$choices2$map = _values$choices2.map) === null || _values$choices2$map === void 0 ? void 0 : _values$choices2$map.call(_values$choices2, function (item) {
return item.choice_text;
})
}));
},
onFinishFailed: ( /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(errInfo) {
var _errInfo$errorFields;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
message/* default */.ZP.error(errInfo.errorFields[0].errors[0]);
form.scrollToField(errInfo === null || errInfo === void 0 || (_errInfo$errorFields = errInfo.errorFields) === null || _errInfo$errorFields === void 0 || (_errInfo$errorFields = _errInfo$errorFields[0]) === null || _errInfo$errorFields === void 0 ? void 0 : _errInfo$errorFields.name, {
behavior: 'smooth',
block: 'center'
});
case 2:
case "end":
return _context.stop();
}
}, _callee);
}));
return function (_x) {
return _ref2.apply(this, arguments);
};
}()),
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'center'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
flex: 1
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
display: 'inline-flex',
border: '1px solid #9096A3',
borderRadius: '50%',
width: 10,
height: 10,
marginRight: 5,
background: '#9096A3'
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: '判断题'
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
className: EditPotinmodules.scoreinput,
name: "question_score",
label: "\u5206\u503C",
rules: [{
required: true,
message: '请输入分值'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
style: {
width: 150
},
placeholder: "\u8BF7\u8F93\u5165\u5F53\u524D\u5C0F\u9898\u5206\u6570",
max: 100,
min: 0.1
})
}), (exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis = exerciseitem.exercise) === null || _exerciseitem$exercis === void 0 ? void 0 : _exerciseitem$exercis.exercise_status) == 1 && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
marginLeft: 20,
color: 'red',
cursor: 'pointer'
},
onClick: function onClick() {
deleteitem();
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-piliangshanchu3",
style: {
fontSize: 14,
marginRight: 6
}
}), "\u5220\u9664"]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(JudgmentQuestionEditor/* JudgmentQuestionEditor */.Z, {
form: form,
questionTitlePlaceholder: "\u8BF7\u7F16\u8F91\u5224\u65AD\u9898\u9898\u5E72\u5185\u5BB9",
choiceKey: ""
}), /*#__PURE__*/(0,jsx_runtime.jsx)(MoreSetting, {
getTagData: getTagData,
qitem: qitem,
exerciseitem: exerciseitem,
TagDiscipline: TagDiscipline,
form: form
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.morebottom,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.no,
onClick: function onClick() {
var _qitem$question_choic2;
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
name: qitem.question_title,
repeat_answer: !qitem.repeat_answer,
choices: qitem === null || qitem === void 0 || (_qitem$question_choic2 = qitem.question_choices) === null || _qitem$question_choic2 === void 0 ? void 0 : _qitem$question_choic2.map(function (item) {
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
is_answer: item !== null && item !== void 0 && item.standard_boolean ? 1 : 0
});
})
}));
},
children: "\u91CD\u7F6E"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.no,
onClick: function onClick() {
if (!qitem.isadd) {
var _qitem$question_choic3;
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
name: qitem.question_title,
repeat_answer: !qitem.repeat_answer,
choices: qitem === null || qitem === void 0 || (_qitem$question_choic3 = qitem.question_choices) === null || _qitem$question_choic3 === void 0 ? void 0 : _qitem$question_choic3.map(function (item) {
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
is_answer: item !== null && item !== void 0 && item.standard_boolean ? 1 : 0
});
})
}));
setisedit(false);
} else {
setisedit(false);
init();
}
},
children: "\u53D6\u6D88"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.yes,
onClick: function onClick() {
form.submit();
},
children: "\u4FDD\u5B58\u9898\u76EE"
})]
})]
});
};
/* harmony default export */ var Questions_JudgmentQuestionEditor = (JudgmentQuestionEditor_DragQuestions);
// EXTERNAL MODULE: ./src/components/QuestionEditor/CombinationQuestionEditor.tsx
var CombinationQuestionEditor = __webpack_require__(97638);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EditPotin/components/Questions/CombinationQuestionEditor.tsx
var CombinationQuestionEditor_DragQuestions = function DragQuestions(_ref) {
var _exerciseitem$exercis;
var qitem = _ref.qitem,
setisedit = _ref.setisedit,
TagDiscipline = _ref.TagDiscipline,
exerciseitem = _ref.exerciseitem,
seveeditor = _ref.seveeditor,
deleteitem = _ref.deleteitem,
getTagData = _ref.getTagData,
init = _ref.init;
var _Form$useForm = es_form/* default */.Z.useForm(),
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
form = _Form$useForm2[0];
(0,_react_17_0_2_react.useEffect)(function () {
var _qitem$sub_exercise_q;
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
name: qitem.question_title,
sub_item_banks: (_qitem$sub_exercise_q = qitem.sub_exercise_questions) === null || _qitem$sub_exercise_q === void 0 ? void 0 : _qitem$sub_exercise_q.map(function (item) {
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
name: item.question_title,
choices: item.question_choices.map(function (val) {
return objectSpread2_default()(objectSpread2_default()({}, val), {}, {
is_answer: val !== null && val !== void 0 && val.standard_boolean ? 1 : 0
});
})
});
}),
repeat_answer: !qitem.repeat_answer
}));
}, [qitem]);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
form: form,
colon: false,
onValuesChange: function onValuesChange(values, value) {
if (values !== null && values !== void 0 && values.sub_item_banks) {
var _form$getFieldValue, _form$getFieldValue2;
var items = ((_form$getFieldValue = form.getFieldValue('sub_item_banks')) === null || _form$getFieldValue === void 0 ? void 0 : _form$getFieldValue.length) > 0 && ((_form$getFieldValue2 = form.getFieldValue('sub_item_banks')) === null || _form$getFieldValue2 === void 0 || (_form$getFieldValue2 = _form$getFieldValue2.map(function (item) {
return item.question_score;
})) === null || _form$getFieldValue2 === void 0 ? void 0 : _form$getFieldValue2.filter(function (item) {
return item;
}));
if ((items === null || items === void 0 ? void 0 : items.length) > 0) {
var _parseFloat;
form.setFieldsValue({
question_score: (_parseFloat = parseFloat(items.reduce(function (a, b) {
return parseFloat(a) + parseFloat(b);
}))) === null || _parseFloat === void 0 ? void 0 : _parseFloat.toFixed(1)
});
}
}
},
onFinish: function onFinish(values) {
var _values$sub_item_bank;
seveeditor(objectSpread2_default()(objectSpread2_default()(objectSpread2_default()({}, qitem), values), {}, {
question_title: values.name,
sub_questions: values === null || values === void 0 || (_values$sub_item_bank = values.sub_item_banks) === null || _values$sub_item_bank === void 0 ? void 0 : _values$sub_item_bank.map(function (item) {
var _item$choices, _item$choices$map, _item$choices2, _item$choices2$map;
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
question_title: item.name,
question_choices: item === null || item === void 0 || (_item$choices = item.choices) === null || _item$choices === void 0 || (_item$choices$map = _item$choices.map) === null || _item$choices$map === void 0 ? void 0 : _item$choices$map.call(_item$choices, function (item) {
return item.choice_text;
}),
standard_answers: item === null || item === void 0 || (_item$choices2 = item.choices) === null || _item$choices2 === void 0 || (_item$choices2$map = _item$choices2.map) === null || _item$choices2$map === void 0 ? void 0 : _item$choices2$map.call(_item$choices2, function (item, index) {
return (item === null || item === void 0 ? void 0 : item.is_answer) === 1 && index + 1;
}).filter(function (item) {
return item;
}),
item_type: 0
});
})
}));
},
onFinishFailed: ( /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(errInfo) {
var _errInfo$errorFields;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
message/* default */.ZP.error(errInfo.errorFields[0].errors[0]);
form.scrollToField(errInfo === null || errInfo === void 0 || (_errInfo$errorFields = errInfo.errorFields) === null || _errInfo$errorFields === void 0 || (_errInfo$errorFields = _errInfo$errorFields[0]) === null || _errInfo$errorFields === void 0 ? void 0 : _errInfo$errorFields.name, {
behavior: 'smooth',
block: 'center'
});
case 2:
case "end":
return _context.stop();
}
}, _callee);
}));
return function (_x) {
return _ref2.apply(this, arguments);
};
}()),
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'center'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
flex: 1
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
display: 'inline-flex',
border: '1px solid #9096A3',
borderRadius: '50%',
width: 10,
height: 10,
marginRight: 5,
background: '#9096A3'
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: '组合题'
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
className: EditPotinmodules.scoreinput,
name: "question_score",
label: "\u5206\u503C",
rules: [{
required: true,
message: '请输入分值'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
style: {
width: 150
},
placeholder: "\u8BF7\u8F93\u5165\u5F53\u524D\u5C0F\u9898\u5206\u6570",
disabled: true,
max: 100,
min: 0.1
})
}), (exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis = exerciseitem.exercise) === null || _exerciseitem$exercis === void 0 ? void 0 : _exerciseitem$exercis.exercise_status) == 1 && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
marginLeft: 20,
color: 'red',
cursor: 'pointer'
},
onClick: function onClick() {
deleteitem();
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-piliangshanchu3",
style: {
fontSize: 14,
marginRight: 6
}
}), "\u5220\u9664"]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(CombinationQuestionEditor/* CombinationQuestionEditor */.r, {
form: form,
withScore: true,
choiceKey: "",
questionTitlePlaceholder: "\u8BF7\u7F16\u8F91\u7EC4\u5408\u9898\u9898\u5E72\u5185\u5BB9"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(MoreSetting, {
getTagData: getTagData,
qitem: qitem,
exerciseitem: exerciseitem,
TagDiscipline: TagDiscipline,
form: form
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.morebottom,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.no,
onClick: function onClick() {
var _qitem$sub_exercise_q2;
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
name: qitem.question_title,
sub_item_banks: (_qitem$sub_exercise_q2 = qitem.sub_exercise_questions) === null || _qitem$sub_exercise_q2 === void 0 ? void 0 : _qitem$sub_exercise_q2.map(function (item) {
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
name: item.question_title,
choices: item.question_choices.map(function (val) {
return objectSpread2_default()(objectSpread2_default()({}, val), {}, {
is_answer: val !== null && val !== void 0 && val.standard_boolean ? 1 : 0
});
})
});
}),
repeat_answer: !qitem.repeat_answer
}));
},
children: "\u91CD\u7F6E"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.no,
onClick: function onClick() {
if (!qitem.isadd) {
var _qitem$sub_exercise_q3;
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
name: qitem.question_title,
sub_item_banks: (_qitem$sub_exercise_q3 = qitem.sub_exercise_questions) === null || _qitem$sub_exercise_q3 === void 0 ? void 0 : _qitem$sub_exercise_q3.map(function (item) {
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
name: item.question_title,
choices: item.question_choices.map(function (val) {
return objectSpread2_default()(objectSpread2_default()({}, val), {}, {
is_answer: val !== null && val !== void 0 && val.standard_boolean ? 1 : 0
});
})
});
}),
repeat_answer: !qitem.repeat_answer
}));
setisedit(false);
} else {
setisedit(false);
init();
}
},
children: "\u53D6\u6D88"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.yes,
onClick: function onClick() {
form.submit();
},
children: "\u4FDD\u5B58\u9898\u76EE"
})]
})]
});
};
/* harmony default export */ var Questions_CombinationQuestionEditor = (CombinationQuestionEditor_DragQuestions);
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 10 modules
var markdown_editor = __webpack_require__(32679);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EditPotin/components/Questions/ShixunEditor.tsx
var ShixunEditor_DragQuestions = function DragQuestions(_ref) {
var _exerciseitem$exercis, _qitem$shixun3;
var qitem = _ref.qitem,
setqitem = _ref.setqitem,
setisedit = _ref.setisedit,
TagDiscipline = _ref.TagDiscipline,
exerciseitem = _ref.exerciseitem,
seveeditor = _ref.seveeditor,
deleteitem = _ref.deleteitem;
var _Form$useForm = es_form/* default */.Z.useForm(),
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
form = _Form$useForm2[0];
(0,_react_17_0_2_react.useEffect)(function () {
var _qitem$question_choic, _qitem$shixun;
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
name: qitem === null || qitem === void 0 ? void 0 : qitem.question_title,
choices: qitem === null || qitem === void 0 || (_qitem$question_choic = qitem.question_choices) === null || _qitem$question_choic === void 0 ? void 0 : _qitem$question_choic.map(function (item) {
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
standard_boolean: item !== null && item !== void 0 && item.standard_boolean ? 1 : 0
});
}),
repeat_answer: !(qitem !== null && qitem !== void 0 && qitem.repeat_answer)
}));
qitem.shixun = qitem === null || qitem === void 0 || (_qitem$shixun = qitem.shixun) === null || _qitem$shixun === void 0 ? void 0 : _qitem$shixun.map(function (item) {
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
defaultscore: item.challenge_score
});
});
}, []);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
form: form,
colon: false,
onFinish: function onFinish(values) {
var _qitem$shixun2, _values$choices;
var datas = objectSpread2_default()(objectSpread2_default()({}, values), {}, {
question_scores: qitem === null || qitem === void 0 || (_qitem$shixun2 = qitem.shixun) === null || _qitem$shixun2 === void 0 ? void 0 : _qitem$shixun2.map(function (item) {
return item.challenge_score;
}),
item_type: qitem === null || qitem === void 0 ? void 0 : qitem.question_type,
choices: values === null || values === void 0 || (_values$choices = values.choices) === null || _values$choices === void 0 ? void 0 : _values$choices.map(function (item) {
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
is_answer: item.standard_boolean
});
})
});
seveeditor(objectSpread2_default()(objectSpread2_default()({}, qitem), datas));
},
onFinishFailed: ( /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(errInfo) {
var _errInfo$errorFields;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
message/* default */.ZP.error(errInfo.errorFields[0].errors[0]);
form.scrollToField(errInfo === null || errInfo === void 0 || (_errInfo$errorFields = errInfo.errorFields) === null || _errInfo$errorFields === void 0 || (_errInfo$errorFields = _errInfo$errorFields[0]) === null || _errInfo$errorFields === void 0 ? void 0 : _errInfo$errorFields.name, {
behavior: 'smooth',
block: 'center'
});
case 2:
case "end":
return _context.stop();
}
}, _callee);
}));
return function (_x) {
return _ref2.apply(this, arguments);
};
}()),
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'center'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
flex: 1
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
display: 'inline-flex',
border: '1px solid #9096A3',
borderRadius: '50%',
width: 10,
height: 10,
marginRight: 5,
background: '#9096A3'
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u5B9E\u8BAD\u9898"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
className: EditPotinmodules.scoreinput,
name: "question_score",
label: "\u5206\u503C",
rules: [{
required: true,
message: '请输入分值'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
style: {
width: 150
},
placeholder: "\u8BF7\u8F93\u5165\u5F53\u524D\u5C0F\u9898\u5206\u6570",
disabled: true,
max: 100,
min: 1
})
}), (exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis = exerciseitem.exercise) === null || _exerciseitem$exercis === void 0 ? void 0 : _exerciseitem$exercis.exercise_status) == 1 && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
marginLeft: 20,
color: 'red',
cursor: 'pointer'
},
onClick: function onClick() {
deleteitem();
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-piliangshanchu3",
style: {
fontSize: 14,
marginRight: 6
}
}), "\u5220\u9664"]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u9898\u5E72",
name: 'question_title',
labelCol: {
span: 24
},
rules: [{
required: true
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
watch: true,
height: 140,
placeholder: '',
defaultValue: qitem.question_title
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: 'red'
},
children: "*"
}), "\u5173\u5361\u540D\u79F0"]
})
}), qitem === null || qitem === void 0 || (_qitem$shixun3 = qitem.shixun) === null || _qitem$shixun3 === void 0 ? void 0 : _qitem$shixun3.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
marginBottom: 20
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
flex: 1
},
children: [index + 1, "\u3001", item.challenge_name]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: 'red'
},
children: "*"
}), "\u5206\u503C", /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
value: item === null || item === void 0 ? void 0 : item.challenge_score,
onChange: function onChange(e) {
var _qitem$shixun4;
item.challenge_score = e;
var score = parseFloat(qitem === null || qitem === void 0 || (_qitem$shixun4 = qitem.shixun) === null || _qitem$shixun4 === void 0 ? void 0 : _qitem$shixun4.map(function (item) {
return item.challenge_score;
}).reduce(function (a, b) {
return parseFloat(a) + parseFloat(b);
}));
form.setFieldsValue({
question_score: score.toFixed(1)
});
setqitem(objectSpread2_default()({}, qitem));
},
max: 100,
min: 0.1,
style: {
marginLeft: 10,
width: 150
},
placeholder: "\u8BF7\u8F93\u5165\u5F53\u524D\u5C0F\u9898\u5206\u6570",
size: 'middle'
})]
})]
});
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.morebottom,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.no,
onClick: function onClick() {
var _qitem$question_choic2, _qitem$shixun5;
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
name: qitem === null || qitem === void 0 ? void 0 : qitem.question_title,
choices: qitem === null || qitem === void 0 || (_qitem$question_choic2 = qitem.question_choices) === null || _qitem$question_choic2 === void 0 ? void 0 : _qitem$question_choic2.map(function (item) {
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
standard_boolean: item !== null && item !== void 0 && item.standard_boolean ? 1 : 0
});
}),
repeat_answer: !(qitem !== null && qitem !== void 0 && qitem.repeat_answer)
}));
qitem.shixun = qitem === null || qitem === void 0 || (_qitem$shixun5 = qitem.shixun) === null || _qitem$shixun5 === void 0 ? void 0 : _qitem$shixun5.map(function (item) {
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
challenge_score: item.defaultscore
});
});
setqitem(objectSpread2_default()({}, qitem));
},
children: "\u91CD\u7F6E"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.no,
onClick: function onClick() {
var _qitem$question_choic3, _qitem$shixun6;
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
name: qitem === null || qitem === void 0 ? void 0 : qitem.question_title,
choices: qitem === null || qitem === void 0 || (_qitem$question_choic3 = qitem.question_choices) === null || _qitem$question_choic3 === void 0 ? void 0 : _qitem$question_choic3.map(function (item) {
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
standard_boolean: item !== null && item !== void 0 && item.standard_boolean ? 1 : 0
});
}),
repeat_answer: !(qitem !== null && qitem !== void 0 && qitem.repeat_answer)
}));
qitem.shixun = qitem === null || qitem === void 0 || (_qitem$shixun6 = qitem.shixun) === null || _qitem$shixun6 === void 0 ? void 0 : _qitem$shixun6.map(function (item) {
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
challenge_score: item.defaultscore
});
});
setqitem(objectSpread2_default()({}, qitem));
setisedit(false);
},
children: "\u53D6\u6D88"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.yes,
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
var _qitem$shixun7, _qitem$shixun7$map, _qitem$shixun8;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
if (!((qitem === null || qitem === void 0 || (_qitem$shixun7 = qitem.shixun) === null || _qitem$shixun7 === void 0 || (_qitem$shixun7$map = _qitem$shixun7.map) === null || _qitem$shixun7$map === void 0 ? void 0 : _qitem$shixun7$map.call(_qitem$shixun7, function (item) {
return item.challenge_score;
}).filter(function (item) {
return item;
}).length) < (qitem === null || qitem === void 0 || (_qitem$shixun8 = qitem.shixun) === null || _qitem$shixun8 === void 0 ? void 0 : _qitem$shixun8.length))) {
_context2.next = 3;
break;
}
message/* default */.ZP.info('分数不能为空');
return _context2.abrupt("return");
case 3:
form.submit();
// await form.validateFields()
// let values=form.getFieldsValue()
case 4:
case "end":
return _context2.stop();
}
}, _callee2);
})),
children: "\u4FDD\u5B58\u9898\u76EE"
})]
}), console.log('---', qitem)]
});
};
/* harmony default export */ var ShixunEditor = (ShixunEditor_DragQuestions);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EditPotin/components/Saveitem.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var Saveitemmodules = ({"flex_box_center":"flex_box_center___Vhtb1","flex_space_between":"flex_space_between___k2ZrJ","flex_box_vertical_center":"flex_box_vertical_center___tn6Db","flex_box_center_end":"flex_box_center_end___k3eNX","flex_box_column":"flex_box_column___rsWbi","warp":"warp___UlRJc","normalWrap":"normalWrap___Qm4zY","indexTag":"indexTag___rjJ1u","redio":"redio___VW3yr","redioitem":"redioitem___jAPlJ","redioitemyes":"redioitemyes___VoiQ1","title":"title___Dt2dl","titleyes":"titleyes___Fjh3a","yestag":"yestag___CXrPv","checkbox":"checkbox___CgMU_","checkboxitem":"checkboxitem___PpJ9n","checkboxitemyes":"checkboxitemyes___pCfvZ","bottom":"bottom___BqrmJ","bottomitem":"bottomitem___Qk2rG","left":"left___l29lW","right":"right___nB1XE","completion":"completion___y1m7L","content":"content___AmQy4","items":"items___lIt8e","simple":"simple___zxJLH","shixunWrapper":"shixunWrapper___kAYdL","shixun":"shixun___UE6xS","score":"score___Px5Fq","qtitle":"qtitle___wG7Nn","program":"program___gzKdL","combination":"combination___R0ysn","qtype":"qtype___U0Suy"});
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/row/index.js
var row = __webpack_require__(95237);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/col/index.js
var col = __webpack_require__(43604);
// EXTERNAL MODULE: ./node_modules/_js-base64@2.6.4@js-base64/base64.js
var base64 = __webpack_require__(24334);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EditPotin/components/SaveItem.tsx
//数组对应值
var tagDotData = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
var SaveItem_DragQuestions = function DragQuestions(_ref) {
var _qitem$question_choic, _qitem$question_choic2, _qitem$standard_answe, _qitem$standard_answe2, _qitem$shixun, _qitem$sub_exercise_q, _qitem$program_attr, _qitem$tag_discipline, _qitem$tag_discipline2, _qitem$tag_discipline3, _qitem$tag_discipline4;
var qitem = _ref.qitem;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Saveitemmodules.warp,
children: [((qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 0 || (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 2) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Saveitemmodules.normalWrap,
children: qitem === null || qitem === void 0 || (_qitem$question_choic = qitem.question_choices) === null || _qitem$question_choic === void 0 ? void 0 : _qitem$question_choic.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Saveitemmodules.redio,
children: [!(item !== null && item !== void 0 && item.standard_boolean) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: Saveitemmodules.redioitem
}), (item === null || item === void 0 ? void 0 : item.standard_boolean) && /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "".concat(Saveitemmodules.redioitemyes, " icon-duigou1")
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "".concat(item !== null && item !== void 0 && item.standard_boolean ? Saveitemmodules.titleyes : Saveitemmodules.title, " ").concat(Saveitemmodules.indexTag),
children: (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 0 ? tagDotData[index] : ''
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: item !== null && item !== void 0 && item.standard_boolean ? Saveitemmodules.titleyes : Saveitemmodules.title,
value: item === null || item === void 0 ? void 0 : item.choice_text
}), (item === null || item === void 0 ? void 0 : item.standard_boolean) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Saveitemmodules.yestag,
children: "\u6B63\u786E\u7B54\u6848"
})]
});
})
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 1 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Saveitemmodules.normalWrap,
children: qitem === null || qitem === void 0 || (_qitem$question_choic2 = qitem.question_choices) === null || _qitem$question_choic2 === void 0 ? void 0 : _qitem$question_choic2.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Saveitemmodules.checkbox,
children: [!(item !== null && item !== void 0 && item.standard_boolean) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: Saveitemmodules.checkboxitem
}), (item === null || item === void 0 ? void 0 : item.standard_boolean) && /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "".concat(Saveitemmodules.checkboxitemyes, " icon-duigou1")
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "".concat(item !== null && item !== void 0 && item.standard_boolean ? Saveitemmodules.titleyes : Saveitemmodules.title, " ").concat(Saveitemmodules.indexTag),
children: tagDotData[index]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: item !== null && item !== void 0 && item.standard_boolean ? Saveitemmodules.titleyes : Saveitemmodules.title,
value: item === null || item === void 0 ? void 0 : item.choice_text
}), (item === null || item === void 0 ? void 0 : item.standard_boolean) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Saveitemmodules.yestag,
children: "\u6B63\u786E\u7B54\u6848"
})]
});
})
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 3 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Saveitemmodules.completion,
children: qitem === null || qitem === void 0 || (_qitem$standard_answe = qitem.standard_answer) === null || _qitem$standard_answe === void 0 ? void 0 : _qitem$standard_answe.map(function (item, index) {
var _item$answer_text;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: Saveitemmodules.title,
children: ["\u586B\u7A7A\u9879", index + 1]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
gutter: [30, 20],
className: "".concat(Saveitemmodules.content, " mb20"),
children: (_item$answer_text = item.answer_text) === null || _item$answer_text === void 0 ? void 0 : _item$answer_text.map(function (val, vindex) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Saveitemmodules.items,
children: val
})
}, vindex);
})
})]
});
})
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 4 && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Saveitemmodules.simple,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: Saveitemmodules.title,
children: "\u53C2\u8003\u7B54\u6848"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: Saveitemmodules.content,
value: (qitem === null || qitem === void 0 || (_qitem$standard_answe2 = qitem.standard_answer) === null || _qitem$standard_answe2 === void 0 ? void 0 : _qitem$standard_answe2[0]) || ''
})]
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 5 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Saveitemmodules.shixunWrapper,
children: qitem === null || qitem === void 0 || (_qitem$shixun = qitem.shixun) === null || _qitem$shixun === void 0 ? void 0 : _qitem$shixun.map(function (val, vindex) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "".concat(Saveitemmodules.shixun, " mb30"),
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: Saveitemmodules.score,
children: ["\uFF08", val === null || val === void 0 ? void 0 : val.challenge_score, "\u5206\uFF09"]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: Saveitemmodules.qtitle,
children: [(qitem === null || qitem === void 0 ? void 0 : qitem.index) + "." + (vindex + 1), "\u3001", val === null || val === void 0 ? void 0 : val.challenge_name]
})]
}, vindex);
})
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 6 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Saveitemmodules.program,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: Saveitemmodules.content,
value: (qitem === null || qitem === void 0 ? void 0 : qitem.description) || '- -'
})
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 7 && (qitem === null || qitem === void 0 || (_qitem$sub_exercise_q = qitem.sub_exercise_questions) === null || _qitem$sub_exercise_q === void 0 ? void 0 : _qitem$sub_exercise_q.map(function (val, vndex) {
var _val$question_choices;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Saveitemmodules.combination,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: Saveitemmodules.score,
children: [val === null || val === void 0 ? void 0 : val.question_score, "\u5206"]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: Saveitemmodules.qtype,
children: "\u5355\u9009\u9898"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: Saveitemmodules.qtitle,
children: [(qitem === null || qitem === void 0 ? void 0 : qitem.index) + "." + (vndex + 1), "\u3001", val === null || val === void 0 ? void 0 : val.question_title]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Saveitemmodules.warp,
style: {
padding: '30px 58px',
paddingBottom: 0
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: val === null || val === void 0 || (_val$question_choices = val.question_choices) === null || _val$question_choices === void 0 ? void 0 : _val$question_choices.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Saveitemmodules.redio,
children: [!(item !== null && item !== void 0 && item.standard_boolean) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: Saveitemmodules.redioitem
}), (item === null || item === void 0 ? void 0 : item.standard_boolean) && /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "".concat(Saveitemmodules.redioitemyes, " icon-duigou1")
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "".concat(item !== null && item !== void 0 && item.standard_boolean ? Saveitemmodules.titleyes : Saveitemmodules.title, " ").concat(Saveitemmodules.indexTag),
children: tagDotData[index]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: item !== null && item !== void 0 && item.standard_boolean ? Saveitemmodules.titleyes : Saveitemmodules.title,
value: item === null || item === void 0 ? void 0 : item.choice_text
}), (item === null || item === void 0 ? void 0 : item.standard_boolean) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Saveitemmodules.yestag,
children: "\u6B63\u786E\u7B54\u6848"
})]
});
})
})
})]
});
})), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 8 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
disabledFill: true,
className: Saveitemmodules.content,
showProgramFill: true,
value: base64.Base64.decode((qitem === null || qitem === void 0 || (_qitem$program_attr = qitem.program_attr) === null || _qitem$program_attr === void 0 ? void 0 : _qitem$program_attr.code) || '')
})
}), ((qitem === null || qitem === void 0 ? void 0 : qitem.question_type) <= 4 || [6, 8].includes(qitem === null || qitem === void 0 ? void 0 : qitem.question_type)) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Saveitemmodules.bottom,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "".concat(Saveitemmodules.bottomitem, " mb30"),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: Saveitemmodules.left,
children: "\u89E3\u6790"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: Saveitemmodules.right,
value: (qitem === null || qitem === void 0 ? void 0 : qitem.analysis) || ''
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "".concat(Saveitemmodules.bottomitem, " mb30"),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: Saveitemmodules.left,
children: "\u96BE\u5EA6"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: Saveitemmodules.right,
children: (qitem === null || qitem === void 0 ? void 0 : qitem.difficulty) === 1 ? '简单' : (qitem === null || qitem === void 0 ? void 0 : qitem.difficulty) === 2 ? '适中' : (qitem === null || qitem === void 0 ? void 0 : qitem.difficulty) === 3 ? '困难' : '- -'
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Saveitemmodules.bottomitem,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: Saveitemmodules.left,
children: "\u77E5\u8BC6\u70B9"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: (qitem === null || qitem === void 0 || (_qitem$tag_discipline = qitem.tag_discipline_names) === null || _qitem$tag_discipline === void 0 ? void 0 : _qitem$tag_discipline.length) <= 0 ? '- -' : qitem === null || qitem === void 0 || (_qitem$tag_discipline2 = qitem.tag_discipline_names) === null || _qitem$tag_discipline2 === void 0 || (_qitem$tag_discipline2 = _qitem$tag_discipline2.join('')) === null || _qitem$tag_discipline2 === void 0 ? void 0 : _qitem$tag_discipline2.toString(),
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: Saveitemmodules.right,
children: (qitem === null || qitem === void 0 || (_qitem$tag_discipline3 = qitem.tag_discipline_names) === null || _qitem$tag_discipline3 === void 0 ? void 0 : _qitem$tag_discipline3.length) <= 0 ? '- -' : qitem === null || qitem === void 0 || (_qitem$tag_discipline4 = qitem.tag_discipline_names) === null || _qitem$tag_discipline4 === void 0 || (_qitem$tag_discipline4 = _qitem$tag_discipline4.join('')) === null || _qitem$tag_discipline4 === void 0 ? void 0 : _qitem$tag_discipline4.toString()
})
})]
})]
})]
});
};
/* harmony default export */ var SaveItem = (SaveItem_DragQuestions);
// EXTERNAL MODULE: ./src/pages/Classrooms/Lists/Exercise/Edit/components/UploadQuestions/index.tsx + 1 modules
var UploadQuestions = __webpack_require__(9211);
// EXTERNAL MODULE: ./src/components/QuestionEditor/SubjectiveQuestionEditor.tsx
var SubjectiveQuestionEditor = __webpack_require__(44352);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EditPotin/components/Questions/SubjectiveQuestionEditor.tsx
var SubjectiveQuestionEditor_DragQuestions = function DragQuestions(_ref) {
var _exerciseitem$exercis;
var qitem = _ref.qitem,
setisedit = _ref.setisedit,
TagDiscipline = _ref.TagDiscipline,
exerciseitem = _ref.exerciseitem,
seveeditor = _ref.seveeditor,
deleteitem = _ref.deleteitem,
getTagData = _ref.getTagData,
init = _ref.init;
var _Form$useForm = es_form/* default */.Z.useForm(),
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
form = _Form$useForm2[0];
(0,_react_17_0_2_react.useEffect)(function () {
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
name: qitem.question_title,
answer_texts: qitem.standard_answer,
repeat_answer: !qitem.repeat_answer
}));
}, [qitem]);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
form: form,
colon: false,
onFinish: function onFinish(values) {
seveeditor(objectSpread2_default()(objectSpread2_default()(objectSpread2_default()({}, qitem), values), {}, {
standard_answers: values === null || values === void 0 ? void 0 : values.answer_texts,
question_title: values === null || values === void 0 ? void 0 : values.name
}));
},
onFinishFailed: ( /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(errInfo) {
var _errInfo$errorFields;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
message/* default */.ZP.error(errInfo.errorFields[0].errors[0]);
form.scrollToField(errInfo === null || errInfo === void 0 || (_errInfo$errorFields = errInfo.errorFields) === null || _errInfo$errorFields === void 0 || (_errInfo$errorFields = _errInfo$errorFields[0]) === null || _errInfo$errorFields === void 0 ? void 0 : _errInfo$errorFields.name, {
behavior: 'smooth',
block: 'center'
});
case 2:
case "end":
return _context.stop();
}
}, _callee);
}));
return function (_x) {
return _ref2.apply(this, arguments);
};
}()),
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'center'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
flex: 1
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
display: 'inline-flex',
border: '1px solid #9096A3',
borderRadius: '50%',
width: 10,
height: 10,
marginRight: 5,
background: '#9096A3'
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: '简答题'
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
className: EditPotinmodules.scoreinput,
name: "question_score",
label: "\u5206\u503C",
rules: [{
required: true,
message: '请输入分值'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
style: {
width: 150
},
placeholder: "\u8BF7\u8F93\u5165\u5F53\u524D\u5C0F\u9898\u5206\u6570",
max: 100,
min: 0.1
})
}), (exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis = exerciseitem.exercise) === null || _exerciseitem$exercis === void 0 ? void 0 : _exerciseitem$exercis.exercise_status) == 1 && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
marginLeft: 20,
color: 'red',
cursor: 'pointer'
},
onClick: function onClick() {
deleteitem();
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-piliangshanchu3",
style: {
fontSize: 14,
marginRight: 6
}
}), "\u5220\u9664"]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(SubjectiveQuestionEditor/* SubjectiveQuestionEditor */.W, {
form: form,
showKeywords: true,
questionTitlePlaceholder: "\u8BF7\u7F16\u8F91\u7B80\u7B54\u9898\u9898\u5E72\u5185\u5BB9"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(MoreSetting, {
getTagData: getTagData,
qitem: qitem,
exerciseitem: exerciseitem,
TagDiscipline: TagDiscipline,
form: form
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.morebottom,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.no,
onClick: function onClick() {
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
name: qitem === null || qitem === void 0 ? void 0 : qitem.question_title,
answer_texts: qitem.standard_answer || [],
repeat_answer: !(qitem !== null && qitem !== void 0 && qitem.repeat_answer)
}));
},
children: "\u91CD\u7F6E"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.no,
onClick: function onClick() {
if (!qitem.isadd) {
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
name: qitem === null || qitem === void 0 ? void 0 : qitem.question_title,
answer_texts: qitem.standard_answer || [],
repeat_answer: !(qitem !== null && qitem !== void 0 && qitem.repeat_answer)
}));
setisedit(false);
} else {
setisedit(false);
init();
}
},
children: "\u53D6\u6D88"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.yes,
onClick: function onClick() {
form.submit();
},
children: "\u4FDD\u5B58\u9898\u76EE"
})]
})]
});
};
/* harmony default export */ var Questions_SubjectiveQuestionEditor = (SubjectiveQuestionEditor_DragQuestions);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EditPotin/components/Setscore.tsx
var SetScore = function SetScore(_ref) {
var _exerciseitem$exercis, _exerciseitem$exercis2;
var setScoreShow = _ref.setScoreShow,
ScoreShow = _ref.ScoreShow,
exerciseitem = _ref.exerciseitem,
getdata = _ref.getdata;
var _useState = (0,_react_17_0_2_react.useState)(false),
_useState2 = slicedToArray_default()(_useState, 2),
isshow = _useState2[0],
setisshow = _useState2[1];
function setscore() {
return _setscore.apply(this, arguments);
}
function _setscore() {
_setscore = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var _exerciseitem$exercis4, _exerciseitem$exercis5;
var question_arr, res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
question_arr = exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis4 = exerciseitem.exercise_question_types) === null || _exerciseitem$exercis4 === void 0 || (_exerciseitem$exercis4 = _exerciseitem$exercis4.filter(function (item) {
return item.Singlequestion;
})) === null || _exerciseitem$exercis4 === void 0 ? void 0 : _exerciseitem$exercis4.map(function (item) {
return {
question_type: item.question_type,
score: item.Singlequestion
};
});
_context.next = 3;
return (0,fetch/* default */.ZP)("/api/exercises/".concat(exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis5 = exerciseitem.exercise) === null || _exerciseitem$exercis5 === void 0 ? void 0 : _exerciseitem$exercis5.id, "/batch_set_score.json"), {
method: 'POST',
body: {
question_arr: question_arr
}
});
case 3:
res = _context.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
getdata();
}
case 5:
case "end":
return _context.stop();
}
}, _callee);
}));
return _setscore.apply(this, arguments);
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [ScoreShow && /*#__PURE__*/(0,jsx_runtime.jsxs)(modal/* default */.Z, {
title: false,
footer: false,
open: ScoreShow,
width: 640,
centered: true,
zIndex: 10,
closable: false,
className: EditPotinmodules.scoremodal,
onCancel: function onCancel() {
setScoreShow(false);
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'center'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.title,
children: ["\u6279\u91CF\u8BBE\u7F6E\u5206\u503C", /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.score,
children: ["\u603B\u5206 ", (exerciseitem === null || exerciseitem === void 0 ? void 0 : exerciseitem.exercise_question_types.length) > 0 && (exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis = exerciseitem.exercise_types) === null || _exerciseitem$exercis === void 0 ? void 0 : _exerciseitem$exercis.q_scores)]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
onClick: function onClick() {
return setScoreShow(false);
},
className: EditPotinmodules.close,
children: "X"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.content,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u9898\u578B\u540D\u79F0"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u5C0F\u9898\u603B\u6570"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u9898\u578B\u603B\u5206"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u64CD\u4F5C"
})]
}), exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis2 = exerciseitem.exercise_question_types) === null || _exerciseitem$exercis2 === void 0 || (_exerciseitem$exercis2 = _exerciseitem$exercis2.filter(function (item) {
return item.name !== '实训题' && item.name !== '组合题';
})) === null || _exerciseitem$exercis2 === void 0 ? void 0 : _exerciseitem$exercis2.map(function (item) {
var _item$items;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.items,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: item === null || item === void 0 ? void 0 : item.name
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: item === null || item === void 0 || (_item$items = item.items) === null || _item$items === void 0 ? void 0 : _item$items.length
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: item === null || item === void 0 ? void 0 : item.score
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: ["\u6BCF\u9898", /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
max: 100,
min: 0.1,
onChange: function onChange(e) {
item.Singlequestion = e;
},
style: {
width: 90,
height: 38,
margin: '0px 10px',
display: 'flex',
alignItems: 'center'
}
}), "\u5206"]
})]
});
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.bottom,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.no,
onClick: function onClick() {
setScoreShow(false);
},
children: "\u53D6\u6D88"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.yes,
onClick: function onClick() {
var _exerciseitem$exercis3;
if (exerciseitem !== null && exerciseitem !== void 0 && exerciseitem.use_blank_score && exerciseitem !== null && exerciseitem !== void 0 && (_exerciseitem$exercis3 = exerciseitem.exercise_question_types) !== null && _exerciseitem$exercis3 !== void 0 && (_exerciseitem$exercis3 = _exerciseitem$exercis3.filter(function (item) {
return item.name === '填空题';
})) !== null && _exerciseitem$exercis3 !== void 0 && (_exerciseitem$exercis3 = _exerciseitem$exercis3[0]) !== null && _exerciseitem$exercis3 !== void 0 && _exerciseitem$exercis3.Singlequestion) {
setisshow(true);
return;
}
setscore();
setScoreShow(false);
},
children: "\u786E\u8BA4"
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(modal/* default */.Z, {
title: false,
footer: false,
centered: true,
zIndex: 20,
open: isshow,
width: 640,
closable: false,
className: EditPotinmodules.scoremodal,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
marginTop: 40
},
children: ["\u586B\u7A7A\u9898\u4E2D\u5B58\u5728", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#FA6400'
},
children: "\u6309\u7A7A\u7ED9\u5206"
}), "\u7684\u5C0F\u9898\uFF0C\u82E5\u6279\u91CF\u8BBE\u7F6E\u5206\u503C\u4F1A\u7EDF\u4E00\u5C06\u586B\u7A7A\u9898\u6539\u4E3A\u6309\u9898\u7ED9\u5206"]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.bottom,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.no,
onClick: function onClick() {
setisshow(false);
},
children: "\u53D6\u6D88"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.yes,
onClick: function onClick() {
setscore();
setisshow(false);
setScoreShow(false);
},
children: "\u786E\u8BA4"
})]
})]
})]
});
};
/* harmony default export */ var Setscore = (SetScore);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/createForOfIteratorHelper.js
var createForOfIteratorHelper = __webpack_require__(91232);
var createForOfIteratorHelper_default = /*#__PURE__*/__webpack_require__.n(createForOfIteratorHelper);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tabs/index.js + 24 modules
var tabs = __webpack_require__(99313);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/table/index.js + 85 modules
var table = __webpack_require__(90508);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/pagination/index.js + 10 modules
var pagination = __webpack_require__(66786);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EditPotin/components/AddQuestionsModal/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var AddQuestionsModalmodules = ({"flex_box_center":"flex_box_center___aDsO9","flex_space_between":"flex_space_between___5V4Xk","flex_box_vertical_center":"flex_box_vertical_center___rNdEP","flex_box_center_end":"flex_box_center_end___cKjnr","flex_box_column":"flex_box_column___glFYD","scoremodal":"scoremodal___PfqOf","selectWrapper":"selectWrapper___Mtqcz","allqingchu":"allqingchu___IqL8g","title":"title___UgYfD","score":"score___LjJmD","close":"close___I0jAO","content":"content___4u86F","items":"items___mK2L5","bottom":"bottom___vQTEm","yes":"yes___j81JQ","no":"no___kiUH4","titlecount":"titlecount___lliQr","add":"add___QhDj8","search":"search___QCCaL","searchIcon":"searchIcon___oXRH5","tabWrap":"tabWrap___Cu_4D","previewModal":"previewModal___BVDlS"});
// EXTERNAL MODULE: ./src/models/problemset/util.ts
var problemset_util = __webpack_require__(6917);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EditPotin/components/AddQuestionsModal/Saveitem.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var AddQuestionsModal_Saveitemmodules = ({"flex_box_center":"flex_box_center___zojHa","flex_space_between":"flex_space_between___wmLZ4","flex_box_vertical_center":"flex_box_vertical_center___DszWW","flex_box_center_end":"flex_box_center_end___mVCv5","flex_box_column":"flex_box_column___fbC9t","warp":"warp___isAcM","mainPart":"mainPart___TiJvQ","shixunbutton":"shixunbutton___h3Ybb","redio":"redio___xDffb","redioitem":"redioitem___FFPtq","redioitemyes":"redioitemyes___pF7ID","title":"title___mnPZc","titleyes":"titleyes___wrtWQ","yestag":"yestag___D4krY","qcount":"qcount___W5pwO","score":"score___eKQzl","qtitle":"qtitle___lb8MD","checkbox":"checkbox___QpUm4","checkboxitem":"checkboxitem___Wm2SH","checkboxitemyes":"checkboxitemyes___VVVTe","bottom":"bottom___Mn_Bw","bottomitem":"bottomitem___JTyHT","left":"left___nQqpo","right":"right___v58qy","completion":"completion___BnZSp","content":"content___MU8hZ","items":"items___a7i54","simple":"simple___GDw3K","shixun":"shixun___DGzTe","combination":"combination___AG9cr"});
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EditPotin/components/AddQuestionsModal/SaveItem.tsx
//数组对应值
var SaveItem_tagDotData = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
var AddQuestionsModal_SaveItem_DragQuestions = function DragQuestions(_ref) {
var _qitem$program_attr, _qitem$choices, _qitem$choices2, _qitem$standard_answe, _qitem$answer_texts, _qitem$challenge_name, _qitem$program_attr2, _qitem$sub_item_banks, _qitem$program_attr3;
var qitem = _ref.qitem;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: AddQuestionsModal_Saveitemmodules.warp,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: AddQuestionsModal_Saveitemmodules.mainPart,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: AddQuestionsModal_Saveitemmodules.qcount,
children: [(qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 8 && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: AddQuestionsModal_Saveitemmodules.content,
showProgramFill: true,
value: qitem === null || qitem === void 0 || (_qitem$program_attr = qitem.program_attr) === null || _qitem$program_attr === void 0 ? void 0 : _qitem$program_attr.description
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) != 8 && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: AddQuestionsModal_Saveitemmodules.qtitle,
value: (qitem === null || qitem === void 0 ? void 0 : qitem.name) || (qitem === null || qitem === void 0 ? void 0 : qitem.title)
})]
}), ((qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 0 || (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 2) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: qitem === null || qitem === void 0 || (_qitem$choices = qitem.choices) === null || _qitem$choices === void 0 ? void 0 : _qitem$choices.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: AddQuestionsModal_Saveitemmodules.redio,
children: [!(item !== null && item !== void 0 && item.is_answer) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: AddQuestionsModal_Saveitemmodules.redioitem
}), (item === null || item === void 0 ? void 0 : item.is_answer) && /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "".concat(AddQuestionsModal_Saveitemmodules.redioitemyes, " icon-duigou1")
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: item !== null && item !== void 0 && item.is_answer ? AddQuestionsModal_Saveitemmodules.titleyes : AddQuestionsModal_Saveitemmodules.title,
value: SaveItem_tagDotData[index] + (item === null || item === void 0 ? void 0 : item.choice_text)
}), (item === null || item === void 0 ? void 0 : item.is_answer) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: AddQuestionsModal_Saveitemmodules.yestag,
children: "\u6B63\u786E\u7B54\u6848"
})]
});
})
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 1 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: qitem === null || qitem === void 0 || (_qitem$choices2 = qitem.choices) === null || _qitem$choices2 === void 0 ? void 0 : _qitem$choices2.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: AddQuestionsModal_Saveitemmodules.checkbox,
children: [!(item !== null && item !== void 0 && item.is_answer) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: AddQuestionsModal_Saveitemmodules.checkboxitem
}), (item === null || item === void 0 ? void 0 : item.is_answer) && /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "".concat(AddQuestionsModal_Saveitemmodules.checkboxitemyes, " icon-duigou1")
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: item !== null && item !== void 0 && item.is_answer ? AddQuestionsModal_Saveitemmodules.titleyes : AddQuestionsModal_Saveitemmodules.title,
value: SaveItem_tagDotData[index] + (item === null || item === void 0 ? void 0 : item.choice_text)
}), (item === null || item === void 0 ? void 0 : item.is_answer) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: AddQuestionsModal_Saveitemmodules.yestag,
children: "\u6B63\u786E\u7B54\u6848"
})]
});
})
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 3 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: AddQuestionsModal_Saveitemmodules.completion,
children: qitem === null || qitem === void 0 || (_qitem$standard_answe = qitem.standard_answer) === null || _qitem$standard_answe === void 0 ? void 0 : _qitem$standard_answe.map(function (item, index) {
var _item$answer_text;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: AddQuestionsModal_Saveitemmodules.title,
children: ["\u586B\u7A7A\u9879", index + 1]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: AddQuestionsModal_Saveitemmodules.content,
children: item === null || item === void 0 || (_item$answer_text = item.answer_text) === null || _item$answer_text === void 0 ? void 0 : _item$answer_text.map(function (val, vindex) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: AddQuestionsModal_Saveitemmodules.items,
children: val
});
})
})]
});
})
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 4 && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: AddQuestionsModal_Saveitemmodules.simple,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: AddQuestionsModal_Saveitemmodules.title,
children: "\u53C2\u8003\u7B54\u6848"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: AddQuestionsModal_Saveitemmodules.content,
value: (qitem === null || qitem === void 0 || (_qitem$answer_texts = qitem.answer_texts) === null || _qitem$answer_texts === void 0 ? void 0 : _qitem$answer_texts[0]) || '- -'
})]
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 5 && (qitem === null || qitem === void 0 || (_qitem$challenge_name = qitem.challenge_names) === null || _qitem$challenge_name === void 0 ? void 0 : _qitem$challenge_name.map(function (val, vindex) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: AddQuestionsModal_Saveitemmodules.shixun,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: AddQuestionsModal_Saveitemmodules.qtitle,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
marginRight: 10
},
children: ["\u7B2C", (0,util/* toChineseNumber */.EM)(vindex + 1), "\u9898"]
}), val]
})
});
})), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 6 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: AddQuestionsModal_Saveitemmodules.simple,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: AddQuestionsModal_Saveitemmodules.content,
value: (qitem === null || qitem === void 0 || (_qitem$program_attr2 = qitem.program_attr) === null || _qitem$program_attr2 === void 0 ? void 0 : _qitem$program_attr2.description) || '- -'
})
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 7 && (qitem === null || qitem === void 0 || (_qitem$sub_item_banks = qitem.sub_item_banks) === null || _qitem$sub_item_banks === void 0 ? void 0 : _qitem$sub_item_banks.map(function (val, vndex) {
var _val$choices;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: AddQuestionsModal_Saveitemmodules.combination,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: AddQuestionsModal_Saveitemmodules.qtitle,
children: val === null || val === void 0 ? void 0 : val.name
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: AddQuestionsModal_Saveitemmodules.warp,
style: {
padding: '0px',
paddingTop: 20
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: val === null || val === void 0 || (_val$choices = val.choices) === null || _val$choices === void 0 ? void 0 : _val$choices.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: AddQuestionsModal_Saveitemmodules.redio,
children: [!(item !== null && item !== void 0 && item.is_answer) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: AddQuestionsModal_Saveitemmodules.redioitem
}), (item === null || item === void 0 ? void 0 : item.is_answer) && /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "".concat(AddQuestionsModal_Saveitemmodules.redioitemyes, " icon-duigou1")
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: item !== null && item !== void 0 && item.is_answer ? AddQuestionsModal_Saveitemmodules.titleyes : AddQuestionsModal_Saveitemmodules.title,
value: SaveItem_tagDotData[index] + (item === null || item === void 0 ? void 0 : item.choice_text)
}), (item === null || item === void 0 ? void 0 : item.is_answer) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: AddQuestionsModal_Saveitemmodules.yestag,
children: "\u6B63\u786E\u7B54\u6848"
})]
});
})
})
})]
});
})), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 8 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
disabledFill: true,
className: AddQuestionsModal_Saveitemmodules.content,
showProgramFill: true,
value: base64.Base64.decode((qitem === null || qitem === void 0 || (_qitem$program_attr3 = qitem.program_attr) === null || _qitem$program_attr3 === void 0 ? void 0 : _qitem$program_attr3.code) || '')
})
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 5 && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
background: '#F6F7F9',
padding: '0px 20px',
height: 46,
lineHeight: '46px',
marginTop: 40,
display: 'flex',
alignItems: 'center'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
flex: 1,
alignItems: 'center',
display: 'flex'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
marginRight: 30
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
marginRight: 10,
color: '#666666'
},
children: "\u521B\u5EFA\u8005"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#000000'
},
children: (qitem === null || qitem === void 0 ? void 0 : qitem.author_name) || '- -'
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
marginRight: 30
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
marginRight: 10,
color: '#666666'
},
children: "\u6240\u5C5E\u5355\u4F4D"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#000000'
},
children: (qitem === null || qitem === void 0 ? void 0 : qitem.author_school_name) || '- -'
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
marginRight: 30
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
marginRight: 10,
color: '#666666'
},
children: "\u5B66\u4E60\u4EBA\u6570"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#000000'
},
children: (qitem === null || qitem === void 0 ? void 0 : qitem.study_count) || '0'
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
className: AddQuestionsModal_Saveitemmodules.shixunbutton,
href: "/shixuns/".concat(qitem === null || qitem === void 0 ? void 0 : qitem.identifier, "/challenges?exercise=true"),
target: "_blank",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
onClick: function onClick() {},
style: {
marginRight: 20
},
className: "iconfont icon-shixunkecheng mr5 "
}), "\u5B9E\u8BAD\u8BE6\u60C5"]
})]
})]
}), ((qitem === null || qitem === void 0 ? void 0 : qitem.question_type) <= 4 || [6, 8].includes(qitem === null || qitem === void 0 ? void 0 : qitem.question_type)) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: AddQuestionsModal_Saveitemmodules.bottom,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: AddQuestionsModal_Saveitemmodules.bottomitem,
style: {
alignItems: 'flex-start'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: AddQuestionsModal_Saveitemmodules.left,
children: "\u89E3\u6790"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: AddQuestionsModal_Saveitemmodules.right,
value: (qitem === null || qitem === void 0 ? void 0 : qitem.analysis) || ''
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: AddQuestionsModal_Saveitemmodules.bottomitem,
style: {
alignItems: 'center'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: AddQuestionsModal_Saveitemmodules.left,
children: "\u96BE\u5EA6"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: AddQuestionsModal_Saveitemmodules.right,
children: (qitem === null || qitem === void 0 ? void 0 : qitem.difficulty) === 1 ? '简单' : (qitem === null || qitem === void 0 ? void 0 : qitem.difficulty) === 2 ? '适中' : '困难'
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: AddQuestionsModal_Saveitemmodules.bottomitem,
style: {
alignItems: 'center'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: AddQuestionsModal_Saveitemmodules.left,
children: "\u77E5\u8BC6\u70B9"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: AddQuestionsModal_Saveitemmodules.right,
children: qitem === null || qitem === void 0 ? void 0 : qitem.tag_discipline
})]
})]
})]
});
};
/* harmony default export */ var AddQuestionsModal_SaveItem = (AddQuestionsModal_SaveItem_DragQuestions);
// EXTERNAL MODULE: ./src/assets/images/paper/shengxu.svg
var shengxu = __webpack_require__(57534);
// EXTERNAL MODULE: ./src/assets/images/paper/jiangxu.svg
var jiangxu = __webpack_require__(87389);
// EXTERNAL MODULE: ./src/components/ReuseShixunModal/index.tsx + 1 modules
var ReuseShixunModal = __webpack_require__(15490);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EditPotin/components/AddQuestionsModal/index.tsx
var AddQuestionsModal_AddModal = function AddModal(_ref) {
var _datas$tag_discipline, _grouplist$share_bank, _grouplist$my_banks_g;
var setScoreShow = _ref.setScoreShow,
ScoreShow = _ref.ScoreShow,
onOk = _ref.onOk,
isshixuns = _ref.isshixuns,
isloadings = _ref.isloadings;
var _useState = (0,_react_17_0_2_react.useState)({
type: '0',
page: 1,
per_page: 10,
updated_at: '',
quotes: ''
}),
_useState2 = slicedToArray_default()(_useState, 2),
param = _useState2[0],
setparam = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)([]),
_useState4 = slicedToArray_default()(_useState3, 2),
courseOptions = _useState4[0],
setcourseOptions = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)([]),
_useState6 = slicedToArray_default()(_useState5, 2),
checkitems = _useState6[0],
setcheckitems = _useState6[1];
var _useState7 = (0,_react_17_0_2_react.useState)([]),
_useState8 = slicedToArray_default()(_useState7, 2),
listitems = _useState8[0],
setlistitems = _useState8[1];
var _useState9 = (0,_react_17_0_2_react.useState)([]),
_useState10 = slicedToArray_default()(_useState9, 2),
datas = _useState10[0],
setdatas = _useState10[1];
var _useState11 = (0,_react_17_0_2_react.useState)(false),
_useState12 = slicedToArray_default()(_useState11, 2),
loading = _useState12[0],
setloading = _useState12[1];
var _Form$useForm = es_form/* default */.Z.useForm(),
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
form = _Form$useForm2[0];
var _useState13 = (0,_react_17_0_2_react.useState)(),
_useState14 = slicedToArray_default()(_useState13, 2),
qitem = _useState14[0],
setqitem = _useState14[1];
var _useState15 = (0,_react_17_0_2_react.useState)(false),
_useState16 = slicedToArray_default()(_useState15, 2),
isshow = _useState16[0],
setisshow = _useState16[1];
var _useState17 = (0,_react_17_0_2_react.useState)(isshixuns),
_useState18 = slicedToArray_default()(_useState17, 2),
isshixun = _useState18[0],
setisshixun = _useState18[1];
var _useState19 = (0,_react_17_0_2_react.useState)([]),
_useState20 = slicedToArray_default()(_useState19, 2),
ShiXunListItems = _useState20[0],
setshixunitems = _useState20[1];
var _useState21 = (0,_react_17_0_2_react.useState)(true),
_useState22 = slicedToArray_default()(_useState21, 2),
indexi = _useState22[0],
setindexi = _useState22[1];
var _useState23 = (0,_react_17_0_2_react.useState)([]),
_useState24 = slicedToArray_default()(_useState23, 2),
grouplist = _useState24[0],
setgrouplist = _useState24[1];
var _useState25 = (0,_react_17_0_2_react.useState)(0),
_useState26 = slicedToArray_default()(_useState25, 2),
addcount = _useState26[0],
setaddcount = _useState26[1];
var typeData = [{
name: "全部",
value: "",
question_type: 0
}, {
name: "单选题",
value: "SINGLE",
question_type: 0
}, {
name: "多选题",
value: "MULTIPLE",
question_type: 1
}, {
name: "判断题",
value: "JUDGMENT",
question_type: 2
}, {
name: "填空题",
value: "COMPLETION",
question_type: 3
}, {
name: "简答题",
value: "SUBJECTIVE",
question_type: 4
}, {
name: "实训题",
value: "SHIXUN",
question_type: 5
}, {
name: "编程题",
value: "PROGRAM",
question_type: 6
}, {
name: "组合题",
value: "COMBINATION",
question_type: 7
}, {
name: "程序填空题",
value: "BPROGRAM",
question_type: 8
}];
var _useState27 = (0,_react_17_0_2_react.useState)([]),
_useState28 = slicedToArray_default()(_useState27, 2),
checkedItemsArr = _useState28[0],
setCheckedItemsArr = _useState28[1];
var selectedShixunId = (0,_react_17_0_2_react.useRef)(new Set());
var selectedQuestionId = (0,_react_17_0_2_react.useRef)(new Set());
var difficultyData = [{
name: "简单",
value: 1
}, {
name: "适中",
value: 2
}, {
name: "困难",
value: 3
}];
var diff = [{
name: '初级',
value: 1
}, {
name: '中级',
value: 2
}, {
name: '中高级',
value: 3
}, {
name: '高级',
value: 4
}];
var _useState29 = (0,_react_17_0_2_react.useState)(false),
_useState30 = slicedToArray_default()(_useState29, 2),
showClearButton = _useState30[0],
setShowClearButton = _useState30[1]; // 新增的变量用于控制是否显示清空按钮
var handleClearButtonClick = function handleClearButtonClick() {
form.resetFields();
isshixun = false;
setisshixun(false);
setShowClearButton(false); // 更新显示清空按钮的状态
form.submit();
};
(0,_react_17_0_2_react.useEffect)(function () {
if (addcount > 0) {
setTimeout(function () {
setaddcount(0);
}, 2000);
}
}, [addcount]);
(0,_react_17_0_2_react.useEffect)(function () {
if (ScoreShow) {
form.setFieldsValue({
item_type: '',
courseid: '',
tag_discipline_id: null,
difficulty: null,
keyword: null
});
if (indexi && isshixun) {
form.setFieldsValue({
item_type: 'SHIXUN'
});
param.item_type = "SHIXUN";
setparam(objectSpread2_default()({}, param));
setindexi(false);
}
getdatas(param);
getdisciplines();
getwjj();
}
}, [ScoreShow]);
function getdatas(_x) {
return _getdatas.apply(this, arguments);
}
function _getdatas() {
_getdatas = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(params) {
var _params$courseid, _params$courseid2;
var ids, shixun_ids, res;
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
setloading(true);
setparam(params);
// if (isshixun) {
// let res = await Fetch(`/api/shixun_lists.json`, {
// method: 'get',
// params: {
// ...params,
// discipline_id: params?.courseid?.[0] || null,
// sub_discipline_id: params?.courseid?.[1] || null,
// limit: params.per_page,
// }
// })
// setdatas(res);
// } else {
if (!((listitems === null || listitems === void 0 ? void 0 : listitems.length) <= 0 && params.type === '5')) {
_context3.next = 6;
break;
}
setdatas([]);
setloading(false);
return _context3.abrupt("return");
case 6:
ids = params.type === '5' ? listitems === null || listitems === void 0 ? void 0 : listitems.filter(function (item) {
return !ShiXunListItems.includes(item);
}) : null;
shixun_ids = params.type === '5' ? listitems === null || listitems === void 0 ? void 0 : listitems.filter(function (item) {
return ShiXunListItems.includes(item);
}) : null;
_context3.next = 10;
return (0,fetch/* default */.ZP)("/api/item_banks.json", {
method: 'get',
params: objectSpread2_default()(objectSpread2_default()({}, params), {}, {
discipline_id: (params === null || params === void 0 || (_params$courseid = params.courseid) === null || _params$courseid === void 0 ? void 0 : _params$courseid[0]) || null,
sub_discipline_id: (params === null || params === void 0 || (_params$courseid2 = params.courseid) === null || _params$courseid2 === void 0 ? void 0 : _params$courseid2[1]) || null,
ids: ids,
shixun_ids: shixun_ids,
keyword: params.keyword ? encodeURIComponent(params.keyword) : params.keyword,
include_shixuns: true,
type: params.type === '5' ? null : params.type,
clazz: params.type === '3' ? 'ItemBanksGroup' : null
// ids:listitems
})
});
case 10:
res = _context3.sent;
setdatas(res);
// }
setloading(false);
case 13:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return _getdatas.apply(this, arguments);
}
function getdisciplines() {
return _getdisciplines.apply(this, arguments);
}
function _getdisciplines() {
_getdisciplines = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
var res;
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
_context4.next = 2;
return (0,fetch/* default */.ZP)("/api/disciplines.json", {
method: 'get',
params: {
source: 'question',
group_id: 0,
group_type: param.type === '5' ? null : param.type === '5',
clazz: 'ItemBanksGroup'
}
});
case 2:
res = _context4.sent;
setcourseOptions((0,problemset_util/* formatCourseOptions */.L)(res === null || res === void 0 ? void 0 : res.disciplines));
case 4:
case "end":
return _context4.stop();
}
}, _callee4);
}));
return _getdisciplines.apply(this, arguments);
}
function getwjj() {
return _getwjj.apply(this, arguments);
}
function _getwjj() {
_getwjj = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5() {
var res;
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
_context5.next = 2;
return (0,fetch/* default */.ZP)("/api/item_banks_groups/all_groups.json", {
method: 'get'
});
case 2:
res = _context5.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
setgrouplist(res);
}
case 4:
case "end":
return _context5.stop();
}
}, _callee5);
}));
return _getwjj.apply(this, arguments);
}
function getmy(_x2) {
return _getmy.apply(this, arguments);
}
function _getmy() {
_getmy = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6(params) {
var _params$list, _params$list2, _params$courseid3, _params$courseid4;
var ids, shixun_ids, res;
return regeneratorRuntime_default()().wrap(function _callee6$(_context6) {
while (1) switch (_context6.prev = _context6.next) {
case 0:
setloading(true);
ids = (_params$list = params.list) === null || _params$list === void 0 ? void 0 : _params$list.filter(function (item) {
return !ShiXunListItems.includes(item);
});
shixun_ids = (_params$list2 = params.list) === null || _params$list2 === void 0 ? void 0 : _params$list2.filter(function (item) {
return ShiXunListItems.includes(item);
});
if (!(ids.length === 0 && shixun_ids.length === 0)) {
_context6.next = 7;
break;
}
setloading(false);
setdatas([]);
return _context6.abrupt("return");
case 7:
_context6.next = 9;
return (0,fetch/* default */.ZP)("/api/item_banks.json", {
method: 'get',
params: objectSpread2_default()(objectSpread2_default()({}, params), {}, {
discipline_id: (params === null || params === void 0 || (_params$courseid3 = params.courseid) === null || _params$courseid3 === void 0 ? void 0 : _params$courseid3[0]) || null,
sub_discipline_id: (params === null || params === void 0 || (_params$courseid4 = params.courseid) === null || _params$courseid4 === void 0 ? void 0 : _params$courseid4[1]) || null,
ids: ids,
shixun_ids: shixun_ids,
type: params.type === '5' ? null : params.type,
clazz: params.type === '3' ? 'ItemBanksGroup' : null
// ids:listitems
})
});
case 9:
res = _context6.sent;
setloading(false);
setdatas(res);
case 12:
case "end":
return _context6.stop();
}
}, _callee6);
}));
return _getmy.apply(this, arguments);
}
var paramsFromUrl = (0,_umi_production_exports.useParams)();
var _useReuseModal = (0,ReuseShixunModal/* useReuseModal */.P)(),
_useReuseModal2 = slicedToArray_default()(_useReuseModal, 4),
reuseModalVisible = _useReuseModal2[0],
closeReuseModal = _useReuseModal2[1],
renderData = _useReuseModal2[2],
showReuseModal = _useReuseModal2[3];
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(modal/* default */.Z, {
title: false,
footer: false,
open: ScoreShow,
width: 1200,
centered: true,
closable: false,
className: AddQuestionsModalmodules.scoremodal,
onCancel: function onCancel() {
setScoreShow(false);
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'center'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: AddQuestionsModalmodules.title,
children: "\u9898\u5E93\u9009\u9898"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
onClick: function onClick() {
return setScoreShow(false);
},
className: AddQuestionsModalmodules.close,
children: "X"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tabs/* default */.Z, {
className: AddQuestionsModalmodules.tabWrap,
activeKey: param.type,
onChange: function onChange(e) {
param.type = e;
param.page = 1;
param.updated_at = '', param.quotes = '',
// param.item_type = null,
param.courseid = '', param.tag_discipline_id = null, param.difficulty = null, param.keyword = null, param.group_id = null, form.setFieldsValue({
// item_type: null,
courseid: '',
tag_discipline_id: null,
difficulty: null,
keyword: null,
group_id: null
});
// if (!param?.item_type && param.type !== '5') {
// param.item_type = 'SINGLE'
// form.setFieldsValue({
// item_type: 'SINGLE'
// })
// }
if ((param === null || param === void 0 ? void 0 : param.item_type) === 'SHIXUN' && param.type !== '5') {
isshixun = true;
setisshixun(true);
}
setShowClearButton(false);
if (param.type === '5') {
isshixun = false;
setisshixun(false);
// param.item_type = ''
// form.setFieldsValue({
// item_type: ''
// })
}
setparam(objectSpread2_default()({}, param));
getdatas(objectSpread2_default()({}, param));
},
items: [{
label: "\u516C\u5171",
key: '1'
}, {
label: "\u56E2\u961F\u5171\u4EAB",
key: '3'
}, {
label: "\u6536\u85CF\u5939",
key: '2'
}, {
label: "\u6211\u521B\u5EFA\u7684",
key: '0'
}, {
label: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: ["\u5DF2\u9009", listitems.length > 0 && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: AddQuestionsModalmodules.titlecount,
children: listitems.length
}), addcount > 0 && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: AddQuestionsModalmodules.add,
children: ["+", addcount]
})]
}),
key: '5'
}]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
layout: 'inline',
form: form,
onValuesChange: function onValuesChange(values, items) {
var _param$keyword, _param$keyword$replac;
var hasFilter = Object.values(items).some(function (value) {
return value !== null && value !== '' && value !== undefined;
});
var isInputEmpty = items.keyword === '';
setShowClearButton(hasFilter || !isInputEmpty);
param.page = 1;
param.keyword = (_param$keyword = param.keyword) === null || _param$keyword === void 0 || (_param$keyword$replac = _param$keyword.replace) === null || _param$keyword$replac === void 0 ? void 0 : _param$keyword$replac.call(_param$keyword, /^\s+|\s+$/g, '');
if ((items === null || items === void 0 ? void 0 : items.item_type) === 'SHIXUN') {
if (param.type === '5') {
setisshixun(false);
} else {
setisshixun(true);
}
if (values.keyword || values.keyword === '') {
return;
}
form.submit();
} else {
if (values !== null && values !== void 0 && values.courseid) {
form.setFieldsValue({
tag_discipline_id: ''
});
}
setisshixun(false);
if (values.keyword || values.keyword === '') {
return;
}
form.submit();
}
},
onFinish: function onFinish(values) {
getdatas(objectSpread2_default()(objectSpread2_default()({}, param), values));
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "item_type",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"], {
className: AddQuestionsModalmodules.selectWrapper,
placeholder: "\u9898\u578B",
style: {
width: 110
},
size: "middle",
allowClear: true,
children: typeData.map(function (item) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
children: item.name
}, item.value);
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "courseid",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(cascader/* default */.Z, {
className: AddQuestionsModalmodules.selectWrapper,
style: {
width: 160
},
size: "middle",
placeholder: "\u65B9\u5411&\u8BFE\u7A0B",
options: courseOptions
})
}), !isshixun && /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "tag_discipline_id",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"], {
className: AddQuestionsModalmodules.selectWrapper,
placeholder: "\u77E5\u8BC6\u70B9",
style: {
width: 160
},
size: "middle",
allowClear: true,
children: datas === null || datas === void 0 || (_datas$tag_discipline = datas.tag_disciplines) === null || _datas$tag_discipline === void 0 ? void 0 : _datas$tag_discipline.map(function (item) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
children: item.name
}, item.id);
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: isshixun ? 'diff' : 'difficulty',
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_select["default"], {
className: AddQuestionsModalmodules.selectWrapper,
placeholder: "\u96BE\u5EA6",
style: {
width: 118
},
size: "middle",
allowClear: true,
children: [!isshixun && difficultyData.map(function (item) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
children: item.name
}, item.value);
}), isshixun && diff.map(function (item) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
children: item.name
}, item.value);
})]
})
}), (param.type === '3' || param.type === '0') && !isshixun && /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: 'group_id',
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_select["default"], {
className: AddQuestionsModalmodules.selectWrapper,
placeholder: "\u6587\u4EF6\u5939",
showSearch: true,
style: {
width: 118
},
size: "middle",
allowClear: true,
filterOption: function filterOption(inputValue, option) {
return option.children.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1;
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
children: "\u6839\u76EE\u5F55"
}, 0), param.type === '3' && (grouplist === null || grouplist === void 0 || (_grouplist$share_bank = grouplist.share_banks_groups) === null || _grouplist$share_bank === void 0 ? void 0 : _grouplist$share_bank.map(function (item) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
children: item.name
}, item.id);
})), param.type === '0' && (grouplist === null || grouplist === void 0 || (_grouplist$my_banks_g = grouplist.my_banks_groups) === null || _grouplist$my_banks_g === void 0 ? void 0 : _grouplist$my_banks_g.map(function (item) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
children: item.name
}, item.id);
}))]
})
}), showClearButton && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: AddQuestionsModalmodules.allqingchu,
onClick: handleClearButtonClick,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-guanbi4"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u6E05\u9664\u7B5B\u9009\u6761\u4EF6"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
style: {
flex: '0 0 auto',
marginRight: 0,
marginLeft: 'auto'
},
name: "keyword",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z.Search, {
className: AddQuestionsModalmodules.search,
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22",
allowClear: true,
suffix: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-sousuo9 font14 ".concat(AddQuestionsModalmodules.searchIcon),
onClick: function onClick() {
return form.submit();
}
}),
onSearch: function onSearch(value) {
form.submit();
}
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
background: '#F6F7F9',
display: 'flex',
alignItems: 'center',
marginTop: 18,
height: 40,
paddingLeft: 10,
paddingRight: 20
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
onClick: function onClick() {
if (param.updated_at === 'asc') {
param.updated_at = 'desc';
} else {
param.updated_at = 'asc';
}
setparam(objectSpread2_default()(objectSpread2_default()({}, param), {}, {
page: 1
}));
getdatas(objectSpread2_default()(objectSpread2_default()({}, param), {}, {
page: 1
}));
},
children: [" ", !param.updated_at ? /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
style: {
fontSize: "14px"
},
className: "iconfont icon-jiangxu mr5 c-light-primary"
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
src: param.updated_at === 'asc' ? shengxu/* default */.Z : jiangxu/* default */.Z,
style: {
width: "15px",
verticalAlign: "text-bottom"
},
className: "font14 mr5 c-light-primary"
}), "\u6309\u66F4\u65B0\u65F6\u95F4\u6392\u5E8F"]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
onClick: function onClick() {
if (param.quotes === 'asc') {
param.quotes = 'desc';
} else {
param.quotes = 'asc';
}
setparam(objectSpread2_default()(objectSpread2_default()({}, param), {}, {
page: 1
}));
getdatas(objectSpread2_default()(objectSpread2_default()({}, param), {}, {
page: 1
}));
},
style: {
marginLeft: 20
},
children: [" ", !param.quotes ? /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
style: {
fontSize: "14px"
},
className: "iconfont icon-jiangxu mr5 c-light-primary"
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
src: param.quotes === 'asc' ? shengxu/* default */.Z : jiangxu/* default */.Z,
style: {
width: "15px",
verticalAlign: "text-bottom"
},
className: "font14 mr5 c-light-primary"
}), "\u6309\u4F7F\u7528\u6B21\u6570\u6392\u5E8F"]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
style: {
marginTop: 2,
marginBottom: 20
},
scroll: {
y: 260
},
dataSource: (datas === null || datas === void 0 ? void 0 : datas.items) || (datas === null || datas === void 0 ? void 0 : datas.shixun_list),
pagination: false,
loading: loading,
rowKey: function rowKey(e) {
return e.id;
},
rowSelection: {
type: 'checkbox',
selectedRowKeys: checkitems,
getCheckboxProps: function getCheckboxProps(record) {
return {
disabled: record.shixun_tag_num === 1
};
},
onSelect: function onSelect(record, selected, selectedRows) {
if (selected) {
if (isshixun) {
setshixunitems([].concat(toConsumableArray_default()(ShiXunListItems), [record.id]));
}
setcheckitems([].concat(toConsumableArray_default()(checkitems), [record.id]));
setCheckedItemsArr([].concat(toConsumableArray_default()(checkedItemsArr), [record]));
//添加
if (record.identifier) {
selectedShixunId.current.add(record.id);
} else {
selectedQuestionId.current.add(record.id);
}
setaddcount(1);
setlistitems([].concat(toConsumableArray_default()(listitems), [record.id]));
//取消选中则在checkedItemsArr、selectedRowKeys中过滤掉这条数据
} else {
var newData = checkedItemsArr.filter(function (item) {
return item.id !== record.id;
});
setCheckedItemsArr(newData);
var arr = newData.map(function (item) {
return item.id;
});
setcheckitems(toConsumableArray_default()(arr));
//移除
if (record.identifier) {
selectedShixunId.current["delete"](record.id);
} else {
selectedQuestionId.current["delete"](record.id);
}
var list = listitems.filter(function (item) {
return item !== record.id;
});
setlistitems(list);
if (isshixun) {
var list2 = ShiXunListItems.filter(function (item) {
return item !== record.id;
});
setshixunitems(toConsumableArray_default()(list2));
}
if (param.type === '5') {
getmy(objectSpread2_default()(objectSpread2_default()({}, param), {}, {
list: toConsumableArray_default()(list)
}));
return;
}
}
},
onSelectAll: function onSelectAll(selected, selectedRows, changeRows) {
if (!selected) {
var arr = changeRows.map(function (item) {
return item.id;
});
var newArr = checkitems.filter(function (item) {
return !arr.some(function (ele) {
return ele === item;
});
});
var newArr1 = checkedItemsArr.filter(function (item) {
return !arr.some(function (ele) {
return ele === item.id;
});
});
setCheckedItemsArr(newArr1);
setcheckitems(toConsumableArray_default()(newArr));
//批量移除
setlistitems(toConsumableArray_default()(newArr));
if (isshixun) {
var list2 = ShiXunListItems.filter(function (item) {
return !arr.some(function (ele) {
return ele === item.id;
});
});
setshixunitems(toConsumableArray_default()(list2));
}
if (param.type === '5') {
getmy(objectSpread2_default()(objectSpread2_default()({}, param), {}, {
list: toConsumableArray_default()(newArr)
}));
}
var _iterator = createForOfIteratorHelper_default()(arr),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var item = _step.value;
if (item.identifier) {
selectedShixunId.current["delete"](item);
} else {
selectedQuestionId.current["delete"](item);
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
}
//全选把由未选中变为选中的数据统一放到setSelectedRowKeys中存储
else {
var arr1 = changeRows.map(function (item) {
return item.id;
}); //过滤出选中数据的唯一值
if (isshixun) {
setshixunitems([].concat(toConsumableArray_default()(ShiXunListItems), toConsumableArray_default()(arr1)));
}
setCheckedItemsArr([].concat(toConsumableArray_default()(checkedItemsArr), toConsumableArray_default()(changeRows)));
setcheckitems([].concat(toConsumableArray_default()(checkitems), toConsumableArray_default()(arr1))); //存储所有选中数据的唯一值,可用于批量删除/新增/修改等操作
//批量加入
setlistitems([].concat(toConsumableArray_default()(listitems), toConsumableArray_default()(arr1)));
var _iterator2 = createForOfIteratorHelper_default()(changeRows),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var _item = _step2.value;
if (_item.identifier) {
selectedShixunId.current.add(_item.id);
} else {
selectedQuestionId.current.add(_item.id);
}
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
}
}
},
columns: [{
title: '题型',
dataIndex: 'item_type',
key: 'item_type',
render: function render(value, record, index) {
var _typeData$filter;
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: isshixun || record !== null && record !== void 0 && record.challenge_names ? '实训题' : typeData === null || typeData === void 0 || (_typeData$filter = typeData.filter(function (item) {
return item.value === value;
})) === null || _typeData$filter === void 0 || (_typeData$filter = _typeData$filter[0]) === null || _typeData$filter === void 0 ? void 0 : _typeData$filter.name
});
}
}, {
title: '试题名称',
dataIndex: 'name',
width: isshixun ? '30%' : '60%',
key: 'name',
render: function render(value, record, index) {
var _record$program_attr;
return /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
showLines: 1,
showTextOnly: true,
value: isshixun || record !== null && record !== void 0 && record.challenge_names ? record !== null && record !== void 0 && record.title || value === null ? '--' : value : (record === null || record === void 0 ? void 0 : record.item_type) == "BPROGRAM" ? record === null || record === void 0 || (_record$program_attr = record.program_attr) === null || _record$program_attr === void 0 ? void 0 : _record$program_attr.description : value || '- -'
}, 1);
}
}, {
title: '创建者',
dataIndex: 'author_name',
key: 'author_name',
hidden: !isshixun
}, {
title: '所属单位',
dataIndex: 'author_school_name',
key: 'author_school_name',
hidden: !isshixun
}, {
title: '难度',
dataIndex: 'difficulty',
key: 'difficulty',
render: function render(value, record, index) {
var _difficultyData$filte, _difficultyData$filte2;
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: isshixun || record !== null && record !== void 0 && record.challenge_names ? (record === null || record === void 0 ? void 0 : record.level) || (difficultyData === null || difficultyData === void 0 || (_difficultyData$filte = difficultyData.filter(function (item) {
return item.value === value;
})) === null || _difficultyData$filte === void 0 || (_difficultyData$filte = _difficultyData$filte[0]) === null || _difficultyData$filte === void 0 ? void 0 : _difficultyData$filte.name) : difficultyData === null || difficultyData === void 0 || (_difficultyData$filte2 = difficultyData.filter(function (item) {
return item.value === value;
})) === null || _difficultyData$filte2 === void 0 || (_difficultyData$filte2 = _difficultyData$filte2[0]) === null || _difficultyData$filte2 === void 0 ? void 0 : _difficultyData$filte2.name
});
}
}, {
title: '关卡数量',
dataIndex: 'challenges_count',
key: 'challenges_count',
hidden: !isshixun,
render: function render(value, record, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: value || '- -'
});
}
}, {
title: '使用次数',
dataIndex: 'quotes',
key: 'quotes',
render: function render(value, record, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: isshixun || record !== null && record !== void 0 && record.challenge_names ? (record === null || record === void 0 ? void 0 : record.study_count) || (record === null || record === void 0 ? void 0 : record.stu_num) : value
});
}
}, {
title: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: ["\u53D1\u5E03\u72B6\u6001 ", /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: "\u672A\u53D1\u5E03\u7684\u5B9E\u8DF5\u9879\u76EE\u4E0D\u80FD\u88AB\u9009\u7528",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(QuestionCircleOutlined/* default */.Z, {})
})]
}),
dataIndex: 'shixun_tag_num_name',
key: 'shixun_tag_num_name',
hidden: !isshixun,
render: function render(value, record, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: value || '- -'
});
}
}, {
title: '操作',
dataIndex: 'id',
key: 'item_type',
render: function render(value, record, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
flex: 1,
textAlign: 'start'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("a", {
onClick: function onClick() {
var _typeData$filter2;
setqitem(objectSpread2_default()(objectSpread2_default()({}, record), {}, {
question_type: isshixun || record !== null && record !== void 0 && record.challenge_names ? 5 : typeData === null || typeData === void 0 || (_typeData$filter2 = typeData.filter(function (item) {
return item.value === (record === null || record === void 0 ? void 0 : record.item_type);
})) === null || _typeData$filter2 === void 0 || (_typeData$filter2 = _typeData$filter2[0]) === null || _typeData$filter2 === void 0 ? void 0 : _typeData$filter2.question_type
}));
setisshow(true);
},
children: "\u67E5\u770B"
}), (record === null || record === void 0 ? void 0 : record.shixun_tag_num) === 1 && /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
target: "_blank",
href: "/shixuns/".concat(record === null || record === void 0 ? void 0 : record.identifier, "/challenges"),
style: {
marginLeft: 10
},
children: "\u53BB\u53D1\u5E03"
})]
});
}
}].filter(function (item) {
return !item.hidden;
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(pagination/* default */.Z, {
current: param.page,
total: (datas === null || datas === void 0 ? void 0 : datas.items_count) || (datas === null || datas === void 0 ? void 0 : datas.shixuns_count),
style: {
marginBottom: 20
},
defaultPageSize: param.per_page,
showTotal: function showTotal(e) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: ["\u5171\xA0", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#165DFF'
},
children: e
}), "\xA0\u6761\u6570\u636E"]
});
},
pageSize: param.per_page,
onChange: function onChange(e, limit) {
param.page = e;
param.per_page = limit;
setparam(objectSpread2_default()({}, param));
getdatas(objectSpread2_default()({}, param));
}
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: AddQuestionsModalmodules.bottom,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: AddQuestionsModalmodules.no,
onClick: function onClick() {
setScoreShow(false);
},
children: "\u53D6\u6D88"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
loading: isloadings,
style: {
width: isloadings && 75
},
className: AddQuestionsModalmodules.yes,
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var hasUsedShixun;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (!((listitems === null || listitems === void 0 ? void 0 : listitems.length) <= 0)) {
_context.next = 3;
break;
}
message/* default */.ZP.info('当前暂未选择数据');
return _context.abrupt("return");
case 3:
_context.next = 5;
return showReuseModal({
id: toConsumableArray_default()(selectedShixunId.current),
course_id: paramsFromUrl.coursesId,
type: 'shixun'
});
case 5:
hasUsedShixun = _context.sent;
if (!hasUsedShixun) {
onOk(toConsumableArray_default()(selectedQuestionId.current), toConsumableArray_default()(selectedShixunId.current), true, listitems === null || listitems === void 0 ? void 0 : listitems.length);
}
case 7:
case "end":
return _context.stop();
}
}, _callee);
})),
children: "\u786E\u8BA4"
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
open: isshow,
title: '题目详情',
footer: false,
className: AddQuestionsModalmodules.previewModal,
width: 1000,
centered: true,
onCancel: function onCancel() {
setisshow(false);
},
onOk: function onOk() {
setisshow(false);
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AddQuestionsModal_SaveItem, {
qitem: qitem
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(ReuseShixunModal/* default */.Z, {
visible: reuseModalVisible,
position: "\u5DF2\u9009\u8BD5\u9898",
onCancel: closeReuseModal,
onOk: ( /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(ids) {
var shixunCopyIds, deletedShixunIds, _iterator3, _step3, item;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
shixunCopyIds = [];
deletedShixunIds = [];
_iterator3 = createForOfIteratorHelper_default()(ids);
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
item = _step3.value;
if (item.is_copy === 1 && item.is_use === 1) {
shixunCopyIds.push(item.id);
}
if (item.is_use === 0) {
deletedShixunIds.push(item.id);
}
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
_context2.next = 6;
return onOk(toConsumableArray_default()(selectedQuestionId.current), toConsumableArray_default()(selectedShixunId.current).filter(function (id) {
return !deletedShixunIds.includes(id);
}), true, listitems === null || listitems === void 0 ? void 0 : listitems.length, shixunCopyIds);
case 6:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function (_x3) {
return _ref3.apply(this, arguments);
};
}()),
renderData: renderData,
inPaper: false,
modalType: "multiple",
type: "shixun"
})]
});
};
/* harmony default export */ var AddQuestionsModal = (AddQuestionsModal_AddModal);
// EXTERNAL MODULE: ./src/components/QuestionEditor/BProgramEditor.tsx
var BProgramEditor = __webpack_require__(64827);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EditPotin/components/Questions/BProgramEditor.tsx
var BProgramEditor_DragQuestions = function DragQuestions(_ref) {
var qitem = _ref.qitem,
TagDiscipline = _ref.TagDiscipline,
exerciseitem = _ref.exerciseitem,
setisedit = _ref.setisedit,
seveeditor = _ref.seveeditor,
deleteitem = _ref.deleteitem,
getTagData = _ref.getTagData,
init = _ref.init;
var _Form$useForm = es_form/* default */.Z.useForm(),
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
form = _Form$useForm2[0];
var scoreByBlank = true;
(0,_react_17_0_2_react.useEffect)(function () {
var _qitem$program_attr, _qitem$program_attr2, _qitem$hack_sets;
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
standard_answers: qitem.standard_answer,
difficulty: (qitem === null || qitem === void 0 ? void 0 : qitem.difficult) || 2,
item_banks_group_id: qitem.item_banks_group_id,
hack: objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
time_limit: (qitem === null || qitem === void 0 ? void 0 : qitem.time_limit) || 3
}),
hack_codes: {
language: qitem === null || qitem === void 0 || (_qitem$program_attr = qitem.program_attr) === null || _qitem$program_attr === void 0 ? void 0 : _qitem$program_attr.language,
code: base64.Base64.decode((qitem === null || qitem === void 0 || (_qitem$program_attr2 = qitem.program_attr) === null || _qitem$program_attr2 === void 0 ? void 0 : _qitem$program_attr2.code) || '')
},
hack_sets: objectSpread2_default()({}, qitem === null || qitem === void 0 || (_qitem$hack_sets = qitem.hack_sets) === null || _qitem$hack_sets === void 0 ? void 0 : _qitem$hack_sets[0]),
repeat_answer: !qitem.repeat_answer
}));
}, [qitem]);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
form: form,
colon: false,
onValuesChange: function onValuesChange(values, value) {
if (values !== null && values !== void 0 && values.standard_answers) {
var _form$getFieldValue, _form$getFieldValue2;
var items = ((_form$getFieldValue = form.getFieldValue('standard_answers')) === null || _form$getFieldValue === void 0 ? void 0 : _form$getFieldValue.length) > 0 && ((_form$getFieldValue2 = form.getFieldValue('standard_answers')) === null || _form$getFieldValue2 === void 0 || (_form$getFieldValue2 = _form$getFieldValue2.map(function (item) {
return item.score;
})) === null || _form$getFieldValue2 === void 0 ? void 0 : _form$getFieldValue2.filter(function (item) {
return item;
}));
if ((items === null || items === void 0 ? void 0 : items.length) > 0) {
var _items$reduce;
form.setFieldsValue({
question_score: (items === null || items === void 0 ? void 0 : items.length) > 0 && ((_items$reduce = items.reduce(function (a, b) {
return a + b;
})) === null || _items$reduce === void 0 ? void 0 : _items$reduce.toFixed(1))
});
}
}
},
onFinish: function onFinish(values) {
var _values$standard_answ;
seveeditor(objectSpread2_default()(objectSpread2_default()(objectSpread2_default()({}, qitem), values), {}, {
item_type: qitem === null || qitem === void 0 ? void 0 : qitem.question_type,
standard_answers: (_values$standard_answ = values.standard_answers) === null || _values$standard_answ === void 0 ? void 0 : _values$standard_answ.map(function (item, index) {
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
position: index + 1
});
}),
hack_codes: objectSpread2_default()(objectSpread2_default()({}, values.hack_codes), {}, {
code: base64.Base64.encode(values.hack_codes.code)
}),
standard_answer: undefined //后端希望只传一个,存和取的字段又不统一
}));
},
onFinishFailed: ( /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(errInfo) {
var _errInfo$errorFields;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
message/* default */.ZP.error(errInfo.errorFields[0].errors[0]);
form.scrollToField(errInfo === null || errInfo === void 0 || (_errInfo$errorFields = errInfo.errorFields) === null || _errInfo$errorFields === void 0 || (_errInfo$errorFields = _errInfo$errorFields[0]) === null || _errInfo$errorFields === void 0 ? void 0 : _errInfo$errorFields.name, {
behavior: 'smooth',
block: 'center'
});
case 2:
case "end":
return _context.stop();
}
}, _callee);
}));
return function (_x) {
return _ref2.apply(this, arguments);
};
}()),
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'center'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
flex: 1
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
display: 'inline-flex',
border: '1px solid #9096A3',
borderRadius: '50%',
width: 10,
height: 10,
marginRight: 5,
background: '#9096A3'
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: '程序填空题'
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
className: EditPotinmodules.scoreinput,
name: "question_score",
label: "\u5206\u503C",
rules: [{
required: true,
message: '请输入分值'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
style: {
width: 150
},
placeholder: "\u8BF7\u8F93\u5165\u5F53\u524D\u5C0F\u9898\u5206\u6570",
size: 'middle',
disabled: true,
max: 100,
min: 0.1
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
marginLeft: 20,
color: 'red',
cursor: 'pointer'
},
onClick: function onClick() {
deleteitem();
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-piliangshanchu3",
style: {
fontSize: 14,
marginRight: 6
}
}), " \u5220\u9664"]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(BProgramEditor/* BProgramEditor */.t, {
form: form,
questionTitlePlaceholder: "\u8BF7\u7F16\u8F91\u586B\u7A7A\u9898\u9898\u5E72\u5185\u5BB9",
scoreByBlank: scoreByBlank,
hackidentifier: qitem === null || qitem === void 0 ? void 0 : qitem.hack_identifier,
answerKey: "standard_answers"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(MoreSetting, {
getTagData: getTagData,
qitem: qitem,
exerciseitem: exerciseitem,
TagDiscipline: TagDiscipline,
form: form
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.morebottom,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.no,
onClick: function onClick() {
var _exerciseitem$exercis, _qitem$program_attr3, _qitem$program_attr4, _qitem$hack_sets2;
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
standard_answers: qitem.standard_answer,
difficulty: qitem.difficult,
item_banks_group_id: qitem.item_banks_group_id,
hack: objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
sub_discipline_id: exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis = exerciseitem.exercise) === null || _exerciseitem$exercis === void 0 ? void 0 : _exerciseitem$exercis.sub_discipline_id,
tag_discipline_ids: []
}),
hack_codes: {
language: qitem === null || qitem === void 0 || (_qitem$program_attr3 = qitem.program_attr) === null || _qitem$program_attr3 === void 0 ? void 0 : _qitem$program_attr3.language,
code: base64.Base64.decode(qitem === null || qitem === void 0 || (_qitem$program_attr4 = qitem.program_attr) === null || _qitem$program_attr4 === void 0 ? void 0 : _qitem$program_attr4.code)
},
hack_sets: objectSpread2_default()({}, qitem === null || qitem === void 0 || (_qitem$hack_sets2 = qitem.hack_sets) === null || _qitem$hack_sets2 === void 0 ? void 0 : _qitem$hack_sets2[0]),
repeat_answer: !qitem.repeat_answer
}));
},
children: "\u91CD\u7F6E"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.no,
onClick: function onClick() {
if (!qitem.isadd) {
var _exerciseitem$exercis2, _qitem$program_attr5, _qitem$program_attr6, _qitem$hack_sets3;
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
standard_answers: qitem.standard_answer,
difficulty: qitem.difficult,
item_banks_group_id: qitem.item_banks_group_id,
hack: objectSpread2_default()(objectSpread2_default()({}, qitem), {}, {
sub_discipline_id: exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis2 = exerciseitem.exercise) === null || _exerciseitem$exercis2 === void 0 ? void 0 : _exerciseitem$exercis2.sub_discipline_id,
tag_discipline_ids: []
}),
hack_codes: {
language: qitem === null || qitem === void 0 || (_qitem$program_attr5 = qitem.program_attr) === null || _qitem$program_attr5 === void 0 ? void 0 : _qitem$program_attr5.language,
code: base64.Base64.decode(qitem === null || qitem === void 0 || (_qitem$program_attr6 = qitem.program_attr) === null || _qitem$program_attr6 === void 0 ? void 0 : _qitem$program_attr6.code)
},
hack_sets: objectSpread2_default()({}, qitem === null || qitem === void 0 || (_qitem$hack_sets3 = qitem.hack_sets) === null || _qitem$hack_sets3 === void 0 ? void 0 : _qitem$hack_sets3[0]),
repeat_answer: !qitem.repeat_answer
}));
setisedit(false);
} else {
setisedit(false);
init();
}
},
children: "\u53D6\u6D88"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.yes,
onClick: function onClick() {
form.submit();
},
children: "\u4FDD\u5B58\u9898\u76EE"
})]
})]
});
};
/* harmony default export */ var Questions_BProgramEditor = (BProgramEditor_DragQuestions);
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
var env = __webpack_require__(2367);
// EXTERNAL MODULE: ./src/utils/hooks/useOverflow.ts
var useOverflow = __webpack_require__(74297);
// EXTERNAL MODULE: ./src/service/exercise.ts
var service_exercise = __webpack_require__(86886);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/EditPotin/index.tsx
// import AddPoints from '@/components/AddPoints';
var questionType = [{
name: '单选题',
id: 0,
count: 'q_singles',
score: 'q_singles_scores',
nameType: "SINGLE"
}, {
name: '多选题',
id: 1,
count: 'q_doubles',
score: 'q_doubles_scores',
nameType: "MULTIPLE"
}, {
name: '判断题',
id: 2,
count: 'q_judges',
score: 'q_judges_scores',
nameType: "JUDGMENT"
}, {
name: '填空题',
id: 3,
count: 'q_nulls',
score: 'q_nulls_scores',
nameType: "COMPLETION"
}, {
name: '简答题',
id: 4,
count: 'q_mains',
score: 'q_mains_scores',
nameType: "SUBJECTIVE"
}, {
name: '实训题',
id: 5,
count: 'q_shixuns',
score: 'q_shixuns_scores',
nameType: "PRACTICAL"
}, {
name: '编程题',
id: 6,
count: 'q_pros',
score: 'q_pros_scores',
nameType: "PROGRAM"
}, {
name: '组合题',
id: 7,
count: 'q_combinations',
score: 'q_combinations_scores',
nameType: "COMBINATION"
}, {
name: '程序填空题',
id: 8,
count: 'q_combinations',
score: 'q_combinations_scores',
nameType: "BPROGRAM"
}];
var AddNewPaper = function AddNewPaper(_ref) {
var _exerciseitem$exercis, _exerciseitem$exercis2, _exerciseitem$exercis3, _exerciseitem$exercis4, _exerciseitem$exercis5, _exerciseitem$exercis6, _exerciseitem$exercis7, _user$userInfo, _exerciseitem$exercis8, _user$userInfo2, _exerciseitem$exercis9, _user$userInfo3, _qitem$program_attr, _exerciseitem$exercis10, _exerciseitem$exercis14;
var user = _ref.user,
dispatch = _ref.dispatch,
itemid = _ref.itemid,
setisedits = _ref.setisedits,
setitemid = _ref.setitemid;
var _useState = (0,_react_17_0_2_react.useState)(),
_useState2 = slicedToArray_default()(_useState, 2),
exerciseitem = _useState2[0],
setexerciseitem = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(false),
_useState4 = slicedToArray_default()(_useState3, 2),
isloading = _useState4[0],
setisloading = _useState4[1]; //防止多次点击
var _useState5 = (0,_react_17_0_2_react.useState)(),
_useState6 = slicedToArray_default()(_useState5, 2),
qitem = _useState6[0],
setqitem = _useState6[1]; //获取id
var _useState7 = (0,_react_17_0_2_react.useState)(),
_useState8 = slicedToArray_default()(_useState7, 2),
Bigqitem = _useState8[0],
setBigqitem = _useState8[1]; //获取大题
var _useState9 = (0,_react_17_0_2_react.useState)(false),
_useState10 = slicedToArray_default()(_useState9, 2),
rightloading = _useState10[0],
setrightloading = _useState10[1]; //右侧loading状态
var _useState11 = (0,_react_17_0_2_react.useState)(false),
_useState12 = slicedToArray_default()(_useState11, 2),
isedit = _useState12[0],
setisedit = _useState12[1]; //是否进入编辑状态
var _useState13 = (0,_react_17_0_2_react.useState)(),
_useState14 = slicedToArray_default()(_useState13, 2),
TagDiscipline = _useState14[0],
setTagDiscipline = _useState14[1]; //获取知识点
var _useState15 = (0,_react_17_0_2_react.useState)(false),
_useState16 = slicedToArray_default()(_useState15, 2),
uploadModalVisible = _useState16[0],
setUploadModalVisible = _useState16[1]; //批量导入弹窗
var _useState17 = (0,_react_17_0_2_react.useState)(false),
_useState18 = slicedToArray_default()(_useState17, 2),
ScoreShow = _useState18[0],
setScoreShow = _useState18[1]; //批量设置得分窗口显隐
var _useState19 = (0,_react_17_0_2_react.useState)(false),
_useState20 = slicedToArray_default()(_useState19, 2),
showquestion = _useState20[0],
setshowquestion = _useState20[1]; //题库选题显隐
var _useState21 = (0,_react_17_0_2_react.useState)(false),
_useState22 = slicedToArray_default()(_useState21, 2),
isshixun = _useState22[0],
setisshixun = _useState22[1];
var _useState23 = (0,_react_17_0_2_react.useState)(false),
_useState24 = slicedToArray_default()(_useState23, 2),
isadd = _useState24[0],
setisadd = _useState24[1];
var _useState25 = (0,_react_17_0_2_react.useState)(false),
_useState26 = slicedToArray_default()(_useState25, 2),
isTips = _useState26[0],
setisTips = _useState26[1];
var params = (0,_umi_production_exports.useParams)();
var _useState27 = (0,_react_17_0_2_react.useState)(false),
_useState28 = slicedToArray_default()(_useState27, 2),
isloadings = _useState28[0],
setisloadings = _useState28[1]; //防止多次点击
var _Form$useForm = es_form/* default */.Z.useForm(),
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
form = _Form$useForm2[0];
var _useState29 = (0,_react_17_0_2_react.useState)(false),
_useState30 = slicedToArray_default()(_useState29, 2),
isOpenEditName = _useState30[0],
setIsOpenEditName = _useState30[1];
(0,_react_17_0_2_react.useEffect)(function () {
if (itemid) {
init();
}
}, [itemid]);
(0,_react_17_0_2_react.useEffect)(function () {
setisedits(isedit);
}, [isedit]);
var getTagData = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(id) {
var res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return dispatch({
type: 'newExercisePaper/getTagDiscipline',
payload: {
sub_discipline_id: id
}
});
case 2:
res = _context.sent;
dispatch({
type: 'globalSetting/footerToggle',
payload: false
});
setTagDiscipline(res);
case 5:
case "end":
return _context.stop();
}
}, _callee);
}));
return function getTagData(_x) {
return _ref2.apply(this, arguments);
};
}();
function init() {
return _init.apply(this, arguments);
}
function _init() {
_init = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee10() {
var _res$exercise, _res$exercise_questio, _res$exercise_questio2;
var res, _res$exercise2;
return regeneratorRuntime_default()().wrap(function _callee10$(_context10) {
while (1) switch (_context10.prev = _context10.next) {
case 0:
setrightloading(true);
setisloading(true);
_context10.next = 4;
return dispatch({
type: 'exercise/editExercise',
payload: {
categoryId: itemid
}
});
case 4:
res = _context10.sent;
setrightloading(false);
setisloading(false);
setexerciseitem(res);
setisadd(false);
if (res !== null && res !== void 0 && (_res$exercise = res.exercise) !== null && _res$exercise !== void 0 && _res$exercise.sub_discipline_id) {
getTagData(res === null || res === void 0 || (_res$exercise2 = res.exercise) === null || _res$exercise2 === void 0 ? void 0 : _res$exercise2.sub_discipline_id);
}
//初始化qid为第一题第一个
setqitem(objectSpread2_default()(objectSpread2_default()({}, res === null || res === void 0 || (_res$exercise_questio = res.exercise_question_types) === null || _res$exercise_questio === void 0 || (_res$exercise_questio = _res$exercise_questio[0]) === null || _res$exercise_questio === void 0 || (_res$exercise_questio = _res$exercise_questio.items) === null || _res$exercise_questio === void 0 ? void 0 : _res$exercise_questio[0]), {}, {
index: 1
}));
setBigqitem(objectSpread2_default()(objectSpread2_default()({}, res === null || res === void 0 || (_res$exercise_questio2 = res.exercise_question_types) === null || _res$exercise_questio2 === void 0 ? void 0 : _res$exercise_questio2[0]), {}, {
indexs: 1
}));
case 12:
case "end":
return _context10.stop();
}
}, _callee10);
}));
return _init.apply(this, arguments);
}
function getdatas(_x2) {
return _getdatas.apply(this, arguments);
}
function _getdatas() {
_getdatas = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee11(params) {
var _res$exercise_questio3, _items$filter, _res$exercise_questio4, _bigitems$filter;
var res, items, item, bigitems, valitems;
return regeneratorRuntime_default()().wrap(function _callee11$(_context11) {
while (1) switch (_context11.prev = _context11.next) {
case 0:
setrightloading(true);
setisloading(true);
_context11.next = 4;
return dispatch({
type: 'exercise/editExercise',
payload: {
categoryId: itemid
}
});
case 4:
res = _context11.sent;
setexerciseitem(res);
items = [];
res === null || res === void 0 || (_res$exercise_questio3 = res.exercise_question_types) === null || _res$exercise_questio3 === void 0 || _res$exercise_questio3.map(function (item) {
var _item$items;
item === null || item === void 0 || (_item$items = item.items) === null || _item$items === void 0 || _item$items.map(function (val, index) {
items.push(objectSpread2_default()(objectSpread2_default()({}, val), {}, {
index: index + 1
}));
});
});
item = (_items$filter = items.filter(function (val) {
return val.question_id === (params === null || params === void 0 ? void 0 : params.id);
})) === null || _items$filter === void 0 ? void 0 : _items$filter[0];
bigitems = res === null || res === void 0 || (_res$exercise_questio4 = res.exercise_question_types) === null || _res$exercise_questio4 === void 0 ? void 0 : _res$exercise_questio4.map(function (val, index) {
if ((item === null || item === void 0 ? void 0 : item.question_type) === (val === null || val === void 0 ? void 0 : val.question_type)) {
return objectSpread2_default()(objectSpread2_default()({}, val), {}, {
indexs: index + 1
});
}
});
valitems = (_bigitems$filter = bigitems.filter(function (item) {
return item;
})) === null || _bigitems$filter === void 0 ? void 0 : _bigitems$filter[0];
setBigqitem(objectSpread2_default()({}, valitems));
setqitem(objectSpread2_default()({}, item));
setrightloading(false);
setisloading(false);
setisadd(false);
case 16:
case "end":
return _context11.stop();
}
}, _callee11);
}));
return _getdatas.apply(this, arguments);
}
function seveeditor(_x3) {
return _seveeditor.apply(this, arguments);
}
function _seveeditor() {
_seveeditor = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee14(params) {
var _exerciseitem$exercis16;
var datas, url, res;
return regeneratorRuntime_default()().wrap(function _callee14$(_context14) {
while (1) switch (_context14.prev = _context14.next) {
case 0:
datas = objectSpread2_default()(objectSpread2_default()({}, params), {}, {
repeat_answer: !params.repeat_answer,
difficulty: (params === null || params === void 0 ? void 0 : params.difficulty) || 2,
item_type: params.question_type,
sub_discipline_id: exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis16 = exerciseitem.exercise) === null || _exerciseitem$exercis16 === void 0 ? void 0 : _exerciseitem$exercis16.sub_discipline_id,
tag_discipline_ids: [],
hack: objectSpread2_default()(objectSpread2_default()({}, params === null || params === void 0 ? void 0 : params.hack), {}, {
difficult: (params === null || params === void 0 ? void 0 : params.difficulty) || 2
}),
hack_identifier: sessionStorage.projectFill
});
if (params.tag_discipline_ids) {
datas.tag_discipline_ids = Array.isArray(params.tag_discipline_ids) ? params.tag_discipline_ids : [params.tag_discipline_ids];
}
url = isadd ? "/api/exercises/".concat(itemid, "/exercise_questions") : "/api/exercise_questions/".concat(params === null || params === void 0 ? void 0 : params.question_id, ".json");
if (!((params === null || params === void 0 ? void 0 : params.is_my) === 1)) {
_context14.next = 7;
break;
}
modal/* default */.Z.confirm({
title: '提示',
content: '此题目已存在于试题库,是否将修改后的题目覆盖试题库的原题?',
okText: '覆盖原题',
cancelText: '不覆盖',
keyboard: false,
onOk: function () {
var _onOk2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee12() {
var res;
return regeneratorRuntime_default()().wrap(function _callee12$(_context12) {
while (1) switch (_context12.prev = _context12.next) {
case 0:
datas.is_cover = 1;
_context12.next = 3;
return (0,fetch/* default */.ZP)(url, {
method: isadd ? 'post' : 'PUT',
body: objectSpread2_default()({}, datas)
});
case 3:
res = _context12.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
setisedit(false);
getdatas({
id: (res === null || res === void 0 ? void 0 : res.exercise_question_id) || (params === null || params === void 0 ? void 0 : params.question_id)
});
}
case 5:
case "end":
return _context12.stop();
}
}, _callee12);
}));
function onOk() {
return _onOk2.apply(this, arguments);
}
return onOk;
}(),
onCancel: function () {
var _onCancel = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee13() {
var res;
return regeneratorRuntime_default()().wrap(function _callee13$(_context13) {
while (1) switch (_context13.prev = _context13.next) {
case 0:
_context13.next = 2;
return (0,fetch/* default */.ZP)(url, {
method: isadd ? 'post' : 'PUT',
body: objectSpread2_default()({}, datas)
});
case 2:
res = _context13.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
setisedit(false);
getdatas({
id: (res === null || res === void 0 ? void 0 : res.exercise_question_id) || (params === null || params === void 0 ? void 0 : params.question_id)
});
}
case 4:
case "end":
return _context13.stop();
}
}, _callee13);
}));
function onCancel() {
return _onCancel.apply(this, arguments);
}
return onCancel;
}()
});
_context14.next = 11;
break;
case 7:
_context14.next = 9;
return (0,fetch/* default */.ZP)(url, {
method: isadd ? 'post' : 'PUT',
body: objectSpread2_default()({}, datas)
});
case 9:
res = _context14.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
setisedit(false);
getdatas({
id: (res === null || res === void 0 ? void 0 : res.exercise_question_id) || (params === null || params === void 0 ? void 0 : params.question_id)
});
}
case 11:
(0,util/* scrollToTop */.k3)();
case 12:
case "end":
return _context14.stop();
}
}, _callee14);
}));
return _seveeditor.apply(this, arguments);
}
function sort_question(_x4) {
return _sort_question.apply(this, arguments);
}
function _sort_question() {
_sort_question = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee15(params) {
var res1, _res$exercise3, res, _res$exercise4;
return regeneratorRuntime_default()().wrap(function _callee15$(_context15) {
while (1) switch (_context15.prev = _context15.next) {
case 0:
setisloading(true);
_context15.next = 3;
return (0,fetch/* default */.ZP)("/api/exercises/".concat(itemid, "/sort_question_type.json"), {
method: 'post',
body: {
question_type: params
}
});
case 3:
res1 = _context15.sent;
setisloading(false);
if (!((res1 === null || res1 === void 0 ? void 0 : res1.status) === 0)) {
_context15.next = 12;
break;
}
_context15.next = 8;
return dispatch({
type: 'exercise/editExercise',
payload: {
categoryId: itemid
}
});
case 8:
res = _context15.sent;
setexerciseitem(res);
setisadd(false);
if (res !== null && res !== void 0 && (_res$exercise3 = res.exercise) !== null && _res$exercise3 !== void 0 && _res$exercise3.sub_discipline_id) {
getTagData(res === null || res === void 0 || (_res$exercise4 = res.exercise) === null || _res$exercise4 === void 0 ? void 0 : _res$exercise4.sub_discipline_id);
}
case 12:
case "end":
return _context15.stop();
}
}, _callee15);
}));
return _sort_question.apply(this, arguments);
}
var handleOk = /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(list, cb) {
var _list$;
var newParams;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
if (!(list.length === 0)) {
_context2.next = 4;
break;
}
message/* default */.ZP.warning('请上传文件');
cb();
return _context2.abrupt("return");
case 4:
newParams = {
id: params === null || params === void 0 ? void 0 : params.exerciseId,
file: (_list$ = list[0]) === null || _list$ === void 0 ? void 0 : _list$.file
};
uploadRequest(newParams, "".concat(env/* default */.Z.API_SERVER, "/api/courses/").concat(params === null || params === void 0 ? void 0 : params.coursesId, "/exercises/import_exercise.json"), function (res) {
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
var _res$fail;
var obj = {};
res === null || res === void 0 || (_res$fail = res.fail) === null || _res$fail === void 0 || _res$fail.forEach(function (e) {
var _Object$keys;
var isExist = (_Object$keys = Object.keys(obj)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.includes(e.message);
if (isExist) {
obj[e.message] = obj[e.message] + 1;
} else {
obj[e.message] = 1;
}
});
var str = "\u6210\u529F\u5BFC\u5165".concat(res === null || res === void 0 ? void 0 : res.success, "\u6761");
Object.keys(obj).forEach(function (item) {
str = str + ",".concat(item).concat(obj[item], "\u6761");
});
message/* default */.ZP.success(str);
setUploadModalVisible(false);
init();
}
if ((res === null || res === void 0 ? void 0 : res.status) === -1) {
message/* default */.ZP.error(res === null || res === void 0 ? void 0 : res.message);
cb();
}
});
case 6:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function handleOk(_x5, _x6) {
return _ref3.apply(this, arguments);
};
}();
var uploadRequest = function uploadRequest(params, url, callback, progressFunction, error) {
var formData = new FormData();
Object.keys(params).forEach(function (key) {
formData.append(key, params[key]);
});
var xhr = new window.XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('load', function (res) {
var _res$target;
callback(JSON.parse(res === null || res === void 0 || (_res$target = res.target) === null || _res$target === void 0 ? void 0 : _res$target.response));
}, false);
xhr.addEventListener('error', function (err) {
if (error) {
error(err);
}
}, false);
xhr.upload.onprogress = function (e) {
if (progressFunction) {
progressFunction(e);
}
};
xhr.open('POST', url);
xhr.send(formData);
return xhr;
};
function deleteitem() {
return _deleteitem.apply(this, arguments);
}
function _deleteitem() {
_deleteitem = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee17() {
return regeneratorRuntime_default()().wrap(function _callee17$(_context17) {
while (1) switch (_context17.prev = _context17.next) {
case 0:
modal/* default */.Z.confirm({
title: '提示',
content: '确定要删除这个试题吗?',
okText: '确定',
centered: true,
className: EditPotinmodules.modalconfirm,
onOk: function () {
var _onOk3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee16() {
var res;
return regeneratorRuntime_default()().wrap(function _callee16$(_context16) {
while (1) switch (_context16.prev = _context16.next) {
case 0:
if (!qitem.question_id) {
_context16.next = 7;
break;
}
_context16.next = 3;
return (0,fetch/* default */.ZP)("/api/exercise_questions/".concat(qitem.question_id, ".json"), {
method: 'delete'
});
case 3:
res = _context16.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
init();
setisedit(false);
}
_context16.next = 10;
break;
case 7:
setqitem({});
setisedit(false);
init();
case 10:
case "end":
return _context16.stop();
}
}, _callee16);
}));
function onOk() {
return _onOk3.apply(this, arguments);
}
return onOk;
}(),
cancelText: '取消'
});
case 1:
case "end":
return _context17.stop();
}
}, _callee17);
}));
return _deleteitem.apply(this, arguments);
}
var addquestion = /*#__PURE__*/function () {
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(data) {
var res;
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return (0,fetch/* default */.ZP)("/api/exercises/".concat(itemid, "/select_questions.json"), {
method: 'post',
body: objectSpread2_default()({}, data)
});
case 2:
res = _context3.sent;
return _context3.abrupt("return", res);
case 4:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return function addquestion(_x7) {
return _ref4.apply(this, arguments);
};
}();
var _useOverflow = (0,useOverflow/* useOverflow */.I)(),
overflow = _useOverflow.overflow,
handleMouseEnter = _useOverflow.handleMouseEnter,
handleMouseLeave = _useOverflow.handleMouseLeave;
var exportMenu = function exportMenu(values, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)(menu/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(menu/* default */.Z.Item, {
disabled: index === 0 ? true : false,
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
var arr;
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
if (!(index === 0)) {
_context4.next = 2;
break;
}
return _context4.abrupt("return");
case 2:
if (!isedit) {
_context4.next = 5;
break;
}
message/* default */.ZP.info('请先保存或取消当前正在编辑的试题。');
return _context4.abrupt("return");
case 5:
arr = (0,util/* moveArray */.rz)(exerciseitem === null || exerciseitem === void 0 ? void 0 : exerciseitem.exercise_question_types, index, index - 1);
_context4.next = 8;
return sort_question(arr.map(function (item) {
return item.name;
}));
case 8:
case "end":
return _context4.stop();
}
}, _callee4);
})),
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: EditPotinmodules.moreSpan,
children: "\u4E0A\u79FB"
})
}, "1"), /*#__PURE__*/(0,jsx_runtime.jsx)(menu/* default */.Z.Item, {
disabled: index === (exerciseitem === null || exerciseitem === void 0 ? void 0 : exerciseitem.exercise_question_types.length) - 1 ? true : false,
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5() {
var arr;
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
if (!(index === (exerciseitem === null || exerciseitem === void 0 ? void 0 : exerciseitem.exercise_question_types.length) - 1)) {
_context5.next = 2;
break;
}
return _context5.abrupt("return");
case 2:
if (!isedit) {
_context5.next = 5;
break;
}
message/* default */.ZP.info('请先保存或取消当前正在编辑的试题。');
return _context5.abrupt("return");
case 5:
arr = (0,util/* moveArray */.rz)(exerciseitem === null || exerciseitem === void 0 ? void 0 : exerciseitem.exercise_question_types, index, index + 1);
_context5.next = 8;
return sort_question(arr.map(function (item) {
return item.name;
}));
case 8:
case "end":
return _context5.stop();
}
}, _callee5);
})),
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: EditPotinmodules.moreSpan,
children: "\u4E0B\u79FB"
})
}, "2"), /*#__PURE__*/(0,jsx_runtime.jsx)(menu/* default */.Z.Item, {
onClick: function onClick() {
var _questionType$find;
form.setFieldsValue({
name: values.name,
item_type_en: (_questionType$find = questionType.find(function (item) {
return item.id == values.question_type;
})) === null || _questionType$find === void 0 ? void 0 : _questionType$find.nameType
});
setIsOpenEditName(true);
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: EditPotinmodules.moreSpan,
children: "\u91CD\u547D\u540D"
})
}, "3")]
});
};
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
spinning: rightloading,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.bg,
children: [(exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis = exerciseitem.exercise_types) === null || _exerciseitem$exercis === void 0 ? void 0 : _exerciseitem$exercis.q_counts) === 0 && !isedit && /*#__PURE__*/(0,jsx_runtime.jsx)(NoData/* default */.Z, {
customText: "\u8FD8\u6CA1\u6709\u8BD5\u9898\uFF0C\u4ECE\u5E95\u90E8\u64CD\u4F5C\u680F\u6765\u6DFB\u52A0\u5427\uFF5E"
}), ((exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis2 = exerciseitem.exercise_types) === null || _exerciseitem$exercis2 === void 0 ? void 0 : _exerciseitem$exercis2.q_counts) > 0 || isedit) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
textAlign: 'center'
},
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
marginTop: 20,
borderTop: '1px solid #DCDCDC',
display: 'flex',
alignItems: 'stretch'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
backgroundColor: '#F6F7F9'
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(affix/* default */.Z, {
offsetTop: 10,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(skeleton/* default */.Z, {
className: EditPotinmodules.left,
active: true,
loading: isloading,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.left,
children: [(exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis3 = exerciseitem.exercise) === null || _exerciseitem$exercis3 === void 0 ? void 0 : _exerciseitem$exercis3.exercise_status) === 1 && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
onClick: function onClick() {
if (isedit) {
message/* default */.ZP.info('请先保存或取消当前正在编辑试题。');
return;
}
setScoreShow(true);
},
className: EditPotinmodules.Button,
children: "\u6279\u91CF\u8BBE\u7F6E\u5206\u503C"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: EditPotinmodules.scrollWrapper,
style: {
overflow: overflow
},
onMouseEnter: handleMouseEnter,
onMouseLeave: handleMouseLeave,
children: exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis4 = exerciseitem.exercise_question_types) === null || _exerciseitem$exercis4 === void 0 ? void 0 : _exerciseitem$exercis4.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "mb30",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.title,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.titleleft,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
color: '#000000',
fontWeight: 400,
fontSize: 12
},
children: [" ", (0,util/* toChineseNumber */.EM)(index + 1), "\u3001\u3010", item.name, "\u3011"]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
color: '#464F66',
fontSize: 12
},
children: ["\uFF08", item.count, "\u5C0F\u9898\uFF0C\u5171", item.score, "\u5206\uFF09"]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(dropdown/* default */.Z, {
dropdownRender: function dropdownRender() {
return exportMenu(item, index);
},
placement: "bottomLeft",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: EditPotinmodules.more_style,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-sandian font12"
})
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(LeftItems, {
isedit: isedit,
setBigqitem: setBigqitem,
bigitem: objectSpread2_default()(objectSpread2_default()({}, item), {}, {
indexs: index + 1
}),
setqitem: setqitem,
qitem: qitem,
Itemid: itemid,
getdata: getdatas,
data: item.items
})]
}, index);
})
})]
})
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(skeleton/* default */.Z, {
className: EditPotinmodules.right,
active: true,
loading: rightloading,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.right,
children: [(Bigqitem === null || Bigqitem === void 0 ? void 0 : Bigqitem.question_type) === (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.title,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
flex: 1
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
color: '#000000',
fontWeight: 600,
fontSize: 16
},
children: [" ", (Bigqitem === null || Bigqitem === void 0 ? void 0 : Bigqitem.indexs) && (0,util/* toChineseNumber */.EM)(Bigqitem === null || Bigqitem === void 0 ? void 0 : Bigqitem.indexs), "\u3001\u3010", Bigqitem === null || Bigqitem === void 0 ? void 0 : Bigqitem.name, "\u3011"]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
color: '#464F66',
fontSize: 16,
fontWeight: 400
},
children: ["\uFF08", Bigqitem === null || Bigqitem === void 0 ? void 0 : Bigqitem.count, "\u5C0F\u9898\uFF0C\u5171", Bigqitem === null || Bigqitem === void 0 ? void 0 : Bigqitem.score, "\u5206\uFF09"]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'center'
},
children: [(qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 5 && !isedit && /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
className: EditPotinmodules.shixun,
href: "/shixuns/".concat(qitem === null || qitem === void 0 ? void 0 : qitem.shixun_identifier, "/challenges?exercise=true"),
target: "_blank",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
onClick: function onClick() {},
style: {
marginRight: 20
},
className: "iconfont icon-shixunkecheng mr5 "
}), "\u5B9E\u8BAD\u8BE6\u60C5"]
}), !isedit && (exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis5 = exerciseitem.exercise) === null || _exerciseitem$exercis5 === void 0 ? void 0 : _exerciseitem$exercis5.exercise_status) == 1 && /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
onClick: function onClick() {
//如果删除直接进行更新
deleteitem();
},
style: {
marginRight: 20
},
className: "".concat(EditPotinmodules["delete"], " iconfont icon-shanchu13 mr5 ")
}), !isedit && ((exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis6 = exerciseitem.exercise) === null || _exerciseitem$exercis6 === void 0 ? void 0 : _exerciseitem$exercis6.exercise_status) == 1 || (exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis7 = exerciseitem.exercise) === null || _exerciseitem$exercis7 === void 0 ? void 0 : _exerciseitem$exercis7.exercise_status) == 2 && ((_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 || (_user$userInfo = _user$userInfo.course) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.course_role) != 15 || (exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis8 = exerciseitem.exercise) === null || _exerciseitem$exercis8 === void 0 ? void 0 : _exerciseitem$exercis8.exercise_status) == 3 && ((_user$userInfo2 = user.userInfo) === null || _user$userInfo2 === void 0 || (_user$userInfo2 = _user$userInfo2.course) === null || _user$userInfo2 === void 0 ? void 0 : _user$userInfo2.course_role) != 15 || (exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis9 = exerciseitem.exercise) === null || _exerciseitem$exercis9 === void 0 ? void 0 : _exerciseitem$exercis9.exercise_status) == 4 && ((_user$userInfo3 = user.userInfo) === null || _user$userInfo3 === void 0 || (_user$userInfo3 = _user$userInfo3.course) === null || _user$userInfo3 === void 0 ? void 0 : _user$userInfo3.course_role) != 15) && /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
onClick: function onClick() {
if ((qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 6) {
_umi_production_exports.history.push("/problems/newedit/".concat(qitem === null || qitem === void 0 ? void 0 : qitem.hack_identifier, "?type=exercises&express_id=").concat(params.exerciseId, "&question_id=").concat(qitem === null || qitem === void 0 ? void 0 : qitem.question_id, "&score=").concat(qitem === null || qitem === void 0 ? void 0 : qitem.question_score, "&exercise=true&callback_url=/classrooms/").concat(params.coursesId, "/exercise/add/").concat(itemid, "?type=2"));
} else {
setisedit(true);
}
},
className: "".concat(EditPotinmodules.edit, " iconfont icon-bianji_Hover mr5 ")
})]
})]
}), !isedit && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.qcount,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: EditPotinmodules.score,
children: [qitem === null || qitem === void 0 ? void 0 : qitem.question_score, "\u5206"]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: EditPotinmodules.qtitle,
value: (qitem === null || qitem === void 0 ? void 0 : qitem.index) + '、' + "".concat((qitem === null || qitem === void 0 ? void 0 : qitem.question_type) == 8 ? qitem === null || qitem === void 0 || (_qitem$program_attr = qitem.program_attr) === null || _qitem$program_attr === void 0 ? void 0 : _qitem$program_attr.description : qitem === null || qitem === void 0 ? void 0 : qitem.question_title)
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(SaveItem, {
TagDiscipline: TagDiscipline,
qitem: qitem
})]
}), isedit && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [(qitem === null || qitem === void 0 ? void 0 : qitem.question_type) <= 1 && /*#__PURE__*/(0,jsx_runtime.jsx)(SingleEditor, {
deleteitem: deleteitem,
getTagData: getTagData,
seveeditor: seveeditor,
exerciseitem: exerciseitem,
TagDiscipline: TagDiscipline,
setisedit: setisedit,
qitem: qitem,
init: init
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 5 && /*#__PURE__*/(0,jsx_runtime.jsx)(ShixunEditor, {
setqitem: setqitem,
deleteitem: deleteitem,
seveeditor: seveeditor,
exerciseitem: exerciseitem,
TagDiscipline: TagDiscipline,
setisedit: setisedit,
qitem: qitem
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 3 && /*#__PURE__*/(0,jsx_runtime.jsx)(CombinationEditor, {
deleteitem: deleteitem,
getTagData: getTagData,
seveeditor: seveeditor,
exerciseitem: exerciseitem,
TagDiscipline: TagDiscipline,
setisedit: setisedit,
qitem: qitem,
init: init
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 2 && /*#__PURE__*/(0,jsx_runtime.jsx)(Questions_JudgmentQuestionEditor, {
deleteitem: deleteitem,
getTagData: getTagData,
seveeditor: seveeditor,
exerciseitem: exerciseitem,
TagDiscipline: TagDiscipline,
setisedit: setisedit,
qitem: qitem,
init: init
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 4 && /*#__PURE__*/(0,jsx_runtime.jsx)(Questions_SubjectiveQuestionEditor, {
deleteitem: deleteitem,
getTagData: getTagData,
seveeditor: seveeditor,
exerciseitem: exerciseitem,
TagDiscipline: TagDiscipline,
setisedit: setisedit,
qitem: qitem,
init: init
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 7 && /*#__PURE__*/(0,jsx_runtime.jsx)(Questions_CombinationQuestionEditor, {
deleteitem: deleteitem,
getTagData: getTagData,
seveeditor: seveeditor,
exerciseitem: exerciseitem,
TagDiscipline: TagDiscipline,
setisedit: setisedit,
qitem: qitem,
init: init
}), (qitem === null || qitem === void 0 ? void 0 : qitem.question_type) === 8 && /*#__PURE__*/(0,jsx_runtime.jsx)(Questions_BProgramEditor, {
deleteitem: deleteitem,
getTagData: getTagData,
seveeditor: seveeditor,
exerciseitem: exerciseitem,
TagDiscipline: TagDiscipline,
setisedit: setisedit,
qitem: qitem,
init: init
})]
})]
})
})]
})
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: EditPotinmodules.bottomdiv,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: EditPotinmodules.exercise_styles,
children: [(exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis10 = exerciseitem.exercise) === null || _exerciseitem$exercis10 === void 0 ? void 0 : _exerciseitem$exercis10.exercise_status) == 1 && /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: EditPotinmodules.spanBtn,
onClick: function onClick() {
if (isedit) {
message/* default */.ZP.info('请先保存或取消当前正在编辑的试题。');
return;
}
setshowquestion(true);
setisshixun(false);
},
children: "\u9898\u5E93\u9009\u9898"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: EditPotinmodules.spanBtn,
onClick: function onClick() {
if (isedit) {
message/* default */.ZP.info('请先保存或取消当前正在编辑的试题。');
return;
}
setUploadModalVisible(true);
},
children: "\u5BFC\u5165\u8BD5\u9898"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: EditPotinmodules.spanBtn,
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6() {
var res, _user$userInfo4;
return regeneratorRuntime_default()().wrap(function _callee6$(_context6) {
while (1) switch (_context6.prev = _context6.next) {
case 0:
_context6.next = 2;
return (0,fetch/* default */.ZP)("/api/exercises/".concat(params === null || params === void 0 ? void 0 : params.exerciseId, "/simulate_start_answer.json"), {
method: 'get',
params: {
coursesId: params === null || params === void 0 ? void 0 : params.coursesId,
categoryId: params === null || params === void 0 ? void 0 : params.exerciseId,
is_reset: 1
}
});
case 2:
res = _context6.sent;
if ((res === null || res === void 0 ? void 0 : res.status) != -1) {
window.open("/classrooms/".concat(params === null || params === void 0 ? void 0 : params.coursesId, "/exercise/").concat(params === null || params === void 0 ? void 0 : params.exerciseId, "/").concat((_user$userInfo4 = user.userInfo) === null || _user$userInfo4 === void 0 ? void 0 : _user$userInfo4.login, "/initate_answer"));
}
case 4:
case "end":
return _context6.stop();
}
}, _callee6);
})),
children: "\u6A21\u62DF\u8003\u8BD5"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: EditPotinmodules.spanBtn,
onClick: function onClick() {
window.open("/classrooms/".concat(params === null || params === void 0 ? void 0 : params.coursesId, "/exercise/").concat(params === null || params === void 0 ? void 0 : params.exerciseId, "/detail?random=false&tabs=2"));
},
children: "\u8BD5\u5377\u9884\u89C8"
}), questionType === null || questionType === void 0 ? void 0 : questionType.map(function (item) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: EditPotinmodules.addQuestionBtn,
type: "primary",
onClick: function onClick() {
if (isedit) {
message/* default */.ZP.info('请先保存或取消当前正在编辑的试题。');
return;
}
setisadd(true);
if (item.id === 5) {
setshowquestion(true);
setisshixun(true);
return;
}
if (item.id === 6) {
var _exerciseitem$exercis11, _exerciseitem$exercis12, _exerciseitem$exercis13;
_umi_production_exports.history.push("/problems/newcreate?difficult=".concat(exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis11 = exerciseitem.exercise) === null || _exerciseitem$exercis11 === void 0 ? void 0 : _exerciseitem$exercis11.difficulty, "&sub_discipline_id=").concat(exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis12 = exerciseitem.exercise) === null || _exerciseitem$exercis12 === void 0 ? void 0 : _exerciseitem$exercis12.sub_discipline_id, "&express_id=").concat(exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis13 = exerciseitem.exercise) === null || _exerciseitem$exercis13 === void 0 ? void 0 : _exerciseitem$exercis13.id, "&callback_url=/classrooms/").concat(params.coursesId, "/exercise/add/").concat(itemid, "?type=2"));
return;
}
setisedit(true);
if (item.id === 2) {
setqitem({
question_type: item.id,
isadd: true,
repeat_answer: true,
choices: [{
choice_text: '正确',
is_answer: 0
}, {
choice_text: '错误',
is_answer: 0
}],
question_choices: [{
choice_text: '正确',
is_answer: 0
}, {
choice_text: '错误',
is_answer: 0
}],
difficulty: 2,
standard_answers: [],
question_score: '',
question_title: '',
tag_discipline_ids: [],
analysis: ''
});
} else {
setqitem({
question_type: item.id,
question_choices: Array.from({
length: 4
}, function () {
return {
choice_text: '',
is_answer: 0
};
}),
standard_answers: [],
repeat_answer: true,
difficulty: 2,
isadd: true,
tag_discipline_ids: [],
question_score: '',
analysis: '',
sub_item_banks: [],
is_ordered: true,
question_title: '',
use_keywords: false,
keywords: [],
use_blank_score: true,
allow_student_debug: false,
submit_rule: 1,
downcase: true,
no_space: true
});
}
},
children: item.name
}, item.id);
})]
}), (exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis14 = exerciseitem.exercise) === null || _exerciseitem$exercis14 === void 0 ? void 0 : _exerciseitem$exercis14.exercise_status) != 1 && /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
width: '1022px'
}
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: EditPotinmodules.saveBtn,
onClick: function onClick() {
var _exerciseitem$exercis15;
if (isedit) {
message/* default */.ZP.info('请先保存或取消当前正在编辑试题。');
return;
}
if ((exerciseitem === null || exerciseitem === void 0 || (_exerciseitem$exercis15 = exerciseitem.exercise) === null || _exerciseitem$exercis15 === void 0 ? void 0 : _exerciseitem$exercis15.exercise_status) == 1) {
setisTips(true);
} else {
_umi_production_exports.history.back();
}
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-baocun1",
style: {
fontSize: 15,
marginRight: 5
}
}), "\u4FDD\u5B58\u8BD5\u5377"]
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Setscore, {
setScoreShow: setScoreShow,
ScoreShow: ScoreShow,
exerciseitem: exerciseitem,
getdata: init
}), showquestion && /*#__PURE__*/(0,jsx_runtime.jsx)(AddQuestionsModal, {
setScoreShow: setshowquestion,
isshixuns: isshixun,
isloadings: isloadings,
ScoreShow: showquestion,
onOk: ( /*#__PURE__*/function () {
var _ref8 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee8(questionIdArr, shixunIdArr, ischeck_only, listitems_length, shixunCopyIds) {
var params, res;
return regeneratorRuntime_default()().wrap(function _callee8$(_context8) {
while (1) switch (_context8.prev = _context8.next) {
case 0:
setisloadings(true);
params = {
exam_id: itemid,
item_bank_ids: questionIdArr,
shixun_ids: shixunIdArr,
shixun_copy_ids: shixunCopyIds
};
_context8.next = 4;
return addquestion(objectSpread2_default()(objectSpread2_default()({}, params), {}, {
check_only: ischeck_only
}));
case 4:
res = _context8.sent;
setisloadings(false);
if (!((res === null || res === void 0 ? void 0 : res.status) === 0)) {
_context8.next = 14;
break;
}
_context8.next = 9;
return addquestion(params);
case 9:
init();
setshowquestion(false);
message/* default */.ZP.info('添加成功');
_context8.next = 15;
break;
case 14:
if (res.status === -2) {
modal/* default */.Z.confirm({
title: '提示',
content: "\u5F53\u524D\u5DF2\u9009\u62E9".concat(listitems_length, "\u9053\u8BD5\u9898\uFF0C\u5DF2\u52A0\u5165\u8FC7\u7684\u8BD5\u9898\u6216\u672A\u53D1\u5E03\u7684\u7F16\u7A0B\u9898\u5C06\u4E0D\u4F1A\u91CD\u590D\u52A0\u5165"),
onOk: function () {
var _onOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee7() {
return regeneratorRuntime_default()().wrap(function _callee7$(_context7) {
while (1) switch (_context7.prev = _context7.next) {
case 0:
_context7.next = 2;
return addquestion(params);
case 2:
setshowquestion(false);
init();
message/* default */.ZP.info('添加成功');
case 5:
case "end":
return _context7.stop();
}
}, _callee7);
}));
function onOk() {
return _onOk.apply(this, arguments);
}
return onOk;
}()
});
}
case 15:
case "end":
return _context8.stop();
}
}, _callee8);
}));
return function (_x8, _x9, _x10, _x11, _x12) {
return _ref8.apply(this, arguments);
};
}())
}), /*#__PURE__*/(0,jsx_runtime.jsx)(UploadQuestions/* default */.Z, {
visible: uploadModalVisible,
onCancel: function onCancel() {
return setUploadModalVisible(false);
},
onOk: handleOk
}), /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
title: "\u63D0\u793A",
open: isTips,
confirmLoading: false //确定按钮loading
,
centered: true,
okText: "\u8BBE\u7F6E\u89C4\u5219",
cancelText: "\u4FEE\u6539\u8BD5\u5377",
footer: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
onClick: function onClick() {
setisTips(false); //修改试卷跳转
_umi_production_exports.history.back();
},
children: "\u7A0D\u540E\u518D\u8BF4"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "primary",
onClick: function onClick() {
// console.log(`/classrooms/${params?.coursesId}/exercise/${exerciseitem?.exercise.id}/detail?random=${false}&tabs=3`);
_umi_production_exports.history.push("/classrooms/".concat(params === null || params === void 0 ? void 0 : params.coursesId, "/exercise/").concat(itemid, "/detail?random=", false, "&tabs=3"));
setisTips(false);
},
children: "\u8BBE\u7F6E\u89C4\u5219"
})]
}),
onCancel: function onCancel() {
setisTips(false); //修改试卷跳转
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u8BD5\u5377\u521B\u5EFA\u5B8C\u6210\uFF01\u76EE\u524D\u5904\u4E8E\u672A\u53D1\u5E03\u72B6\u6001\uFF0C\u662F\u5426\u8BBE\u7F6E\u8003\u8BD5\u89C4\u5219\uFF1F"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
centered: true,
title: "\u7F16\u8F91\u9898\u578B\u540D\u79F0",
open: isOpenEditName,
width: 500,
onOk: function onOk() {
return form.submit();
},
onCancel: function onCancel() {
return setIsOpenEditName(false);
},
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
form: form,
initialValues: {},
onFinish: ( /*#__PURE__*/function () {
var _ref9 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee9(values) {
var res;
return regeneratorRuntime_default()().wrap(function _callee9$(_context9) {
while (1) switch (_context9.prev = _context9.next) {
case 0:
_context9.next = 2;
return (0,service_exercise/* getEditQuestionTypeAlias */.RK)(objectSpread2_default()({
id: itemid
}, values));
case 2:
res = _context9.sent;
if (res.status == 0) {
message/* default */.ZP.success("修改成功");
init();
setIsOpenEditName(false);
}
case 4:
case "end":
return _context9.stop();
}
}, _callee9);
}));
return function (_x13) {
return _ref9.apply(this, arguments);
};
}()),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "name",
style: {
marginBottom: 0
},
rules: [{
required: true,
message: '请输入题型名称'
}, {
whitespace: true,
message: '请勿输入空格'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
size: "large",
maxLength: 6,
showCount: true
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
hidden: true,
name: "item_type_en",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
size: "large"
})
})]
})
})]
});
};
/* harmony default export */ var EditPotin = ((0,_umi_production_exports.connect)(function (_ref10) {
var user = _ref10.user,
dispatch = _ref10.dispatch;
return {
user: user,
dispatch: dispatch
};
})(AddNewPaper));
// EXTERNAL MODULE: ./src/components/DigitalLabel/index.tsx + 1 modules
var DigitalLabel = __webpack_require__(8354);
// EXTERNAL MODULE: ./src/pages/Paperlibrary/Add/TitleEditor.tsx
var TitleEditor = __webpack_require__(42318);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Add/index.tsx
var _excluded = ["classroomList", "globalSetting", "problemset", "loading", "exercise", "user", "dispatch"];
var ExerciseAdd = function ExerciseAdd(_ref) {
var _problemset$disciplin4, _userInfo$course, _exercise$editData, _exercise$editData8, _exercise$editData9, _exercise$editData10, _exercise$editData11, _exercise$editData12;
var classroomList = _ref.classroomList,
globalSetting = _ref.globalSetting,
problemset = _ref.problemset,
loading = _ref.loading,
exercise = _ref.exercise,
user = _ref.user,
dispatch = _ref.dispatch,
props = objectWithoutProperties_default()(_ref, _excluded);
var params = (0,_umi_production_exports.useParams)();
var _useState = (0,_react_17_0_2_react.useState)(false),
_useState2 = slicedToArray_default()(_useState, 2),
btnLoading = _useState2[0],
setBtnLoading = _useState2[1];
var userInfo = user.userInfo;
var _Form$useForm = es_form/* default */.Z.useForm(),
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
form = _Form$useForm2[0];
var _useState3 = (0,_react_17_0_2_react.useState)({}),
_useState4 = slicedToArray_default()(_useState3, 2),
items = _useState4[0],
setitems = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)(1),
_useState6 = slicedToArray_default()(_useState5, 2),
current = _useState6[0],
setcurrent = _useState6[1];
var _useState7 = (0,_react_17_0_2_react.useState)(''),
_useState8 = slicedToArray_default()(_useState7, 2),
itemid = _useState8[0],
setitemid = _useState8[1];
var _useSearchParams = (0,_umi_production_exports.useSearchParams)(),
_useSearchParams2 = slicedToArray_default()(_useSearchParams, 1),
searchParams = _useSearchParams2[0];
var _useState9 = (0,_react_17_0_2_react.useState)(false),
_useState10 = slicedToArray_default()(_useState9, 2),
subloading = _useState10[0],
setsubloading = _useState10[1];
var _useState11 = (0,_react_17_0_2_react.useState)(false),
_useState12 = slicedToArray_default()(_useState11, 2),
isedit = _useState12[0],
setisedit = _useState12[1];
var _useState13 = (0,_react_17_0_2_react.useState)(false),
_useState14 = slicedToArray_default()(_useState13, 2),
showUpdate = _useState14[0],
setshowUpdate = _useState14[1];
(0,_react_17_0_2_react.useEffect)(function () {
dispatch({
type: 'problemset/getEditDisciplines',
payload: {
source: 'new_question',
identifier: params === null || params === void 0 ? void 0 : params.coursesId
}
});
dispatch({
type: 'globalSetting/footerToggle',
payload: false
});
form.setFieldsValue({
difficulty: 2
});
}, []);
(0,_react_17_0_2_react.useEffect)(function () {
if (params.exerciseId) {
asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var res, _res$exercise, _res$exercise2, _res$exercise3;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return dispatch({
type: 'exercise/editExercise',
payload: {
categoryId: params.exerciseId
}
});
case 2:
res = _context.sent;
if ((res === null || res === void 0 ? void 0 : res.status) !== -1) {
if ((res === null || res === void 0 || (_res$exercise = res.exercise) === null || _res$exercise === void 0 ? void 0 : _res$exercise.exercise_status) === 2 || (res === null || res === void 0 || (_res$exercise2 = res.exercise) === null || _res$exercise2 === void 0 ? void 0 : _res$exercise2.exercise_status) === 3 || (res === null || res === void 0 || (_res$exercise3 = res.exercise) === null || _res$exercise3 === void 0 ? void 0 : _res$exercise3.exercise_status) === 4) {
setshowUpdate(true);
} else {
setshowUpdate(false);
}
}
case 4:
case "end":
return _context.stop();
}
}, _callee);
}))();
}
}, [params]);
(0,_react_17_0_2_react.useEffect)(function () {
if (params.exerciseId) {
var _items$exercise, _items$exercise2;
var _items = exercise.editData;
form.setFieldsValue(objectSpread2_default()(objectSpread2_default()({}, _items.exercise), {}, {
courseid: [_items === null || _items === void 0 || (_items$exercise = _items.exercise) === null || _items$exercise === void 0 ? void 0 : _items$exercise.discipline_id, (_items$exercise2 = _items.exercise) === null || _items$exercise2 === void 0 ? void 0 : _items$exercise2.sub_discipline_id]
}));
}
}, [exercise]);
(0,_react_17_0_2_react.useEffect)(function () {
if (searchParams.get('type') === '2') {
setitemid(params.exerciseId);
setcurrent(2);
}
}, [searchParams.get('type')]);
(0,_react_17_0_2_react.useEffect)(function () {
var _problemset$disciplin;
if (problemset !== null && problemset !== void 0 && (_problemset$disciplin = problemset.disciplinesData) !== null && _problemset$disciplin !== void 0 && (_problemset$disciplin = _problemset$disciplin.checked) !== null && _problemset$disciplin !== void 0 && _problemset$disciplin.sub_discipline_id) {
var _problemset$disciplin2, _problemset$disciplin3;
form.setFieldsValue({
courseid: [problemset === null || problemset === void 0 || (_problemset$disciplin2 = problemset.disciplinesData) === null || _problemset$disciplin2 === void 0 || (_problemset$disciplin2 = _problemset$disciplin2.checked) === null || _problemset$disciplin2 === void 0 ? void 0 : _problemset$disciplin2.discipline_id, problemset === null || problemset === void 0 || (_problemset$disciplin3 = problemset.disciplinesData) === null || _problemset$disciplin3 === void 0 || (_problemset$disciplin3 = _problemset$disciplin3.checked) === null || _problemset$disciplin3 === void 0 ? void 0 : _problemset$disciplin3.sub_discipline_id]
});
}
}, [problemset === null || problemset === void 0 || (_problemset$disciplin4 = problemset.disciplinesData) === null || _problemset$disciplin4 === void 0 ? void 0 : _problemset$disciplin4.checked]);
function onModalOk(_x, _x2) {
return _onModalOk.apply(this, arguments);
}
function _onModalOk() {
_onModalOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4(time, cb) {
var value, courseid, _courseid2, id, subid, res, _res$data4, _res$data5, _res$data6, _res$data7;
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
_context4.next = 2;
return form.validateFields();
case 2:
value = form.getFieldsValue();
courseid = value.courseid;
_courseid2 = slicedToArray_default()(courseid, 2), id = _courseid2[0], subid = _courseid2[1];
value.sub_discipline_id = subid;
value.is_md = true;
value.time = parseInt(value.time) > 9999 ? 9999 : value.time;
_context4.next = 10;
return dispatch({
type: "exercise/addExercise",
payload: objectSpread2_default()(objectSpread2_default()({}, value), params)
});
case 10:
res = _context4.sent;
if (!(res.status === 0)) {
_context4.next = 21;
break;
}
_context4.next = 14;
return (0,fetch/* default */.ZP)("/api/courses/".concat(params === null || params === void 0 ? void 0 : params.coursesId, "/exercises/notice_at.json"), {
method: 'POST',
body: {
course_id: params === null || params === void 0 ? void 0 : params.coursesId,
id: res === null || res === void 0 || (_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : _res$data4.exercise_id,
time: time
}
});
case 14:
set_work_points((_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : _res$data5.exercise_id);
setitemid(res === null || res === void 0 || (_res$data6 = res.data) === null || _res$data6 === void 0 ? void 0 : _res$data6.exercise_id);
setcurrent(2);
setsubloading(false);
_umi_production_exports.history.replace("/classrooms/".concat(params.coursesId, "/exercise/add/").concat((_res$data7 = res.data) === null || _res$data7 === void 0 ? void 0 : _res$data7.exercise_id, "?type=2"));
// history.push(`/classrooms/${params.coursesId}/exercise/${res.data?.exercise_id}/edit`)
_context4.next = 22;
break;
case 21:
message/* default */.ZP.error(res.message);
case 22:
cb();
case 23:
case "end":
return _context4.stop();
}
}, _callee4);
}));
return _onModalOk.apply(this, arguments);
}
function setitem(items) {
setitems(objectSpread2_default()({}, items));
}
function set_work_points(_x3) {
return _set_work_points.apply(this, arguments);
}
function _set_work_points() {
_set_work_points = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5(id) {
var record, res;
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
if (items !== null && items !== void 0 && items.ec_point_ids) {
_context5.next = 2;
break;
}
return _context5.abrupt("return");
case 2:
record = objectSpread2_default()({}, items);
delete record.id;
_context5.next = 6;
return (0,fetch/* default */.ZP)("/api/ec_courses/".concat(items === null || items === void 0 ? void 0 : items.ec_course_id, "/ec_points/set_work_points.json"), {
method: 'post',
body: objectSpread2_default()({
exercise_id: id
}, record)
});
case 6:
res = _context5.sent;
case 7:
case "end":
return _context5.stop();
}
}, _callee5);
}));
return _set_work_points.apply(this, arguments);
}
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
background: '#ffffff',
marginTop: -8,
padding: 8,
minHeight: '100vh',
paddingBottom: 64
},
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
className: "edu-container",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("section", {
className: "animated fadeIn",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
className: "mt10",
children: userInfo && /*#__PURE__*/(0,jsx_runtime.jsxs)(breadcrumb/* default */.Z, {
separator: ">",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
to: "/classrooms/".concat(params.coursesId, "/exercise"),
children: userInfo === null || userInfo === void 0 || (_userInfo$course = userInfo.course) === null || _userInfo$course === void 0 ? void 0 : _userInfo$course.course_name
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
to: "/classrooms/".concat(params.coursesId, "/exercise"),
children: "\u8BD5\u5377\u5217\u8868"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, {
children: params.exerciseId ? '编辑试卷' : '新建试卷'
})]
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "bg-white",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
justifyContent: 'center',
paddingTop: 20,
alignItems: 'center'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
onClick: function onClick() {
if (isedit) {
message/* default */.ZP.info('请先保存或取消当前正在编辑试题。');
return;
}
setcurrent(1);
},
className: current === 1 ? Addmodules.selectdiv : Addmodules.divitem,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(DigitalLabel/* default */.Z, {
number: 1,
active: current === 1,
className: "mr10"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u8BD5\u5377\u57FA\u7840\u4FE1\u606F"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
width: 188,
border: '1px dotted #9096A3',
margin: '0px 30px',
height: 1
}
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
onClick: function onClick() {
if (!params.exerciseId && !itemid) {
message/* default */.ZP.info('请先保存基础信息再新建试题');
return;
}
setcurrent(2);
if (itemid) {
return;
}
setitemid(params.exerciseId);
},
className: current !== 1 ? Addmodules.selectdiv : Addmodules.divitem,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(DigitalLabel/* default */.Z, {
number: 2,
active: current !== 1,
className: "mr10"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u7F16\u8F91\u8BD5\u9898"
})]
})]
}), current === 2 && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "tc",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(TitleEditor/* default */.Z, {
defaultValue: exercise === null || exercise === void 0 || (_exercise$editData = exercise.editData) === null || _exercise$editData === void 0 || (_exercise$editData = _exercise$editData.exercise) === null || _exercise$editData === void 0 ? void 0 : _exercise$editData.exercise_name,
onFinish: ( /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(newTitle) {
var _exercise$editData2, _exercise$editData3, _exercise$editData4, _exercise$editData5, _exercise$editData6, _exercise$editData7;
var res;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
if (!(newTitle.trim() === (exercise === null || exercise === void 0 || (_exercise$editData2 = exercise.editData) === null || _exercise$editData2 === void 0 || (_exercise$editData2 = _exercise$editData2.exercise) === null || _exercise$editData2 === void 0 ? void 0 : _exercise$editData2.exercise_name))) {
_context2.next = 2;
break;
}
return _context2.abrupt("return", true);
case 2:
_context2.next = 4;
return (0,service_exercise/* putExercise */.wy)({
exercise_name: newTitle,
exercise_description: exercise === null || exercise === void 0 || (_exercise$editData3 = exercise.editData) === null || _exercise$editData3 === void 0 || (_exercise$editData3 = _exercise$editData3.exercise) === null || _exercise$editData3 === void 0 ? void 0 : _exercise$editData3.exercise_description,
sub_discipline_id: exercise === null || exercise === void 0 || (_exercise$editData4 = exercise.editData) === null || _exercise$editData4 === void 0 || (_exercise$editData4 = _exercise$editData4.exercise) === null || _exercise$editData4 === void 0 ? void 0 : _exercise$editData4.sub_discipline_id,
time: exercise === null || exercise === void 0 || (_exercise$editData5 = exercise.editData) === null || _exercise$editData5 === void 0 || (_exercise$editData5 = _exercise$editData5.exercise) === null || _exercise$editData5 === void 0 ? void 0 : _exercise$editData5.time,
exerciseId: (_exercise$editData6 = exercise.editData) === null || _exercise$editData6 === void 0 || (_exercise$editData6 = _exercise$editData6.exercise) === null || _exercise$editData6 === void 0 ? void 0 : _exercise$editData6.id,
difficulty: (_exercise$editData7 = exercise.editData) === null || _exercise$editData7 === void 0 || (_exercise$editData7 = _exercise$editData7.exercise) === null || _exercise$editData7 === void 0 ? void 0 : _exercise$editData7.difficulty
});
case 4:
res = _context2.sent;
if (!(res.status === 0)) {
_context2.next = 8;
break;
}
form.setFieldValue('exercise_name', newTitle);
return _context2.abrupt("return", true);
case 8:
return _context2.abrupt("return", false);
case 9:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function (_x4) {
return _ref3.apply(this, arguments);
};
}())
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
fontSize: 14
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
color: '#5F6368'
},
children: ["\u7B54\u9898\u65F6\u957F", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#000000',
marginLeft: 8
},
children: (exercise === null || exercise === void 0 || (_exercise$editData8 = exercise.editData) === null || _exercise$editData8 === void 0 || (_exercise$editData8 = _exercise$editData8.exercise) === null || _exercise$editData8 === void 0 ? void 0 : _exercise$editData8.time) || '不限'
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
margin: '0px 30px',
color: '#5F6368'
},
children: ["\u96BE\u5EA6", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#000000',
marginLeft: 8
},
children: (exercise === null || exercise === void 0 || (_exercise$editData9 = exercise.editData) === null || _exercise$editData9 === void 0 || (_exercise$editData9 = _exercise$editData9.exercise) === null || _exercise$editData9 === void 0 ? void 0 : _exercise$editData9.difficulty) === 1 ? '简单' : (exercise === null || exercise === void 0 || (_exercise$editData10 = exercise.editData) === null || _exercise$editData10 === void 0 || (_exercise$editData10 = _exercise$editData10.exercise) === null || _exercise$editData10 === void 0 ? void 0 : _exercise$editData10.difficulty) === 2 ? '适中' : '困难'
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
marginRight: 30,
color: '#5F6368'
},
children: ["\u8BD5\u9898\u603B\u6570", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#000000',
marginLeft: 8
},
children: (exercise === null || exercise === void 0 || (_exercise$editData11 = exercise.editData) === null || _exercise$editData11 === void 0 || (_exercise$editData11 = _exercise$editData11.exercise_types) === null || _exercise$editData11 === void 0 ? void 0 : _exercise$editData11.q_counts) || 0
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
color: '#5F6368'
},
children: ["\u603B\u5206", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#000000',
marginLeft: 8
},
children: exercise === null || exercise === void 0 || (_exercise$editData12 = exercise.editData) === null || _exercise$editData12 === void 0 || (_exercise$editData12 = _exercise$editData12.exercise_types) === null || _exercise$editData12 === void 0 ? void 0 : _exercise$editData12.q_scores
})]
})]
})]
})]
}), current === 1 && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
className: [Addmodules.bg, 'mt20'].join(' '),
style: {
padding: '30px 120px 300px 120px'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
form: form,
colon: false,
layout: "horizontal",
labelCol: {
span: 4
},
wrapperCol: {
span: 20
},
initialValues: {
time: 60
},
onFinish: ( /*#__PURE__*/function () {
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(value) {
var _exercise$editData13, res, courseid, _courseid, id, subid, _res, _res$data, _res$data2, _res$data3;
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
setBtnLoading(true);
setsubloading(true);
if (!params.exerciseId) {
_context3.next = 13;
break;
}
value.exerciseId = (_exercise$editData13 = exercise.editData) === null || _exercise$editData13 === void 0 || (_exercise$editData13 = _exercise$editData13.exercise) === null || _exercise$editData13 === void 0 ? void 0 : _exercise$editData13.id;
value.sub_discipline_id = value.courseid[value.courseid.length - 1];
_context3.next = 7;
return (0,service_exercise/* putExercise */.wy)(objectSpread2_default()({}, value));
case 7:
setcurrent(2);
set_work_points(params === null || params === void 0 ? void 0 : params.exerciseId);
setitemid(params.exerciseId);
setBtnLoading(false);
setsubloading(false);
return _context3.abrupt("return");
case 13:
_context3.next = 15;
return (0,fetch/* default */.ZP)("/api/courses/".concat(params === null || params === void 0 ? void 0 : params.coursesId, "/exercises/overload_alert.json"), {
method: 'get',
params: {
course_id: params === null || params === void 0 ? void 0 : params.coursesId
}
});
case 15:
res = _context3.sent;
if (!(res !== null && res !== void 0 && res.alert)) {
_context3.next = 20;
break;
}
dispatch({
type: 'classroomList/setActionTabs',
payload: {
key: '预约弹窗'
}
});
_context3.next = 30;
break;
case 20:
courseid = value.courseid;
_courseid = slicedToArray_default()(courseid, 2), id = _courseid[0], subid = _courseid[1];
value.sub_discipline_id = subid;
value.is_md = true;
value.time = parseInt(value.time) > 9999 ? 9999 : value.time;
_context3.next = 27;
return dispatch({
type: "exercise/addExercise",
payload: objectSpread2_default()(objectSpread2_default()({}, value), params)
});
case 27:
_res = _context3.sent;
if (_res.status === 0) {
set_work_points((_res$data = _res.data) === null || _res$data === void 0 ? void 0 : _res$data.exercise_id);
// trackEvent(['教学课堂', '试卷', '新建试卷']);
// history.push(`/classrooms/${params.coursesId}/exercise/${res.data?.exercise_id}/edit`)
_umi_production_exports.history.replace("/classrooms/".concat(params.coursesId, "/exercise/add/").concat((_res$data2 = _res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.exercise_id, "?type=2"));
setitemid(_res === null || _res === void 0 || (_res$data3 = _res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.exercise_id);
setcurrent(2);
} else {
// message.error(res.message)
}
setsubloading(false);
case 30:
setBtnLoading(false);
case 31:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return function (_x5) {
return _ref4.apply(this, arguments);
};
}()),
className: Addmodules.formWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "exercise_name",
label: "\u8BD5\u5377\u540D\u79F0",
className: Addmodules.baseLineHeight,
rules: [{
required: true,
validator: function validator(_, value) {
var _value$replaceAll;
return (value === null || value === void 0 || (_value$replaceAll = value.replaceAll(' ', '')) === null || _value$replaceAll === void 0 ? void 0 : _value$replaceAll.length) > 0 ? Promise.resolve() : Promise.reject('请填写试卷标题');
}
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
maxLength: 60,
className: Addmodules.baseFormItem,
placeholder: "\u8BF7\u8F93\u5165\u8BD5\u5377\u540D\u79F0",
showCount: true
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "方向&课程",
name: "courseid",
rules: [{
required: true,
message: '请选择课程'
}],
className: Addmodules.baseLineHeight,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(cascader/* default */.Z, {
disabled: showUpdate,
placeholder: "\u8BF7\u9009\u62E9\u65B9\u5411&\u8BFE\u7A0B",
options: problemset.courseOptions,
className: Addmodules.baseFormItem,
allowClear: false,
size: "large",
popupClassName: Addmodules.cascaderPopup,
dropdownMenuColumnStyle: {
padding: '8px 12px',
fontSize: 14
}
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u96BE\u5EA6",
name: "difficulty",
className: Addmodules.radioBtnWrapper,
rules: [{
required: true,
message: '请选择难度'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default.Group */.ZP.Group, {
className: Addmodules.radiogroup,
disabled: showUpdate,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Button */.ZP.Button, {
className: Addmodules.easy,
value: 1,
children: "\u7B80\u5355"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Button */.ZP.Button, {
className: Addmodules.medium,
value: 2,
children: "\u9002\u4E2D"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Button */.ZP.Button, {
className: Addmodules.hard,
value: 3,
children: "\u56F0\u96BE"
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u7B54\u9898\u65F6\u957F",
className: Addmodules.baseLineHeight,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
width: '100%'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "time",
noStyle: true,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
disabled: showUpdate,
min: 1,
max: 9999,
className: Addmodules.baseFormItem,
style: {
width: 220
},
maxLength: 60,
placeholder: "\u8BF7\u586B\u5199\u7B54\u9898\u65F6\u957F"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
marginLeft: '10px',
width: '40px',
lineHeight: '46px',
fontSize: 14
},
children: "\u5206\u949F"
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u8BD5\u5377\u987B\u77E5",
name: "exercise_description",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z.TextArea, {
disabled: showUpdate,
rows: 6,
maxLength: 65535,
placeholder: "\u8BF7\u5728\u6B64\u8F93\u5165\u672C\u6B21\u8BD5\u5377\u7B54\u9898\u7684\u76F8\u5173\u8BF4\u660E\uFF0C\u6700\u5927\u9650\u523665535\u4E2A\u5B57\u7B26"
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Add_EngineeringPoints, {
exercise_id: params === null || params === void 0 ? void 0 : params.exerciseId,
setitem: setitem
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Addmodules.bottmodiv,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: "".concat(Addmodules.cancelBtn),
type: "primary",
onClick: function onClick() {
_umi_production_exports.history.back();
},
children: "\u53D6\u6D88"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
loading: subloading,
onClick: function onClick() {
form.validateFields();
form.submit();
},
type: "primary",
className: "".concat(Addmodules.confirmBtn, " ml20"),
children: "\u4E0B\u4E00\u6B65"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(ExerciseModel, {
setsubloading: setsubloading,
onModalOk: onModalOk
})]
}), current === 2 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(EditPotin, {
setisedits: setisedit,
setitemid: setitemid,
itemid: itemid
})
})]
})
});
};
/* harmony default export */ var Add = ((0,_umi_production_exports.connect)(function (_ref5) {
var classroomList = _ref5.classroomList,
loading = _ref5.loading,
user = _ref5.user,
problemset = _ref5.problemset,
globalSetting = _ref5.globalSetting,
exercise = _ref5.exercise;
return {
classroomList: classroomList,
globalSetting: globalSetting,
problemset: problemset,
user: user,
exercise: exercise,
loading: loading.effects
};
})(ExerciseAdd));
/***/ }),
/***/ 9211:
/*!***************************************************************************************************!*\
!*** ./src/pages/Classrooms/Lists/Exercise/Edit/components/UploadQuestions/index.tsx + 1 modules ***!
\***************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ components_UploadQuestions; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(79800);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/_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/modal/index.js + 16 modules
var modal = __webpack_require__(43418);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/upload/index.js
var upload = __webpack_require__(60028);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
var es_button = __webpack_require__(3113);
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
var env = __webpack_require__(2367);
// EXTERNAL MODULE: ./src/utils/util.tsx
var util = __webpack_require__(73400);
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
var _umi_production_exports = __webpack_require__(19086);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Edit/components/UploadQuestions/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var UploadQuestionsmodules = ({"customModal":"customModal___bVzUV","content":"content___oKhZq","upload":"upload___nPxEL","infoText":"infoText___gZEJF","okBtn":"okBtn___CVo2A","fileList":"fileList___tauGN","fileName":"fileName___T_8JX"});
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Edit/components/UploadQuestions/index.tsx
var UploadQuestions = function UploadQuestions(_ref) {
var visible = _ref.visible,
onOk = _ref.onOk,
onCancel = _ref.onCancel;
var _useState = (0,_react_17_0_2_react.useState)([]),
_useState2 = slicedToArray_default()(_useState, 2),
fileList = _useState2[0],
setFileList = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(false),
_useState4 = slicedToArray_default()(_useState3, 2),
loading = _useState4[0],
setLoading = _useState4[1];
// const fileList = useRef<any>([])
var params = (0,_umi_production_exports.useParams)();
(0,_react_17_0_2_react.useEffect)(function () {
if (!visible) {
setFileList([]);
setLoading(false);
}
}, [visible]);
var handleOk = function handleOk() {
setLoading(true);
onOk(fileList, function () {
setLoading(false);
});
};
var handleCancel = function handleCancel() {
onCancel();
};
// const handleChange = (info: any) => {
// const newFileList = info?.fileList || [];
// if (newFileList.every((item: any) => item.status !== 'uploading')) {
// setLoading(false)
// } else {
// setLoading(true)
// }
// fileList.current = newFileList
// }
var down = function down() {
var url = "".concat(env/* default */.Z.API_SERVER, "/api/courses/").concat(params.coursesId, "/exercises/down_template");
(0,util/* downLoadLink */.Nd)(null, url);
};
var handleBeforeUpload = function handleBeforeUpload(info) {
var param = {
name: info.name,
uid: info.uid,
file: info
};
setFileList([param]);
return false;
};
var handleRemove = function handleRemove() {
setFileList([]);
};
return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
title: "\u5BFC\u5165\u8BD5\u9898",
open: visible,
onOk: handleOk,
centered: true,
wrapClassName: UploadQuestionsmodules.customModal,
onCancel: handleCancel,
width: 663,
okText: "\u786E\u8BA4",
okButtonProps: {
className: UploadQuestionsmodules.okBtn
},
cancelText: "\u53D6\u6D88",
confirmLoading: loading,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: UploadQuestionsmodules.content,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
fontWeight: 600
},
children: "\u6B65\u9AA41"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#5F6367'
},
children: "\u6839\u636E\u6A21\u677F\u8981\u6C42\u7F16\u8F91\u9700\u8981\u4E0A\u4F20\u7684\u8BD5\u9898"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: "#0152d9",
cursor: 'pointer',
marginLeft: 20
},
onClick: down,
children: "\u4E0B\u8F7D\u8003\u8BD5\u8BD5\u9898\u6A21\u677F"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-xiazai4 ml10",
onClick: down,
style: {
fontSize: 14,
cursor: 'pointer',
color: "#0152d9"
}
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
style: {
color: "#FA6400"
},
className: "mt10",
children: "\u63D0\u793A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
className: UploadQuestionsmodules.infoText,
children: "1\u3001\u76EE\u524D\u4EC5\u652F\u6301Excel\u683C\u5F0F\u6A21\u677F\uFF1B "
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
className: UploadQuestionsmodules.infoText,
children: "2\u3001\u4E0D\u652F\u6301\u7EC4\u5408\u9898\u548C\u5B9E\u8BAD\u9898\u5BFC\u5165\uFF1B"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
className: UploadQuestionsmodules.infoText,
children: "3\u3001\u6BCF\u6B21\u6700\u591A\u5BFC\u5165300\u9898\uFF1B"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
className: UploadQuestionsmodules.infoText,
children: "4\u3001\u586B\u7A7A\u9898\u5BFC\u5165\u6700\u591A\u652F\u63015\u4E2A\u586B\u7A7A\u9879\u3002"
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
style: {
marginTop: 22
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
fontWeight: 600
},
children: "\u6B65\u9AA42"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
style: {
flex: 1
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("li", {
style: {
color: '#5F6367'
},
children: "\u4E0A\u4F20\u7F16\u8F91\u597D\u7684\u8BD5\u9898\u6587\u6863\uFF0C\u786E\u5B9A\u5BFC\u5165"
}), visible && /*#__PURE__*/(0,jsx_runtime.jsx)(upload/* default */.Z, {
action: "".concat(env/* default */.Z.API_SERVER, "/api/attachments.json"),
beforeUpload: handleBeforeUpload,
onRemove: handleRemove,
withCredentials: true,
fileList: fileList,
accept: ".xls,.xlsx",
showUploadList: false,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: UploadQuestionsmodules.upload,
type: "primary",
icon: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-shangchuan3",
style: {
fontSize: 14
}
}),
children: "\u4E0A\u4F20\u6587\u4EF6"
})
}), fileList.map(function (fileItem, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: UploadQuestionsmodules.fileList,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: UploadQuestionsmodules.fileName,
children: fileItem === null || fileItem === void 0 ? void 0 : fileItem.name
}), /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-shanchu12",
style: {
color: '#F65160',
fontSize: 16,
cursor: 'pointer'
},
onClick: handleRemove
})]
}, index);
})]
})]
})]
})
});
};
/* harmony default export */ var components_UploadQuestions = (UploadQuestions);
/***/ }),
/***/ 42318:
/*!****************************************************!*\
!*** ./src/pages/Paperlibrary/Add/TitleEditor.tsx ***!
\****************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js */ 7557);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js */ 41498);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js */ 79800);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ 59301);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! antd */ 6848);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd */ 62680);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! antd */ 8591);
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./index.less?modules */ 19804);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
var TitleEditor = function TitleEditor(_ref) {
var defaultValue = _ref.defaultValue,
onFinish = _ref.onFinish;
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(false),
_useState2 = _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_2___default()(_useState, 2),
isEdit = _useState2[0],
setIsEdit = _useState2[1];
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(defaultValue),
_useState4 = _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_2___default()(_useState3, 2),
value = _useState4[0],
setValue = _useState4[1];
(0,react__WEBPACK_IMPORTED_MODULE_3__.useEffect)(function () {
setValue(defaultValue);
}, [defaultValue]);
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", {
children: !isEdit ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("div", {
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z.title,
children: [value, /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(antd__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
title: "\u70B9\u51FB\u7F16\u8F91\u8BD5\u5377\u540D\u79F0",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("i", {
className: "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z.editIcon, " iconfont icon-bianji_Hover"),
onClick: function onClick() {
return setIsEdit(true);
}
})
})]
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(antd__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, {
autoFocus: true,
maxLength: 60,
style: {
textAlign: 'center',
marginTop: 20,
marginBottom: 20
},
value: value,
onChange: function onChange(e) {
setValue(e.target.value);
},
onBlur: /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee() {
var _value$replaceAll;
var flag;
return _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (!((value === null || value === void 0 || (_value$replaceAll = value.replaceAll(' ', '')) === null || _value$replaceAll === void 0 ? void 0 : _value$replaceAll.length) <= 0)) {
_context.next = 3;
break;
}
antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .ZP.error('试卷标题不能为空');
return _context.abrupt("return");
case 3:
_context.next = 5;
return onFinish(value);
case 5:
flag = _context.sent;
flag && setIsEdit(false);
case 7:
case "end":
return _context.stop();
}
}, _callee);
})),
onPressEnter: /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee2() {
var _value$replaceAll2;
var flag;
return _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
if (!((value === null || value === void 0 || (_value$replaceAll2 = value.replaceAll(' ', '')) === null || _value$replaceAll2 === void 0 ? void 0 : _value$replaceAll2.length) <= 0)) {
_context2.next = 3;
break;
}
antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .ZP.error('试卷标题不能为空');
return _context2.abrupt("return");
case 3:
_context2.next = 5;
return onFinish(value);
case 5:
flag = _context2.sent;
flag && setIsEdit(false);
case 7:
case "end":
return _context2.stop();
}
}, _callee2);
}))
})
});
};
/* harmony default export */ __webpack_exports__.Z = (TitleEditor);
/***/ }),
/***/ 74297:
/*!****************************************!*\
!*** ./src/utils/hooks/useOverflow.ts ***!
\****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ I: function() { return /* binding */ useOverflow; }
/* harmony export */ });
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js */ 79800);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ 59301);
var useOverflow = function useOverflow() {
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)('hidden'),
_useState2 = _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_0___default()(_useState, 2),
overflow = _useState2[0],
setOverflow = _useState2[1];
var handleMouseEnter = function handleMouseEnter() {
return setOverflow('auto');
};
var handleMouseLeave = function handleMouseLeave() {
return setOverflow('hidden');
};
return {
overflow: overflow,
handleMouseEnter: handleMouseEnter,
handleMouseLeave: handleMouseLeave
};
};
/***/ }),
/***/ 87389:
/*!*********************************************!*\
!*** ./src/assets/images/paper/jiangxu.svg ***!
\*********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* unused harmony export ReactComponent */
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = function __defNormalProp(obj, key, value) {
return key in obj ? __defProp(obj, key, {
enumerable: true,
configurable: true,
writable: true,
value: value
}) : obj[key] = value;
};
var __spreadValues = function __spreadValues(a, b) {
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols) {
var _iterator = _createForOfIteratorHelper(__getOwnPropSymbols(b)),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var prop = _step.value;
if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
}
return a;
};
var SvgJiangxu = function SvgJiangxu(props) {
return /* @__PURE__ */React.createElement("svg", __spreadValues({
className: "jiangxu_svg__icon",
viewBox: "0 0 1024 1024",
xmlns: "http://www.w3.org/2000/svg",
width: 32,
height: 32
}, props), /* @__PURE__ */React.createElement("path", {
d: "M365.714 73.143H1024v73.143H365.714zm0 292.571H1024v73.143H365.714zm0 292.572H1024v73.143H365.714zm0 292.571H1024V1024H365.714v-73.143z",
fill: "#98BDF7"
}), /* @__PURE__ */React.createElement("path", {
d: "m248.686 803.182-65.829 75.922V658.286h-73.143v220.818l-65.828-75.995L0 851.383 146.286 1024 292.57 851.53z",
fill: "#145DFF"
}), /* @__PURE__ */React.createElement("path", {
d: "M146.286 0 0 158.72l43.886 55.223 65.828-75.922v227.693h73.143V138.021l65.829 75.922 43.885-55.223z",
fill: "#98BDF7"
}));
};
/* harmony default export */ __webpack_exports__.Z = ("data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMzIiIGhlaWdodD0iMzIiPjxwYXRoIGQ9Ik0zNjUuNzE0IDczLjE0M0gxMDI0djczLjE0M0gzNjUuNzE0em0wIDI5Mi41NzFIMTAyNHY3My4xNDNIMzY1LjcxNHptMCAyOTIuNTcySDEwMjR2NzMuMTQzSDM2NS43MTR6bTAgMjkyLjU3MUgxMDI0VjEwMjRIMzY1LjcxNHYtNzMuMTQzeiIgZmlsbD0iIzk4QkRGNyIvPjxwYXRoIGQ9Im0yNDguNjg2IDgwMy4xODItNjUuODI5IDc1LjkyMlY2NTguMjg2aC03My4xNDN2MjIwLjgxOGwtNjUuODI4LTc1Ljk5NUwwIDg1MS4zODMgMTQ2LjI4NiAxMDI0IDI5Mi41NyA4NTEuNTN6IiBmaWxsPSIjMTQ1REZGIi8+PHBhdGggZD0iTTE0Ni4yODYgMCAwIDE1OC43Mmw0My44ODYgNTUuMjIzIDY1LjgyOC03NS45MjJ2MjI3LjY5M2g3My4xNDNWMTM4LjAyMWw2NS44MjkgNzUuOTIyIDQzLjg4NS01NS4yMjN6IiBmaWxsPSIjOThCREY3Ii8+PC9zdmc+");
/***/ }),
/***/ 57534:
/*!*********************************************!*\
!*** ./src/assets/images/paper/shengxu.svg ***!
\*********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* unused harmony export ReactComponent */
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = function __defNormalProp(obj, key, value) {
return key in obj ? __defProp(obj, key, {
enumerable: true,
configurable: true,
writable: true,
value: value
}) : obj[key] = value;
};
var __spreadValues = function __spreadValues(a, b) {
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols) {
var _iterator = _createForOfIteratorHelper(__getOwnPropSymbols(b)),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var prop = _step.value;
if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
}
return a;
};
var SvgShengxu = function SvgShengxu(props) {
return /* @__PURE__ */React.createElement("svg", __spreadValues({
className: "shengxu_svg__icon",
viewBox: "0 0 1024 1024",
xmlns: "http://www.w3.org/2000/svg",
width: 32,
height: 32
}, props), /* @__PURE__ */React.createElement("path", {
d: "M365.714 73.143H1024v73.143H365.714zm0 292.571H1024v73.143H365.714zm0 292.572H1024v73.143H365.714zm0 292.571H1024V1024H365.714v-73.143zM248.686 803.182l-65.829 75.922V658.286h-73.143v220.818l-65.828-75.995L0 851.383 146.286 1024 292.57 851.53z",
fill: "#98BDF7"
}), /* @__PURE__ */React.createElement("path", {
d: "M146.286 0 0 158.72l43.886 55.223 65.828-75.922v227.693h73.143V138.021l65.829 75.922 43.885-55.223z",
fill: "#145DFF"
}));
};
/* harmony default export */ __webpack_exports__.Z = ("data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMzIiIGhlaWdodD0iMzIiPjxwYXRoIGQ9Ik0zNjUuNzE0IDczLjE0M0gxMDI0djczLjE0M0gzNjUuNzE0em0wIDI5Mi41NzFIMTAyNHY3My4xNDNIMzY1LjcxNHptMCAyOTIuNTcySDEwMjR2NzMuMTQzSDM2NS43MTR6bTAgMjkyLjU3MUgxMDI0VjEwMjRIMzY1LjcxNHYtNzMuMTQzek0yNDguNjg2IDgwMy4xODJsLTY1LjgyOSA3NS45MjJWNjU4LjI4NmgtNzMuMTQzdjIyMC44MThsLTY1LjgyOC03NS45OTVMMCA4NTEuMzgzIDE0Ni4yODYgMTAyNCAyOTIuNTcgODUxLjUzeiIgZmlsbD0iIzk4QkRGNyIvPjxwYXRoIGQ9Ik0xNDYuMjg2IDAgMCAxNTguNzJsNDMuODg2IDU1LjIyMyA2NS44MjgtNzUuOTIydjIyNy42OTNoNzMuMTQzVjEzOC4wMjFsNjUuODI5IDc1LjkyMiA0My44ODUtNTUuMjIzeiIgZmlsbD0iIzE0NURGRiIvPjwvc3ZnPg==");
/***/ }),
/***/ 19804:
/*!*******************************************************!*\
!*** ./src/pages/Paperlibrary/Add/index.less?modules ***!
\*******************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__) {
// extracted by mini-css-extract-plugin
/* harmony default export */ __webpack_exports__.Z = ({"flex_box_center":"flex_box_center___ycN2f","flex_space_between":"flex_space_between___LcS9e","flex_box_vertical_center":"flex_box_vertical_center___uwjPm","flex_box_center_end":"flex_box_center_end___Pc903","flex_box_column":"flex_box_column___AXEdv","bg":"bg___fm2Cw","title":"title___J3MCU","editIcon":"editIcon___i4Zll","titleLeft":"titleLeft___da61c","titleRight":"titleRight___EsdL6","formWrap":"formWrap___YTxC3","baseLineHeight":"baseLineHeight___TprCB","radioBtnWrapper":"radioBtnWrapper___Mt_XG","radiogroup":"radiogroup___EvkWh","easy":"easy___mSxtg","medium":"medium___NIaWN","hard":"hard___mddnD","baseFormItem":"baseFormItem___csbyb","cascaderPopup":"cascaderPopup___BttnF","selectdiv":"selectdiv___TAr4i","divitem":"divitem___iaXB2","bottmodiv":"bottmodiv___bmp6p","cancelBtn":"cancelBtn___Q4ZcL","confirmBtn":"confirmBtn___nRiCD"});
/***/ }),
/***/ 27666:
/*!****************************************************************************!*\
!*** ./node_modules/_antd@5.9.0@antd/es/_util/throttleByAnimationFrame.js ***!
\****************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony import */ var _babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/toConsumableArray */ 45112);
/* harmony import */ var rc_util_es_raf__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rc-util/es/raf */ 91659);
function throttleByAnimationFrame(fn) {
let requestId;
const later = args => () => {
requestId = null;
fn.apply(void 0, (0,_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(args));
};
const throttled = function () {
if (requestId == null) {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
requestId = (0,rc_util_es_raf__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(later(args));
}
};
throttled.cancel = () => {
rc_util_es_raf__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.cancel(requestId);
requestId = null;
};
return throttled;
}
/* harmony default export */ __webpack_exports__.Z = (throttleByAnimationFrame);
/***/ }),
/***/ 81228:
/*!*********************************************************************!*\
!*** ./node_modules/_antd@5.9.0@antd/es/affix/index.js + 2 modules ***!
\*********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ affix; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.24.1@@babel/runtime/helpers/esm/classCallCheck.js
var classCallCheck = __webpack_require__(94464);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.24.1@@babel/runtime/helpers/esm/createClass.js
var createClass = __webpack_require__(52653);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.24.1@@babel/runtime/helpers/esm/inherits.js
var inherits = __webpack_require__(562);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.24.1@@babel/runtime/helpers/esm/createSuper.js + 1 modules
var createSuper = __webpack_require__(90520);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./node_modules/_classnames@2.5.1@classnames/index.js
var _classnames_2_5_1_classnames = __webpack_require__(92310);
var _classnames_2_5_1_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_5_1_classnames);
// EXTERNAL MODULE: ./node_modules/_rc-resize-observer@1.4.0@rc-resize-observer/es/index.js + 4 modules
var es = __webpack_require__(28647);
// EXTERNAL MODULE: ./node_modules/_rc-util@5.39.1@rc-util/es/omit.js
var omit = __webpack_require__(62805);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/_util/throttleByAnimationFrame.js
var throttleByAnimationFrame = __webpack_require__(27666);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/context.js
var context = __webpack_require__(36355);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/genComponentStyleHook.js
var genComponentStyleHook = __webpack_require__(83116);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/statistic.js
var statistic = __webpack_require__(37613);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/affix/style/index.js
// ============================== Shared ==============================
const genSharedAffixStyle = token => {
const {
componentCls
} = token;
return {
[componentCls]: {
position: 'fixed',
zIndex: token.zIndexPopup
}
};
};
// ============================== Export ==============================
/* harmony default export */ var style = ((0,genComponentStyleHook/* default */.Z)('Affix', token => {
const affixToken = (0,statistic/* merge */.TS)(token, {
zIndexPopup: token.zIndexBase + 10
});
return [genSharedAffixStyle(affixToken)];
}));
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/affix/utils.js
function getTargetRect(target) {
return target !== window ? target.getBoundingClientRect() : {
top: 0,
bottom: window.innerHeight
};
}
function getFixedTop(placeholderRect, targetRect, offsetTop) {
if (offsetTop !== undefined && targetRect.top > placeholderRect.top - offsetTop) {
return offsetTop + targetRect.top;
}
return undefined;
}
function getFixedBottom(placeholderRect, targetRect, offsetBottom) {
if (offsetBottom !== undefined && targetRect.bottom < placeholderRect.bottom + offsetBottom) {
const targetBottomOffset = window.innerHeight - targetRect.bottom;
return offsetBottom + targetBottomOffset;
}
return undefined;
}
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/affix/index.js
"use client";
const TRIGGER_EVENTS = ['resize', 'scroll', 'touchstart', 'touchmove', 'touchend', 'pageshow', 'load'];
function getDefaultTarget() {
return typeof window !== 'undefined' ? window : null;
}
var AffixStatus;
(function (AffixStatus) {
AffixStatus[AffixStatus["None"] = 0] = "None";
AffixStatus[AffixStatus["Prepare"] = 1] = "Prepare";
})(AffixStatus || (AffixStatus = {}));
let InternalAffix = /*#__PURE__*/function (_React$Component) {
(0,inherits/* default */.Z)(InternalAffix, _React$Component);
var _super = (0,createSuper/* default */.Z)(InternalAffix);
function InternalAffix() {
var _this;
(0,classCallCheck/* default */.Z)(this, InternalAffix);
_this = _super.apply(this, arguments);
_this.state = {
status: AffixStatus.None,
lastAffix: false,
prevTarget: null
};
_this.placeholderNodeRef = /*#__PURE__*/(0,_react_17_0_2_react.createRef)();
_this.fixedNodeRef = /*#__PURE__*/(0,_react_17_0_2_react.createRef)();
_this.addListeners = () => {
const targetFunc = _this.getTargetFunc();
const target = targetFunc === null || targetFunc === void 0 ? void 0 : targetFunc();
const {
prevTarget
} = _this.state;
if (prevTarget !== target) {
TRIGGER_EVENTS.forEach(eventName => {
prevTarget === null || prevTarget === void 0 ? void 0 : prevTarget.removeEventListener(eventName, _this.lazyUpdatePosition);
target === null || target === void 0 ? void 0 : target.addEventListener(eventName, _this.lazyUpdatePosition);
});
_this.updatePosition();
_this.setState({
prevTarget: target
});
}
};
_this.removeListeners = () => {
if (_this.timer) {
clearTimeout(_this.timer);
_this.timer = null;
}
const {
prevTarget
} = _this.state;
const targetFunc = _this.getTargetFunc();
const newTarget = targetFunc === null || targetFunc === void 0 ? void 0 : targetFunc();
TRIGGER_EVENTS.forEach(eventName => {
newTarget === null || newTarget === void 0 ? void 0 : newTarget.removeEventListener(eventName, _this.lazyUpdatePosition);
prevTarget === null || prevTarget === void 0 ? void 0 : prevTarget.removeEventListener(eventName, _this.lazyUpdatePosition);
});
_this.updatePosition.cancel();
// https://github.com/ant-design/ant-design/issues/22683
_this.lazyUpdatePosition.cancel();
};
_this.getOffsetTop = () => {
const {
offsetBottom,
offsetTop
} = _this.props;
return offsetBottom === undefined && offsetTop === undefined ? 0 : offsetTop;
};
_this.getOffsetBottom = () => _this.props.offsetBottom;
// =================== Measure ===================
_this.measure = () => {
const {
status,
lastAffix
} = _this.state;
const {
onChange
} = _this.props;
const targetFunc = _this.getTargetFunc();
if (status !== AffixStatus.Prepare || !_this.fixedNodeRef.current || !_this.placeholderNodeRef.current || !targetFunc) {
return;
}
const offsetTop = _this.getOffsetTop();
const offsetBottom = _this.getOffsetBottom();
const targetNode = targetFunc();
if (targetNode) {
const newState = {
status: AffixStatus.None
};
const placeholderRect = getTargetRect(_this.placeholderNodeRef.current);
if (placeholderRect.top === 0 && placeholderRect.left === 0 && placeholderRect.width === 0 && placeholderRect.height === 0) {
return;
}
const targetRect = getTargetRect(targetNode);
const fixedTop = getFixedTop(placeholderRect, targetRect, offsetTop);
const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom);
if (fixedTop !== undefined) {
newState.affixStyle = {
position: 'fixed',
top: fixedTop,
width: placeholderRect.width,
height: placeholderRect.height
};
newState.placeholderStyle = {
width: placeholderRect.width,
height: placeholderRect.height
};
} else if (fixedBottom !== undefined) {
newState.affixStyle = {
position: 'fixed',
bottom: fixedBottom,
width: placeholderRect.width,
height: placeholderRect.height
};
newState.placeholderStyle = {
width: placeholderRect.width,
height: placeholderRect.height
};
}
newState.lastAffix = !!newState.affixStyle;
if (onChange && lastAffix !== newState.lastAffix) {
onChange(newState.lastAffix);
}
_this.setState(newState);
}
};
_this.prepareMeasure = () => {
// event param is used before. Keep compatible ts define here.
_this.setState({
status: AffixStatus.Prepare,
affixStyle: undefined,
placeholderStyle: undefined
});
// Test if `updatePosition` called
if (false) {}
};
_this.updatePosition = (0,throttleByAnimationFrame/* default */.Z)(() => {
_this.prepareMeasure();
});
_this.lazyUpdatePosition = (0,throttleByAnimationFrame/* default */.Z)(() => {
const targetFunc = _this.getTargetFunc();
const {
affixStyle
} = _this.state;
// Check position change before measure to make Safari smooth
if (targetFunc && affixStyle) {
const offsetTop = _this.getOffsetTop();
const offsetBottom = _this.getOffsetBottom();
const targetNode = targetFunc();
if (targetNode && _this.placeholderNodeRef.current) {
const targetRect = getTargetRect(targetNode);
const placeholderRect = getTargetRect(_this.placeholderNodeRef.current);
const fixedTop = getFixedTop(placeholderRect, targetRect, offsetTop);
const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom);
if (fixedTop !== undefined && affixStyle.top === fixedTop || fixedBottom !== undefined && affixStyle.bottom === fixedBottom) {
return;
}
}
}
// Directly call prepare measure since it's already throttled.
_this.prepareMeasure();
});
return _this;
}
(0,createClass/* default */.Z)(InternalAffix, [{
key: "getTargetFunc",
value: function getTargetFunc() {
const {
getTargetContainer
} = this.context;
const {
target
} = this.props;
if (target !== undefined) {
return target;
}
return getTargetContainer !== null && getTargetContainer !== void 0 ? getTargetContainer : getDefaultTarget;
}
// Event handler
}, {
key: "componentDidMount",
value: function componentDidMount() {
// [Legacy] Wait for parent component ref has its value.
// We should use target as directly element instead of function which makes element check hard.
this.timer = setTimeout(this.addListeners);
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
this.addListeners();
if (prevProps.offsetTop !== this.props.offsetTop || prevProps.offsetBottom !== this.props.offsetBottom) {
this.updatePosition();
}
this.measure();
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this.removeListeners();
}
// =================== Render ===================
}, {
key: "render",
value: function render() {
const {
affixStyle,
placeholderStyle
} = this.state;
const {
affixPrefixCls,
rootClassName,
children
} = this.props;
const className = _classnames_2_5_1_classnames_default()(affixStyle && rootClassName, {
[affixPrefixCls]: !!affixStyle
});
let props = (0,omit/* default */.Z)(this.props, ['prefixCls', 'offsetTop', 'offsetBottom', 'target', 'onChange', 'affixPrefixCls', 'rootClassName']);
// Omit this since `onTestUpdatePosition` only works on test.
if (false) {}
return /*#__PURE__*/_react_17_0_2_react.createElement(es/* default */.Z, {
onResize: this.updatePosition
}, /*#__PURE__*/_react_17_0_2_react.createElement("div", Object.assign({}, props, {
ref: this.placeholderNodeRef
}), affixStyle && /*#__PURE__*/_react_17_0_2_react.createElement("div", {
style: placeholderStyle,
"aria-hidden": "true"
}), /*#__PURE__*/_react_17_0_2_react.createElement("div", {
className: className,
ref: this.fixedNodeRef,
style: affixStyle
}, /*#__PURE__*/_react_17_0_2_react.createElement(es/* default */.Z, {
onResize: this.updatePosition
}, children))));
}
}]);
return InternalAffix;
}(_react_17_0_2_react.Component);
InternalAffix.contextType = context/* ConfigContext */.E_;
const Affix = /*#__PURE__*/(0,_react_17_0_2_react.forwardRef)((props, ref) => {
const {
prefixCls: customizePrefixCls,
rootClassName
} = props;
const {
getPrefixCls
} = (0,_react_17_0_2_react.useContext)(context/* ConfigContext */.E_);
const affixPrefixCls = getPrefixCls('affix', customizePrefixCls);
const [wrapSSR, hashId] = style(affixPrefixCls);
const AffixProps = Object.assign(Object.assign({}, props), {
affixPrefixCls,
rootClassName: _classnames_2_5_1_classnames_default()(rootClassName, hashId)
});
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement(InternalAffix, Object.assign({}, AffixProps, {
ref: ref
})));
});
if (false) {}
/* harmony default export */ var affix = (Affix);
/***/ }),
/***/ 66104:
/*!**************************************************************************!*\
!*** ./node_modules/_antd@5.9.0@antd/es/breadcrumb/index.js + 6 modules ***!
\**************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ breadcrumb; }
});
// EXTERNAL MODULE: ./node_modules/_classnames@2.5.1@classnames/index.js
var _classnames_2_5_1_classnames = __webpack_require__(92310);
var _classnames_2_5_1_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_5_1_classnames);
// EXTERNAL MODULE: ./node_modules/_rc-util@5.39.1@rc-util/es/Children/toArray.js
var toArray = __webpack_require__(47783);
// EXTERNAL MODULE: ./node_modules/_rc-util@5.39.1@rc-util/es/pickAttrs.js
var pickAttrs = __webpack_require__(90339);
// 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/_util/reactNode.js
var reactNode = __webpack_require__(92343);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/context.js
var context = __webpack_require__(36355);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.5@@ant-design/icons/es/icons/DownOutlined.js + 1 modules
var DownOutlined = __webpack_require__(42137);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/dropdown/dropdown.js
var dropdown = __webpack_require__(91857);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/breadcrumb/BreadcrumbSeparator.js
"use client";
const BreadcrumbSeparator = _ref => {
let {
children
} = _ref;
const {
getPrefixCls
} = _react_17_0_2_react.useContext(context/* ConfigContext */.E_);
const prefixCls = getPrefixCls('breadcrumb');
return /*#__PURE__*/_react_17_0_2_react.createElement("li", {
className: `${prefixCls}-separator`,
"aria-hidden": "true"
}, children === '' ? children : children || '/');
};
BreadcrumbSeparator.__ANT_BREADCRUMB_SEPARATOR = true;
/* harmony default export */ var breadcrumb_BreadcrumbSeparator = (BreadcrumbSeparator);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/breadcrumb/useItemRender.js
"use client";
var __rest = undefined && undefined.__rest || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function getBreadcrumbName(route, params) {
if (route.title === undefined || route.title === null) {
return null;
}
const paramsKeys = Object.keys(params).join('|');
return typeof route.title === 'object' ? route.title : String(route.title).replace(new RegExp(`:(${paramsKeys})`, 'g'), (replacement, key) => params[key] || replacement);
}
function renderItem(prefixCls, item, children, href) {
if (children === null || children === undefined) {
return null;
}
const {
className,
onClick
} = item,
restItem = __rest(item, ["className", "onClick"]);
const passedProps = Object.assign(Object.assign({}, (0,pickAttrs/* default */.Z)(restItem, {
data: true,
aria: true
})), {
onClick
});
if (href !== undefined) {
return /*#__PURE__*/_react_17_0_2_react.createElement("a", Object.assign({}, passedProps, {
className: _classnames_2_5_1_classnames_default()(`${prefixCls}-link`, className),
href: href
}), children);
}
return /*#__PURE__*/_react_17_0_2_react.createElement("span", Object.assign({}, passedProps, {
className: _classnames_2_5_1_classnames_default()(`${prefixCls}-link`, className)
}), children);
}
function useItemRender(prefixCls, itemRender) {
const mergedItemRender = (item, params, routes, path, href) => {
if (itemRender) {
return itemRender(item, params, routes, path);
}
const name = getBreadcrumbName(item, params);
return renderItem(prefixCls, item, name, href);
};
return mergedItemRender;
}
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/breadcrumb/BreadcrumbItem.js
"use client";
var BreadcrumbItem_rest = undefined && undefined.__rest || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const InternalBreadcrumbItem = props => {
const {
prefixCls,
separator = '/',
children,
menu,
overlay,
dropdownProps,
href
} = props;
// Warning for deprecated usage
if (false) {}
/** If overlay is have Wrap a Dropdown */
const renderBreadcrumbNode = breadcrumbItem => {
if (menu || overlay) {
const mergeDropDownProps = Object.assign({}, dropdownProps);
if (menu) {
const _a = menu || {},
{
items
} = _a,
menuProps = BreadcrumbItem_rest(_a, ["items"]);
mergeDropDownProps.menu = Object.assign(Object.assign({}, menuProps), {
items: items === null || items === void 0 ? void 0 : items.map((_a, index) => {
var {
key,
title,
label,
path
} = _a,
itemProps = BreadcrumbItem_rest(_a, ["key", "title", "label", "path"]);
let mergedLabel = label !== null && label !== void 0 ? label : title;
if (path) {
mergedLabel = /*#__PURE__*/_react_17_0_2_react.createElement("a", {
href: `${href}${path}`
}, mergedLabel);
}
return Object.assign(Object.assign({}, itemProps), {
key: key !== null && key !== void 0 ? key : index,
label: mergedLabel
});
})
});
} else if (overlay) {
mergeDropDownProps.overlay = overlay;
}
return /*#__PURE__*/_react_17_0_2_react.createElement(dropdown/* default */.Z, Object.assign({
placement: "bottom"
}, mergeDropDownProps), /*#__PURE__*/_react_17_0_2_react.createElement("span", {
className: `${prefixCls}-overlay-link`
}, breadcrumbItem, /*#__PURE__*/_react_17_0_2_react.createElement(DownOutlined/* default */.Z, null)));
}
return breadcrumbItem;
};
// wrap to dropDown
const link = renderBreadcrumbNode(children);
if (link !== undefined && link !== null) {
return /*#__PURE__*/_react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /*#__PURE__*/_react_17_0_2_react.createElement("li", null, link), separator && /*#__PURE__*/_react_17_0_2_react.createElement(breadcrumb_BreadcrumbSeparator, null, separator));
}
return null;
};
const BreadcrumbItem = props => {
const {
prefixCls: customizePrefixCls,
children,
href
} = props,
restProps = BreadcrumbItem_rest(props, ["prefixCls", "children", "href"]);
const {
getPrefixCls
} = _react_17_0_2_react.useContext(context/* ConfigContext */.E_);
const prefixCls = getPrefixCls('breadcrumb', customizePrefixCls);
return /*#__PURE__*/_react_17_0_2_react.createElement(InternalBreadcrumbItem, Object.assign({}, restProps, {
prefixCls: prefixCls
}), renderItem(prefixCls, restProps, children, href));
};
BreadcrumbItem.__ANT_BREADCRUMB_ITEM = true;
/* harmony default export */ var breadcrumb_BreadcrumbItem = (BreadcrumbItem);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/style/index.js
var style = __webpack_require__(87832);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/genComponentStyleHook.js
var genComponentStyleHook = __webpack_require__(83116);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/statistic.js
var statistic = __webpack_require__(37613);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/breadcrumb/style/index.js
const genBreadcrumbStyle = token => {
const {
componentCls,
iconCls
} = token;
return {
[componentCls]: Object.assign(Object.assign({}, (0,style/* resetComponent */.Wf)(token)), {
color: token.itemColor,
fontSize: token.fontSize,
[iconCls]: {
fontSize: token.iconFontSize
},
ol: {
display: 'flex',
flexWrap: 'wrap',
margin: 0,
padding: 0,
listStyle: 'none'
},
a: Object.assign({
color: token.linkColor,
transition: `color ${token.motionDurationMid}`,
padding: `0 ${token.paddingXXS}px`,
borderRadius: token.borderRadiusSM,
height: token.lineHeight * token.fontSize,
display: 'inline-block',
marginInline: -token.marginXXS,
'&:hover': {
color: token.linkHoverColor,
backgroundColor: token.colorBgTextHover
}
}, (0,style/* genFocusStyle */.Qy)(token)),
[`li:last-child`]: {
color: token.lastItemColor
},
[`${componentCls}-separator`]: {
marginInline: token.separatorMargin,
color: token.separatorColor
},
[`${componentCls}-link`]: {
[`
> ${iconCls} + span,
> ${iconCls} + a
`]: {
marginInlineStart: token.marginXXS
}
},
[`${componentCls}-overlay-link`]: {
borderRadius: token.borderRadiusSM,
height: token.lineHeight * token.fontSize,
display: 'inline-block',
padding: `0 ${token.paddingXXS}px`,
marginInline: -token.marginXXS,
[`> ${iconCls}`]: {
marginInlineStart: token.marginXXS,
fontSize: token.fontSizeIcon
},
'&:hover': {
color: token.linkHoverColor,
backgroundColor: token.colorBgTextHover,
a: {
color: token.linkHoverColor
}
},
a: {
'&:hover': {
backgroundColor: 'transparent'
}
}
},
// rtl style
[`&${token.componentCls}-rtl`]: {
direction: 'rtl'
}
})
};
};
// ============================== Export ==============================
/* harmony default export */ var breadcrumb_style = ((0,genComponentStyleHook/* default */.Z)('Breadcrumb', token => {
const BreadcrumbToken = (0,statistic/* merge */.TS)(token, {});
return [genBreadcrumbStyle(BreadcrumbToken)];
}, token => ({
itemColor: token.colorTextDescription,
lastItemColor: token.colorText,
iconFontSize: token.fontSize,
linkColor: token.colorTextDescription,
linkHoverColor: token.colorText,
separatorColor: token.colorTextDescription,
separatorMargin: token.marginXS
})));
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/breadcrumb/useItems.js
var useItems_rest = undefined && undefined.__rest || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function route2item(route) {
const {
breadcrumbName,
children
} = route,
rest = useItems_rest(route, ["breadcrumbName", "children"]);
const clone = Object.assign({
title: breadcrumbName
}, rest);
if (children) {
clone.menu = {
items: children.map(_a => {
var {
breadcrumbName: itemBreadcrumbName
} = _a,
itemProps = useItems_rest(_a, ["breadcrumbName"]);
return Object.assign(Object.assign({}, itemProps), {
title: itemBreadcrumbName
});
})
};
}
return clone;
}
function useItems(items, routes) {
return (0,_react_17_0_2_react.useMemo)(() => {
if (items) {
return items;
}
if (routes) {
return routes.map(route2item);
}
return null;
}, [items, routes]);
}
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/breadcrumb/Breadcrumb.js
"use client";
var Breadcrumb_rest = undefined && undefined.__rest || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const getPath = (params, path) => {
if (path === undefined) {
return path;
}
let mergedPath = (path || '').replace(/^\//, '');
Object.keys(params).forEach(key => {
mergedPath = mergedPath.replace(`:${key}`, params[key]);
});
return mergedPath;
};
const Breadcrumb = props => {
const {
prefixCls: customizePrefixCls,
separator = '/',
style,
className,
rootClassName,
routes: legacyRoutes,
items,
children,
itemRender,
params = {}
} = props,
restProps = Breadcrumb_rest(props, ["prefixCls", "separator", "style", "className", "rootClassName", "routes", "items", "children", "itemRender", "params"]);
const {
getPrefixCls,
direction,
breadcrumb
} = _react_17_0_2_react.useContext(context/* ConfigContext */.E_);
let crumbs;
const prefixCls = getPrefixCls('breadcrumb', customizePrefixCls);
const [wrapSSR, hashId] = breadcrumb_style(prefixCls);
const mergedItems = useItems(items, legacyRoutes);
if (false) {}
const mergedItemRender = useItemRender(prefixCls, itemRender);
if (mergedItems && mergedItems.length > 0) {
// generated by route
const paths = [];
const itemRenderRoutes = items || legacyRoutes;
crumbs = mergedItems.map((item, index) => {
const {
path,
key,
type,
menu,
overlay,
onClick,
className: itemClassName,
separator: itemSeparator,
dropdownProps
} = item;
const mergedPath = getPath(params, path);
if (mergedPath !== undefined) {
paths.push(mergedPath);
}
const mergedKey = key !== null && key !== void 0 ? key : index;
if (type === 'separator') {
return /*#__PURE__*/_react_17_0_2_react.createElement(breadcrumb_BreadcrumbSeparator, {
key: mergedKey
}, itemSeparator);
}
const itemProps = {};
const isLastItem = index === mergedItems.length - 1;
if (menu) {
itemProps.menu = menu;
} else if (overlay) {
itemProps.overlay = overlay;
}
let {
href
} = item;
if (paths.length && mergedPath !== undefined) {
href = `#/${paths.join('/')}`;
}
return /*#__PURE__*/_react_17_0_2_react.createElement(InternalBreadcrumbItem, Object.assign({
key: mergedKey
}, itemProps, (0,pickAttrs/* default */.Z)(item, {
data: true,
aria: true
}), {
className: itemClassName,
dropdownProps: dropdownProps,
href: href,
separator: isLastItem ? '' : separator,
onClick: onClick,
prefixCls: prefixCls
}), mergedItemRender(item, params, itemRenderRoutes, paths, href));
});
} else if (children) {
const childrenLength = (0,toArray/* default */.Z)(children).length;
crumbs = (0,toArray/* default */.Z)(children).map((element, index) => {
if (!element) {
return element;
}
// =================== Warning =====================
if (false) {}
false ? 0 : void 0;
const isLastItem = index === childrenLength - 1;
return (0,reactNode/* cloneElement */.Tm)(element, {
separator: isLastItem ? '' : separator,
key: index
});
});
}
const breadcrumbClassName = _classnames_2_5_1_classnames_default()(prefixCls, breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.className, {
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, rootClassName, hashId);
const mergedStyle = Object.assign(Object.assign({}, breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.style), style);
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement("nav", Object.assign({
className: breadcrumbClassName,
style: mergedStyle
}, restProps), /*#__PURE__*/_react_17_0_2_react.createElement("ol", null, crumbs)));
};
Breadcrumb.Item = breadcrumb_BreadcrumbItem;
Breadcrumb.Separator = breadcrumb_BreadcrumbSeparator;
if (false) {}
/* harmony default export */ var breadcrumb_Breadcrumb = (Breadcrumb);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/breadcrumb/index.js
"use client";
/* harmony default export */ var breadcrumb = (breadcrumb_Breadcrumb);
/***/ }),
/***/ 60028:
/*!**********************************************************!*\
!*** ./node_modules/_antd@5.9.0@antd/es/upload/index.js ***!
\**********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony import */ var _Dragger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Dragger */ 71409);
/* harmony import */ var _Upload__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Upload */ 38883);
"use client";
const Upload = _Upload__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z;
Upload.Dragger = _Dragger__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z;
Upload.LIST_IGNORE = _Upload__WEBPACK_IMPORTED_MODULE_0__/* .LIST_IGNORE */ .E;
/* harmony default export */ __webpack_exports__.Z = (Upload);
/***/ })
}]);