|
|
"use strict";
|
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[75816],{
|
|
|
|
|
|
/***/ 63674:
|
|
|
/*!*******************************************************************!*\
|
|
|
!*** ./src/pages/Paperlibrary/Random/Edit/index.tsx + 29 modules ***!
|
|
|
\*******************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// ESM COMPAT FLAG
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"default": function() { return /* binding */ Edit; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/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/_react@17.0.2@react/index.js
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var Editmodules = ({"wrapper":"wrapper___KtBVT","breadCrumbWrapper":"breadCrumbWrapper___k9tSB","baseInfo":"baseInfo____j5EY","radioBtnWrapper":"radioBtnWrapper___k9OCh","radiogroup":"radiogroup___e2fW6","easy":"easy___WcUAp","medium":"medium___U_o3j","hard":"hard___dAXLS","fixedBottom":"fixedBottom___liDZ4","cancelBtn":"cancelBtn___ZV9Mi","confirmBtn":"confirmBtn___DwH6m","previewBtn":"previewBtn___aLYCy"});
|
|
|
// 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/form/index.js + 19 modules
|
|
|
var es_form = __webpack_require__(78241);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/breadcrumb/index.js + 6 modules
|
|
|
var breadcrumb = __webpack_require__(66104);
|
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 15 modules
|
|
|
var _umi_production_exports = __webpack_require__(8931);
|
|
|
;// CONCATENATED MODULE: ./src/components/ExerciseComponents/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var ExerciseComponentsmodules = ({"digitalLabel":"digitalLabel___hkWuZ","active":"active___jawU1","titleEditor":"titleEditor___wX1lW","title":"title___SuT2h","editIcon":"editIcon___XrTIi","paperTab":"paperTab___GUxeB","tabItem":"tabItem___or0fY","dottedLine":"dottedLine___Ln0Xr"});
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/components/ExerciseComponents/DigitalLabel.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(ExerciseComponentsmodules.digitalLabel, " ").concat(active ? ExerciseComponentsmodules.active : '', " ").concat(className),
|
|
|
children: number
|
|
|
});
|
|
|
};
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tooltip/index.js + 3 modules
|
|
|
var tooltip = __webpack_require__(6848);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
|
|
|
var input = __webpack_require__(20008);
|
|
|
;// CONCATENATED MODULE: ./src/components/ExerciseComponents/TitleEditor.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TitleEditor = function TitleEditor(_ref) {
|
|
|
var defaultValue = _ref.defaultValue,
|
|
|
onFinish = _ref.onFinish;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
isEdit = _useState2[0],
|
|
|
setIsEdit = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(defaultValue),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
value = _useState4[0],
|
|
|
setValue = _useState4[1];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
setValue(defaultValue);
|
|
|
}, [defaultValue]);
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: ExerciseComponentsmodules.titleEditor,
|
|
|
children: !isEdit ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ExerciseComponentsmodules.title,
|
|
|
onDoubleClick: function onDoubleClick() {
|
|
|
return setIsEdit(true);
|
|
|
},
|
|
|
children: [value, /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u70B9\u51FB\u7F16\u8F91\u8BD5\u5377\u540D\u79F0",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "".concat(ExerciseComponentsmodules.editIcon, " iconfont icon-bianji_Hover"),
|
|
|
onClick: function onClick() {
|
|
|
return setIsEdit(true);
|
|
|
}
|
|
|
})
|
|
|
})]
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(input/* 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__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var _value$replaceAll;
|
|
|
var flag;
|
|
|
return regeneratorRuntime_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;
|
|
|
}
|
|
|
message/* 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__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
var _value$replaceAll2;
|
|
|
var flag;
|
|
|
return regeneratorRuntime_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;
|
|
|
}
|
|
|
message/* 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);
|
|
|
}))
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
|
|
|
// 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);
|
|
|
;// CONCATENATED MODULE: ./src/components/ExerciseComponents/PaperTab.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var PaperTab = function PaperTab(_ref) {
|
|
|
var _tabs$, _tabs$2, _tabs$4, _tabs$5, _tabs$6, _tabs$9, _tabs$10;
|
|
|
var _ref$onChange = _ref.onChange,
|
|
|
onChange = _ref$onChange === void 0 ? /*#__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:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
})) : _ref$onChange,
|
|
|
tabs = _ref.tabs,
|
|
|
activeKey = _ref.activeKey,
|
|
|
defaultActiveKey = _ref.defaultActiveKey,
|
|
|
_ref$className = _ref.className,
|
|
|
className = _ref$className === void 0 ? '' : _ref$className;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(defaultActiveKey === undefined ? (_tabs$ = tabs[0]) === null || _tabs$ === void 0 ? void 0 : _tabs$.key : defaultActiveKey),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
innerActiveKey = _useState2[0],
|
|
|
setInnerActiveKey = _useState2[1];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (activeKey !== undefined) {
|
|
|
setInnerActiveKey(activeKey);
|
|
|
}
|
|
|
}, [activeKey]);
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "center",
|
|
|
align: "middle",
|
|
|
className: "".concat(ExerciseComponentsmodules.paperTab, " ").concat(className),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: "".concat(ExerciseComponentsmodules.tabItem, " ").concat(innerActiveKey === ((_tabs$2 = tabs[0]) === null || _tabs$2 === void 0 ? void 0 : _tabs$2.key) ? ExerciseComponentsmodules.active : ''),
|
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
var _tabs$3;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.next = 2;
|
|
|
return onChange(tabs[0].key);
|
|
|
case 2:
|
|
|
setInnerActiveKey((_tabs$3 = tabs[0]) === null || _tabs$3 === void 0 ? void 0 : _tabs$3.key);
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
})),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(DigitalLabel, {
|
|
|
number: 1,
|
|
|
active: innerActiveKey === ((_tabs$4 = tabs[0]) === null || _tabs$4 === void 0 ? void 0 : _tabs$4.key),
|
|
|
className: "mr10"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: (_tabs$5 = tabs[0]) === null || _tabs$5 === void 0 ? void 0 : _tabs$5.label
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "188px",
|
|
|
className: "".concat(ExerciseComponentsmodules.dottedLine, " ml30 mr30")
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: "".concat(ExerciseComponentsmodules.tabItem, " ").concat(innerActiveKey === ((_tabs$6 = tabs[1]) === null || _tabs$6 === void 0 ? void 0 : _tabs$6.key) ? ExerciseComponentsmodules.active : ''),
|
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
|
|
var _tabs$7, _tabs$8;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
_context3.next = 2;
|
|
|
return onChange((_tabs$7 = tabs[1]) === null || _tabs$7 === void 0 ? void 0 : _tabs$7.key);
|
|
|
case 2:
|
|
|
setInnerActiveKey((_tabs$8 = tabs[1]) === null || _tabs$8 === void 0 ? void 0 : _tabs$8.key);
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
})),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(DigitalLabel, {
|
|
|
number: 2,
|
|
|
active: innerActiveKey === ((_tabs$9 = tabs[1]) === null || _tabs$9 === void 0 ? void 0 : _tabs$9.key),
|
|
|
className: "mr10"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: (_tabs$10 = tabs[1]) === null || _tabs$10 === void 0 ? void 0 : _tabs$10.label
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
|
|
|
;// CONCATENATED MODULE: ./src/components/ExerciseComponents/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
// 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/spin/index.js + 1 modules
|
|
|
var spin = __webpack_require__(71418);
|
|
|
// 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__(96971);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(3113);
|
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
|
var fetch = __webpack_require__(14735);
|
|
|
;// CONCATENATED MODULE: ./src/service/randomPaper/index.ts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getRandomExam(_x) {
|
|
|
return _getRandomExam.apply(this, arguments);
|
|
|
}
|
|
|
function _getRandomExam() {
|
|
|
_getRandomExam = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(id) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
return _context.abrupt("return", (0,fetch/* default */.ZP)("/api/examination_banks/".concat(id, "/edit_random_exam_new.json"), {
|
|
|
method: 'get'
|
|
|
}));
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return _getRandomExam.apply(this, arguments);
|
|
|
}
|
|
|
function updateRandomExam(_x2, _x3) {
|
|
|
return _updateRandomExam.apply(this, arguments);
|
|
|
}
|
|
|
function _updateRandomExam() {
|
|
|
_updateRandomExam = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(id, params) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
return _context2.abrupt("return", (0,fetch/* default */.ZP)("/api/examination_banks/".concat(id, "/update_random_exam.json"), {
|
|
|
method: 'post',
|
|
|
body: params
|
|
|
}));
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return _updateRandomExam.apply(this, arguments);
|
|
|
}
|
|
|
function createRandomExam(_x4) {
|
|
|
return _createRandomExam.apply(this, arguments);
|
|
|
}
|
|
|
function _createRandomExam() {
|
|
|
_createRandomExam = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(params) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
return _context3.abrupt("return", (0,fetch/* default */.ZP)("/api/examination_banks/create_random_exam.json", {
|
|
|
method: 'post',
|
|
|
body: params
|
|
|
}));
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return _createRandomExam.apply(this, arguments);
|
|
|
}
|
|
|
function getDisciplines(_x5) {
|
|
|
return _getDisciplines.apply(this, arguments);
|
|
|
}
|
|
|
function _getDisciplines() {
|
|
|
_getDisciplines = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4(params) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
return _context4.abrupt("return", (0,fetch/* default */.ZP)("/api/disciplines.json", {
|
|
|
method: 'get',
|
|
|
params: params
|
|
|
}));
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
return _getDisciplines.apply(this, arguments);
|
|
|
}
|
|
|
function getQuestionNum(_x6) {
|
|
|
return _getQuestionNum.apply(this, arguments);
|
|
|
}
|
|
|
function _getQuestionNum() {
|
|
|
_getQuestionNum = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5(params) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
|
|
|
while (1) switch (_context5.prev = _context5.next) {
|
|
|
case 0:
|
|
|
return _context5.abrupt("return", (0,fetch/* default */.ZP)("/api/item_banks/item_difficulty_count.json", {
|
|
|
method: 'get',
|
|
|
params: params
|
|
|
}));
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context5.stop();
|
|
|
}
|
|
|
}, _callee5);
|
|
|
}));
|
|
|
return _getQuestionNum.apply(this, arguments);
|
|
|
}
|
|
|
function setItemTypeScore(_x7, _x8) {
|
|
|
return _setItemTypeScore.apply(this, arguments);
|
|
|
}
|
|
|
function _setItemTypeScore() {
|
|
|
_setItemTypeScore = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6(id, params) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee6$(_context6) {
|
|
|
while (1) switch (_context6.prev = _context6.next) {
|
|
|
case 0:
|
|
|
return _context6.abrupt("return", (0,fetch/* default */.ZP)("/api/examination_banks/".concat(id, "/set_item_type_score.json"), {
|
|
|
method: 'post',
|
|
|
body: params
|
|
|
}));
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context6.stop();
|
|
|
}
|
|
|
}, _callee6);
|
|
|
}));
|
|
|
return _setItemTypeScore.apply(this, arguments);
|
|
|
}
|
|
|
function setItemTypeScores(_x9, _x10) {
|
|
|
return _setItemTypeScores.apply(this, arguments);
|
|
|
}
|
|
|
function _setItemTypeScores() {
|
|
|
_setItemTypeScores = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee7(id, params) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee7$(_context7) {
|
|
|
while (1) switch (_context7.prev = _context7.next) {
|
|
|
case 0:
|
|
|
return _context7.abrupt("return", (0,fetch/* default */.ZP)("/api/exercises/".concat(id, "/set_item_type_score.json"), {
|
|
|
method: 'post',
|
|
|
body: params
|
|
|
}));
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context7.stop();
|
|
|
}
|
|
|
}, _callee7);
|
|
|
}));
|
|
|
return _setItemTypeScores.apply(this, arguments);
|
|
|
}
|
|
|
function deleteItem(_x11, _x12) {
|
|
|
return _deleteItem.apply(this, arguments);
|
|
|
}
|
|
|
function _deleteItem() {
|
|
|
_deleteItem = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee8(id, params) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee8$(_context8) {
|
|
|
while (1) switch (_context8.prev = _context8.next) {
|
|
|
case 0:
|
|
|
return _context8.abrupt("return", (0,fetch/* default */.ZP)("/api/examination_banks/".concat(id, "/delete_item_type.json"), {
|
|
|
method: 'post',
|
|
|
body: params
|
|
|
}));
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context8.stop();
|
|
|
}
|
|
|
}, _callee8);
|
|
|
}));
|
|
|
return _deleteItem.apply(this, arguments);
|
|
|
}
|
|
|
function deletecourseItem(_x13, _x14) {
|
|
|
return _deletecourseItem.apply(this, arguments);
|
|
|
}
|
|
|
function _deletecourseItem() {
|
|
|
_deletecourseItem = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee9(id, params) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee9$(_context9) {
|
|
|
while (1) switch (_context9.prev = _context9.next) {
|
|
|
case 0:
|
|
|
return _context9.abrupt("return", (0,fetch/* default */.ZP)("/api/exercises/".concat(id, "/delete_item_type.json"), {
|
|
|
method: 'post',
|
|
|
body: params
|
|
|
}));
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context9.stop();
|
|
|
}
|
|
|
}, _callee9);
|
|
|
}));
|
|
|
return _deletecourseItem.apply(this, arguments);
|
|
|
}
|
|
|
function previewRandomPaper(_x15) {
|
|
|
return _previewRandomPaper.apply(this, arguments);
|
|
|
}
|
|
|
function _previewRandomPaper() {
|
|
|
_previewRandomPaper = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee10(params) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee10$(_context10) {
|
|
|
while (1) switch (_context10.prev = _context10.next) {
|
|
|
case 0:
|
|
|
return _context10.abrupt("return", (0,fetch/* default */.ZP)("/api/examination_banks/preview_random_questions.json", {
|
|
|
method: 'post',
|
|
|
body: params
|
|
|
}));
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context10.stop();
|
|
|
}
|
|
|
}, _callee10);
|
|
|
}));
|
|
|
return _previewRandomPaper.apply(this, arguments);
|
|
|
}
|
|
|
function toggleRandomQuestions(_x16) {
|
|
|
return _toggleRandomQuestions.apply(this, arguments);
|
|
|
}
|
|
|
function _toggleRandomQuestions() {
|
|
|
_toggleRandomQuestions = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee11(params) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee11$(_context11) {
|
|
|
while (1) switch (_context11.prev = _context11.next) {
|
|
|
case 0:
|
|
|
return _context11.abrupt("return", (0,fetch/* default */.ZP)('/api/examination_banks/toggle_random_questions.json', {
|
|
|
method: 'post',
|
|
|
body: params
|
|
|
}));
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context11.stop();
|
|
|
}
|
|
|
}, _callee11);
|
|
|
}));
|
|
|
return _toggleRandomQuestions.apply(this, arguments);
|
|
|
}
|
|
|
function saveQuestionList(_x17) {
|
|
|
return _saveQuestionList.apply(this, arguments);
|
|
|
}
|
|
|
function _saveQuestionList() {
|
|
|
_saveQuestionList = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee12(params) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee12$(_context12) {
|
|
|
while (1) switch (_context12.prev = _context12.next) {
|
|
|
case 0:
|
|
|
return _context12.abrupt("return", (0,fetch/* default */.ZP)('/api/examination_banks/save_question_list.json', {
|
|
|
method: 'post',
|
|
|
body: params
|
|
|
}));
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context12.stop();
|
|
|
}
|
|
|
}, _callee12);
|
|
|
}));
|
|
|
return _saveQuestionList.apply(this, arguments);
|
|
|
}
|
|
|
function getExerciseRandomExam(_x18) {
|
|
|
return _getExerciseRandomExam.apply(this, arguments);
|
|
|
}
|
|
|
function _getExerciseRandomExam() {
|
|
|
_getExerciseRandomExam = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee13(params) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee13$(_context13) {
|
|
|
while (1) switch (_context13.prev = _context13.next) {
|
|
|
case 0:
|
|
|
return _context13.abrupt("return", (0,fetch/* default */.ZP)("/api/exercises/".concat(params.categoryId, "/edit.json"), {
|
|
|
method: 'get',
|
|
|
params: objectSpread2_default()({}, params)
|
|
|
}));
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context13.stop();
|
|
|
}
|
|
|
}, _callee13);
|
|
|
}));
|
|
|
return _getExerciseRandomExam.apply(this, arguments);
|
|
|
}
|
|
|
// 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);
|
|
|
;// CONCATENATED MODULE: ./src/service/randomPaper/types.ts
|
|
|
var RuleValueKeyType = /*#__PURE__*/function (RuleValueKeyType) {
|
|
|
RuleValueKeyType["OnlyFileFolder"] = "1";
|
|
|
RuleValueKeyType["OnlyKnowledge"] = "2";
|
|
|
RuleValueKeyType["OnlyDifficulty"] = "3";
|
|
|
RuleValueKeyType["FileFolderAndDiff"] = "4";
|
|
|
RuleValueKeyType["FileFolderAndKnowledge"] = "5";
|
|
|
RuleValueKeyType["KnowledgeAndDiff"] = "6";
|
|
|
RuleValueKeyType["All"] = "7";
|
|
|
RuleValueKeyType["Shixun"] = "8";
|
|
|
return RuleValueKeyType;
|
|
|
}({});
|
|
|
// EXTERNAL MODULE: ./node_modules/_lodash@4.17.21@lodash/lodash.js
|
|
|
var lodash = __webpack_require__(89392);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/reducer.ts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var RuleValueType = /*#__PURE__*/function (RuleValueType) {
|
|
|
RuleValueType[RuleValueType["FileFolder"] = 1] = "FileFolder";
|
|
|
RuleValueType[RuleValueType["Difficulty"] = 2] = "Difficulty";
|
|
|
RuleValueType[RuleValueType["Knowledge"] = 3] = "Knowledge";
|
|
|
return RuleValueType;
|
|
|
}(RuleValueType || {});
|
|
|
var DataContext = /*#__PURE__*/(0,_react_17_0_2_react.createContext)(null);
|
|
|
var RuleValueMap = defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()({}, RuleValueKeyType.OnlyFileFolder, [RuleValueType.FileFolder]), RuleValueKeyType.OnlyKnowledge, [RuleValueType.Knowledge]), RuleValueKeyType.OnlyDifficulty, [RuleValueType.Difficulty]), RuleValueKeyType.FileFolderAndDiff, [RuleValueType.FileFolder, RuleValueType.Difficulty]), RuleValueKeyType.FileFolderAndKnowledge, [RuleValueType.FileFolder, RuleValueType.Knowledge]), RuleValueKeyType.KnowledgeAndDiff, [RuleValueType.Knowledge, RuleValueType.Difficulty]), RuleValueKeyType.All, [RuleValueType.Knowledge, RuleValueType.Difficulty, RuleValueType.FileFolder]);
|
|
|
var compareTwoArr = function compareTwoArr(target, source) {
|
|
|
if (target.length !== source.length) {
|
|
|
return false;
|
|
|
}
|
|
|
var _iterator = createForOfIteratorHelper_default()(source),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var sourceValue = _step.value;
|
|
|
if (!target.includes(sourceValue)) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
return true;
|
|
|
};
|
|
|
var getRuleValue = function getRuleValue(userSelect) {
|
|
|
for (var _i = 0, _Object$entries = Object.entries(RuleValueMap); _i < _Object$entries.length; _i++) {
|
|
|
var _Object$entries$_i = slicedToArray_default()(_Object$entries[_i], 2),
|
|
|
ruleKey = _Object$entries$_i[0],
|
|
|
ruleValueArr = _Object$entries$_i[1];
|
|
|
if (compareTwoArr(userSelect, ruleValueArr)) {
|
|
|
return ruleKey;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
var questionTypeMap = {
|
|
|
SINGLE: '单选题',
|
|
|
MULTIPLE: '多选题',
|
|
|
COMPLETION: '填空题',
|
|
|
JUDGMENT: '判断题',
|
|
|
SUBJECTIVE: '简答题',
|
|
|
PROGRAM: '编程题',
|
|
|
BPROGRAM: '程序填空题',
|
|
|
COMBINATION: '组合题',
|
|
|
PRACTICAL: '实训题'
|
|
|
};
|
|
|
var difficultyMap = {
|
|
|
'1': {
|
|
|
label: '简单',
|
|
|
color: '#46B70E'
|
|
|
},
|
|
|
'2': {
|
|
|
label: '适中',
|
|
|
color: '#165DFF'
|
|
|
},
|
|
|
'3': {
|
|
|
label: '困难',
|
|
|
color: '#EE6F1A'
|
|
|
}
|
|
|
};
|
|
|
var getFixedNumber = function getFixedNumber(num) {
|
|
|
return num && parseFloat(num.toFixed(1));
|
|
|
};
|
|
|
var reducer = function reducer(state, action) {
|
|
|
switch (action.type) {
|
|
|
//初始化
|
|
|
case 'init':
|
|
|
{
|
|
|
return action.payload;
|
|
|
}
|
|
|
//只更新试卷的基础信息部分
|
|
|
case 'updateBaseInfo':
|
|
|
{
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
examination_bank: action.payload
|
|
|
});
|
|
|
}
|
|
|
//删除某个题型
|
|
|
case 'deleteQuestionType':
|
|
|
{
|
|
|
var item_types = state.item_types;
|
|
|
var newItemTypes = item_types.filter(function (item) {
|
|
|
return item.item_type !== action.payload;
|
|
|
});
|
|
|
state.examination_bank.question_count = getFixedNumber(newItemTypes.reduce(function (acc, cur) {
|
|
|
return acc + cur.item_bank_count;
|
|
|
}, 0));
|
|
|
state.examination_bank.total_score = getFixedNumber(newItemTypes.reduce(function (acc, cur) {
|
|
|
return acc + cur.total_score;
|
|
|
}, 0));
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
item_types: newItemTypes
|
|
|
});
|
|
|
}
|
|
|
//批量增删题型
|
|
|
case 'setQuestionType':
|
|
|
{
|
|
|
var _state$item_types = state.item_types,
|
|
|
_item_types = _state$item_types === void 0 ? [] : _state$item_types;
|
|
|
var prevItemTypes = _item_types.map(function (item) {
|
|
|
return item.item_type;
|
|
|
});
|
|
|
var _newItemTypes = _item_types.filter(function (item) {
|
|
|
return action.payload.includes(item.item_type);
|
|
|
});
|
|
|
var _iterator2 = createForOfIteratorHelper_default()(action.payload),
|
|
|
_step2;
|
|
|
try {
|
|
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
|
var itemType = _step2.value;
|
|
|
if (!prevItemTypes.includes(itemType)) {
|
|
|
if (itemType === 'PRACTICAL') {
|
|
|
_newItemTypes.push({
|
|
|
item_type: itemType,
|
|
|
contents: [],
|
|
|
item_banks: [],
|
|
|
item_bank_count: 0,
|
|
|
item_bank_num: 0,
|
|
|
item_type_text: questionTypeMap[itemType],
|
|
|
random_rule_type: RuleValueKeyType.Shixun,
|
|
|
score: 0,
|
|
|
total_score: 0
|
|
|
});
|
|
|
} else {
|
|
|
_newItemTypes.push({
|
|
|
item_type: itemType,
|
|
|
contents: [],
|
|
|
item_bank_count: 0,
|
|
|
item_type_text: questionTypeMap[itemType],
|
|
|
// random_rule_type: '1',
|
|
|
score: 0,
|
|
|
total_score: 0
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator2.e(err);
|
|
|
} finally {
|
|
|
_iterator2.f();
|
|
|
}
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
item_types: _newItemTypes
|
|
|
});
|
|
|
}
|
|
|
//调整题型顺序
|
|
|
case 'updateItemTypes':
|
|
|
{
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
item_types: action.payload
|
|
|
});
|
|
|
}
|
|
|
//删除抽题规则
|
|
|
case 'deleteRule':
|
|
|
{
|
|
|
var _currentItem$contents;
|
|
|
var stateCopy = (0,lodash.cloneDeep)(state);
|
|
|
var currentItem = stateCopy.item_types.find(function (item) {
|
|
|
return item.item_type === action.payload.itemType;
|
|
|
});
|
|
|
var deleteRule = currentItem.contents.find(function (content) {
|
|
|
return content.id === action.payload.id && content.is_share == action.payload.is_share;
|
|
|
});
|
|
|
currentItem.contents = currentItem.contents.filter(function (content) {
|
|
|
return content !== deleteRule;
|
|
|
});
|
|
|
if (((_currentItem$contents = currentItem.contents) === null || _currentItem$contents === void 0 ? void 0 : _currentItem$contents.length) === 0) currentItem.random_rule_type = [];
|
|
|
currentItem.item_bank_count -= deleteRule === null || deleteRule === void 0 ? void 0 : deleteRule.quanlity;
|
|
|
stateCopy.examination_bank.question_count -= deleteRule === null || deleteRule === void 0 ? void 0 : deleteRule.quanlity;
|
|
|
currentItem.total_score -= (deleteRule === null || deleteRule === void 0 ? void 0 : deleteRule.quanlity) * currentItem.score;
|
|
|
stateCopy.examination_bank.total_score -= (deleteRule === null || deleteRule === void 0 ? void 0 : deleteRule.quanlity) * currentItem.score;
|
|
|
currentItem.total_score = getFixedNumber(currentItem.total_score);
|
|
|
stateCopy.examination_bank.total_score = getFixedNumber(stateCopy.examination_bank.total_score);
|
|
|
stateCopy.contents = currentItem.contents;
|
|
|
return stateCopy;
|
|
|
}
|
|
|
case 'changeQuestionNum':
|
|
|
{
|
|
|
var _currentItem$contents2;
|
|
|
var _stateCopy = (0,lodash.cloneDeep)(state);
|
|
|
var _currentItem = _stateCopy.item_types.find(function (item) {
|
|
|
return item.item_type === action.payload.itemType;
|
|
|
});
|
|
|
var countitems = _currentItem === null || _currentItem === void 0 || (_currentItem$contents2 = _currentItem.contents) === null || _currentItem$contents2 === void 0 ? void 0 : _currentItem$contents2.find(function (item) {
|
|
|
return item.id === action.payload.id;
|
|
|
});
|
|
|
if (action.payload.itemType === 'PRACTICAL') {
|
|
|
if (action.payload.num) {
|
|
|
_stateCopy.examination_bank.question_count = _stateCopy.examination_bank.question_count - _currentItem.item_bank_count + action.payload.num;
|
|
|
_stateCopy.examination_bank.total_score = getFixedNumber(_stateCopy.examination_bank.total_score - _currentItem.total_score + action.payload.num * _currentItem.score);
|
|
|
}
|
|
|
if (action.payload.score) {
|
|
|
_stateCopy.examination_bank.total_score = getFixedNumber(_stateCopy.examination_bank.total_score - _currentItem.total_score + action.payload.num * _currentItem.score);
|
|
|
}
|
|
|
_currentItem.item_bank_count = action.payload.num;
|
|
|
_currentItem.total_score = getFixedNumber(_currentItem.item_bank_count * _currentItem.score);
|
|
|
return _stateCopy;
|
|
|
}
|
|
|
_stateCopy.examination_bank.question_count = _stateCopy.examination_bank.question_count - (countitems === null || countitems === void 0 ? void 0 : countitems.quanlity) + action.payload.num;
|
|
|
var currentRule = _currentItem.contents.find(function (content) {
|
|
|
return content.id === action.payload.id && content.teacher_group_id === action.payload.teacher_group_id;
|
|
|
});
|
|
|
currentRule.quanlity = action.payload.num;
|
|
|
var newItemBankCount = 0,
|
|
|
newTotalScore = 0;
|
|
|
var _iterator3 = createForOfIteratorHelper_default()(_currentItem.contents),
|
|
|
_step3;
|
|
|
try {
|
|
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
|
var content = _step3.value;
|
|
|
newItemBankCount += content === null || content === void 0 ? void 0 : content.quanlity;
|
|
|
newTotalScore += (content === null || content === void 0 ? void 0 : content.quanlity) * _currentItem.score;
|
|
|
}
|
|
|
|
|
|
// stateCopy.examination_bank.question_count = stateCopy?.item_types?.map((item => item.item_bank_count))?.reduce((a, b) => a + b)
|
|
|
} catch (err) {
|
|
|
_iterator3.e(err);
|
|
|
} finally {
|
|
|
_iterator3.f();
|
|
|
}
|
|
|
_stateCopy.examination_bank.total_score = getFixedNumber(_stateCopy.examination_bank.total_score - _currentItem.total_score + newTotalScore);
|
|
|
_currentItem.item_bank_count = newItemBankCount;
|
|
|
_currentItem.total_score = getFixedNumber(newTotalScore);
|
|
|
return _stateCopy;
|
|
|
}
|
|
|
case 'changeQuestionScore':
|
|
|
{
|
|
|
var _stateCopy2 = (0,lodash.cloneDeep)(state);
|
|
|
var _currentItem2 = _stateCopy2.item_types.find(function (item) {
|
|
|
return item.item_type === action.payload.itemType;
|
|
|
});
|
|
|
_currentItem2.score = action.payload.score;
|
|
|
_currentItem2.total_score = getFixedNumber(_currentItem2.item_bank_count * _currentItem2.score);
|
|
|
_stateCopy2.examination_bank.total_score = getFixedNumber(_stateCopy2.item_types.reduce(function (acc, cur) {
|
|
|
return acc + cur.total_score;
|
|
|
}, 0));
|
|
|
return _stateCopy2;
|
|
|
}
|
|
|
case 'editRule':
|
|
|
{
|
|
|
var _stateCopy3 = (0,lodash.cloneDeep)(state);
|
|
|
var _currentItem3 = _stateCopy3.item_types.find(function (item) {
|
|
|
return item.item_type === action.payload.itemType;
|
|
|
});
|
|
|
_currentItem3.contents = action.payload.tableData.map(function (content) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, content), {}, {
|
|
|
item_type: action.payload.itemType,
|
|
|
random_rule_type: action.payload.randomRuleType
|
|
|
});
|
|
|
});
|
|
|
_currentItem3.random_rule_type = action.payload.randomRuleType;
|
|
|
_currentItem3.item_bank_count = _currentItem3.contents.reduce(function (acc, cur) {
|
|
|
return acc + (cur === null || cur === void 0 ? void 0 : cur.quanlity);
|
|
|
}, 0);
|
|
|
_currentItem3.score = _currentItem3.score || 1;
|
|
|
_currentItem3.total_score = getFixedNumber(_currentItem3.item_bank_count * _currentItem3.score);
|
|
|
_stateCopy3.examination_bank.question_count = _stateCopy3.item_types.reduce(function (acc, cur) {
|
|
|
return acc + cur.item_bank_count;
|
|
|
}, 0);
|
|
|
_stateCopy3.examination_bank.total_score = getFixedNumber(_stateCopy3.item_types.reduce(function (acc, cur) {
|
|
|
return acc + cur.total_score;
|
|
|
}, 0));
|
|
|
return _stateCopy3;
|
|
|
}
|
|
|
case 'addShixun':
|
|
|
{
|
|
|
var _stateCopy4$item_type;
|
|
|
var _stateCopy4 = (0,lodash.cloneDeep)(state);
|
|
|
var _currentItem4 = _stateCopy4.item_types.find(function (item) {
|
|
|
return item.item_type === 'PRACTICAL';
|
|
|
});
|
|
|
_currentItem4.item_banks = action.payload.shixunList;
|
|
|
_stateCopy4.examination_bank.question_count = _stateCopy4.examination_bank.question_count + 1;
|
|
|
_currentItem4.item_bank_num = _currentItem4.item_banks.length;
|
|
|
_currentItem4.item_bank_count = _currentItem4.item_bank_count || 1;
|
|
|
_currentItem4.score = _currentItem4.score || 1;
|
|
|
_currentItem4.total_score = _currentItem4.total_score || _currentItem4.score * _currentItem4.item_bank_count;
|
|
|
_stateCopy4.examination_bank.total_score = _stateCopy4 === null || _stateCopy4 === void 0 || (_stateCopy4$item_type = _stateCopy4.item_types) === null || _stateCopy4$item_type === void 0 ? void 0 : _stateCopy4$item_type.map(function (item) {
|
|
|
return item.total_score;
|
|
|
}).reduce(function (a, b) {
|
|
|
return a + b;
|
|
|
});
|
|
|
return _stateCopy4;
|
|
|
}
|
|
|
case 'deleteShixunQuestion':
|
|
|
{
|
|
|
var _stateCopy5 = (0,lodash.cloneDeep)(state);
|
|
|
var _currentItem5 = _stateCopy5.item_types.find(function (item) {
|
|
|
return item.item_type === 'PRACTICAL';
|
|
|
});
|
|
|
_currentItem5.item_banks = _currentItem5.item_banks.filter(function (item) {
|
|
|
return item.id !== action.payload.shixunId;
|
|
|
});
|
|
|
_currentItem5.item_bank_num -= 1;
|
|
|
if (_currentItem5.item_bank_count > _currentItem5.item_bank_num) {
|
|
|
_currentItem5.item_bank_count -= 1;
|
|
|
_currentItem5.total_score -= _currentItem5.score;
|
|
|
_currentItem5.total_score = getFixedNumber(_currentItem5.total_score);
|
|
|
}
|
|
|
return _stateCopy5;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/BaseInfo.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var BaseInfo = function BaseInfo(_ref) {
|
|
|
var courseOptions = _ref.courseOptions,
|
|
|
setCurrentKey = _ref.setCurrentKey,
|
|
|
loading = _ref.loading,
|
|
|
form = _ref.form;
|
|
|
var _useContext = (0,_react_17_0_2_react.useContext)(DataContext),
|
|
|
data = _useContext.data,
|
|
|
disabled = _useContext.disabled,
|
|
|
dispatch = _useContext.dispatch;
|
|
|
var urlParams = (0,_umi_production_exports.useParams)();
|
|
|
var isFirst = (0,_react_17_0_2_react.useRef)(true);
|
|
|
var initData = (0,_react_17_0_2_react.useMemo)(function () {
|
|
|
var _data$examination_ban, _data$examination_ban2, _data$examination_ban3, _data$examination_ban4, _data$examination_ban5;
|
|
|
if (!courseOptions.length || !data) {
|
|
|
return;
|
|
|
}
|
|
|
var subDisciplineId = data === null || data === void 0 || (_data$examination_ban = data.examination_bank) === null || _data$examination_ban === void 0 ? void 0 : _data$examination_ban.sub_discipline_id;
|
|
|
var time = (data === null || data === void 0 || (_data$examination_ban2 = data.examination_bank) === null || _data$examination_ban2 === void 0 ? void 0 : _data$examination_ban2.time) === -1 ? undefined : isFirst.current ? urlParams.id ? data === null || data === void 0 || (_data$examination_ban3 = data.examination_bank) === null || _data$examination_ban3 === void 0 ? void 0 : _data$examination_ban3.time : (data === null || data === void 0 || (_data$examination_ban4 = data.examination_bank) === null || _data$examination_ban4 === void 0 ? void 0 : _data$examination_ban4.time) || 60 : data === null || data === void 0 || (_data$examination_ban5 = data.examination_bank) === null || _data$examination_ban5 === void 0 ? void 0 : _data$examination_ban5.time;
|
|
|
isFirst.current = false;
|
|
|
var valueForCascader = [];
|
|
|
var _iterator = createForOfIteratorHelper_default()(courseOptions),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var item = _step.value;
|
|
|
var _iterator2 = createForOfIteratorHelper_default()(item.children),
|
|
|
_step2;
|
|
|
try {
|
|
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
|
var option = _step2.value;
|
|
|
if (option.value === subDisciplineId) {
|
|
|
valueForCascader = [item.value, option.value];
|
|
|
}
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator2.e(err);
|
|
|
} finally {
|
|
|
_iterator2.f();
|
|
|
}
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, data.examination_bank), {}, {
|
|
|
time: time,
|
|
|
course: valueForCascader
|
|
|
});
|
|
|
}, [data, courseOptions]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
form.setFieldsValue(objectSpread2_default()({}, initData));
|
|
|
}, [initData]);
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(spin/* default */.Z, {
|
|
|
spinning: loading,
|
|
|
size: "large",
|
|
|
style: {
|
|
|
position: 'fixed',
|
|
|
maxHeight: '100vh'
|
|
|
},
|
|
|
className: "mt30",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Editmodules.baseInfo,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
|
|
|
form: form,
|
|
|
autoComplete: "off",
|
|
|
colon: false,
|
|
|
labelCol: {
|
|
|
span: 4
|
|
|
},
|
|
|
wrapperCol: {
|
|
|
span: 20
|
|
|
},
|
|
|
initialValues: initData,
|
|
|
onValuesChange: function onValuesChange(changedValues, newValues) {
|
|
|
var _newValues$course = newValues.course,
|
|
|
course = _newValues$course === void 0 ? [] : _newValues$course;
|
|
|
var newBaseInfo = objectSpread2_default()(objectSpread2_default()({}, newValues), {}, {
|
|
|
sub_discipline_id: course[1] || 0
|
|
|
});
|
|
|
dispatch({
|
|
|
type: 'updateBaseInfo',
|
|
|
payload: newBaseInfo
|
|
|
});
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "name",
|
|
|
label: "\u8BD5\u5377\u540D\u79F0",
|
|
|
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,
|
|
|
size: "large",
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u8BD5\u5377\u540D\u79F0",
|
|
|
showCount: true
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
label: '方向&课程',
|
|
|
name: "course",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请选择方向&课程'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(cascader/* default */.Z, {
|
|
|
disabled: disabled,
|
|
|
size: "large",
|
|
|
allowClear: false,
|
|
|
placeholder: "\u8BF7\u9009\u62E9\u65B9\u5411&\u8BFE\u7A0B",
|
|
|
options: courseOptions,
|
|
|
dropdownMenuColumnStyle: {
|
|
|
padding: '8px 12px',
|
|
|
fontSize: 14
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
label: "\u96BE\u5EA6",
|
|
|
name: "difficulty",
|
|
|
className: Editmodules.radioBtnWrapper,
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请选择难度'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default.Group */.ZP.Group, {
|
|
|
disabled: disabled,
|
|
|
className: Editmodules.radiogroup,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Button */.ZP.Button, {
|
|
|
className: Editmodules.easy,
|
|
|
value: 1,
|
|
|
children: "\u7B80\u5355"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Button */.ZP.Button, {
|
|
|
className: Editmodules.medium,
|
|
|
value: 2,
|
|
|
children: "\u9002\u4E2D"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Button */.ZP.Button, {
|
|
|
className: Editmodules.hard,
|
|
|
value: 3,
|
|
|
children: "\u56F0\u96BE"
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
label: "\u7B54\u9898\u65F6\u957F",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
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, {
|
|
|
min: 1,
|
|
|
disabled: disabled,
|
|
|
size: "large",
|
|
|
max: 9999,
|
|
|
style: {
|
|
|
width: 220
|
|
|
},
|
|
|
placeholder: "\u8BF7\u586B\u5199\u7B54\u9898\u65F6\u957F"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "ml10",
|
|
|
children: "\u5206\u949F"
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
label: "\u8BD5\u5377\u987B\u77E5",
|
|
|
name: "exam_notes",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z.TextArea, {
|
|
|
rows: 6,
|
|
|
disabled: disabled,
|
|
|
showCount: true,
|
|
|
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.jsxs)("div", {
|
|
|
className: Editmodules.fixedBottom,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
className: "".concat(Editmodules.cancelBtn, " mr5"),
|
|
|
onClick: function onClick() {
|
|
|
if (urlParams.id || window.location.href.indexOf('randompaper') > -1) {
|
|
|
_umi_production_exports.history.push("/paperlibrary");
|
|
|
} else {
|
|
|
_umi_production_exports.history.push("/classrooms/".concat(urlParams.coursesId, "/exercise"));
|
|
|
}
|
|
|
},
|
|
|
children: "\u53D6\u6D88"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
className: "".concat(Editmodules.confirmBtn, " ml15"),
|
|
|
type: "primary",
|
|
|
size: "large",
|
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return form.validateFields();
|
|
|
case 2:
|
|
|
if (!(!urlParams.id && !urlParams.coursesId)) {
|
|
|
_context.next = 9;
|
|
|
break;
|
|
|
}
|
|
|
_context.next = 5;
|
|
|
return createRandomExam(data);
|
|
|
case 5:
|
|
|
res = _context.sent;
|
|
|
if (res.status === 0) {
|
|
|
_umi_production_exports.history.replace("/randompaper/edit/".concat(res === null || res === void 0 ? void 0 : res.examination_bank_id, "?type=settings"));
|
|
|
setCurrentKey('settings');
|
|
|
}
|
|
|
_context.next = 10;
|
|
|
break;
|
|
|
case 9:
|
|
|
setCurrentKey('settings');
|
|
|
case 10:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
})),
|
|
|
children: "\u4E0B\u4E00\u6B65"
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var Edit_BaseInfo = (BaseInfo);
|
|
|
// 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/objectDestructuringEmpty.js
|
|
|
var objectDestructuringEmpty = __webpack_require__(70236);
|
|
|
var objectDestructuringEmpty_default = /*#__PURE__*/__webpack_require__.n(objectDestructuringEmpty);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
|
|
|
var modal = __webpack_require__(43418);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/QuestionInfo/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var QuestionInfomodules = ({"flex_box_center":"flex_box_center___NXYwj","flex_space_between":"flex_space_between___Oy2UZ","flex_box_vertical_center":"flex_box_vertical_center___ybBar","flex_box_center_end":"flex_box_center_end___yyQPf","flex_box_column":"flex_box_column____kuXY","questionInfo":"questionInfo___U9mnu","label":"label___PP7Ng","content":"content___PUXFl","leftPart":"leftPart___uoQeo","rightPart":"rightPart___mCG7H","dragItem":"dragItem___djmPG","blackText":"blackText___KqEaU","greyText":"greyText___VamKm","iconWrapper":"iconWrapper___o1C0y","contentArea":"contentArea___Fj7D0","dragging":"dragging___mX3Il","hidden":"hidden___KWDLK","dragIcon":"dragIcon___yPuB3","deleteIcon":"deleteIcon___go29y","disabled":"disabled___uSK9k","challengeNameWrapper":"challengeNameWrapper___DFjRy","challengeName":"challengeName___m7v0x","shixunPreviewFooter":"shixunPreviewFooter___iaciG","shixunInfoWrapper":"shixunInfoWrapper___aSihg","shixunInfo":"shixunInfo___WYBm1","btnToDetail":"btnToDetail___WVmtj","fixedBottom":"fixedBottom___oeMSX","cancelBtn":"cancelBtn___ac73V","confirmBtn":"confirmBtn___sYh2O","previewBtn":"previewBtn___c2uQz","setScoreModalTitle":"setScoreModalTitle___ADafj","modalTitle":"modalTitle___t821D","scoreText":"scoreText___M3UUZ"});
|
|
|
// EXTERNAL MODULE: ./src/components/NoData/index.tsx
|
|
|
var NoData = __webpack_require__(77068);
|
|
|
// EXTERNAL MODULE: ./src/components/ui-customization/index.tsx + 34 modules
|
|
|
var ui_customization = __webpack_require__(45277);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/checkbox/index.js + 3 modules
|
|
|
var es_checkbox = __webpack_require__(24905);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/QuestionInfo/QuestionTypeModal.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var options = [{
|
|
|
label: '单选题',
|
|
|
value: 'SINGLE'
|
|
|
}, {
|
|
|
label: '多选题',
|
|
|
value: 'MULTIPLE'
|
|
|
}, {
|
|
|
label: '填空题',
|
|
|
value: 'COMPLETION'
|
|
|
}, {
|
|
|
label: '判断题',
|
|
|
value: 'JUDGMENT'
|
|
|
}, {
|
|
|
label: '简答题',
|
|
|
value: 'SUBJECTIVE'
|
|
|
}, {
|
|
|
label: '编程题',
|
|
|
value: 'PROGRAM'
|
|
|
}, {
|
|
|
label: '组合题',
|
|
|
value: 'COMBINATION'
|
|
|
}, {
|
|
|
label: '实训题',
|
|
|
value: 'PRACTICAL'
|
|
|
}, {
|
|
|
label: '程序填空题',
|
|
|
value: 'BPROGRAM'
|
|
|
}];
|
|
|
var QuestionTypeModal = function QuestionTypeModal(_ref) {
|
|
|
var open = _ref.open,
|
|
|
onCancel = _ref.onCancel,
|
|
|
_onOk = _ref.onOk;
|
|
|
var _useContext = (0,_react_17_0_2_react.useContext)(DataContext),
|
|
|
data = _useContext.data,
|
|
|
dispatch = _useContext.dispatch;
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (open) {
|
|
|
var _ref2 = data || {},
|
|
|
item_types = _ref2.item_types;
|
|
|
setQuestionType(item_types === null || item_types === void 0 ? void 0 : item_types.map(function (item) {
|
|
|
return item.item_type;
|
|
|
}));
|
|
|
}
|
|
|
}, [open, data]);
|
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
questionType = _useState2[0],
|
|
|
setQuestionType = _useState2[1];
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u9898\u578B\u8BBE\u7F6E", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-grey-333",
|
|
|
style: {
|
|
|
fontSize: 14,
|
|
|
fontWeight: 400
|
|
|
},
|
|
|
children: '(通过勾选可对题型进行添加/删除)'
|
|
|
})]
|
|
|
}),
|
|
|
closable: true,
|
|
|
centered: true,
|
|
|
open: open,
|
|
|
onCancel: onCancel,
|
|
|
onOk: function onOk() {
|
|
|
return _onOk(questionType);
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z.Group, {
|
|
|
value: questionType,
|
|
|
onChange: function onChange(checkedValue) {
|
|
|
return setQuestionType(checkedValue);
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
|
|
|
gutter: [0, 20],
|
|
|
children: options.map(function (item) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
span: 6,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
value: item.value,
|
|
|
children: item.label
|
|
|
})
|
|
|
}, item.value);
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var QuestionInfo_QuestionTypeModal = (QuestionTypeModal);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/table/index.js + 85 modules
|
|
|
var table = __webpack_require__(86383);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/QuestionInfo/SetScoreModal.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var SetScore = function SetScore(_ref) {
|
|
|
var open = _ref.open,
|
|
|
onCancel = _ref.onCancel,
|
|
|
_onOk = _ref.onOk;
|
|
|
var _useContext = (0,_react_17_0_2_react.useContext)(DataContext),
|
|
|
data = _useContext.data;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
tempData = _useState2[0],
|
|
|
setTempData = _useState2[1];
|
|
|
console.log('--xxx-', tempData);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (open) {
|
|
|
setTempData((0,lodash.cloneDeep)(data));
|
|
|
}
|
|
|
}, [open, data]);
|
|
|
var paperTotalScore = (0,_react_17_0_2_react.useMemo)(function () {
|
|
|
var _tempData$item_types, _total;
|
|
|
var total;
|
|
|
total = tempData === null || tempData === void 0 || (_tempData$item_types = tempData.item_types) === null || _tempData$item_types === void 0 ? void 0 : _tempData$item_types.map(function (item) {
|
|
|
return item.total_score;
|
|
|
}).reduce(function (a, b) {
|
|
|
return parseFloat(a) + parseFloat(b);
|
|
|
});
|
|
|
// for (const item of tempData?.item_types || []) {
|
|
|
// total += item.total_score
|
|
|
// }
|
|
|
return (_total = total) === null || _total === void 0 ? void 0 : _total.toFixed(1);
|
|
|
}, [tempData]);
|
|
|
return open ? /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: QuestionInfomodules.setScoreModalTitle,
|
|
|
justify: "space-between",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionInfomodules.modalTitle,
|
|
|
children: "\u6279\u91CF\u8BBE\u7F6E\u5206\u503C"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: QuestionInfomodules.scoreText,
|
|
|
children: ["\u603B\u5206\xA0", paperTotalScore]
|
|
|
})]
|
|
|
}),
|
|
|
open: open,
|
|
|
width: 640,
|
|
|
centered: true,
|
|
|
closable: true,
|
|
|
onCancel: onCancel,
|
|
|
onOk: function onOk() {
|
|
|
_onOk(tempData);
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
|
|
|
columns: [{
|
|
|
title: '题型名称',
|
|
|
dataIndex: 'item_type_text'
|
|
|
}, {
|
|
|
title: '小题总数',
|
|
|
dataIndex: 'item_bank_count'
|
|
|
}, {
|
|
|
title: '题型总分',
|
|
|
dataIndex: 'total_score'
|
|
|
}, {
|
|
|
title: '操作',
|
|
|
render: function render(value, record) {
|
|
|
var score = record.score,
|
|
|
item_type = record.item_type;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
color: '#9096A3'
|
|
|
},
|
|
|
children: ["\u6BCF", (record === null || record === void 0 ? void 0 : record.item_type) === "PRACTICAL" ? '题' : "题", /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
precision: 1,
|
|
|
size: "large",
|
|
|
className: "ml10 mr10",
|
|
|
min: 0.1,
|
|
|
disabled: (record === null || record === void 0 ? void 0 : record.item_bank_count) === 0,
|
|
|
max: 100
|
|
|
// value={score}
|
|
|
,
|
|
|
onChange: function onChange(v) {
|
|
|
// if (record?.item_type === "PRACTICAL") {
|
|
|
// const dataCopy = tempData
|
|
|
// const currentItem = dataCopy.item_types.find(item => item.item_type === item_type)
|
|
|
// currentItem.score = Number(v)
|
|
|
|
|
|
// currentItem.item_banks = currentItem?.item_banks?.map((item: any) => {
|
|
|
// return {
|
|
|
// ...item,
|
|
|
// score: Number(v * item?.challenges?.length).toFixed(1),
|
|
|
// challenges: item?.challenges?.map((val: any) => {
|
|
|
// return {
|
|
|
// ...val,
|
|
|
// score: Number(v)
|
|
|
// }
|
|
|
// })
|
|
|
// }
|
|
|
// })
|
|
|
|
|
|
// setTempData({ ...dataCopy })
|
|
|
|
|
|
// // currentItem.score = Number(v)*currentItem
|
|
|
// } else {
|
|
|
var dataCopy = tempData;
|
|
|
var currentItem = dataCopy.item_types.find(function (item) {
|
|
|
return item.item_type === item_type;
|
|
|
});
|
|
|
currentItem.score = Number(v);
|
|
|
var new_total_score = v * currentItem.item_bank_count;
|
|
|
currentItem.total_score = new_total_score && Number(new_total_score.toFixed(1));
|
|
|
dataCopy.examination_bank.total_score = dataCopy.item_types.reduce(function (acc, cur) {
|
|
|
return Number(acc) + Number(cur.total_score);
|
|
|
}, 0);
|
|
|
setTempData(objectSpread2_default()({}, dataCopy));
|
|
|
// }
|
|
|
}
|
|
|
}), "\u5206"]
|
|
|
});
|
|
|
}
|
|
|
}],
|
|
|
dataSource: tempData === null || tempData === void 0 ? void 0 : tempData.item_types,
|
|
|
rowKey: "item_type",
|
|
|
pagination: false
|
|
|
})
|
|
|
}) : null;
|
|
|
};
|
|
|
/* harmony default export */ var SetScoreModal = (SetScore);
|
|
|
// 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/select/index.js
|
|
|
var es_select = __webpack_require__(57809);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tree/index.js + 8 modules
|
|
|
var tree = __webpack_require__(22631);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/QuestionInfo/RuleModal/ImgIcon/folder-closed.png
|
|
|
var folder_closed_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAtFJREFUWEftWL9rU1EYPffFpCCKEEEJVUQHB10qAUHFHwguDg4ORRDq4uDg4CBIJ6GD0D/B3UEFJ5cugjbQChIqokWKClVrFDGIg2B8yZX3Xl/z/O5LzvfyKhTJXV7g/jrfOfc797sx1toCNnAzQ4A51RkymJNA/CcMvpoYhf0xDWtPwqICWEKM+QSYGgojt3Hw3mweFjmD9YlR+N8WAJSdjYwBrAWCb1oL+jzvMbzSFKoPBgLKAc6dugPbuRDtHzAXgGEMxmjjsXEAYr4MMOw2DcA8wcjWG6g+XOEAZ8c+wNpKtCXZMI+WMn6DJrbsOMQBPtrr9ySM4ZX9LEApkOfd5QBntvvhuhqFswKOz2/wDQWSZ9o0FADLfji5fBTYPwmUduYVMmV+IrLWF2DpFtCcizDTu3hmFeCBKaC4LR2cJpvjMZrwfn8HFm8qATan/bWslWckq6SuTyWcIfi5allrkmsY/DoZSZzanCwQo0REAwTIJf583e9txNIWic9p5E2OCQilZ7BxzY/8L60RSqRkcgnHqKXERgFw5eq/80EagIbB91cSPigilMabNWmYD6okXr7cZdABIAE7Gv6dpfIuZxJDI/G7S32ymJx6CoDP50ny5mIXIJPQ2Y8kEVVEw+DSeCKLWbkldlQA6JZwaZe9BuDr8xkAZjU6Pp5LvHiu9xmkWej6Wt8KXOK1VuGDL89272IaMLv6yAID3cUvzvS5SZyQyZOAZZl7hrnEz0/rjZoxzAhOyUEOcOFEH6MWhDGCWAApPs8B1o/p68GsANgbRVVRPzu8fvVg5gA0xcLTsV/wCtF/iKz6cABkfBfL+Z12m0tc2/cWXnFPODf3zZCxmOj4yxzg/O4qWv48LDwHIHOZrO/i5HoGHRQ3HeEAg0m1ShWtn/dh27tgUAilTqOUMcyqm7AfbZjCR5Q2j+N4o64DOMDhXq8pQ4B5mdzwDP4B5kHmZrL/eyAAAAAASUVORK5CYII=";
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/QuestionInfo/RuleModal/ImgIcon/folder-opened.png
|
|
|
var folder_opened_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAA4RJREFUWEftWEtrE1EYPXfSh5VWSlMfNSi4sokLK30pWtuKIChVVBBBWpfiRhcKghii7tp/4FrBBxREXbhQ0Bj7gqokahe+kNZWqa21tLGtk7kymY5J79yZL5NUKNLZZHHnzj33fOec+90wzrkHS/hhywBzrM4ygzkSiP+EwTdtPvDJdnDeCI4KgBPEsGGAPYOn8Bq23A7nwiLNYH+bD+rYSwBlloUYAzgH9F/Zo48pyhMoBVdR3ZkVUBpgV9MNcO24sb7OnA6GYtBEa75rbkCYL24wOcxGAPYUhSUXUH3/Cw0wXDUIziuMJYkFc6mluH+GcRSv2UYDfLxJtSWMwiuOUxsUC6Qot2iAD71q8ruZVNgtYFO/+m+yQKKm2UgGAMvU5GTvbqDyClC4LmUMuw+LTFiYdNDC7FdgIASMG57KHGDNdSB/tVyKltIJAESmRHziBmZHgf5WlwBrb6bihFrQmkdpCSDRiiyu+ozgyJzBujtpy1Jiy9XOAPqOuQRY35mKP8qdFvELBFJu1qH1HnUL8K59iV0DFtwqc3PPIQnAH+3noGmXAK1k4YnhxoaS8joqQgFYOaBUAlBSedbTIgCcuLwBc78+SW3qWnJUzkjG8/yAZ3Nqd937BYDfghvB4x+NQJ5vAMycozRvOVOF+Rk1FaVAkQEquX73PkmJh89EwXngn5+5dhsuPgwopYYZu/ZKAA6dDkLTQhaAlhKLDAsvuJWE+X5RDbCi1jBjpEkCcPCsH4mpmKXEVIksbZiAkDxz5zWZVwaUnjS6pkiDTcx8aI2CscCCRtStJqmjzKmtLD8FeLxAZKcNwPcnguCJ0II1SAYERJSJnUxX0gysagbC2+0YbPNDnY79rZrk6LR+n0DkRsP5a4GK80C4xuEkeXswCvCAfaOawV3E1K2+DGUaUeO+i4AlB9NpeX0gCGihpA6zeahcpBB7W4Bo0IHBgSN+zP2MGVuX1ZiihHKJOC5IpMAHfH7gAFAfetUYBUcgGwIXZc73d0BixqEffNGQ5mYi1yjCSFdLKhIfA6ZHHQBGm/2YmYpJ2bAEN4nAmVRZjKmzwOQQcWnq3focnNdTBwV9n88yhuKj95xb/i5/HdSpRwBbmfpXIRPTCIS5ycF0U3o8O+g7SWR9FebiHeCJXQArkNdKYIiqODXO2G9A6cCeiRANcFEsmf1HlgFmz50xc8kz+AfHHTJwrKNsNwAAAABJRU5ErkJggg==";
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/QuestionInfo/RuleModal/ImgIcon/folderopen1.png
|
|
|
var folderopen1_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAABWlJREFUWEftV1tsVEUY/ubspUu3W9mWGlttwXqJVRNBbqIFDbyA8mCCkAYtpEaIGBODhBCECiG+UE1EnzTempYqtSAE45saBMX40JC0IRojpd1GKM1uW7bd7V7OOWPmnD3bPTNndxYbE2I6L2dzdubMN9/3/ZchlFIXbuNB5gDOUp05BmdJIP4fDPZcxt2xaRzVgadBUQ3QDDEE5m/2zBkE1whwoYTg461LcX42LEoZZOCiMXoJoBUCHEIASgH2dBqUgijKORfBkW3/EqgUYNsPieMAmtj+Fhb2NIfFXvaFnUhCQBlI6wD8dGcBrisEP5V7fft2NuJvKcC9p6PDoLSa7cwTJgKejZj8WjLm93iWSAG2tI+qEsdlvywl6BZPqBByQgpw44fDKskEAQUF+82e5rBrxCvGz7fWZr+XkZ/ZwFTIbgkKel0K8LkPhlW2uLbSh9UNQfh9btGLIrIZ7E7WyDkaf8xYQsX538cwHE4YgKUAnz0WMgC+/EwNSn1uR5MVEcxZ/xbjUgbyi3PXDNNLAW44FjIk3rOxNpvtCseuCEFCMGcUc/2734YMFaQA178fUhlDB56vy+4s27AYlgrOocA7Z0IG60UDPLypLm8BEQBncnc2X3ITijng4ZMhM8vK+kHGIIuyI5sXZgsGn//ECmOvgMJ8rgA5/f92T8hM8rkAX/psZI+u4yClesAWhhLNhPTBpSMhfeSkF7eLoP5OHzY8FoSizGzU+vWQmXosgLvPTNTGJpNXi8lvPF4hPwoZW0YZsKw+gMWLSrMV1ASYE8V7e27WTUwnB7IzsrFVjOXzdDVWOpfgY+YO+j3YvKrCWMEkP9g9ZHjeJvErnaN9oHhYgCSrYQ5F2echKPcpSGkUE9PU3vXkMeWWJxcg6HcZAA+cGDIosgHc0THaqun0EN8ViFFqdij5SlTT8jKsa5gHJdPF/DaQwCcXotkCme+8y+/zY1m937D/W19yHmSs7eoeb0gm0v1Wi2QBEGpuAcm8buCjF6tmWqyMHPu/iWAkahQlseZm0lKw1I2mRlPm/V2D9iCxZG1pH+2j4GR2KB1lJaaE8TSTUDf88kiNB2sfKsWCMgWlXgVVARfG4xp+/iuBU72xmca7gGW2NlYaMu/vYgxyaYaBbGkPt+pUP5Trw1xGa4Nu7FhdjkULPBlDUwxGVLgVgsFIGj/+MY0rYdXwzzwvQTzFOiDHi4Fj9K14wI+V9/uxr3PQuZLs6hxviKnpfttVI+fERzdVoPoOsWmYiGt4ozsCncnFA+JeFGp0KwJuNK+pwL6OPBKzYzV/npHZoZN/74UK3OUAMJ7S8VpXBJoRsPYgEhBLskLzmkq0nR7OX+q2t4fNaHYYtUEXdq4O4N6MxGzKnzfSiExpqJnvRm8oiYtXkhiJasZqj8vMMCqzaebAsvbsiQf9OHXxRv5+kEXzZFzvt+5qgiQEmO8jhseSGjAW0w0wJW7g8Tovnqovgb+EGO+XLvTCRYBITEd3bxy/DqREQrnmojLgRt/VMaN7z9ssNLeP94GPZotR2d2CECy5x40315XZNIgldbz61U15aSLASHgSqqblB9hyfKpV07WMzHaXi3lS3NPrAnav9ePRGjOgVI3i5KUEvrucEm6HfFix2h6dnMbNqen8AHd1pxpiyWS/mS0lYSncj2cWVJURBHwEI1Ed8VQ+8sSoSasqro9OFL40beuM/UIpXSnczvjbF387484jK+VODDL/3QiPny3YsG7vGFsRT+rfE5BSC6QjB7IWWfY/91FrrwRRV0k76i2fhhcnk2obqN4IQrxOAGWevEV8UIiS1iltO/t69SEpQHnI/bcz5gDOlt/bnsF/AOXAMnuF/cdAAAAAAElFTkSuQmCC";
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/QuestionInfo/RuleModal/ImgIcon/folder.png
|
|
|
var folder_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAABpxJREFUWAntWE2IHFUQrtfzk5nNbrKbRGPcRSU/oIEkmERjMAQhCBIjKBpFEBER9OZNL4IevOhFbyGHRA9BhKBeouJFIkTNwaxGg16ikN1k0WR3M5ndnf/ptr56r7p7+s1mkYCHkILpev1e1VdfVb3X0zNEt+Qmr4Dpl9+xs9FYq0XvR0SPUETriC9WYI6x72YML0T0By99Gxj68KWd5k/ndEPKiwRy7RadZSKrDEdDVGiRxfnZ9YjJM1MTUScydIwn371Roh7BD042P2Hg5xHRxRON+6R6WlE7m1wzGRjT4ZnTjNOFjQkYIbQ68UlGURhSYIIpTu7k6N7CkWeN6XoE3zoxP8WMuK22kemG6ngxel4CWQeubpw1AmQrkFpnyx9HVg/uy8MuLbPV5uJ7DuloUDhlA8hWSAxS8SSEZy6zi152V2pX3/YJzjVlH8EtYkTDUaAhOobuJ0vZL7XuJWzoKY9gtd6JY5eKAQ0PFOL7/2NQqbWp0eKNCjFmk0fQVsvQ2Opl9Pj2NZQPeGdnWpu5jbtu68zA2uV4QsIll+sAdPigfPXzNF2cafKBCo1HUFF2bRiikQEmx/If9042H49vdm9qTKsDenD9EE1O263mbaaDhy7FeWf3jBe5F5mXe5+b+gyFhiy17rWKK+NVcGQ5ppRjpheZW680/oQQSy5LAiSmGHGpPYKyB/WUZnurvFUDJD32eodFJQXjrGAN4nQ2Hq/4BGHsgtrHChKxAH38BT6+wED8LUCOt/CejSW6czhPF2badPqvJoUO2/o4ew0Y+yaE+xBkVwkEniBrd5KScEsOnwNo1TCjY5fQ6/uG6b51RXWlLWMNOvxdNaZD/J2GEKLF340dP+xZe0xjCPBxQTmIjqHtx67DRIiKDTuDUMb+3jsKPeQQYufdJRrjaiqezR/xgKGYVgM/5ItHEJZog22FHSuCEOZ1DQAbjPvZryz1gWYeQ2XMW0ahBOEYrPFhuFhjDDuvxWBtATi4GCUat7Ls5j0DVwW8tYyOeNBUa4Z0/nLbJQ8QJGu1XlMvd2LnoaQN4NQryBxi9YbbCrRpbYGa7Yh+mWzS7EKXxlbl6ZWHV9DalTn6+twC7V5f4q/LHE3Pd+nIqSrV2VYF1dfvd8xl97yts1o7/eLRf7B1RbSWCaSd5zdmem3vCtrFwVVanYjOTDTpgXuW0e9TLfr4hzmaWQhlew4WDc01JbwUfTF8zGtM4GLcp4JYSiRLDisHtg70kMNcMW+kWsfPzNOJX2uYEkELQQ6CVwCQcK8C8ThNGHYaE9ojCAPZu6xxOBEAGqLjvZvKdqLPFb7qn11WcjEhDNheW6b40BAsewR1EQYIJKApB8ytkJMIC1/WDuX8STfjYJIK4fWfA+BngIiOEdSJ9ywAAQAJmBvrhM5NzCbvjAqk+mKlI4kJDjuoRuI6hsYHotreKTNoe8I9grZmzkDqx4YwFgerPxtfYGAXwSLLFXMHdwzS09uXU6nAGFwe+ZpEmVJjzOm8aqwLpNM69vqx9ck337G8AML8BTsQQKHNL7CX50KavNqljbfnaYDfuiHnptr03jfX6O9qSAe2DNCjm8s034hocrbLEIa2jRVp22iRupxXpY7kBK1HG7wcY4a1EHerMqmXFz6aZW9bHWTBCbmHaTLGHATrq5YbarSJai2usbMt86+EJ7aW6bHNJZq61qU5JrplNPnp8OlPNfryHL8xS1/QFRsPsBg5eMH3WyzRYcJ5S0ZWy5grqho/cjG+WjdU51+/adsG3x8fb9AbX1TlEZMmx8D0zP1ld9A4TioeyTcvYoOWxfcJCrEcB0T3Edhqm5clvtg4TRLjGX4c/jblH6h8ztCawRwFjI1tBI0PyKoW4nzvPWZ03zE7tgGhRMf1tx2xPHt6wlNI2a0b/g/k/BV9hgiUXOq8HS5ei43iPSQJ8r6xiVocv4JBwJ79K5WtEOx0Tny0XdD8QfXPT0f0+dmWvKWAHfbqoe8b1MafGpKN0xiLn2r2z+X0GS6JyeW5o5VmPhfIW2b2y5xduDh44CABFqhUBa9nP1xGWw1dqoRUcy8M6JD6CF7mVLbDqOW1uF5vjpeK+YfEYQkCWYYZc4HQyxU+6Veqeme1Jpuc4t4CNFqdcY9g1yzbX2/WL+QCM9QLhzstl90/S1fUdg2FgWQT6EVLbNHpThjNhaa8Hz6e7DgcFVbPTxwNcrk9JgqH9bBkCWYDZPh7uNmWanuhVfhIVaIwOjUzeNfLZ141XPdbcpNX4F/ikyqlsA/6bwAAAABJRU5ErkJggg==";
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/QuestionInfo/RuleModal/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var RuleModalmodules = ({"ruleCheckBox":"ruleCheckBox___Onj2f","folderAreaWrapper":"folderAreaWrapper___ut2mr","folderAreaHeader":"folderAreaHeader___fOIDA","folderWrapper":"folderWrapper___IpJ50","folderIcon":"folderIcon___zBoRM","shareFolderIcon":"shareFolderIcon____5s3p","treeNodeItem":"treeNodeItem___quqla","treeNodeDifficulty":"treeNodeDifficulty___en0gk"});
|
|
|
// EXTERNAL MODULE: ./src/service/problemset.ts
|
|
|
var problemset = __webpack_require__(77624);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/QuestionInfo/RuleModal/FileFolder.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新treeNode的统一方法
|
|
|
var updateTreeData = function updateTreeData(list, key, changePart) {
|
|
|
return list.map(function (node) {
|
|
|
if (node.key === key) {
|
|
|
return _objectSpread(_objectSpread({}, node), changePart);
|
|
|
}
|
|
|
if (node.children) {
|
|
|
return _objectSpread(_objectSpread({}, node), {}, {
|
|
|
children: updateTreeData(node.children, key, changePart)
|
|
|
});
|
|
|
}
|
|
|
return node;
|
|
|
});
|
|
|
};
|
|
|
var diffMap = {
|
|
|
'简单': 1,
|
|
|
'适中': 2,
|
|
|
'困难': 3
|
|
|
};
|
|
|
var generateTree = function generateTree(arr, ruleValue, type) {
|
|
|
return arr.map(function (item) {
|
|
|
var _item$tag_disciplines;
|
|
|
var tagNodeArr = item === null || item === void 0 ? void 0 : item.tag_disciplines.map(function (tagItem) {
|
|
|
var tagDifficultyArr = tagItem === null || tagItem === void 0 ? void 0 : tagItem.difficulty_count.map(function (diff) {
|
|
|
return {
|
|
|
label: diff === null || diff === void 0 ? void 0 : diff.name,
|
|
|
value: diffMap[diff.name]
|
|
|
};
|
|
|
});
|
|
|
return {
|
|
|
title: getRuleValue(ruleValue) === RuleValueKeyType.All && tagDifficultyArr.length > 0 ? /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-between",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: "".concat(tagItem.name, "\uFF08").concat(tagItem.child_count, "\uFF09")
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "mr15",
|
|
|
style: {
|
|
|
color: '#666'
|
|
|
},
|
|
|
children: "\u96BE\u5EA6"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["".concat(item.id, "_").concat(tagItem.id), 'diffValue'],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z.Group, {
|
|
|
style: {
|
|
|
columnGap: 12
|
|
|
},
|
|
|
options: tagDifficultyArr
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["".concat(item.id, "_").concat(tagItem.id), 'diffNum'],
|
|
|
initialValue: tagItem === null || tagItem === void 0 ? void 0 : tagItem.difficulty_count,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
type: "hidden"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["".concat(item.id, "_").concat(tagItem.id), 'extra'],
|
|
|
initialValue: objectSpread2_default()(objectSpread2_default()({}, item), {}, {
|
|
|
type: type
|
|
|
}),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
type: "hidden"
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
}) : "".concat(tagItem.name, "\uFF08").concat(tagItem.child_count, "\uFF09"),
|
|
|
key: "".concat(item.id, "_").concat(tagItem.id),
|
|
|
name: tagItem.name,
|
|
|
parentName: item.name,
|
|
|
item_banks_count: tagItem.child_count,
|
|
|
icon: null,
|
|
|
isLeaf: true,
|
|
|
checkable: getRuleValue(ruleValue) === RuleValueKeyType.FileFolderAndKnowledge,
|
|
|
disableCheckbox: tagItem.child_count === 0
|
|
|
};
|
|
|
});
|
|
|
var difficultyArr = item === null || item === void 0 ? void 0 : item.difficulty_count.map(function (diff) {
|
|
|
return {
|
|
|
label: diff === null || diff === void 0 ? void 0 : diff.name,
|
|
|
value: diffMap[diff.name]
|
|
|
};
|
|
|
});
|
|
|
return {
|
|
|
title: getRuleValue(ruleValue) === RuleValueKeyType.FileFolderAndDiff && difficultyArr.length > 0 ? /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-between",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: "".concat(item.name, "\uFF08").concat(item.item_banks_count, "\uFF09")
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "mr15",
|
|
|
style: {
|
|
|
color: '#666'
|
|
|
},
|
|
|
children: "\u96BE\u5EA6"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["".concat(item.id), 'diffValue'],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z.Group, {
|
|
|
style: {
|
|
|
columnGap: 12
|
|
|
},
|
|
|
options: difficultyArr
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["".concat(item.id), 'diffNum'],
|
|
|
initialValue: item === null || item === void 0 ? void 0 : item.difficulty_count,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
type: "hidden"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["".concat(item.id), 'extra'],
|
|
|
initialValue: objectSpread2_default()(objectSpread2_default()({}, item), {}, {
|
|
|
type: type
|
|
|
}),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
type: "hidden"
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
}) : "".concat(item.name, "\uFF08").concat(item.item_banks_count, "\uFF09"),
|
|
|
key: "".concat(item.id),
|
|
|
name: item.name,
|
|
|
item_banks_count: item.item_banks_count,
|
|
|
icon: function icon(e) {
|
|
|
if (e.expanded) {
|
|
|
// 展开
|
|
|
return type === '0' ? /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: folder_opened_namespaceObject,
|
|
|
className: RuleModalmodules.folderIcon
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: folderopen1_namespaceObject,
|
|
|
className: RuleModalmodules.shareFolderIcon
|
|
|
});
|
|
|
} else {
|
|
|
// 收起
|
|
|
return type === '0' ? /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: folder_closed_namespaceObject,
|
|
|
className: RuleModalmodules.folderIcon
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: folder_namespaceObject,
|
|
|
className: RuleModalmodules.shareFolderIcon
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
isLeaf: !item.have_child && !((_item$tag_disciplines = item.tag_disciplines) !== null && _item$tag_disciplines !== void 0 && _item$tag_disciplines.length),
|
|
|
checkable: getRuleValue(ruleValue) === RuleValueKeyType.OnlyFileFolder,
|
|
|
disableCheckbox: item.item_banks_count === 0,
|
|
|
children: item.children.length ? getRuleValue(ruleValue) === RuleValueKeyType.All || getRuleValue(ruleValue) === RuleValueKeyType.FileFolderAndKnowledge ? [].concat(toConsumableArray_default()(generateTree(item.children, ruleValue, type)), toConsumableArray_default()(tagNodeArr)) : generateTree(item.children, ruleValue, type) : []
|
|
|
};
|
|
|
});
|
|
|
};
|
|
|
var generateTree2 = function generateTree2(arr, ruleValue, type) {
|
|
|
return arr.map(function (item) {
|
|
|
var _item$tag_disciplines2;
|
|
|
var tagNodeArr = item === null || item === void 0 ? void 0 : item.tag_disciplines.map(function (tagItem) {
|
|
|
console.log("tagItem:", tagItem);
|
|
|
var tagDifficultyArr = tagItem === null || tagItem === void 0 ? void 0 : tagItem.difficulty_count.map(function (diff) {
|
|
|
return {
|
|
|
label: diff === null || diff === void 0 ? void 0 : diff.name,
|
|
|
value: diffMap[diff.name]
|
|
|
};
|
|
|
});
|
|
|
return {
|
|
|
title: getRuleValue(ruleValue) === RuleValueKeyType.All && tagDifficultyArr.length > 0 ? /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-between",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: "".concat(tagItem.name, "\uFF08").concat(tagItem.child_count, "\uFF09")
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "mr15",
|
|
|
style: {
|
|
|
color: '#666'
|
|
|
},
|
|
|
children: "\u96BE\u5EA6"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["".concat(item.id, "_").concat(tagItem.id), 'diffValue'],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z.Group, {
|
|
|
style: {
|
|
|
columnGap: 12
|
|
|
},
|
|
|
options: tagDifficultyArr
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["".concat(item.id, "_").concat(tagItem.id), 'diffNum'],
|
|
|
initialValue: tagItem === null || tagItem === void 0 ? void 0 : tagItem.difficulty_count,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
type: "hidden"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["".concat(item.id, "_").concat(tagItem.id), 'extra'],
|
|
|
initialValue: objectSpread2_default()(objectSpread2_default()({}, item), {}, {
|
|
|
type: type
|
|
|
}),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
type: "hidden"
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
}) : "".concat(tagItem.name, "\uFF08").concat(tagItem.child_count, "\uFF09"),
|
|
|
key: "".concat(item.id, "_").concat(tagItem.id),
|
|
|
name: tagItem.name,
|
|
|
parentName: item.name,
|
|
|
item_banks_count: tagItem.child_count,
|
|
|
icon: null,
|
|
|
isLeaf: true,
|
|
|
checkable: getRuleValue(ruleValue) === RuleValueKeyType.FileFolderAndKnowledge,
|
|
|
disableCheckbox: tagItem.child_count === 0
|
|
|
};
|
|
|
});
|
|
|
var difficultyArr = item === null || item === void 0 ? void 0 : item.difficulty_count.map(function (diff) {
|
|
|
return {
|
|
|
label: diff === null || diff === void 0 ? void 0 : diff.name,
|
|
|
value: diffMap[diff.name]
|
|
|
};
|
|
|
});
|
|
|
return {
|
|
|
title: getRuleValue(ruleValue) === RuleValueKeyType.FileFolderAndDiff && difficultyArr.length > 0 ? /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-between",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: "".concat(item.name, "\uFF08").concat(item.item_banks_count, "\uFF09")
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "mr15",
|
|
|
style: {
|
|
|
color: '#666'
|
|
|
},
|
|
|
children: "\u96BE\u5EA6"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["".concat(item.id), 'diffValue'],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z.Group, {
|
|
|
style: {
|
|
|
columnGap: 12
|
|
|
},
|
|
|
options: difficultyArr
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["".concat(item.id), 'diffNum'],
|
|
|
initialValue: item === null || item === void 0 ? void 0 : item.difficulty_count,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
type: "hidden"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["".concat(item.id), 'extra'],
|
|
|
initialValue: objectSpread2_default()(objectSpread2_default()({}, item), {}, {
|
|
|
type: type
|
|
|
}),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
type: "hidden"
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
}) : "".concat(item.name, "\uFF08").concat(item.item_banks_count, "\uFF09"),
|
|
|
key: "".concat(item.id),
|
|
|
name: item.name,
|
|
|
item_banks_count: item.item_banks_count,
|
|
|
icon: function icon(e) {
|
|
|
if (e.expanded) {
|
|
|
// 展开
|
|
|
return type === '0' ? /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: folder_opened_namespaceObject,
|
|
|
className: RuleModalmodules.folderIcon
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: folderopen1_namespaceObject,
|
|
|
className: RuleModalmodules.shareFolderIcon
|
|
|
});
|
|
|
} else {
|
|
|
// 收起
|
|
|
return type === '0' ? /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: folder_closed_namespaceObject,
|
|
|
className: RuleModalmodules.folderIcon
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: folder_namespaceObject,
|
|
|
className: RuleModalmodules.shareFolderIcon
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
isLeaf: !item.have_child && !((_item$tag_disciplines2 = item.tag_disciplines) !== null && _item$tag_disciplines2 !== void 0 && _item$tag_disciplines2.length),
|
|
|
checkable: getRuleValue(ruleValue) === RuleValueKeyType.OnlyFileFolder,
|
|
|
disableCheckbox: item.item_banks_count === 0,
|
|
|
children: // item.children.length ?
|
|
|
// (getRuleValue(ruleValue) === RuleValueKeyType.All || getRuleValue(ruleValue) === RuleValueKeyType.FileFolderAndKnowledge) ?
|
|
|
[].concat(toConsumableArray_default()(generateTree2(item.children, ruleValue, type)), toConsumableArray_default()(tagNodeArr)) //: generateTree2(item.children, ruleValue, type) : []
|
|
|
};
|
|
|
});
|
|
|
};
|
|
|
var FileFolder = function FileFolder(_ref) {
|
|
|
var ruleValue = _ref.ruleValue,
|
|
|
defaultData = _ref.defaultData,
|
|
|
setSelectData = _ref.setSelectData,
|
|
|
currentItemType = _ref.currentItemType,
|
|
|
selectData = _ref.selectData;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)("1"),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
activeKey = _useState2[0],
|
|
|
setActiveKey = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(true),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
isFirst = _useState4[0],
|
|
|
setIsFirst = _useState4[1];
|
|
|
var _Form$useForm = es_form/* default */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
teamlist = _useState6[0],
|
|
|
setteamlist = _useState6[1];
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)('all'),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
teamvalue = _useState8[0],
|
|
|
setteamvalue = _useState8[1];
|
|
|
var _onCheck = function onCheck(checkedKeys, info, type) {
|
|
|
var checkedNodes = info.checkedNodes;
|
|
|
console.log("type:", type, checkedNodes, selectData);
|
|
|
if (type === '0') {
|
|
|
setMyCheckedKeys(checkedKeys);
|
|
|
if (getRuleValue(ruleValue) === RuleValueKeyType.OnlyFileFolder) {
|
|
|
//选文件夹
|
|
|
setSelectData(function (pre) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, pre), {}, {
|
|
|
my: checkedNodes.map(function (node) {
|
|
|
return {
|
|
|
id: node.key,
|
|
|
group_id: node.key,
|
|
|
group_name: node.name,
|
|
|
item_bank_num: node.item_banks_count,
|
|
|
folderType: '0',
|
|
|
quanlity: 1
|
|
|
};
|
|
|
})
|
|
|
});
|
|
|
});
|
|
|
setSelectedNum(checkedNodes.reduce(function (acc, cur) {
|
|
|
return acc + cur.item_banks_count;
|
|
|
}, 0));
|
|
|
} else {
|
|
|
//选知识点
|
|
|
console.log(checkedNodes);
|
|
|
setSelectData(function (pre) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, pre), {}, {
|
|
|
my: checkedNodes.map(function (node) {
|
|
|
var _node$key$split = node.key.split('_'),
|
|
|
_node$key$split2 = slicedToArray_default()(_node$key$split, 2),
|
|
|
group_id = _node$key$split2[0],
|
|
|
tag_discipline_id = _node$key$split2[1];
|
|
|
return {
|
|
|
id: node.key,
|
|
|
tag_discipline_name: node.name,
|
|
|
group_id: group_id,
|
|
|
tag_discipline_id: tag_discipline_id,
|
|
|
folderType: '0',
|
|
|
group_name: node.parentName,
|
|
|
item_bank_num: node.item_banks_count,
|
|
|
quanlity: 1
|
|
|
};
|
|
|
})
|
|
|
});
|
|
|
});
|
|
|
setSelectedNum(checkedNodes.reduce(function (acc, cur) {
|
|
|
return acc + cur.item_banks_count;
|
|
|
}, 0));
|
|
|
}
|
|
|
} else {
|
|
|
setPublicCheckedKeys(checkedKeys);
|
|
|
if (getRuleValue(ruleValue) === RuleValueKeyType.OnlyFileFolder) {
|
|
|
setSelectData(function (pre) {
|
|
|
console.log("pre:", pre);
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, pre), {}, {
|
|
|
"public": checkedNodes.map(function (node) {
|
|
|
return {
|
|
|
id: node.key === '0' ? '00' : node.key,
|
|
|
teacher_group_name: node.name,
|
|
|
teacher_group_id: node.key,
|
|
|
folderType: '3',
|
|
|
item_bank_num: node.item_banks_count,
|
|
|
quanlity: 1
|
|
|
};
|
|
|
})
|
|
|
});
|
|
|
});
|
|
|
} else {
|
|
|
setSelectData(function (pre) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, pre), {}, {
|
|
|
"public": checkedNodes.map(function (node) {
|
|
|
var _node$key$split3 = node.key.split('_'),
|
|
|
_node$key$split4 = slicedToArray_default()(_node$key$split3, 2),
|
|
|
teacher_group_id = _node$key$split4[0],
|
|
|
tag_discipline_id = _node$key$split4[1];
|
|
|
return {
|
|
|
id: node.key === '0' ? '00' : node.key,
|
|
|
tag_discipline_name: node.name,
|
|
|
teacher_group_id: teacher_group_id,
|
|
|
tag_discipline_id: tag_discipline_id,
|
|
|
folderType: '3',
|
|
|
teacher_group_name: node.parentName,
|
|
|
item_bank_num: node.item_banks_count,
|
|
|
quanlity: 1
|
|
|
};
|
|
|
})
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
setSelectedNum(checkedNodes.reduce(function (acc, cur) {
|
|
|
return acc + cur.item_banks_count;
|
|
|
}, 0));
|
|
|
}
|
|
|
};
|
|
|
var _useState9 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
myCheckedKeys = _useState10[0],
|
|
|
setMyCheckedKeys = _useState10[1];
|
|
|
var _useState11 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
publicCheckedKeys = _useState12[0],
|
|
|
setPublicCheckedKeys = _useState12[1];
|
|
|
var _useState13 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState14 = slicedToArray_default()(_useState13, 2),
|
|
|
myFolderData = _useState14[0],
|
|
|
setMyFolderData = _useState14[1];
|
|
|
var _useState15 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState16 = slicedToArray_default()(_useState15, 2),
|
|
|
publicFolderData = _useState16[0],
|
|
|
setPublicFolderData = _useState16[1];
|
|
|
var _useState17 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState18 = slicedToArray_default()(_useState17, 2),
|
|
|
myDatas = _useState18[0],
|
|
|
setMyData = _useState18[1];
|
|
|
var _useState19 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState20 = slicedToArray_default()(_useState19, 2),
|
|
|
publicDatas = _useState20[0],
|
|
|
setPublicData = _useState20[1];
|
|
|
var _useState21 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState22 = slicedToArray_default()(_useState21, 2),
|
|
|
myLoading = _useState22[0],
|
|
|
setMyLoading = _useState22[1];
|
|
|
var _useState23 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState24 = slicedToArray_default()(_useState23, 2),
|
|
|
publicLoading = _useState24[0],
|
|
|
setPublicLoading = _useState24[1];
|
|
|
function initdata() {
|
|
|
return _initdata.apply(this, arguments);
|
|
|
}
|
|
|
function _initdata() {
|
|
|
_initdata = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
_context4.next = 2;
|
|
|
return (0,fetch/* default */.ZP)("/api/teach_group_shares.json", {
|
|
|
method: 'get'
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context4.sent;
|
|
|
if (res) {
|
|
|
setteamlist(res === null || res === void 0 ? void 0 : res.groups);
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return _initdata.apply(this, arguments);
|
|
|
}
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
initdata();
|
|
|
}, []);
|
|
|
var getData = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(params) {
|
|
|
var _res$navigation$, _res$navigation$2;
|
|
|
var res, rootDifficultyArr, rootTagNodeArr, _res$navigation$3, _res$navigation$4, _res$navigation$5, _res$navigation$6, _res$navigation$7, normalChildren, normalChildren2, _res$navigation$8, _res$navigation$9, _res$navigation$10, _res$navigation$11, _res$navigation$12, _normalChildren;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
params.type === '0' ? setMyLoading(true) : setPublicLoading(true);
|
|
|
_context.next = 3;
|
|
|
return (0,problemset/* getGroup */.ex)(params);
|
|
|
case 3:
|
|
|
res = _context.sent;
|
|
|
params.type === '0' ? setMyLoading(false) : setPublicLoading(false);
|
|
|
params.type === '0' ? setMyData(res) : setPublicData(res);
|
|
|
rootDifficultyArr = (_res$navigation$ = res.navigation[0]) === null || _res$navigation$ === void 0 ? void 0 : _res$navigation$.difficulty_count.map(function (diff) {
|
|
|
return {
|
|
|
label: diff === null || diff === void 0 ? void 0 : diff.name,
|
|
|
value: diffMap[diff.name]
|
|
|
};
|
|
|
});
|
|
|
rootTagNodeArr = (_res$navigation$2 = res.navigation[0]) === null || _res$navigation$2 === void 0 ? void 0 : _res$navigation$2.tag_disciplines.map(function (item) {
|
|
|
var tagDifficultyArr = item === null || item === void 0 ? void 0 : item.difficulty_count.map(function (diff) {
|
|
|
return {
|
|
|
label: diff === null || diff === void 0 ? void 0 : diff.name,
|
|
|
value: diffMap[diff.name]
|
|
|
};
|
|
|
});
|
|
|
return {
|
|
|
title: getRuleValue(ruleValue) === RuleValueKeyType.All && tagDifficultyArr.length > 0 ? /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-between",
|
|
|
style: {
|
|
|
color: '#232B40'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: "".concat(item.name, "\uFF08").concat(item.child_count, "\uFF09")
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "mr15",
|
|
|
style: {
|
|
|
color: '#666'
|
|
|
},
|
|
|
children: "\u96BE\u5EA6"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["0_".concat(item.id), 'diffValue'],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z.Group, {
|
|
|
style: {
|
|
|
columnGap: 12
|
|
|
},
|
|
|
options: tagDifficultyArr
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["0_".concat(item.id), 'diffNum'],
|
|
|
initialValue: item === null || item === void 0 ? void 0 : item.difficulty_count,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
type: "hidden"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["0_".concat(item.id), 'extra'],
|
|
|
initialValue: {
|
|
|
tag_discipline_name: item.name,
|
|
|
name: '根目录',
|
|
|
type: params.type
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
type: "hidden"
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
style: {
|
|
|
color: '#232B40'
|
|
|
},
|
|
|
children: [item.name, "\uFF08", item.child_count, "\uFF09"]
|
|
|
}),
|
|
|
key: "0_".concat(item.id),
|
|
|
name: item.name,
|
|
|
parentName: '根目录',
|
|
|
item_banks_count: item.child_count,
|
|
|
icon: null,
|
|
|
isLeaf: true,
|
|
|
checkable: getRuleValue(ruleValue) === RuleValueKeyType.FileFolderAndKnowledge,
|
|
|
disableCheckbox: item.child_count === 0
|
|
|
};
|
|
|
});
|
|
|
if (params.type === '0') {
|
|
|
normalChildren = generateTree(res.data, ruleValue, '0');
|
|
|
normalChildren2 = generateTree2(res.data, ruleValue, '0');
|
|
|
console.log("normalChildren2:", normalChildren2);
|
|
|
setMyFolderData([{
|
|
|
title: getRuleValue(ruleValue) === RuleValueKeyType.FileFolderAndDiff ? /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-between",
|
|
|
style: {
|
|
|
color: '#232B40'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: "\u6839\u76EE\u5F55\uFF08".concat((_res$navigation$3 = res.navigation[0]) === null || _res$navigation$3 === void 0 ? void 0 : _res$navigation$3.child_count, "\uFF09")
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "mr15",
|
|
|
style: {
|
|
|
color: '#666'
|
|
|
},
|
|
|
children: "\u96BE\u5EA6"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["0", 'diffValue'],
|
|
|
initialValue: [],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z.Group, {
|
|
|
style: {
|
|
|
columnGap: 12
|
|
|
},
|
|
|
options: rootDifficultyArr
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["0", 'diffNum'],
|
|
|
initialValue: (_res$navigation$4 = res.navigation[0]) === null || _res$navigation$4 === void 0 ? void 0 : _res$navigation$4.difficulty_count,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
type: "hidden"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["0", 'extra'],
|
|
|
initialValue: {
|
|
|
type: '0',
|
|
|
group_id: '0',
|
|
|
name: '根目录'
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
type: "hidden"
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#232B40'
|
|
|
},
|
|
|
children: "\u6839\u76EE\u5F55\uFF08".concat((_res$navigation$5 = res.navigation[0]) === null || _res$navigation$5 === void 0 ? void 0 : _res$navigation$5.child_count, "\uFF09")
|
|
|
}),
|
|
|
key: '0',
|
|
|
name: '根目录',
|
|
|
item_banks_count: (_res$navigation$6 = res.navigation[0]) === null || _res$navigation$6 === void 0 ? void 0 : _res$navigation$6.child_count,
|
|
|
disabled: ((_res$navigation$7 = res.navigation[0]) === null || _res$navigation$7 === void 0 ? void 0 : _res$navigation$7.child_count) > 0 ? false : true,
|
|
|
checkable: getRuleValue(ruleValue) === RuleValueKeyType.OnlyFileFolder,
|
|
|
icon: function icon(e) {
|
|
|
if (e.expanded) {
|
|
|
// 展开
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: folder_opened_namespaceObject,
|
|
|
className: RuleModalmodules.folderIcon
|
|
|
});
|
|
|
} else {
|
|
|
// 收起
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: folder_closed_namespaceObject,
|
|
|
className: RuleModalmodules.folderIcon
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
isLeaf: false,
|
|
|
children: getRuleValue(ruleValue) === RuleValueKeyType.OnlyFileFolder || getRuleValue(ruleValue) === RuleValueKeyType.FileFolderAndDiff ? normalChildren : [].concat(toConsumableArray_default()(normalChildren2), toConsumableArray_default()(rootTagNodeArr))
|
|
|
}]);
|
|
|
} else {
|
|
|
_normalChildren = generateTree(res.data, ruleValue, '3'); // return
|
|
|
setPublicFolderData([{
|
|
|
title: getRuleValue(ruleValue) === RuleValueKeyType.FileFolderAndDiff ? /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-between",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: "\u6839\u76EE\u5F55\uFF08".concat((_res$navigation$8 = res.navigation[0]) === null || _res$navigation$8 === void 0 ? void 0 : _res$navigation$8.child_count, "\uFF09")
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "mr15",
|
|
|
style: {
|
|
|
color: '#666'
|
|
|
},
|
|
|
children: "\u96BE\u5EA6"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["0", 'diffValue'],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z.Group, {
|
|
|
style: {
|
|
|
columnGap: 12
|
|
|
},
|
|
|
options: rootDifficultyArr
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["0", 'diffNum'],
|
|
|
initialValue: (_res$navigation$9 = res.navigation[0]) === null || _res$navigation$9 === void 0 ? void 0 : _res$navigation$9.difficulty_count,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
type: "hidden"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: ["0", 'extra'],
|
|
|
initialValue: {
|
|
|
type: '3',
|
|
|
group_id: '0',
|
|
|
name: '根目录'
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
type: "hidden"
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#232B40'
|
|
|
},
|
|
|
children: "\u6839\u76EE\u5F55\uFF08".concat((_res$navigation$10 = res.navigation[0]) === null || _res$navigation$10 === void 0 ? void 0 : _res$navigation$10.child_count, "\uFF09")
|
|
|
}),
|
|
|
key: '0',
|
|
|
name: '根目录',
|
|
|
item_banks_count: (_res$navigation$11 = res.navigation[0]) === null || _res$navigation$11 === void 0 ? void 0 : _res$navigation$11.child_count,
|
|
|
checkable: getRuleValue(ruleValue) === RuleValueKeyType.OnlyFileFolder,
|
|
|
icon: function icon(e) {
|
|
|
if (e.expanded) {
|
|
|
// 展开
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: folderopen1_namespaceObject,
|
|
|
className: RuleModalmodules.shareFolderIcon
|
|
|
});
|
|
|
} else {
|
|
|
// 收起
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: folder_namespaceObject,
|
|
|
className: RuleModalmodules.shareFolderIcon
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
isLeaf: false,
|
|
|
disabled: ((_res$navigation$12 = res.navigation[0]) === null || _res$navigation$12 === void 0 ? void 0 : _res$navigation$12.child_count) > 0 ? false : true,
|
|
|
children: getRuleValue(ruleValue) === RuleValueKeyType.OnlyFileFolder || getRuleValue(ruleValue) === RuleValueKeyType.FileFolderAndDiff ? _normalChildren : [].concat(toConsumableArray_default()(_normalChildren), toConsumableArray_default()(rootTagNodeArr))
|
|
|
}]);
|
|
|
}
|
|
|
// setTimeout(() => {
|
|
|
// setIsFirst(false)
|
|
|
// },500)
|
|
|
case 9:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function getData(_x) {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (activeKey === "1") {
|
|
|
getData({
|
|
|
type: '0',
|
|
|
group_id: 0,
|
|
|
item_type: currentItemType,
|
|
|
show_children: true
|
|
|
});
|
|
|
} else if (activeKey === "2") {
|
|
|
getData({
|
|
|
type: '3',
|
|
|
except_mine: true,
|
|
|
item_type: currentItemType,
|
|
|
show_children: true,
|
|
|
teach_group_id: teamvalue === 'all' ? '' : teamvalue
|
|
|
});
|
|
|
}
|
|
|
}, [ruleValue, activeKey, teamvalue]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
console.log("selectData-active:", selectData, defaultData, activeKey);
|
|
|
// setMyFolderData([])
|
|
|
// setPublicFolderData
|
|
|
|
|
|
if (activeKey === "1") {
|
|
|
var _selectData$my, _selectData$my2, _selectData$my2$reduc;
|
|
|
setMyCheckedKeys(selectData === null || selectData === void 0 || (_selectData$my = selectData.my) === null || _selectData$my === void 0 ? void 0 : _selectData$my.map(function (item) {
|
|
|
return item.id;
|
|
|
}));
|
|
|
setSelectedNum((selectData === null || selectData === void 0 || (_selectData$my2 = selectData.my) === null || _selectData$my2 === void 0 || (_selectData$my2$reduc = _selectData$my2.reduce) === null || _selectData$my2$reduc === void 0 ? void 0 : _selectData$my2$reduc.call(_selectData$my2, function (acc, cur) {
|
|
|
return acc + cur.item_bank_num;
|
|
|
}, 0)) || 0);
|
|
|
} else if (activeKey === "2") {
|
|
|
var _selectData$public, _selectData$public2, _selectData$public2$r;
|
|
|
setPublicCheckedKeys(selectData === null || selectData === void 0 || (_selectData$public = selectData["public"]) === null || _selectData$public === void 0 ? void 0 : _selectData$public.map(function (item) {
|
|
|
return item.id;
|
|
|
}));
|
|
|
setSelectedNum((selectData === null || selectData === void 0 || (_selectData$public2 = selectData["public"]) === null || _selectData$public2 === void 0 || (_selectData$public2$r = _selectData$public2.reduce) === null || _selectData$public2$r === void 0 ? void 0 : _selectData$public2$r.call(_selectData$public2, function (acc, cur) {
|
|
|
return acc + cur.item_bank_num;
|
|
|
}, 0)) || 0);
|
|
|
}
|
|
|
if (getRuleValue(ruleValue) === RuleValueKeyType.All) {
|
|
|
if (activeKey === "1") {
|
|
|
var _selectData$my3, _selectData$filter;
|
|
|
setMyCheckedKeys(selectData === null || selectData === void 0 || (_selectData$my3 = selectData.my) === null || _selectData$my3 === void 0 ? void 0 : _selectData$my3.map(function (item) {
|
|
|
return item.id;
|
|
|
}));
|
|
|
setSelectedNum((selectData === null || selectData === void 0 ? void 0 : selectData.filter(function (item) {
|
|
|
return !item.is_share;
|
|
|
}).reduce(function (acc, cur) {
|
|
|
return acc + cur.item_bank_num;
|
|
|
}, 0)) || 0);
|
|
|
selectData === null || selectData === void 0 || (_selectData$filter = selectData.filter(function (item) {
|
|
|
return !item.is_share;
|
|
|
})) === null || _selectData$filter === void 0 || _selectData$filter.forEach(function (item) {
|
|
|
var prev = form.getFieldValue(["".concat(item.group_id || 0, "_").concat(item.tag_discipline_id), 'diffValue']) || [];
|
|
|
console.log("prev:", prev);
|
|
|
if (!(prev !== null && prev !== void 0 && prev.includes[item.difficulty])) {
|
|
|
form.setFieldValue(["".concat(item.group_id || 0, "_").concat(item.tag_discipline_id), 'diffValue'], Array.from(new Set([].concat(toConsumableArray_default()(prev), [item.difficulty]))));
|
|
|
}
|
|
|
// form.setFieldValue([`${item.group_id}`, 'diffValue'], [...prev, item.difficulty])
|
|
|
});
|
|
|
} else if (activeKey === "2") {
|
|
|
var _selectData$public3, _selectData$filter2;
|
|
|
setPublicCheckedKeys(selectData === null || selectData === void 0 || (_selectData$public3 = selectData["public"]) === null || _selectData$public3 === void 0 ? void 0 : _selectData$public3.map(function (item) {
|
|
|
return item.id;
|
|
|
}));
|
|
|
setSelectedNum((selectData === null || selectData === void 0 ? void 0 : selectData.filter(function (item) {
|
|
|
return !!item.is_share;
|
|
|
}).reduce(function (acc, cur) {
|
|
|
return acc + cur.item_bank_num;
|
|
|
}, 0)) || 0);
|
|
|
selectData === null || selectData === void 0 || (_selectData$filter2 = selectData.filter(function (item) {
|
|
|
return !!item.is_share;
|
|
|
})) === null || _selectData$filter2 === void 0 || _selectData$filter2.forEach(function (item) {
|
|
|
var prev = form.getFieldValue(["".concat(item.teacher_group_id || 0, "_").concat(item.tag_discipline_id), 'diffValue']) || [];
|
|
|
if (!(prev !== null && prev !== void 0 && prev.includes[item.difficulty])) {
|
|
|
form.setFieldValue(["".concat(item.teacher_group_id || 0, "_").concat(item.tag_discipline_id), 'diffValue'], Array.from(new Set([].concat(toConsumableArray_default()(prev), [item.difficulty]))));
|
|
|
}
|
|
|
// form.setFieldValue([`${item.teacher_group_id}`, 'diffValue'], [...prev, item.difficulty])
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
if (getRuleValue(ruleValue) === RuleValueKeyType.FileFolderAndDiff) {
|
|
|
form.resetFields();
|
|
|
setTimeout(function () {
|
|
|
setSelectData(selectData);
|
|
|
}, 300);
|
|
|
if (activeKey === "1") {
|
|
|
var _selectData$filter3;
|
|
|
setSelectedNum((selectData === null || selectData === void 0 ? void 0 : selectData.filter(function (item) {
|
|
|
return !item.is_share;
|
|
|
}).reduce(function (acc, cur) {
|
|
|
return acc + cur.item_bank_num;
|
|
|
}, 0)) || 0);
|
|
|
selectData === null || selectData === void 0 || (_selectData$filter3 = selectData.filter(function (item) {
|
|
|
return !item.is_share;
|
|
|
})) === null || _selectData$filter3 === void 0 || _selectData$filter3.forEach(function (item) {
|
|
|
var prev = form.getFieldValue(["".concat(item.group_id), 'diffValue']) || [];
|
|
|
console.log("prev:", prev);
|
|
|
if (!(prev !== null && prev !== void 0 && prev.includes[item.difficulty])) {
|
|
|
form.setFieldValue(["".concat(item.group_id), 'diffValue'], Array.from(new Set([].concat(toConsumableArray_default()(prev), [item.difficulty]))));
|
|
|
}
|
|
|
// form.setFieldValue([`${item.group_id}`, 'diffValue'], [...prev, item.difficulty])
|
|
|
});
|
|
|
} else {
|
|
|
var _selectData$filter4;
|
|
|
setSelectedNum((selectData === null || selectData === void 0 ? void 0 : selectData.filter(function (item) {
|
|
|
return !!item.is_share;
|
|
|
}).reduce(function (acc, cur) {
|
|
|
return acc + cur.item_bank_num;
|
|
|
}, 0)) || 0);
|
|
|
selectData === null || selectData === void 0 || (_selectData$filter4 = selectData.filter(function (item) {
|
|
|
return !!item.is_share;
|
|
|
})) === null || _selectData$filter4 === void 0 || _selectData$filter4.forEach(function (item) {
|
|
|
var prev = form.getFieldValue(["".concat(item.teacher_group_id), 'diffValue']) || [];
|
|
|
if (!(prev !== null && prev !== void 0 && prev.includes[item.difficulty])) {
|
|
|
form.setFieldValue(["".concat(item.teacher_group_id), 'diffValue'], Array.from(new Set([].concat(toConsumableArray_default()(prev), [item.difficulty]))));
|
|
|
}
|
|
|
// form.setFieldValue([`${item.teacher_group_id}`, 'diffValue'], [...prev, item.difficulty])
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}, [activeKey]);
|
|
|
console.log("1111111111:", myCheckedKeys, publicCheckedKeys);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
// if(!isFirst){
|
|
|
// return
|
|
|
// }
|
|
|
setTimeout(function () {
|
|
|
switch (getRuleValue(ruleValue)) {
|
|
|
case RuleValueKeyType.OnlyFileFolder:
|
|
|
{
|
|
|
var myData = [];
|
|
|
var publicData = [];
|
|
|
var _iterator = createForOfIteratorHelper_default()(selectData.my || []),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var item = _step.value;
|
|
|
myData.push(item);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
var _iterator2 = createForOfIteratorHelper_default()(selectData["public"] || []),
|
|
|
_step2;
|
|
|
try {
|
|
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
|
var _item = _step2.value;
|
|
|
publicData.push(_item);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator2.e(err);
|
|
|
} finally {
|
|
|
_iterator2.f();
|
|
|
}
|
|
|
setMyCheckedKeys(myData.map(function (item) {
|
|
|
return "".concat(item.group_id);
|
|
|
}));
|
|
|
setPublicCheckedKeys(publicData.map(function (item) {
|
|
|
return "".concat(item.teacher_group_id);
|
|
|
}));
|
|
|
if (activeKey === "1") {
|
|
|
setSelectedNum(myData.reduce(function (acc, cur) {
|
|
|
return acc + cur.item_bank_num;
|
|
|
}, 0));
|
|
|
} else {
|
|
|
setSelectedNum(publicData.reduce(function (acc, cur) {
|
|
|
return acc + cur.item_bank_num;
|
|
|
}, 0));
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
case RuleValueKeyType.FileFolderAndKnowledge:
|
|
|
{
|
|
|
var _ref3;
|
|
|
var _myData = [];
|
|
|
var _publicData = [];
|
|
|
var _iterator3 = createForOfIteratorHelper_default()((selectData === null || selectData === void 0 ? void 0 : selectData.my) || []),
|
|
|
_step3;
|
|
|
try {
|
|
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
|
var _item2 = _step3.value;
|
|
|
// if (item?.group_name) {
|
|
|
_myData.push(_item2);
|
|
|
// } else {
|
|
|
// publicData.push(item)
|
|
|
// }
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator3.e(err);
|
|
|
} finally {
|
|
|
_iterator3.f();
|
|
|
}
|
|
|
var _iterator4 = createForOfIteratorHelper_default()((selectData === null || selectData === void 0 ? void 0 : selectData["public"]) || []),
|
|
|
_step4;
|
|
|
try {
|
|
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
|
var _item3 = _step4.value;
|
|
|
// if (item?.group_name) {
|
|
|
// myData.push(item)
|
|
|
// } else {
|
|
|
_publicData.push(_item3);
|
|
|
// }
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator4.e(err);
|
|
|
} finally {
|
|
|
_iterator4.f();
|
|
|
}
|
|
|
setSelectedNum((_ref3 = activeKey === "1" ? _myData : _publicData) === null || _ref3 === void 0 ? void 0 : _ref3.reduce(function (acc, cur) {
|
|
|
return acc + cur.item_bank_num;
|
|
|
}, 0));
|
|
|
setMyCheckedKeys(_myData.map(function (item) {
|
|
|
return "".concat(item.group_id, "_").concat(item.tag_discipline_id);
|
|
|
}));
|
|
|
setPublicCheckedKeys(_publicData.map(function (item) {
|
|
|
return "".concat(item.teacher_group_id, "_").concat(item.tag_discipline_id);
|
|
|
}));
|
|
|
break;
|
|
|
}
|
|
|
case RuleValueKeyType.All:
|
|
|
{
|
|
|
if (activeKey === "1") {
|
|
|
var _selectData$filter5;
|
|
|
setSelectedNum((selectData === null || selectData === void 0 ? void 0 : selectData.filter(function (item) {
|
|
|
return !item.is_share;
|
|
|
}).reduce(function (acc, cur) {
|
|
|
return acc + cur.item_bank_num;
|
|
|
}, 0)) || 0);
|
|
|
selectData === null || selectData === void 0 || (_selectData$filter5 = selectData.filter(function (item) {
|
|
|
return !item.is_share;
|
|
|
})) === null || _selectData$filter5 === void 0 || _selectData$filter5.forEach(function (item) {
|
|
|
var prev = form.getFieldValue(["".concat(item.group_id || 0, "_").concat(item.tag_discipline_id), 'diffValue']) || [];
|
|
|
console.log("prev:", prev, item.difficulty, item);
|
|
|
if (!(prev !== null && prev !== void 0 && prev.includes[item.difficulty])) {
|
|
|
form.setFieldValue(["".concat(item.group_id || 0, "_").concat(item.tag_discipline_id), 'diffValue'], Array.from(new Set([].concat(toConsumableArray_default()(prev), [item.difficulty]))));
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
var _selectData$filter6;
|
|
|
setSelectedNum((selectData === null || selectData === void 0 ? void 0 : selectData.filter(function (item) {
|
|
|
return !!item.is_share;
|
|
|
}).reduce(function (acc, cur) {
|
|
|
return acc + cur.item_bank_num;
|
|
|
}, 0)) || 0);
|
|
|
selectData === null || selectData === void 0 || (_selectData$filter6 = selectData.filter(function (item) {
|
|
|
return !!item.is_share;
|
|
|
})) === null || _selectData$filter6 === void 0 || _selectData$filter6.forEach(function (item) {
|
|
|
var prev = form.getFieldValue(["".concat(item.group_id || 0, "_").concat(item.tag_discipline_id), 'diffValue']) || [];
|
|
|
console.log("prev:", prev, item.difficulty, item);
|
|
|
if (!(prev !== null && prev !== void 0 && prev.includes[item.difficulty])) {
|
|
|
form.setFieldValue(["".concat(item.group_id || 0, "_").concat(item.tag_discipline_id), 'diffValue'], Array.from(new Set([].concat(toConsumableArray_default()(prev), [item.difficulty]))));
|
|
|
}
|
|
|
// form.setFieldValue([`${item.group_id}`, 'diffValue'], [...prev, item.difficulty])
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// if (myFolderData.length > 0 || publicFolderData.length > 0) {
|
|
|
// defaultData.forEach(item => {
|
|
|
// const prev = form.getFieldValue([`${item.group_id}_${item.tag_discipline_id}`, 'diffValue']) || []
|
|
|
// form.setFieldValue([`${item.group_id}_${item.tag_discipline_id}`, 'diffValue'], [...prev, item.difficulty])
|
|
|
// })
|
|
|
// }
|
|
|
break;
|
|
|
}
|
|
|
case RuleValueKeyType.FileFolderAndDiff:
|
|
|
{
|
|
|
if (activeKey === "1") {
|
|
|
var _selectData$filter7;
|
|
|
setSelectedNum((selectData === null || selectData === void 0 ? void 0 : selectData.filter(function (item) {
|
|
|
return !item.is_share;
|
|
|
}).reduce(function (acc, cur) {
|
|
|
return acc + cur.item_bank_num;
|
|
|
}, 0)) || 0);
|
|
|
selectData === null || selectData === void 0 || (_selectData$filter7 = selectData.filter(function (item) {
|
|
|
return !item.is_share;
|
|
|
})) === null || _selectData$filter7 === void 0 || _selectData$filter7.forEach(function (item) {
|
|
|
var prev = form.getFieldValue(["".concat(item.group_id), 'diffValue']) || [];
|
|
|
console.log("prev:", prev, item.difficulty);
|
|
|
if (!(prev !== null && prev !== void 0 && prev.includes[item.difficulty])) {
|
|
|
form.setFieldValue(["".concat(item.group_id), 'diffValue'], Array.from(new Set([].concat(toConsumableArray_default()(prev), [item.difficulty]))));
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
var _selectData$filter8;
|
|
|
setSelectedNum((selectData === null || selectData === void 0 ? void 0 : selectData.filter(function (item) {
|
|
|
return !!item.is_share;
|
|
|
}).reduce(function (acc, cur) {
|
|
|
return acc + cur.item_bank_num;
|
|
|
}, 0)) || 0);
|
|
|
selectData === null || selectData === void 0 || (_selectData$filter8 = selectData.filter(function (item) {
|
|
|
return !!item.is_share;
|
|
|
})) === null || _selectData$filter8 === void 0 || _selectData$filter8.forEach(function (item) {
|
|
|
var prev = form.getFieldValue(["".concat(item.group_id), 'diffValue']) || [];
|
|
|
if (!(prev !== null && prev !== void 0 && prev.includes[item.difficulty])) {
|
|
|
form.setFieldValue(["".concat(item.group_id), 'diffValue'], Array.from(new Set([].concat(toConsumableArray_default()(prev), [item.difficulty]))));
|
|
|
}
|
|
|
// form.setFieldValue([`${item.group_id}`, 'diffValue'], [...prev, item.difficulty])
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// if (myFolderData.length > 0 || publicFolderData.length > 0) {
|
|
|
// defaultData.forEach(item => {
|
|
|
// const prev = form.getFieldValue([`${item.group_id}`, 'diffValue']) || []
|
|
|
// form.setFieldValue([`${item.group_id}`, 'diffValue'], [...prev, item.difficulty])
|
|
|
// })
|
|
|
// }
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}, 800);
|
|
|
}, [defaultData, ruleValue, myFolderData, publicFolderData]);
|
|
|
var _useState25 = (0,_react_17_0_2_react.useState)(0),
|
|
|
_useState26 = slicedToArray_default()(_useState25, 2),
|
|
|
selectedNum = _useState26[0],
|
|
|
setSelectedNum = _useState26[1];
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z, {
|
|
|
form: form,
|
|
|
onValuesChange: ( /*#__PURE__*/function () {
|
|
|
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(c, v) {
|
|
|
var count, values, valuesd, arr, _i, _Object$keys, _values$id, id, obj, map, _arr, _loop, _i2, _Object$keys2;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
console.log("onValuesChange:", v, c);
|
|
|
count = 0;
|
|
|
if (!(getRuleValue(ruleValue) === RuleValueKeyType.FileFolderAndDiff)) {
|
|
|
_context3.next = 15;
|
|
|
break;
|
|
|
}
|
|
|
_context3.next = 5;
|
|
|
return form.getFieldValue();
|
|
|
case 5:
|
|
|
values = _context3.sent;
|
|
|
valuesd = [];
|
|
|
arr = [];
|
|
|
for (_i = 0, _Object$keys = Object.keys(values); _i < _Object$keys.length; _i++) {
|
|
|
id = _Object$keys[_i];
|
|
|
if (!!((_values$id = values[id]) !== null && _values$id !== void 0 && (_values$id = _values$id.diffValue) !== null && _values$id !== void 0 && _values$id.length) && id !== "null" && id !== null) {
|
|
|
obj = values[id];
|
|
|
valuesd.push(objectSpread2_default()({
|
|
|
id: id
|
|
|
}, obj));
|
|
|
}
|
|
|
}
|
|
|
map = {
|
|
|
1: '简单',
|
|
|
2: '适中',
|
|
|
3: '困难'
|
|
|
};
|
|
|
valuesd.map(function (item) {
|
|
|
var _item$diffValue;
|
|
|
if (item.id == 0) {
|
|
|
var _myDatas$navigation, _publicDatas$navigati;
|
|
|
item.diffNum = activeKey === "1" ? myDatas === null || myDatas === void 0 || (_myDatas$navigation = myDatas.navigation) === null || _myDatas$navigation === void 0 || (_myDatas$navigation = _myDatas$navigation[0]) === null || _myDatas$navigation === void 0 ? void 0 : _myDatas$navigation.difficulty_count : publicDatas === null || publicDatas === void 0 || (_publicDatas$navigati = publicDatas.navigation) === null || _publicDatas$navigati === void 0 || (_publicDatas$navigati = _publicDatas$navigati[0]) === null || _publicDatas$navigati === void 0 ? void 0 : _publicDatas$navigati.difficulty_count;
|
|
|
}
|
|
|
item === null || item === void 0 || (_item$diffValue = item.diffValue) === null || _item$diffValue === void 0 || _item$diffValue.map(function (i) {
|
|
|
var _item$extra, _item$diffNum;
|
|
|
var newItem = {
|
|
|
group_name: ((_item$extra = item.extra) === null || _item$extra === void 0 ? void 0 : _item$extra.name) || "",
|
|
|
teacher_group_name: '',
|
|
|
id: "".concat(item.id, "_").concat(i),
|
|
|
group_id: item.id,
|
|
|
difficulty: i,
|
|
|
item_bank_num: (_item$diffNum = item.diffNum) === null || _item$diffNum === void 0 || (_item$diffNum = _item$diffNum.filter(function (d) {
|
|
|
return d.name === map[i];
|
|
|
})) === null || _item$diffNum === void 0 || (_item$diffNum = _item$diffNum[0]) === null || _item$diffNum === void 0 ? void 0 : _item$diffNum.value
|
|
|
};
|
|
|
if (activeKey === "2") {
|
|
|
var _item$extra2;
|
|
|
newItem.is_share = true;
|
|
|
newItem.teacher_group_id = item.id;
|
|
|
newItem.teacher_group_name = (_item$extra2 = item.extra) === null || _item$extra2 === void 0 ? void 0 : _item$extra2.name;
|
|
|
}
|
|
|
arr.push(newItem);
|
|
|
});
|
|
|
});
|
|
|
count = arr.reduce(function (acc, cur) {
|
|
|
return acc + cur.item_bank_num;
|
|
|
}, 0);
|
|
|
setSelectData([].concat(arr, toConsumableArray_default()(selectData === null || selectData === void 0 ? void 0 : selectData.filter(function (item) {
|
|
|
return activeKey === '1' ? item.is_share : !item.is_share;
|
|
|
}))));
|
|
|
_context3.next = 25;
|
|
|
break;
|
|
|
case 15:
|
|
|
if (!(getRuleValue(ruleValue) === RuleValueKeyType.All)) {
|
|
|
_context3.next = 25;
|
|
|
break;
|
|
|
}
|
|
|
_arr = [];
|
|
|
_loop = /*#__PURE__*/regeneratorRuntime_default()().mark(function _loop() {
|
|
|
var _extra$tag_discipline;
|
|
|
var id, _v$id, _v$id$diffNum, diffNum, _v$id$diffValue, diffValue, _v$id$extra, extra, _id$split, _id$split2, group_id, tag_discipline_id, extraitem;
|
|
|
return regeneratorRuntime_default()().wrap(function _loop$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
id = _Object$keys2[_i2];
|
|
|
_v$id = v[id], _v$id$diffNum = _v$id.diffNum, diffNum = _v$id$diffNum === void 0 ? [] : _v$id$diffNum, _v$id$diffValue = _v$id.diffValue, diffValue = _v$id$diffValue === void 0 ? [] : _v$id$diffValue, _v$id$extra = _v$id.extra, extra = _v$id$extra === void 0 ? {} : _v$id$extra;
|
|
|
console.log('---', extra);
|
|
|
_id$split = id.split('_'), _id$split2 = slicedToArray_default()(_id$split, 2), group_id = _id$split2[0], tag_discipline_id = _id$split2[1];
|
|
|
extraitem = (_extra$tag_discipline = extra.tag_disciplines) === null || _extra$tag_discipline === void 0 || (_extra$tag_discipline = _extra$tag_discipline.filter(function (item) {
|
|
|
return parseInt(item.id) === parseInt(tag_discipline_id);
|
|
|
})) === null || _extra$tag_discipline === void 0 ? void 0 : _extra$tag_discipline[0];
|
|
|
diffValue.forEach(function (diffItemValue) {
|
|
|
var _diffNum$find;
|
|
|
var map = {
|
|
|
1: '简单',
|
|
|
2: '适中',
|
|
|
3: '困难'
|
|
|
};
|
|
|
var currentDiffNum = diffNum === null || diffNum === void 0 || (_diffNum$find = diffNum.find(function (i) {
|
|
|
return i.name === map[diffItemValue];
|
|
|
})) === null || _diffNum$find === void 0 ? void 0 : _diffNum$find.value;
|
|
|
var newItem = {
|
|
|
group_name: '',
|
|
|
teacher_group_name: '',
|
|
|
tag_discipline_name: (extraitem === null || extraitem === void 0 ? void 0 : extraitem.name) || extra.tag_discipline_name,
|
|
|
id: "".concat(id, "_").concat(diffItemValue),
|
|
|
group_id: group_id,
|
|
|
is_share: extraitem !== null && extraitem !== void 0 && extraitem.is_share || (extra === null || extra === void 0 ? void 0 : extra.type) === '3' ? true : false,
|
|
|
tag_discipline_id: tag_discipline_id,
|
|
|
difficulty: diffItemValue,
|
|
|
item_bank_num: currentDiffNum
|
|
|
};
|
|
|
count += currentDiffNum;
|
|
|
if (extra.type === '0') {
|
|
|
newItem.group_name = extra.name;
|
|
|
} else {
|
|
|
newItem.teacher_group_name = extra.name;
|
|
|
}
|
|
|
if (activeKey === "2") {
|
|
|
newItem.is_share = true;
|
|
|
newItem.teacher_group_id = extra.id || 0;
|
|
|
newItem.teacher_group_name = extra.name;
|
|
|
}
|
|
|
if (currentDiffNum > 0) {
|
|
|
_arr.push(newItem);
|
|
|
}
|
|
|
});
|
|
|
case 6:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _loop);
|
|
|
});
|
|
|
_i2 = 0, _Object$keys2 = Object.keys(v);
|
|
|
case 19:
|
|
|
if (!(_i2 < _Object$keys2.length)) {
|
|
|
_context3.next = 24;
|
|
|
break;
|
|
|
}
|
|
|
return _context3.delegateYield(_loop(), "t0", 21);
|
|
|
case 21:
|
|
|
_i2++;
|
|
|
_context3.next = 19;
|
|
|
break;
|
|
|
case 24:
|
|
|
setSelectData([].concat(_arr, toConsumableArray_default()(selectData === null || selectData === void 0 ? void 0 : selectData.filter(function (item) {
|
|
|
return activeKey === '1' ? item.is_share : !item.is_share;
|
|
|
}))));
|
|
|
case 25:
|
|
|
setSelectedNum(count);
|
|
|
case 26:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function (_x2, _x3) {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}()),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(tabs/* default */.Z, {
|
|
|
destroyInactiveTabPane: true,
|
|
|
activeKey: activeKey,
|
|
|
onChange: function onChange(key) {
|
|
|
return setActiveKey(key);
|
|
|
},
|
|
|
style: {
|
|
|
minHeight: 260
|
|
|
},
|
|
|
tabBarExtraContent: {
|
|
|
right: activeKey === '2' && (teamlist === null || teamlist === void 0 ? void 0 : teamlist.length) > 0 && /*#__PURE__*/(0,jsx_runtime.jsxs)(es_select["default"], {
|
|
|
onChange: function onChange(value) {
|
|
|
setteamvalue(value);
|
|
|
},
|
|
|
value: teamvalue,
|
|
|
style: {
|
|
|
width: 120
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
|
|
|
value: "all",
|
|
|
children: "\u5168\u90E8"
|
|
|
}, "all"), teamlist === null || teamlist === void 0 ? void 0 : teamlist.map(function (item) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
|
|
|
value: item === null || item === void 0 ? void 0 : item.group_id,
|
|
|
children: item === null || item === void 0 ? void 0 : item.name
|
|
|
}, item === null || item === void 0 ? void 0 : item.group_id);
|
|
|
})]
|
|
|
})
|
|
|
},
|
|
|
items: [{
|
|
|
key: '1',
|
|
|
label: '我创建的',
|
|
|
children: (myFolderData === null || myFolderData === void 0 ? void 0 : myFolderData.length) === 0 ? /*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
|
|
|
spinning: myLoading,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(NoData/* default */.Z, {
|
|
|
ButtonTwo: /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
|
|
|
target: "_blank",
|
|
|
href: "/problemset",
|
|
|
children: ["\u524D\u5F80\u9898\u5E93\uFF0C\u65B0\u589E\u66F4\u591A\u8BD5\u9898", '>']
|
|
|
})
|
|
|
})
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: RuleModalmodules.folderAreaWrapper,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-between",
|
|
|
align: "middle",
|
|
|
className: RuleModalmodules.folderAreaHeader,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u6587\u4EF6\u5939"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "mr20",
|
|
|
children: ["\u5DF2\u9009", /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
style: {
|
|
|
color: '#3061D0'
|
|
|
},
|
|
|
children: [" ", selectedNum, " "]
|
|
|
}), "\u9898"]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
|
|
|
spinning: myLoading,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
minHeight: 200
|
|
|
},
|
|
|
children: myFolderData.length > 0 && /*#__PURE__*/(0,jsx_runtime.jsx)(tree/* default */.Z, {
|
|
|
checkable: true,
|
|
|
className: RuleModalmodules.folderWrapper,
|
|
|
rootStyle: {
|
|
|
paddingLeft: 15,
|
|
|
paddingRight: 0,
|
|
|
paddingTop: 10
|
|
|
},
|
|
|
selectable: false,
|
|
|
onCheck: function onCheck(checkedKey, info) {
|
|
|
return _onCheck(checkedKey, info, '0');
|
|
|
},
|
|
|
checkedKeys: myCheckedKeys,
|
|
|
checkStrictly: true,
|
|
|
treeData: myFolderData,
|
|
|
showIcon: true,
|
|
|
blockNode: true,
|
|
|
defaultExpandAll: true
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
}, {
|
|
|
key: '2',
|
|
|
label: '团队共享',
|
|
|
children: (publicFolderData === null || publicFolderData === void 0 ? void 0 : publicFolderData.length) === 0 ? /*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
|
|
|
spinning: publicLoading,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(NoData/* default */.Z, {
|
|
|
ButtonTwo: /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
|
|
|
target: "_blank",
|
|
|
href: "/problemset",
|
|
|
children: ["\u524D\u5F80\u9898\u5E93\uFF0C\u65B0\u589E\u66F4\u591A\u8BD5\u9898", '>']
|
|
|
})
|
|
|
})
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: RuleModalmodules.folderAreaWrapper,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-between",
|
|
|
align: "middle",
|
|
|
className: RuleModalmodules.folderAreaHeader,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u6587\u4EF6\u5939"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "mr20",
|
|
|
children: ["\u5DF2\u9009", /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
style: {
|
|
|
color: '#3061D0'
|
|
|
},
|
|
|
children: [" ", selectedNum || 0, " "]
|
|
|
}), "\u9898"]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
|
|
|
spinning: publicLoading,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
minHeight: 200
|
|
|
},
|
|
|
children: (publicFolderData === null || publicFolderData === void 0 ? void 0 : publicFolderData.length) > 0 && /*#__PURE__*/(0,jsx_runtime.jsx)(tree/* default */.Z, {
|
|
|
checkable: true,
|
|
|
className: RuleModalmodules.folderWrapper,
|
|
|
selectable: false,
|
|
|
rootStyle: {
|
|
|
paddingLeft: 15,
|
|
|
paddingRight: 0,
|
|
|
paddingTop: 10
|
|
|
},
|
|
|
onCheck: function onCheck(checkedKey, info) {
|
|
|
return _onCheck(checkedKey, info, '3');
|
|
|
},
|
|
|
checkedKeys: publicCheckedKeys,
|
|
|
checkStrictly: true,
|
|
|
treeData: publicFolderData,
|
|
|
showIcon: true,
|
|
|
blockNode: true,
|
|
|
defaultExpandAll: true
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
}]
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var RuleModal_FileFolder = (FileFolder);
|
|
|
// EXTERNAL MODULE: ./src/models/problemset/util.ts
|
|
|
var util = __webpack_require__(26747);
|
|
|
// EXTERNAL MODULE: ./src/utils/hooks/useCustomRequest.ts
|
|
|
var useCustomRequest = __webpack_require__(27082);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/QuestionInfo/RuleModal/Knowledge.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Knowledge_diffMap = {
|
|
|
'简单': 1,
|
|
|
'适中': 2,
|
|
|
'困难': 3
|
|
|
};
|
|
|
var Knowledge = function Knowledge(_ref) {
|
|
|
var ruleValue = _ref.ruleValue,
|
|
|
setSelectData = _ref.setSelectData,
|
|
|
currentItemType = _ref.currentItemType,
|
|
|
defaultData = _ref.defaultData,
|
|
|
isFirst = _ref.isFirst;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
courseOptions = _useState2[0],
|
|
|
setCourseOptions = _useState2[1];
|
|
|
var _useCustomRequest = (0,useCustomRequest/* useCustomRequest */.U)(getDisciplines, {
|
|
|
source: 'question',
|
|
|
page: 1,
|
|
|
per_page: 10,
|
|
|
group_id: 0,
|
|
|
keyword: '',
|
|
|
group_type: 0,
|
|
|
clazz: 'ItemBanksGroup',
|
|
|
sub_discipline_id: undefined,
|
|
|
item_type: currentItemType,
|
|
|
show_children: true
|
|
|
}),
|
|
|
_useCustomRequest2 = slicedToArray_default()(_useCustomRequest, 4),
|
|
|
params = _useCustomRequest2[0],
|
|
|
isLoading = _useCustomRequest2[1],
|
|
|
getData = _useCustomRequest2[2],
|
|
|
disciplineRes = _useCustomRequest2[3];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return getData({}, true);
|
|
|
case 2:
|
|
|
res = _context.sent;
|
|
|
setCourseOptions((0,util/* formatCourseOptions */.L)(res.disciplines));
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}))();
|
|
|
}, []);
|
|
|
console.log(defaultData);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (!isFirst) {
|
|
|
return;
|
|
|
}
|
|
|
switch (getRuleValue(ruleValue)) {
|
|
|
case RuleValueKeyType.OnlyKnowledge:
|
|
|
{
|
|
|
setSelectedKeys(defaultData.map(function (item) {
|
|
|
return item.tag_discipline_id;
|
|
|
}));
|
|
|
break;
|
|
|
}
|
|
|
case RuleValueKeyType.KnowledgeAndDiff:
|
|
|
{
|
|
|
var map = new Map();
|
|
|
defaultData.forEach(function (item) {
|
|
|
if (!item) {
|
|
|
return;
|
|
|
}
|
|
|
map.has(item.tag_discipline_id) ? map.set(item.tag_discipline_id, [].concat(toConsumableArray_default()(map.get(item.tag_discipline_id)), [item.difficulty])) : map.set(item.tag_discipline_id, [item.difficulty]);
|
|
|
});
|
|
|
var _iterator = createForOfIteratorHelper_default()(map.entries()),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var _step$value = slicedToArray_default()(_step.value, 2),
|
|
|
key = _step$value[0],
|
|
|
value = _step$value[1];
|
|
|
form.setFieldValue([key, 'diff'], value);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}, [defaultData, ruleValue, isFirst]);
|
|
|
var _Form$useForm = es_form/* default */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
var dataSource = (0,_react_17_0_2_react.useMemo)(function () {
|
|
|
var arr = [];
|
|
|
var discipline = '',
|
|
|
subDiscipline = '';
|
|
|
var formValue = {};
|
|
|
var _iterator2 = createForOfIteratorHelper_default()((disciplineRes === null || disciplineRes === void 0 ? void 0 : disciplineRes.disciplines) || []),
|
|
|
_step2;
|
|
|
try {
|
|
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
|
var item = _step2.value;
|
|
|
discipline = item.name;
|
|
|
var _iterator3 = createForOfIteratorHelper_default()(item.sub_disciplines),
|
|
|
_step3;
|
|
|
try {
|
|
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
|
var subItem = _step3.value;
|
|
|
subDiscipline = subItem.name;
|
|
|
var _iterator4 = createForOfIteratorHelper_default()(subItem.tag_disciplines),
|
|
|
_step4;
|
|
|
try {
|
|
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
|
var tagItem = _step4.value;
|
|
|
var rowItem = {
|
|
|
sub_discipline_name: "".concat(discipline, "&").concat(subDiscipline),
|
|
|
sub_discipline_id: subItem.id,
|
|
|
tag_discipline_name: tagItem.name,
|
|
|
id: tagItem.id,
|
|
|
item_bank_num: tagItem.total_count,
|
|
|
difficulty_count: tagItem.difficulty_count,
|
|
|
tag_discipline_id: tagItem.id
|
|
|
// defaultChecks: defaultData?.filter(items => items._id == tagItem.id)?.[0]?.difficulty_count?.map(items => items.value),
|
|
|
// defaultChecks2: defaultData?.filter(items => items._id == tagItem.id)
|
|
|
};
|
|
|
// if (defaultData?.filter(items => items._id == tagItem.id)?.[0]) {
|
|
|
// formValue[tagItem.id] = {};
|
|
|
// formValue[tagItem.id]["diff"] = defaultData?.filter(items => items._id == tagItem.id)?.[0]?.difficulty_count?.map(items => items.value);
|
|
|
// formValue[tagItem.id]["extra"] = rowItem;
|
|
|
// }
|
|
|
arr.push(rowItem);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator4.e(err);
|
|
|
} finally {
|
|
|
_iterator4.f();
|
|
|
}
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator3.e(err);
|
|
|
} finally {
|
|
|
_iterator3.f();
|
|
|
}
|
|
|
}
|
|
|
// form.setFieldsValue(formValue)
|
|
|
} catch (err) {
|
|
|
_iterator2.e(err);
|
|
|
} finally {
|
|
|
_iterator2.f();
|
|
|
}
|
|
|
return arr;
|
|
|
}, [disciplineRes, defaultData]);
|
|
|
var columns = [{
|
|
|
title: '知识点',
|
|
|
dataIndex: 'tag_discipline_name',
|
|
|
show: true,
|
|
|
render: function render(text, record) {
|
|
|
var item_bank_num = record.item_bank_num;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [text, "(".concat(item_bank_num, ")")]
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: '方向&课程',
|
|
|
dataIndex: 'sub_discipline_name',
|
|
|
ellipsis: true,
|
|
|
show: true
|
|
|
}, {
|
|
|
title: '难度',
|
|
|
width: '35%',
|
|
|
show: ruleValue.includes(RuleValueType.Difficulty),
|
|
|
render: function render(t, record) {
|
|
|
var id = record.id,
|
|
|
difficulty_count = record.difficulty_count,
|
|
|
total_count = record.total_count,
|
|
|
sub_discipline_name = record.sub_discipline_name,
|
|
|
tag_discipline_name = record.tag_discipline_name;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: [id, 'diff'],
|
|
|
noStyle: true,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z.Group, {
|
|
|
style: {
|
|
|
columnGap: 12
|
|
|
},
|
|
|
options: difficulty_count.map(function (diff) {
|
|
|
return {
|
|
|
label: diff.name,
|
|
|
value: Knowledge_diffMap[diff.name]
|
|
|
};
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: [id, 'extra'],
|
|
|
initialValue: {
|
|
|
difficulty_count: difficulty_count,
|
|
|
total_count: total_count,
|
|
|
sub_discipline_name: sub_discipline_name,
|
|
|
tag_discipline_name: tag_discipline_name
|
|
|
},
|
|
|
noStyle: true,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
type: "hidden"
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
}].filter(function (item) {
|
|
|
return item.show;
|
|
|
});
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
selectedKeys = _useState4[0],
|
|
|
setSelectedKeys = _useState4[1];
|
|
|
var diffKeyMap = (0,_react_17_0_2_react.useRef)(new Map());
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
marginTop: 12
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: "mb20",
|
|
|
align: "middle",
|
|
|
gutter: 20,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(cascader/* default */.Z, {
|
|
|
placeholder: "\u8BF7\u9009\u62E9\u65B9\u5411&\u8BFE\u7A0B",
|
|
|
size: "large",
|
|
|
style: {
|
|
|
width: 240
|
|
|
},
|
|
|
options: courseOptions,
|
|
|
onChange: function onChange(value) {
|
|
|
getData({
|
|
|
sub_discipline_id: value === null || value === void 0 ? void 0 : value[1]
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomInput */.t7, {
|
|
|
style: {
|
|
|
width: 300
|
|
|
},
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u77E5\u8BC6\u70B9\u540D\u79F0\u8FDB\u884C\u641C\u7D22",
|
|
|
value: params.keyword,
|
|
|
onChange: function onChange(value) {
|
|
|
return getData({
|
|
|
keyword: value
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z, {
|
|
|
form: form,
|
|
|
onValuesChange: function onValuesChange(changeedValues, newValues) {
|
|
|
console.log(newValues);
|
|
|
|
|
|
//难度+知识点
|
|
|
diffKeyMap.current.clear();
|
|
|
var _loop = function _loop() {
|
|
|
var _item$diff;
|
|
|
var id = _Object$keys[_i];
|
|
|
var map = {
|
|
|
1: '简单',
|
|
|
2: '适中',
|
|
|
3: '困难'
|
|
|
};
|
|
|
var item = newValues[id];
|
|
|
var _ref3 = item.extra || {},
|
|
|
difficulty_count = _ref3.difficulty_count,
|
|
|
total_count = _ref3.total_count;
|
|
|
item === null || item === void 0 || (_item$diff = item.diff) === null || _item$diff === void 0 || _item$diff.forEach(function (diff) {
|
|
|
var _difficulty_count$fin;
|
|
|
var diffNum = difficulty_count === null || difficulty_count === void 0 || (_difficulty_count$fin = difficulty_count.find(function (x) {
|
|
|
return x.name === map[diff];
|
|
|
})) === null || _difficulty_count$fin === void 0 ? void 0 : _difficulty_count$fin.value;
|
|
|
var newItem = objectSpread2_default()(objectSpread2_default()({}, item.extra), {}, {
|
|
|
id: "".concat(id, "_").concat(diff),
|
|
|
difficulty: diff,
|
|
|
item_bank_num: diffNum,
|
|
|
tag_discipline_id: id
|
|
|
});
|
|
|
if (diffNum > 0) {
|
|
|
diffKeyMap.current.set("".concat(id, "_").concat(diff), newItem);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
for (var _i = 0, _Object$keys = Object.keys(newValues); _i < _Object$keys.length; _i++) {
|
|
|
_loop();
|
|
|
}
|
|
|
setSelectData(toConsumableArray_default()(diffKeyMap.current.values()));
|
|
|
},
|
|
|
children: (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) === 0 ? /*#__PURE__*/(0,jsx_runtime.jsx)(NoData/* default */.Z, {
|
|
|
ButtonTwo: /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
|
|
|
target: "_blank",
|
|
|
href: "/problemset",
|
|
|
children: ["\u524D\u5F80\u9898\u5E93\uFF0C\u65B0\u589E\u66F4\u591A\u8BD5\u9898", '>']
|
|
|
})
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
|
|
|
rowSelection: getRuleValue(ruleValue) === RuleValueKeyType.OnlyKnowledge ? {
|
|
|
preserveSelectedRowKeys: true,
|
|
|
type: 'checkbox',
|
|
|
onChange: function onChange(selectedRowKeys, selectedRows) {
|
|
|
console.log("table-selectedRowKeys:", selectedRowKeys, selectedRows);
|
|
|
setSelectedKeys(selectedRowKeys);
|
|
|
setSelectData(selectedRows);
|
|
|
},
|
|
|
getCheckboxProps: function getCheckboxProps(record) {
|
|
|
return {
|
|
|
disabled: record.item_bank_num === 0
|
|
|
};
|
|
|
},
|
|
|
selectedRowKeys: selectedKeys
|
|
|
} : undefined,
|
|
|
columns: columns,
|
|
|
dataSource: dataSource,
|
|
|
loading: isLoading,
|
|
|
scroll: {
|
|
|
y: 480
|
|
|
},
|
|
|
rowKey: "id",
|
|
|
pagination: false
|
|
|
// pagination={{
|
|
|
// total: dataSource?.length,
|
|
|
// showTotal: total => <span>共<span style={{ color: '#165DFF', margin: '0 5px' }}>{total}</span>条数据</span>,
|
|
|
// size: 'default',
|
|
|
// pageSize: params.per_page,
|
|
|
// current: params.page,
|
|
|
// onChange(page, pageSize) {
|
|
|
// getData({ page, per_page: pageSize })
|
|
|
// },
|
|
|
// }}
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var RuleModal_Knowledge = (Knowledge);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/QuestionInfo/RuleModal/ruleInfo.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ruleInfo_diffMap = {
|
|
|
'简单': 1,
|
|
|
'适中': 2,
|
|
|
'困难': 3
|
|
|
};
|
|
|
|
|
|
//规则设置内容的UI优先级可以理解为文件夹>知识点>难度,例如勾选了“指定文件夹抽题”则优先展示文件夹组件
|
|
|
|
|
|
var RuleModal = function RuleModal(_ref) {
|
|
|
var _data$item_types;
|
|
|
var open = _ref.open,
|
|
|
onCancel = _ref.onCancel,
|
|
|
setVisibleModalType = _ref.setVisibleModalType,
|
|
|
currentItemType = _ref.currentItemType;
|
|
|
var _useContext = (0,_react_17_0_2_react.useContext)(DataContext),
|
|
|
data = _useContext.data,
|
|
|
dispatch = _useContext.dispatch;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
ruleValue = _useState2[0],
|
|
|
setRuleValue = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
selectData = _useState4[0],
|
|
|
setSelectData = _useState4[1];
|
|
|
var questionInfo = data === null || data === void 0 || (_data$item_types = data.item_types) === null || _data$item_types === void 0 ? void 0 : _data$item_types.find(function (item) {
|
|
|
return item.item_type === currentItemType;
|
|
|
});
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (open) {
|
|
|
var _data$item_types2;
|
|
|
var currentItem = data === null || data === void 0 || (_data$item_types2 = data.item_types) === null || _data$item_types2 === void 0 ? void 0 : _data$item_types2.find(function (item) {
|
|
|
return item.item_type === currentItemType;
|
|
|
});
|
|
|
if ((currentItem === null || currentItem === void 0 ? void 0 : currentItem.random_rule_type) !== RuleValueKeyType.Shixun) {
|
|
|
var _data$item_types3;
|
|
|
var rules = RuleValueMap[currentItem === null || currentItem === void 0 ? void 0 : currentItem.random_rule_type] || [];
|
|
|
setRuleValue(rules);
|
|
|
var defaultSelectData = data === null || data === void 0 || (_data$item_types3 = data.item_types) === null || _data$item_types3 === void 0 || (_data$item_types3 = _data$item_types3.find(function (item) {
|
|
|
return item.item_type === currentItemType;
|
|
|
})) === null || _data$item_types3 === void 0 ? void 0 : _data$item_types3.contents;
|
|
|
console.log('----xxx', getRuleValue(rules));
|
|
|
switch (getRuleValue(rules)) {
|
|
|
case RuleValueKeyType.OnlyDifficulty:
|
|
|
{
|
|
|
setDefaultData(defaultSelectData.map(function (item) {
|
|
|
return item.difficulty;
|
|
|
}));
|
|
|
break;
|
|
|
}
|
|
|
case RuleValueKeyType.OnlyFileFolder:
|
|
|
{
|
|
|
setDefaultData({
|
|
|
my: defaultSelectData === null || defaultSelectData === void 0 ? void 0 : defaultSelectData.filter(function (item) {
|
|
|
return parseInt(item.teacher_group_id) !== "NaN" && !item.teacher_group_id && item.teacher_group_id !== 0;
|
|
|
}),
|
|
|
"public": defaultSelectData === null || defaultSelectData === void 0 ? void 0 : defaultSelectData.filter(function (item) {
|
|
|
return parseInt(item.teacher_group_id) >= 0;
|
|
|
})
|
|
|
});
|
|
|
setSelectData({
|
|
|
my: defaultSelectData === null || defaultSelectData === void 0 ? void 0 : defaultSelectData.filter(function (item) {
|
|
|
return parseInt(item.teacher_group_id) !== "NaN" && !item.teacher_group_id && item.teacher_group_id !== 0;
|
|
|
}),
|
|
|
"public": defaultSelectData === null || defaultSelectData === void 0 ? void 0 : defaultSelectData.filter(function (item) {
|
|
|
return parseInt(item.teacher_group_id) >= 0;
|
|
|
})
|
|
|
});
|
|
|
break;
|
|
|
}
|
|
|
case RuleValueKeyType.FileFolderAndKnowledge:
|
|
|
{
|
|
|
setDefaultData({
|
|
|
my: defaultSelectData === null || defaultSelectData === void 0 ? void 0 : defaultSelectData.filter(function (item) {
|
|
|
return parseInt(item.teacher_group_id) !== "NaN" && !item.teacher_group_id && item.teacher_group_id !== 0;
|
|
|
}),
|
|
|
"public": defaultSelectData === null || defaultSelectData === void 0 ? void 0 : defaultSelectData.filter(function (item) {
|
|
|
return parseInt(item.teacher_group_id) >= 0;
|
|
|
})
|
|
|
});
|
|
|
setSelectData({
|
|
|
my: defaultSelectData === null || defaultSelectData === void 0 ? void 0 : defaultSelectData.filter(function (item) {
|
|
|
return parseInt(item.teacher_group_id) !== "NaN" && !item.teacher_group_id && item.teacher_group_id !== 0;
|
|
|
}),
|
|
|
"public": defaultSelectData === null || defaultSelectData === void 0 ? void 0 : defaultSelectData.filter(function (item) {
|
|
|
return parseInt(item.teacher_group_id) >= 0;
|
|
|
})
|
|
|
});
|
|
|
break;
|
|
|
}
|
|
|
case RuleValueKeyType.FileFolderAndDiff:
|
|
|
{
|
|
|
setDefaultData(defaultSelectData);
|
|
|
setSelectData(defaultSelectData);
|
|
|
break;
|
|
|
}
|
|
|
case RuleValueKeyType.All:
|
|
|
{
|
|
|
setDefaultData(defaultSelectData);
|
|
|
setSelectData(defaultSelectData);
|
|
|
break;
|
|
|
}
|
|
|
default:
|
|
|
setDefaultData(defaultSelectData);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, [open]);
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
totalNumOfDiff = _useState6[0],
|
|
|
setTotalNumOfDiff = _useState6[1];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (open) {
|
|
|
getQuestionNum({
|
|
|
item_type: currentItemType
|
|
|
}).then(function (res) {
|
|
|
if (res.status === 0) {
|
|
|
setTotalNumOfDiff(res.data);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}, [open]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
console.log("selectData", selectData);
|
|
|
}, [selectData]);
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)(),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
defaultData = _useState8[0],
|
|
|
setDefaultData = _useState8[1];
|
|
|
var _useState9 = (0,_react_17_0_2_react.useState)(true),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
isFirst = _useState10[0],
|
|
|
setIsFirst = _useState10[1];
|
|
|
|
|
|
// useEffect(() => {
|
|
|
// if (open) {
|
|
|
// const defaultSelectData = data?.item_types?.find(item => item.item_type === currentItemType)?.contents
|
|
|
// console.log("defaultSelectData:",defaultSelectData,getRuleValue(ruleValue),ruleValue)
|
|
|
// switch (getRuleValue(ruleValue)) {
|
|
|
// case RuleValueKeyType.OnlyDifficulty: {
|
|
|
// setDefaultData(defaultSelectData.map(item => item.difficulty))
|
|
|
// break
|
|
|
// }
|
|
|
// default: setDefaultData(defaultSelectData)
|
|
|
|
|
|
// }
|
|
|
// }
|
|
|
// }, [open])
|
|
|
|
|
|
console.log("isFirst:", isFirst);
|
|
|
var changeRule = function changeRule(checkedValue) {
|
|
|
setRuleValue(checkedValue);
|
|
|
//变更规则后重置数据
|
|
|
setSelectData([]);
|
|
|
setDefaultData([]);
|
|
|
setIsFirst(false);
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(modal/* default */.Z, {
|
|
|
title: "\u8BBE\u7F6E\u62BD\u9898\u89C4\u5219",
|
|
|
width: 948,
|
|
|
closable: true,
|
|
|
centered: true,
|
|
|
open: open,
|
|
|
onCancel: onCancel,
|
|
|
destroyOnClose: true,
|
|
|
onOk: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var _selectData$my, _selectData$public, currentRule, _data$item_types4, _totalNumOfDiff$find, _totalNumOfDiff$find2, _totalNumOfDiff$find3, currentItem, diffvalue;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
if (!(selectData === undefined)) {
|
|
|
_context.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
setVisibleModalType('');
|
|
|
return _context.abrupt("return");
|
|
|
case 3:
|
|
|
if (!(Object.prototype.toString.call(selectData) === '[object Object]')) {
|
|
|
_context.next = 7;
|
|
|
break;
|
|
|
}
|
|
|
if (!(!((_selectData$my = selectData.my) !== null && _selectData$my !== void 0 && _selectData$my.length) && !((_selectData$public = selectData["public"]) !== null && _selectData$public !== void 0 && _selectData$public.length))) {
|
|
|
_context.next = 7;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.warning("试题总数=0,请先设置抽题规则");
|
|
|
return _context.abrupt("return");
|
|
|
case 7:
|
|
|
if (!(!Object.keys(selectData).length && !(selectData !== null && selectData !== void 0 && selectData.length))) {
|
|
|
_context.next = 10;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.warning("试题总数=0,请先设置抽题规则");
|
|
|
return _context.abrupt("return");
|
|
|
case 10:
|
|
|
currentRule = getRuleValue(ruleValue);
|
|
|
_context.t0 = currentRule;
|
|
|
_context.next = _context.t0 === RuleValueKeyType.OnlyFileFolder ? 14 : _context.t0 === RuleValueKeyType.OnlyDifficulty ? 16 : _context.t0 === RuleValueKeyType.OnlyKnowledge ? 20 : _context.t0 === RuleValueKeyType.KnowledgeAndDiff ? 22 : _context.t0 === RuleValueKeyType.FileFolderAndDiff ? 24 : _context.t0 === RuleValueKeyType.FileFolderAndKnowledge ? 26 : _context.t0 === RuleValueKeyType.All ? 28 : 30;
|
|
|
break;
|
|
|
case 14:
|
|
|
dispatch({
|
|
|
type: 'editRule',
|
|
|
payload: {
|
|
|
itemType: currentItemType,
|
|
|
tableData: [].concat(toConsumableArray_default()(selectData.my || []), toConsumableArray_default()(selectData["public"] || [])),
|
|
|
randomRuleType: currentRule
|
|
|
}
|
|
|
});
|
|
|
return _context.abrupt("break", 30);
|
|
|
case 16:
|
|
|
currentItem = data === null || data === void 0 || (_data$item_types4 = data.item_types) === null || _data$item_types4 === void 0 || (_data$item_types4 = _data$item_types4.find(function (item) {
|
|
|
return item.item_type === currentItemType;
|
|
|
})) === null || _data$item_types4 === void 0 ? void 0 : _data$item_types4.contents;
|
|
|
diffvalue = [{}, {
|
|
|
value: (_totalNumOfDiff$find = totalNumOfDiff.find(function (item) {
|
|
|
return item.name === '简单';
|
|
|
})) === null || _totalNumOfDiff$find === void 0 ? void 0 : _totalNumOfDiff$find.value
|
|
|
}, {
|
|
|
value: (_totalNumOfDiff$find2 = totalNumOfDiff.find(function (item) {
|
|
|
return item.name === '适中';
|
|
|
})) === null || _totalNumOfDiff$find2 === void 0 ? void 0 : _totalNumOfDiff$find2.value
|
|
|
}, {
|
|
|
value: (_totalNumOfDiff$find3 = totalNumOfDiff.find(function (item) {
|
|
|
return item.name === '困难';
|
|
|
})) === null || _totalNumOfDiff$find3 === void 0 ? void 0 : _totalNumOfDiff$find3.value
|
|
|
}]; // console.log('totalNumOfDiff', totalNumOfDiff, selectData, diffvalue?.[2]);
|
|
|
dispatch({
|
|
|
type: 'editRule',
|
|
|
payload: {
|
|
|
itemType: currentItemType,
|
|
|
tableData: selectData.map(function (diff, index) {
|
|
|
var _currentItem$filter, _totalNumOfDiff$, _diffvalue$diff;
|
|
|
return {
|
|
|
difficulty: diff,
|
|
|
id: index,
|
|
|
quanlity: (currentItem === null || currentItem === void 0 || (_currentItem$filter = currentItem.filter(function (item) {
|
|
|
return item.id === index;
|
|
|
})) === null || _currentItem$filter === void 0 || (_currentItem$filter = _currentItem$filter[0]) === null || _currentItem$filter === void 0 ? void 0 : _currentItem$filter["quanlity"]) || 1,
|
|
|
item_bank_num: (totalNumOfDiff === null || totalNumOfDiff === void 0 ? void 0 : totalNumOfDiff.length) === 1 ? (_totalNumOfDiff$ = totalNumOfDiff[0]) === null || _totalNumOfDiff$ === void 0 ? void 0 : _totalNumOfDiff$.value : diffvalue === null || diffvalue === void 0 || (_diffvalue$diff = diffvalue[diff]) === null || _diffvalue$diff === void 0 ? void 0 : _diffvalue$diff.value
|
|
|
};
|
|
|
}),
|
|
|
randomRuleType: currentRule
|
|
|
}
|
|
|
});
|
|
|
return _context.abrupt("break", 30);
|
|
|
case 20:
|
|
|
dispatch({
|
|
|
type: 'editRule',
|
|
|
payload: {
|
|
|
itemType: currentItemType,
|
|
|
tableData: selectData.map(function (item) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
|
|
|
quanlity: item.quanlity || 1
|
|
|
});
|
|
|
}),
|
|
|
randomRuleType: currentRule
|
|
|
}
|
|
|
});
|
|
|
return _context.abrupt("break", 30);
|
|
|
case 22:
|
|
|
dispatch({
|
|
|
type: 'editRule',
|
|
|
payload: {
|
|
|
itemType: currentItemType,
|
|
|
tableData: selectData.map(function (item) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
|
|
|
quanlity: item.quanlity || 1
|
|
|
});
|
|
|
}),
|
|
|
randomRuleType: currentRule
|
|
|
}
|
|
|
});
|
|
|
return _context.abrupt("break", 30);
|
|
|
case 24:
|
|
|
dispatch({
|
|
|
type: 'editRule',
|
|
|
payload: {
|
|
|
itemType: currentItemType,
|
|
|
tableData: selectData.map(function (item) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
|
|
|
quanlity: item.quanlity || 1
|
|
|
});
|
|
|
}),
|
|
|
randomRuleType: currentRule
|
|
|
}
|
|
|
});
|
|
|
return _context.abrupt("break", 30);
|
|
|
case 26:
|
|
|
dispatch({
|
|
|
type: 'editRule',
|
|
|
payload: {
|
|
|
itemType: currentItemType,
|
|
|
tableData: [].concat(toConsumableArray_default()(selectData.my || []), toConsumableArray_default()(selectData["public"] || [])),
|
|
|
randomRuleType: currentRule
|
|
|
}
|
|
|
});
|
|
|
return _context.abrupt("break", 30);
|
|
|
case 28:
|
|
|
dispatch({
|
|
|
type: 'editRule',
|
|
|
payload: {
|
|
|
itemType: currentItemType,
|
|
|
tableData: selectData.map(function (item) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
|
|
|
quanlity: item.quanlity || 1
|
|
|
});
|
|
|
}),
|
|
|
randomRuleType: currentRule
|
|
|
}
|
|
|
});
|
|
|
return _context.abrupt("break", 30);
|
|
|
case 30:
|
|
|
setVisibleModalType('');
|
|
|
case 31:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
})),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z.Group, {
|
|
|
className: "".concat(RuleModalmodules.ruleCheckBox),
|
|
|
style: {
|
|
|
marginBottom: 8
|
|
|
},
|
|
|
value: ruleValue,
|
|
|
onChange: function onChange(checkedValue) {
|
|
|
var _questionInfo$content;
|
|
|
if (!!(ruleValue !== null && ruleValue !== void 0 && ruleValue.length) && (questionInfo === null || questionInfo === void 0 || (_questionInfo$content = questionInfo.contents) === null || _questionInfo$content === void 0 ? void 0 : _questionInfo$content.length) > 0) {
|
|
|
modal/* default */.Z.confirm({
|
|
|
title: "提示",
|
|
|
content: "切换规则后,之前的抽题配置将被清空!",
|
|
|
okText: "立即切换",
|
|
|
cancelText: "暂不切换",
|
|
|
onOk: function onOk() {
|
|
|
return changeRule(checkedValue);
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
changeRule(checkedValue);
|
|
|
}
|
|
|
},
|
|
|
options: [{
|
|
|
label: '指定文件夹抽题',
|
|
|
value: RuleValueType.FileFolder
|
|
|
}, {
|
|
|
label: '指定难度抽题',
|
|
|
value: RuleValueType.Difficulty
|
|
|
}, {
|
|
|
label: '指定知识点抽题',
|
|
|
value: RuleValueType.Knowledge
|
|
|
}]
|
|
|
}), ruleValue.includes(RuleValueType.FileFolder) ? /*#__PURE__*/(0,jsx_runtime.jsx)(RuleModal_FileFolder, {
|
|
|
defaultData: defaultData,
|
|
|
selectData: selectData,
|
|
|
ruleValue: ruleValue,
|
|
|
setSelectData: setSelectData,
|
|
|
currentItemType: currentItemType
|
|
|
}) : ruleValue.includes(RuleValueType.Knowledge) ? /*#__PURE__*/(0,jsx_runtime.jsx)(RuleModal_Knowledge, {
|
|
|
defaultData: defaultData,
|
|
|
isFirst: isFirst,
|
|
|
ruleValue: ruleValue,
|
|
|
setSelectData: setSelectData,
|
|
|
currentItemType: currentItemType
|
|
|
}) : ruleValue.includes(RuleValueType.Difficulty) ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
marginTop: 12
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "mr20",
|
|
|
style: {
|
|
|
color: '#666'
|
|
|
},
|
|
|
children: "\u96BE\u5EA6"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z.Group, {
|
|
|
style: {
|
|
|
columnGap: 12
|
|
|
},
|
|
|
options: totalNumOfDiff.map(function (diff) {
|
|
|
return {
|
|
|
label: diff.name,
|
|
|
value: ruleInfo_diffMap[diff.name]
|
|
|
};
|
|
|
}),
|
|
|
value: selectData || defaultData,
|
|
|
onChange: function onChange(checkedValue) {
|
|
|
return setSelectData(checkedValue);
|
|
|
}
|
|
|
})]
|
|
|
}) : null]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var ruleInfo = (RuleModal);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/QuestionInfo/RuleModal/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
var RuleModal_RuleModal = function RuleModal(_ref) {
|
|
|
var open = _ref.open,
|
|
|
onCancel = _ref.onCancel,
|
|
|
setVisibleModalType = _ref.setVisibleModalType,
|
|
|
currentItemType = _ref.currentItemType;
|
|
|
return open ? /*#__PURE__*/(0,jsx_runtime.jsx)(ruleInfo, {
|
|
|
open: open,
|
|
|
onCancel: onCancel,
|
|
|
setVisibleModalType: setVisibleModalType,
|
|
|
currentItemType: currentItemType
|
|
|
}) : null;
|
|
|
};
|
|
|
/* harmony default export */ var QuestionInfo_RuleModal = (RuleModal_RuleModal);
|
|
|
// EXTERNAL MODULE: ./src/service/paperlibrary.ts
|
|
|
var paperlibrary = __webpack_require__(36636);
|
|
|
;// CONCATENATED MODULE: ./src/utils/hooks/useCourseOptions.ts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var useCourseOptions = function useCourseOptions() {
|
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
courseOptions = _useState2[0],
|
|
|
setCourseOptions = _useState2[1];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var getCourseOptions = /*#__PURE__*/function () {
|
|
|
var _ref = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return (0,paperlibrary/* getDisciplines */.d1)({
|
|
|
source: 'question'
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context.sent;
|
|
|
if (res !== null && res !== void 0 && res.disciplines) {
|
|
|
setCourseOptions((0,util/* formatCourseOptions */.L)(res === null || res === void 0 ? void 0 : res.disciplines));
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function getCourseOptions() {
|
|
|
return _ref.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
getCourseOptions();
|
|
|
}, []);
|
|
|
return courseOptions;
|
|
|
};
|
|
|
|
|
|
// EXTERNAL MODULE: ./src/service/classrooms.ts
|
|
|
var classrooms = __webpack_require__(97894);
|
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx
|
|
|
var RenderHtml = __webpack_require__(52961);
|
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
|
var utils_util = __webpack_require__(63834);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.1@@ant-design/icons/es/icons/QuestionCircleOutlined.js + 1 modules
|
|
|
var QuestionCircleOutlined = __webpack_require__(55079);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/QuestionInfo/SelectShixunModal.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var SelectShixunModal = function SelectShixunModal(_ref) {
|
|
|
var open = _ref.open,
|
|
|
onCancel = _ref.onCancel,
|
|
|
_onOk = _ref.onOk;
|
|
|
var _useContext = (0,_react_17_0_2_react.useContext)(DataContext),
|
|
|
data = _useContext.data;
|
|
|
var courseOptions = useCourseOptions();
|
|
|
var _useCustomRequest = (0,useCustomRequest/* useCustomRequest */.U)(classrooms/* getShixunListsItem */.Gm, {
|
|
|
page: 1,
|
|
|
limit: 10,
|
|
|
keyword: '',
|
|
|
diff: '',
|
|
|
discipline_id: '',
|
|
|
sub_discipline_id: '',
|
|
|
type: 0,
|
|
|
include_shixuns: true,
|
|
|
item_type: 'SHIXUN'
|
|
|
}),
|
|
|
_useCustomRequest2 = slicedToArray_default()(_useCustomRequest, 4),
|
|
|
queryParams = _useCustomRequest2[0],
|
|
|
tableLoading = _useCustomRequest2[1],
|
|
|
getShixunData = _useCustomRequest2[2],
|
|
|
shixunData = _useCustomRequest2[3];
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
emptyTipsVisible = _useState2[0],
|
|
|
setEmptyTipsVisible = _useState2[1];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (open) {
|
|
|
getShixunData({
|
|
|
page: 1,
|
|
|
limit: 10,
|
|
|
type: 0
|
|
|
}, true).then(function (res) {
|
|
|
if ((res === null || res === void 0 ? void 0 : res.shixuns_count) === 0) {
|
|
|
setEmptyTipsVisible(true);
|
|
|
}
|
|
|
});
|
|
|
var questionInfo = data.item_types.find(function (item) {
|
|
|
return item.item_type === 'PRACTICAL';
|
|
|
});
|
|
|
setSelectedRowKeys(questionInfo.item_banks.map(function (item) {
|
|
|
return item.id;
|
|
|
}));
|
|
|
setSelectedRows(questionInfo.item_banks);
|
|
|
}
|
|
|
}, [open, data]);
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
selectedRowKeys = _useState4[0],
|
|
|
setSelectedRowKeys = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
selectedRows = _useState6[0],
|
|
|
setSelectedRows = _useState6[1];
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(modal/* default */.Z, {
|
|
|
title: "\u9009\u62E9\u5B9E\u8BAD\u9898",
|
|
|
open: open,
|
|
|
width: 948,
|
|
|
centered: true,
|
|
|
closable: true,
|
|
|
onCancel: onCancel,
|
|
|
onOk: function onOk() {
|
|
|
return _onOk(selectedRows);
|
|
|
},
|
|
|
destroyOnClose: true,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-between",
|
|
|
className: "mb20",
|
|
|
style: {
|
|
|
maxHeight: 650
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(cascader/* default */.Z, {
|
|
|
style: {
|
|
|
width: 160
|
|
|
},
|
|
|
size: "large",
|
|
|
placeholder: "\u8BF7\u9009\u62E9\u65B9\u5411&\u8BFE\u7A0B",
|
|
|
options: courseOptions,
|
|
|
onChange: function onChange(courseId) {
|
|
|
getShixunData({
|
|
|
page: 1,
|
|
|
discipline_id: courseId === null || courseId === void 0 ? void 0 : courseId[0],
|
|
|
sub_discipline_id: courseId === null || courseId === void 0 ? void 0 : courseId[1]
|
|
|
});
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"], {
|
|
|
className: "ml20",
|
|
|
style: {
|
|
|
width: 118
|
|
|
},
|
|
|
size: "large",
|
|
|
placeholder: "\u96BE\u5EA6",
|
|
|
allowClear: true,
|
|
|
options: [{
|
|
|
label: '初级',
|
|
|
value: 1
|
|
|
}, {
|
|
|
label: '中级',
|
|
|
value: 2
|
|
|
}, {
|
|
|
label: '中高级',
|
|
|
value: 3
|
|
|
}, {
|
|
|
label: '高级',
|
|
|
value: 4
|
|
|
}],
|
|
|
onChange: function onChange(diff) {
|
|
|
return getShixunData({
|
|
|
page: 1,
|
|
|
diff: diff
|
|
|
});
|
|
|
}
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomInput */.t7, {
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22",
|
|
|
style: {
|
|
|
width: 290
|
|
|
},
|
|
|
onChange: function onChange(input) {
|
|
|
getShixunData({
|
|
|
keyword: input,
|
|
|
page: 1
|
|
|
});
|
|
|
}
|
|
|
})]
|
|
|
}), emptyTipsVisible ? /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(NoData/* default */.Z, {
|
|
|
customText: "\u6682\u65E0\u6570\u636E",
|
|
|
ButtonText: "\u524D\u5F80\u5B9E\u8DF5\u9879\u76EE\u5E93\uFF0C\u6DFB\u52A0\u66F4\u591A\u8BD5\u9898>",
|
|
|
ButtonClick: function ButtonClick() {
|
|
|
return (0,utils_util/* openNewWindow */.xg)("/shixuns");
|
|
|
}
|
|
|
})
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
|
|
|
loading: tableLoading,
|
|
|
rowKey: "id",
|
|
|
columns: [{
|
|
|
title: '试题名称',
|
|
|
dataIndex: 'name',
|
|
|
width: '30%',
|
|
|
// ellipsis: true,
|
|
|
ellipsis: {
|
|
|
showTitle: true
|
|
|
},
|
|
|
render: function render(text) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
showLines: 1,
|
|
|
showTextOnly: true,
|
|
|
value: text || '--'
|
|
|
}, 1);
|
|
|
}
|
|
|
},
|
|
|
// {
|
|
|
// title: '创建者',
|
|
|
// dataIndex: 'author_name',
|
|
|
// render: (authorName: string) => Array.isArray(authorName) ? <RenderHtml key={1} showLines={1} showTextOnly value={authorName?.[0]} /> : authorName.split('、')[0]
|
|
|
// },
|
|
|
// {
|
|
|
// title: '所属学校',
|
|
|
// dataIndex: 'author_school_name',
|
|
|
// render(value) {
|
|
|
// return <RenderHtml key={1} showLines={1} showTextOnly value={value} />
|
|
|
// },
|
|
|
// },
|
|
|
{
|
|
|
title: '难度',
|
|
|
dataIndex: 'level'
|
|
|
}, {
|
|
|
title: '关卡数量',
|
|
|
dataIndex: 'challenges_count',
|
|
|
key: 'challenges_count',
|
|
|
render: function render(value, record, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: value || '- -'
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: '使用次数',
|
|
|
dataIndex: 'study_count'
|
|
|
}, {
|
|
|
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',
|
|
|
width: 100,
|
|
|
render: function render(value, record, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: value || '- -'
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: '操作',
|
|
|
render: function render(value, record) {
|
|
|
var _ref2 = record || {},
|
|
|
title = _ref2.title,
|
|
|
challenge_names = _ref2.challenge_names,
|
|
|
author_name = _ref2.author_name,
|
|
|
identifier = _ref2.identifier,
|
|
|
author_school_name = _ref2.author_school_name,
|
|
|
study_count = _ref2.study_count;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#165DFF',
|
|
|
cursor: 'pointer'
|
|
|
},
|
|
|
onClick: function onClick() {
|
|
|
modal/* default */.Z.confirm({
|
|
|
title: '题目详情',
|
|
|
closable: true,
|
|
|
width: 1000,
|
|
|
centered: true,
|
|
|
icon: null,
|
|
|
footer: null,
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: title,
|
|
|
style: {
|
|
|
marginBottom: 18
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: QuestionInfomodules.challengeNameWrapper,
|
|
|
children: challenge_names.map(function (name, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: QuestionInfomodules.challengeName,
|
|
|
children: ["\u7B2C", (0,utils_util/* toChineseNumber */.EM)(index + 1), "\u9898\xA0", name]
|
|
|
}, index);
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: QuestionInfomodules.shixunPreviewFooter,
|
|
|
justify: "space-between",
|
|
|
style: {
|
|
|
alignItems: 'center'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: QuestionInfomodules.shixunInfoWrapper,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u521B\u5EFA\u8005"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionInfomodules.shixunInfo,
|
|
|
children: author_name.split('、')[0]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u6240\u5C5E\u5355\u4F4D"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionInfomodules.shixunInfo,
|
|
|
children: author_school_name
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u5B66\u4E60\u4EBA\u6570"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionInfomodules.shixunInfo,
|
|
|
children: study_count
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.ZP, {
|
|
|
type: "primary",
|
|
|
className: QuestionInfomodules.btnToDetail,
|
|
|
onClick: function onClick() {
|
|
|
return (0,utils_util/* openNewWindow */.xg)("/shixuns/".concat(identifier, "/challenges?exercise=true"));
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-shixunkecheng"
|
|
|
}), "\u5B9E\u8BAD\u8BE6\u60C5"]
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
});
|
|
|
},
|
|
|
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"
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
}],
|
|
|
dataSource: shixunData === null || shixunData === void 0 ? void 0 : shixunData.items,
|
|
|
rowSelection: {
|
|
|
selectedRowKeys: selectedRowKeys,
|
|
|
preserveSelectedRowKeys: true,
|
|
|
getCheckboxProps: function getCheckboxProps(record) {
|
|
|
return {
|
|
|
disabled: record.shixun_tag_num === 1
|
|
|
};
|
|
|
},
|
|
|
onChange: function onChange(newSelectedRowKeys, newSelectedRows) {
|
|
|
console.log(newSelectedRowKeys);
|
|
|
setSelectedRowKeys(newSelectedRowKeys);
|
|
|
var newRows = [];
|
|
|
var _iterator = createForOfIteratorHelper_default()(selectedRows),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prevRow = _step.value;
|
|
|
if (newSelectedRowKeys.includes(prevRow.id)) {
|
|
|
newRows.push(prevRow);
|
|
|
}
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
var existKeys = newRows.map(function (row) {
|
|
|
return row.id;
|
|
|
});
|
|
|
var _iterator2 = createForOfIteratorHelper_default()(newSelectedRows),
|
|
|
_step2;
|
|
|
try {
|
|
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
|
var newRow = _step2.value;
|
|
|
if (newRow && newSelectedRowKeys.includes(newRow.id) && !existKeys.includes(newRow.id)) {
|
|
|
var _newRow$author_name, _newRow$challenge_nam, _newRow$challenge_nam2;
|
|
|
newRows.push({
|
|
|
id: newRow.id,
|
|
|
difficulty: newRow.level,
|
|
|
identifier: newRow.identifier,
|
|
|
name: newRow.name,
|
|
|
real_name: newRow === null || newRow === void 0 || (_newRow$author_name = newRow.author_name) === null || _newRow$author_name === void 0 ? void 0 : _newRow$author_name.split('、')[0],
|
|
|
school_name: newRow.author_school_name,
|
|
|
challenge_names: newRow.challenge_names,
|
|
|
challenges: (_newRow$challenge_nam = newRow.challenge_names) === null || _newRow$challenge_nam === void 0 ? void 0 : _newRow$challenge_nam.map(function (item, index) {
|
|
|
return {
|
|
|
subject: item,
|
|
|
id: index,
|
|
|
score: 5
|
|
|
};
|
|
|
}),
|
|
|
score: ((_newRow$challenge_nam2 = newRow.challenge_names) === null || _newRow$challenge_nam2 === void 0 ? void 0 : _newRow$challenge_nam2.length) * 5,
|
|
|
study_count: newRow.study_count,
|
|
|
challenges_count: newRow.challenges_count
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator2.e(err);
|
|
|
} finally {
|
|
|
_iterator2.f();
|
|
|
}
|
|
|
setSelectedRows(newRows);
|
|
|
}
|
|
|
},
|
|
|
pagination: {
|
|
|
current: queryParams.page,
|
|
|
pageSize: queryParams.limit,
|
|
|
total: shixunData === null || shixunData === void 0 ? void 0 : shixunData.items_count,
|
|
|
showTotal: function showTotal(total) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: ["\u5171\xA0", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#165DFF'
|
|
|
},
|
|
|
children: total
|
|
|
}), "\xA0\u6761\u6570\u636E"]
|
|
|
});
|
|
|
},
|
|
|
showQuickJumper: true,
|
|
|
onChange: function onChange(page, pageSize) {
|
|
|
getShixunData({
|
|
|
page: page,
|
|
|
limit: pageSize
|
|
|
});
|
|
|
},
|
|
|
size: 'default'
|
|
|
},
|
|
|
scroll: {
|
|
|
y: 400
|
|
|
}
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var QuestionInfo_SelectShixunModal = (SelectShixunModal);
|
|
|
// 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__(15445);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/QuestionInfo/QuestionList.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var QuestionList = function QuestionList(_ref) {
|
|
|
var onDelete = _ref.onDelete,
|
|
|
list = _ref.list,
|
|
|
onSelect = _ref.onSelect;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
loading = _useState2[0],
|
|
|
setLoading = _useState2[1];
|
|
|
var _useContext = (0,_react_17_0_2_react.useContext)(DataContext),
|
|
|
dispatch = _useContext.dispatch,
|
|
|
disabled = _useContext.disabled;
|
|
|
var reorder = function reorder(prevList, startIndex, endIndex) {
|
|
|
var result = Array.from(prevList);
|
|
|
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;
|
|
|
};
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(null),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
draggingId = _useState4[0],
|
|
|
setDraggingId = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
isDragging = _useState6[0],
|
|
|
setIsDragging = _useState6[1];
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(react_beautiful_dnd_esm/* DragDropContext */.Z5, {
|
|
|
onDragStart: function onDragStart() {
|
|
|
setIsDragging(true);
|
|
|
},
|
|
|
onDragEnd: function onDragEnd(result) {
|
|
|
setIsDragging(false);
|
|
|
if (!result.destination) {
|
|
|
return;
|
|
|
}
|
|
|
var newList = reorder(list, result.source.index, result.destination.index);
|
|
|
dispatch({
|
|
|
type: 'updateItemTypes',
|
|
|
payload: newList
|
|
|
});
|
|
|
},
|
|
|
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()({}, provided.droppableProps), {}, {
|
|
|
ref: provided.innerRef,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
|
|
|
spinning: loading,
|
|
|
children: list.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(react_beautiful_dnd_esm/* Draggable */._l, {
|
|
|
draggableId: index.toString(),
|
|
|
index: index,
|
|
|
isDragDisabled: draggingId !== item.item_type,
|
|
|
children: function children(provided, snapshot) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, objectSpread2_default()(objectSpread2_default()(objectSpread2_default()({
|
|
|
align: "middle",
|
|
|
wrap: false,
|
|
|
ref: provided.innerRef
|
|
|
}, provided.draggableProps), provided.dragHandleProps), {}, {
|
|
|
className: "".concat(QuestionInfomodules.dragItem, " ").concat(isDragging ? QuestionInfomodules.dragging : ''),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: QuestionInfomodules.contentArea,
|
|
|
onClick: function onClick() {
|
|
|
onSelect(item.item_type);
|
|
|
(0,utils_util/* scrollToTop */.k3)();
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: QuestionInfomodules.blackText,
|
|
|
children: [(0,utils_util/* toChineseNumber */.EM)(index + 1), "\u3001\u3010", item.item_type_text, "\u3011"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\uFF08".concat(item.item_bank_count, "\u5C0F\u9898\uFF0C\u5171").concat(parseFloat(item.total_score).toFixed(1), "\u5206\uFF09"),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionInfomodules.greyText,
|
|
|
children: "\uFF08".concat(item.item_bank_count, "\u5C0F\u9898\uFF0C\u5171").concat(parseFloat(item.total_score).toFixed(1), "\u5206\uFF09")
|
|
|
})
|
|
|
})]
|
|
|
}), !disabled && /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u957F\u6309\u53EF\u8FDB\u884C\u62D6\u62FD\u6392\u5E8F",
|
|
|
open: draggingId === item.item_type && !isDragging,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
cursor: 'grab'
|
|
|
},
|
|
|
className: "".concat(QuestionInfomodules.iconWrapper, " ").concat(isDragging ? QuestionInfomodules.hidden : ''),
|
|
|
onMouseEnter: function onMouseEnter() {
|
|
|
setDraggingId(item.item_type);
|
|
|
},
|
|
|
onMouseLeave: function onMouseLeave() {
|
|
|
return setDraggingId(null);
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-tuodong1 ".concat(QuestionInfomodules.dragIcon)
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u5220\u9664",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "".concat(QuestionInfomodules.iconWrapper, " ").concat(isDragging ? QuestionInfomodules.hidden : ''),
|
|
|
style: {
|
|
|
cursor: 'pointer'
|
|
|
},
|
|
|
onClick: function onClick() {
|
|
|
return onDelete(item.item_type);
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-shanchu12 ".concat(QuestionInfomodules.deleteIcon)
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
}));
|
|
|
}
|
|
|
}, index);
|
|
|
})
|
|
|
}), provided.placeholder]
|
|
|
}));
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var QuestionInfo_QuestionList = (QuestionList);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/timeline/index.js + 5 modules
|
|
|
var timeline = __webpack_require__(10777);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/QuestionInfo/QuestionDetail/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var QuestionDetailmodules = ({"flex_box_center":"flex_box_center___ppkzA","flex_space_between":"flex_space_between___Z1syx","flex_box_vertical_center":"flex_box_vertical_center___twJ9S","flex_box_center_end":"flex_box_center_end___uI0uW","flex_box_column":"flex_box_column___JRp7D","timelineWrapper":"timelineWrapper___LP9aM","title":"title___KUHj_","desc":"desc___ubc8E","titles":"titles___njkjf","questionDetailWrapper":"questionDetailWrapper___p4SFM","questionTitle":"questionTitle___JC9X6","questionScoreInfo":"questionScoreInfo___NgOJI","deleteIcon":"deleteIcon___oMVTN","deleteBtn":"deleteBtn___JUPEl","normalText":"normalText___FW9Y_","folderIcon":"folderIcon___gvacQ","challengeNameWrapper":"challengeNameWrapper___fG7Vv","challengeName":"challengeName___Ia1Xs","shixunPreviewFooter":"shixunPreviewFooter___rKsnN","shixunInfoWrapper":"shixunInfoWrapper___FEnDb","shixunInfo":"shixunInfo___TbrA2","btnToDetail":"btnToDetail___dqLQP"});
|
|
|
// EXTERNAL MODULE: ./src/assets/images/problemset/folder-closed.png
|
|
|
var folder_closed = __webpack_require__(73631);
|
|
|
// EXTERNAL MODULE: ./src/assets/images/problemset/folder.png
|
|
|
var folder = __webpack_require__(31328);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/QuestionInfo/QuestionDetail/columns.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var getColumns = function getColumns(ruleValueKey, dispatch, currentItemType, disabled) {
|
|
|
var columnsMap = defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()({}, RuleValueKeyType.OnlyDifficulty, [{
|
|
|
title: '难度',
|
|
|
key: 'difficulty',
|
|
|
render: function render(value, record) {
|
|
|
var difficulty = record.difficulty;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: difficultyMap[difficulty].color
|
|
|
},
|
|
|
children: difficultyMap[difficulty].label
|
|
|
});
|
|
|
}
|
|
|
}]), RuleValueKeyType.OnlyKnowledge, [{
|
|
|
title: '知识点',
|
|
|
dataIndex: 'tag_discipline_name',
|
|
|
ellipsis: true
|
|
|
}, {
|
|
|
title: '方向&课程',
|
|
|
dataIndex: 'sub_discipline_name',
|
|
|
width: 180,
|
|
|
ellipsis: {
|
|
|
showTitle: true
|
|
|
},
|
|
|
render: function render(text, record) {
|
|
|
return "".concat(text);
|
|
|
}
|
|
|
}]), RuleValueKeyType.OnlyFileFolder, [{
|
|
|
title: '文件夹',
|
|
|
render: function render(value, record, index) {
|
|
|
var group_name = record.group_name,
|
|
|
teacher_group_name = record.teacher_group_name;
|
|
|
var name = group_name || teacher_group_name;
|
|
|
var iconUrl = teacher_group_name ? folder : folder_closed;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
display: 'flex'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: iconUrl,
|
|
|
className: QuestionDetailmodules.folderIcon
|
|
|
}), " ", /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: name,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionDetailmodules.titles,
|
|
|
children: name
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: '类型',
|
|
|
render: function render(value, record) {
|
|
|
var teacher_group_name = record.teacher_group_name;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: teacher_group_name ? '团队共享' : '我创建的'
|
|
|
});
|
|
|
}
|
|
|
}]), RuleValueKeyType.KnowledgeAndDiff, [{
|
|
|
title: '知识点',
|
|
|
dataIndex: 'tag_discipline_name',
|
|
|
ellipsis: {
|
|
|
showTitle: true
|
|
|
}
|
|
|
}, {
|
|
|
title: '方向&课程',
|
|
|
width: 180,
|
|
|
dataIndex: 'sub_discipline_name',
|
|
|
ellipsis: {
|
|
|
showTitle: true
|
|
|
}
|
|
|
}, {
|
|
|
title: '难度',
|
|
|
key: 'difficulty',
|
|
|
render: function render(value, record) {
|
|
|
var difficulty = record.difficulty;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: difficultyMap[difficulty].color
|
|
|
},
|
|
|
children: difficultyMap[difficulty].label
|
|
|
});
|
|
|
}
|
|
|
}]), RuleValueKeyType.FileFolderAndKnowledge, [{
|
|
|
title: '知识点',
|
|
|
dataIndex: 'tag_discipline_name',
|
|
|
ellipsis: true
|
|
|
}, {
|
|
|
title: '文件夹',
|
|
|
render: function render(value, record) {
|
|
|
var group_name = record.group_name,
|
|
|
teacher_group_name = record.teacher_group_name;
|
|
|
var name = group_name || teacher_group_name;
|
|
|
var iconUrl = teacher_group_name ? folder : folder_closed;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
display: 'flex'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: iconUrl,
|
|
|
className: QuestionDetailmodules.folderIcon
|
|
|
}), " ", /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: name,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionDetailmodules.titles,
|
|
|
children: name
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: '类型',
|
|
|
render: function render(value, record) {
|
|
|
var teacher_group_name = record.teacher_group_name;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: teacher_group_name ? '团队共享' : '我创建的'
|
|
|
});
|
|
|
}
|
|
|
}]), RuleValueKeyType.FileFolderAndDiff, [{
|
|
|
title: '文件夹',
|
|
|
render: function render(value, record) {
|
|
|
var group_name = record.group_name,
|
|
|
teacher_group_name = record.teacher_group_name;
|
|
|
var name = group_name || teacher_group_name;
|
|
|
var iconUrl = teacher_group_name ? folder : folder_closed;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
display: 'flex'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: iconUrl,
|
|
|
className: QuestionDetailmodules.folderIcon
|
|
|
}), " ", /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: name,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionDetailmodules.titles,
|
|
|
children: name
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: '类型',
|
|
|
render: function render(value, record) {
|
|
|
var teacher_group_name = record.teacher_group_name;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: teacher_group_name ? '团队共享' : '我创建的'
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: '难度',
|
|
|
key: 'difficulty',
|
|
|
render: function render(value, record) {
|
|
|
var difficulty = record.difficulty;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: difficultyMap[difficulty].color
|
|
|
},
|
|
|
children: difficultyMap[difficulty].label
|
|
|
});
|
|
|
}
|
|
|
}]), RuleValueKeyType.All, [{
|
|
|
title: '知识点',
|
|
|
dataIndex: 'tag_discipline_name',
|
|
|
ellipsis: true
|
|
|
}, {
|
|
|
title: '文件夹',
|
|
|
render: function render(value, record) {
|
|
|
var group_name = record.group_name,
|
|
|
teacher_group_name = record.teacher_group_name,
|
|
|
teacher_group_id = record.teacher_group_id;
|
|
|
var name = group_name || teacher_group_name;
|
|
|
var iconUrl = teacher_group_id || teacher_group_id === 0 ? folder : folder_closed;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
display: 'flex'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: iconUrl,
|
|
|
className: QuestionDetailmodules.folderIcon
|
|
|
}), " ", /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: name,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionDetailmodules.titles,
|
|
|
children: name
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: '类型',
|
|
|
render: function render(value, record) {
|
|
|
var teacher_group_id = record.teacher_group_id;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: teacher_group_id || teacher_group_id === 0 ? '团队共享' : '我创建的'
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: '难度',
|
|
|
key: 'difficulty',
|
|
|
render: function render(value, record) {
|
|
|
var difficulty = record.difficulty;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: difficultyMap[difficulty].color
|
|
|
},
|
|
|
children: difficultyMap[difficulty].label
|
|
|
});
|
|
|
}
|
|
|
}]), RuleValueKeyType.Shixun, []);
|
|
|
for (var _i = 0, _Object$values = Object.values(columnsMap); _i < _Object$values.length; _i++) {
|
|
|
var columns = _Object$values[_i];
|
|
|
columns.push({
|
|
|
title: '抽题数量',
|
|
|
key: 'quanlity',
|
|
|
render: function render(value, record) {
|
|
|
var _ref = record || {},
|
|
|
item_bank_num = _ref.item_bank_num,
|
|
|
quanlity = _ref.quanlity,
|
|
|
id = _ref.id,
|
|
|
teacher_group_id = _ref.teacher_group_id;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
disabled: disabled,
|
|
|
min: 1,
|
|
|
max: item_bank_num,
|
|
|
size: "large",
|
|
|
precision: 0,
|
|
|
value: quanlity,
|
|
|
onChange: function onChange(num) {
|
|
|
dispatch({
|
|
|
type: 'changeQuestionNum',
|
|
|
payload: {
|
|
|
itemType: currentItemType,
|
|
|
id: id,
|
|
|
num: num,
|
|
|
teacher_group_id: teacher_group_id
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "ml10 font14",
|
|
|
style: {
|
|
|
color: '#333333'
|
|
|
},
|
|
|
children: ["/", item_bank_num]
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: '操作',
|
|
|
key: 'action',
|
|
|
align: 'right',
|
|
|
render: function render(value, record) {
|
|
|
var id = record.id,
|
|
|
is_share = record.is_share;
|
|
|
return disabled ? /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "cursorNotAllowed c-grey-999",
|
|
|
children: "\u5220\u9664"
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionDetailmodules.deleteBtn,
|
|
|
onClick: function onClick() {
|
|
|
dispatch({
|
|
|
type: 'deleteRule',
|
|
|
payload: {
|
|
|
itemType: currentItemType,
|
|
|
id: id,
|
|
|
is_share: is_share
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
children: "\u5220\u9664"
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
return columnsMap[ruleValueKey];
|
|
|
};
|
|
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/QuestionInfo/QuestionDetail/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ShixunDetail = function ShixunDetail(_ref) {
|
|
|
var _data$item_types, _questionInfo$item_ba, _questionInfo$item_ba2, _questionInfo$item_ba3;
|
|
|
var setVisibleModalType = _ref.setVisibleModalType;
|
|
|
var _useContext = (0,_react_17_0_2_react.useContext)(DataContext),
|
|
|
data = _useContext.data,
|
|
|
dispatch = _useContext.dispatch,
|
|
|
disabled = _useContext.disabled;
|
|
|
var questionInfo = data === null || data === void 0 || (_data$item_types = data.item_types) === null || _data$item_types === void 0 ? void 0 : _data$item_types.find(function (item) {
|
|
|
return item.item_type === 'PRACTICAL';
|
|
|
});
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(timeline/* default */.Z, {
|
|
|
className: QuestionDetailmodules.timelineWrapper,
|
|
|
items: [{
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
transform: 'translateY(-4px)'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: "mb20",
|
|
|
align: "middle",
|
|
|
justify: "space-between",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionDetailmodules.title,
|
|
|
children: "\u9898\u5E93\u9009\u9898"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionDetailmodules.desc,
|
|
|
children: "\uFF08\u9700\u8981\u5148\u4ECE\u9898\u5E93\u4E2D\u9009\u62E9\u5B9E\u8BAD\u9898\uFF0C\u518D\u8BBE\u7F6E\u4ECE\u5DF2\u9009\u5B9E\u8BAD\u9898\u4E2D\u968F\u673A\u62BD\u9898\u7684\u6570\u91CF\uFF09"
|
|
|
})]
|
|
|
}), !disabled && /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomButton */.op, {
|
|
|
style: {
|
|
|
width: 102
|
|
|
},
|
|
|
onClick: function onClick() {
|
|
|
return setVisibleModalType('selectShixun');
|
|
|
},
|
|
|
children: "\u4ECE\u9898\u5E93\u9009\u62E9"
|
|
|
})]
|
|
|
}), (questionInfo === null || questionInfo === void 0 || (_questionInfo$item_ba = questionInfo.item_banks) === null || _questionInfo$item_ba === void 0 ? void 0 : _questionInfo$item_ba.length) === 0 ? /*#__PURE__*/(0,jsx_runtime.jsx)(NoData/* default */.Z, {
|
|
|
customText: "\u6682\u65E0\u5F85\u62BD\u8BD5\u9898\uFF0C\u8BF7\u5148\u4ECE\u9898\u5E93\u8FDB\u884C\u9009\u62E9\uFF5E"
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
|
|
|
rowKey: "id",
|
|
|
className: "mb10",
|
|
|
columns: [{
|
|
|
title: '序号',
|
|
|
width: 60,
|
|
|
render: function render(value, record, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: index + 1
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: '试题名称',
|
|
|
dataIndex: 'name',
|
|
|
width: '30%',
|
|
|
ellipsis: {
|
|
|
showTitle: true
|
|
|
},
|
|
|
render: function render(text) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
showLines: 1,
|
|
|
showTextOnly: true,
|
|
|
value: text
|
|
|
}, 1);
|
|
|
}
|
|
|
},
|
|
|
// {
|
|
|
// title: '创建者',
|
|
|
// dataIndex: 'real_name',
|
|
|
// ellipsis: { showTitle: true }
|
|
|
// },
|
|
|
// {
|
|
|
// title: '所属单位',
|
|
|
// dataIndex: 'school_name',
|
|
|
// ellipsis: { showTitle: true }
|
|
|
// },
|
|
|
{
|
|
|
title: '使用次数',
|
|
|
dataIndex: 'study_count'
|
|
|
}, {
|
|
|
title: '关卡数量',
|
|
|
dataIndex: 'challenges_count',
|
|
|
key: 'challenges_count',
|
|
|
render: function render(value, record, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: value || '- -'
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: '难度',
|
|
|
dataIndex: 'difficulty'
|
|
|
},
|
|
|
// {
|
|
|
// title: <span>分值<Tooltip title="实训题分值等于各关卡分值之和"><QuestionCircleOutlined /></Tooltip></span>,
|
|
|
// dataIndex: 'score'
|
|
|
// },
|
|
|
{
|
|
|
title: '操作',
|
|
|
align: 'right',
|
|
|
width: 180,
|
|
|
render: function render(value, record, index) {
|
|
|
var _ref2 = record || {},
|
|
|
id = _ref2.id,
|
|
|
identifier = _ref2.identifier,
|
|
|
name = _ref2.name,
|
|
|
_ref2$challenge_names = _ref2.challenge_names,
|
|
|
challenge_names = _ref2$challenge_names === void 0 ? [] : _ref2$challenge_names,
|
|
|
real_name = _ref2.real_name,
|
|
|
school_name = _ref2.school_name,
|
|
|
study_count = _ref2.study_count,
|
|
|
_ref2$challenges = _ref2.challenges,
|
|
|
challenges = _ref2$challenges === void 0 ? [] : _ref2$challenges;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#165DFF',
|
|
|
cursor: 'pointer',
|
|
|
marginLeft: 20
|
|
|
},
|
|
|
onClick: function onClick() {
|
|
|
modal/* default */.Z.confirm({
|
|
|
title: '题目详情',
|
|
|
closable: true,
|
|
|
width: 1000,
|
|
|
centered: true,
|
|
|
icon: null,
|
|
|
footer: null,
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: name,
|
|
|
style: {
|
|
|
marginBottom: 18
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: QuestionDetailmodules.challengeNameWrapper,
|
|
|
children: challenges === null || challenges === void 0 ? void 0 : challenges.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: QuestionDetailmodules.challengeName,
|
|
|
children: ["\u7B2C", (0,utils_util/* toChineseNumber */.EM)(index + 1), "\u9898\xA0", item === null || item === void 0 ? void 0 : item.subject]
|
|
|
}, index);
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: QuestionDetailmodules.shixunPreviewFooter,
|
|
|
justify: "space-between",
|
|
|
style: {
|
|
|
alignItems: 'center'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: QuestionDetailmodules.shixunInfoWrapper,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u521B\u5EFA\u8005"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionDetailmodules.shixunInfo,
|
|
|
children: real_name
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u6240\u5C5E\u5355\u4F4D"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionDetailmodules.shixunInfo,
|
|
|
children: school_name
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u5B66\u4E60\u4EBA\u6570"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionDetailmodules.shixunInfo,
|
|
|
children: study_count
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.ZP, {
|
|
|
type: "primary",
|
|
|
className: QuestionDetailmodules.btnToDetail,
|
|
|
onClick: function onClick() {
|
|
|
return (0,utils_util/* openNewWindow */.xg)("/shixuns/".concat(identifier, "/challenges?exercise=true"));
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-shixunkecheng"
|
|
|
}), "\u5B9E\u8BAD\u8BE6\u60C5"]
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
});
|
|
|
},
|
|
|
children: "\u67E5\u770B"
|
|
|
}), !disabled && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onClick: function onClick() {
|
|
|
dispatch({
|
|
|
type: 'deleteShixunQuestion',
|
|
|
payload: {
|
|
|
shixunId: id
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
className: "ml20 ".concat(QuestionDetailmodules.deleteBtn),
|
|
|
children: "\u5220\u9664"
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
}],
|
|
|
dataSource: (questionInfo === null || questionInfo === void 0 ? void 0 : questionInfo.item_banks) || [],
|
|
|
pagination: false
|
|
|
})]
|
|
|
})
|
|
|
}, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
style: {
|
|
|
transform: !!(questionInfo !== null && questionInfo !== void 0 && (_questionInfo$item_ba2 = questionInfo.item_banks) !== null && _questionInfo$item_ba2 !== void 0 && _questionInfo$item_ba2.length) ? 'translateY(-8px)' : 'none'
|
|
|
},
|
|
|
align: "middle",
|
|
|
justify: "space-between",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionDetailmodules.title,
|
|
|
children: "\u5DF2\u9009\u5B9E\u8BAD\u9898\u4E2D\u968F\u673A\u62BD\u9898"
|
|
|
}), !!(questionInfo !== null && questionInfo !== void 0 && (_questionInfo$item_ba3 = questionInfo.item_banks) !== null && _questionInfo$item_ba3 !== void 0 && _questionInfo$item_ba3.length) && /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionDetailmodules.normalText,
|
|
|
children: "\u62BD\u9898\u6570\u91CF"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
min: 0,
|
|
|
disabled: disabled,
|
|
|
max: questionInfo === null || questionInfo === void 0 ? void 0 : questionInfo.item_bank_num,
|
|
|
size: "large",
|
|
|
className: "ml10 mr10",
|
|
|
value: (questionInfo === null || questionInfo === void 0 ? void 0 : questionInfo.item_bank_count) || 1,
|
|
|
onChange: function onChange(value) {
|
|
|
return dispatch({
|
|
|
type: 'changeQuestionNum',
|
|
|
payload: {
|
|
|
num: value || 1,
|
|
|
itemType: 'PRACTICAL'
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "".concat(QuestionDetailmodules.normalText, " mr30"),
|
|
|
children: ["/", questionInfo === null || questionInfo === void 0 ? void 0 : questionInfo.item_bank_num]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionDetailmodules.normalText,
|
|
|
children: "\u6BCF\u9898\u5206\u503C"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
disabled: disabled,
|
|
|
min: 0,
|
|
|
max: 100,
|
|
|
size: "large",
|
|
|
className: "ml10 mr10",
|
|
|
value: questionInfo === null || questionInfo === void 0 ? void 0 : questionInfo.score,
|
|
|
onChange: function onChange(value) {
|
|
|
return dispatch({
|
|
|
type: 'changeQuestionScore',
|
|
|
payload: {
|
|
|
score: value,
|
|
|
itemType: 'PRACTICAL'
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionDetailmodules.normalText,
|
|
|
children: "\u5206"
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
}]
|
|
|
});
|
|
|
};
|
|
|
var QuestionDetail = function QuestionDetail(_ref3) {
|
|
|
var _data$item_types2, _data$item_types3;
|
|
|
var setVisibleModalType = _ref3.setVisibleModalType,
|
|
|
currentItemType = _ref3.currentItemType,
|
|
|
onDelete = _ref3.onDelete;
|
|
|
var urlParams = (0,_umi_production_exports.useParams)();
|
|
|
var _useContext2 = (0,_react_17_0_2_react.useContext)(DataContext),
|
|
|
data = _useContext2.data,
|
|
|
dispatch = _useContext2.dispatch,
|
|
|
disabled = _useContext2.disabled;
|
|
|
var questionIndex = (data === null || data === void 0 || (_data$item_types2 = data.item_types) === null || _data$item_types2 === void 0 ? void 0 : _data$item_types2.findIndex(function (item) {
|
|
|
return item.item_type === currentItemType;
|
|
|
})) + 1;
|
|
|
var questionInfo = data === null || data === void 0 || (_data$item_types3 = data.item_types) === null || _data$item_types3 === void 0 ? void 0 : _data$item_types3.find(function (item) {
|
|
|
return item.item_type === currentItemType;
|
|
|
});
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: QuestionDetailmodules.questionDetailWrapper,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-between",
|
|
|
align: "middle",
|
|
|
className: "mb30",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionDetailmodules.questionTitle,
|
|
|
children: "".concat((0,utils_util/* toChineseNumber */.EM)(questionIndex), "\u3001").concat(questionInfo === null || questionInfo === void 0 ? void 0 : questionInfo.item_type_text)
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: QuestionDetailmodules.questionScoreInfo,
|
|
|
children: ["\uFF08", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#3061D0'
|
|
|
},
|
|
|
children: questionInfo === null || questionInfo === void 0 ? void 0 : questionInfo.item_bank_count
|
|
|
}), "\u5C0F\u9898 ", /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: ["\uFF0C\u5171", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#3061D0'
|
|
|
},
|
|
|
children: questionInfo === null || questionInfo === void 0 ? void 0 : questionInfo.total_score
|
|
|
}), "\u5206"]
|
|
|
}), "\uFF09"]
|
|
|
})]
|
|
|
}), !disabled && /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-shanchutimu ".concat(QuestionDetailmodules.deleteIcon),
|
|
|
onClick: function onClick() {
|
|
|
return onDelete(currentItemType);
|
|
|
}
|
|
|
})]
|
|
|
}), currentItemType === 'PRACTICAL' ? /*#__PURE__*/(0,jsx_runtime.jsx)(ShixunDetail, {
|
|
|
setVisibleModalType: setVisibleModalType
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: (questionInfo === null || questionInfo === void 0 ? void 0 : questionInfo.contents.length) === 0 ? /*#__PURE__*/(0,jsx_runtime.jsx)(NoData/* default */.Z, {
|
|
|
styles: {
|
|
|
margin: '70px auto 100px auto'
|
|
|
},
|
|
|
customText: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: ["\u6682\u65E0\u62BD\u9898\u89C4\u5219\uFF0C\u652F\u6301", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#EA9741'
|
|
|
},
|
|
|
children: "\u6307\u5B9A\u6587\u4EF6\u5939\u3001\u96BE\u5EA6\u3001\u77E5\u8BC6\u70B9"
|
|
|
}), "\u8FDB\u884C\u62BD\u9898\uFF5E"]
|
|
|
}),
|
|
|
ButtonTwo: (urlParams === null || urlParams === void 0 ? void 0 : urlParams.id) && /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
|
|
|
justify: "center",
|
|
|
className: "mt30",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomButton */.op, {
|
|
|
style: {
|
|
|
width: 136,
|
|
|
marginTop: -10
|
|
|
},
|
|
|
onClick: function onClick() {
|
|
|
return setVisibleModalType('rule');
|
|
|
},
|
|
|
children: "\u8BBE\u7F6E\u62BD\u9898\u89C4\u5219"
|
|
|
})
|
|
|
})
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-between",
|
|
|
align: "middle",
|
|
|
className: "mb20",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "".concat(QuestionDetailmodules.normalText),
|
|
|
children: "\u6BCF\u9898\u5206\u503C"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
disabled: disabled,
|
|
|
size: "large",
|
|
|
className: "ml10 mr10",
|
|
|
min: 0.1,
|
|
|
max: 100,
|
|
|
value: questionInfo === null || questionInfo === void 0 ? void 0 : questionInfo.score,
|
|
|
precision: 1,
|
|
|
onChange: function onChange(value) {
|
|
|
return dispatch({
|
|
|
type: 'changeQuestionScore',
|
|
|
payload: {
|
|
|
score: value,
|
|
|
itemType: currentItemType
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionDetailmodules.normalText,
|
|
|
children: "\u5206"
|
|
|
})]
|
|
|
})
|
|
|
}), (urlParams === null || urlParams === void 0 ? void 0 : urlParams.id) && /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomButton */.op, {
|
|
|
onClick: function onClick() {
|
|
|
return setVisibleModalType('rule');
|
|
|
},
|
|
|
children: "\u8BBE\u7F6E\u62BD\u9898\u89C4\u5219"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
|
|
|
columns: getColumns(questionInfo === null || questionInfo === void 0 ? void 0 : questionInfo.random_rule_type, dispatch, currentItemType, disabled),
|
|
|
dataSource: questionInfo === null || questionInfo === void 0 ? void 0 : questionInfo.contents,
|
|
|
pagination: false,
|
|
|
rowKey: "id"
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var QuestionInfo_QuestionDetail = (QuestionDetail);
|
|
|
// EXTERNAL MODULE: ./src/components/AsyncButton/index.tsx
|
|
|
var AsyncButton = __webpack_require__(25486);
|
|
|
// EXTERNAL MODULE: ./src/service/exercise.ts
|
|
|
var exercise = __webpack_require__(39935);
|
|
|
// EXTERNAL MODULE: ./src/utils/authority.ts
|
|
|
var authority = __webpack_require__(71912);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/QuestionInfo/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var QuestionInfo = function QuestionInfo(_ref) {
|
|
|
var _data$item_types, _data$examination_ban2, _data$examination_ban3, _data$examination_ban4, _data$examination_ban5, _difficultyMap, _data$examination_ban6, _data$examination_ban7, _data$examination_ban8, _data$item_types6, _data$item_types7;
|
|
|
objectDestructuringEmpty_default()(_ref);
|
|
|
var _useSearchParams = (0,_umi_production_exports.useSearchParams)(),
|
|
|
_useSearchParams2 = slicedToArray_default()(_useSearchParams, 1),
|
|
|
searchParams = _useSearchParams2[0];
|
|
|
var urlParams = (0,_umi_production_exports.useParams)();
|
|
|
var _useContext = (0,_react_17_0_2_react.useContext)(DataContext),
|
|
|
data = _useContext.data,
|
|
|
dispatch = _useContext.dispatch,
|
|
|
setPreview = _useContext.setPreview,
|
|
|
getData = _useContext.getData,
|
|
|
handlePreview = _useContext.handlePreview,
|
|
|
disabled = _useContext.disabled;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
visibleModalType = _useState2[0],
|
|
|
setVisibleModalType = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(data === null || data === void 0 || (_data$item_types = data.item_types) === null || _data$item_types === void 0 || (_data$item_types = _data$item_types[0]) === null || _data$item_types === void 0 ? void 0 : _data$item_types.item_type),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
currentItemType = _useState4[0],
|
|
|
setCurrentItemType = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(true),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
loading = _useState6[0],
|
|
|
setLoading = _useState6[1];
|
|
|
var handleSave = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(notRedirect) {
|
|
|
var _data$item_types2, _data$item_types3;
|
|
|
var sort_by_item_type, items, dataCopy, _ref3, item_types, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
sort_by_item_type = data.item_types.map(function (item) {
|
|
|
return item.item_type_text;
|
|
|
});
|
|
|
items = data === null || data === void 0 || (_data$item_types2 = data.item_types) === null || _data$item_types2 === void 0 ? void 0 : _data$item_types2.filter(function (item) {
|
|
|
var _item$contents, _item$item_banks;
|
|
|
return ((_item$contents = item.contents) === null || _item$contents === void 0 ? void 0 : _item$contents.length) > 0 || (item === null || item === void 0 || (_item$item_banks = item.item_banks) === null || _item$item_banks === void 0 ? void 0 : _item$item_banks.length) > 0;
|
|
|
}); // console.log('---', sort_by_item_type, items);
|
|
|
// return
|
|
|
data.sort_by_item_type = sort_by_item_type;
|
|
|
if ((_data$item_types3 = data.item_types) !== null && _data$item_types3 !== void 0 && _data$item_types3.length) {
|
|
|
_context.next = 6;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.warning('试题总数=0,请先设置抽题规则');
|
|
|
return _context.abrupt("return");
|
|
|
case 6:
|
|
|
if (!((items === null || items === void 0 ? void 0 : items.length) === 0)) {
|
|
|
_context.next = 9;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.warning('试题总数=0,请先设置抽题规则');
|
|
|
return _context.abrupt("return");
|
|
|
case 9:
|
|
|
dataCopy = (0,lodash.cloneDeep)(data);
|
|
|
_ref3 = dataCopy || {}, item_types = _ref3.item_types;
|
|
|
dataCopy.item_types = item_types.filter(function (item) {
|
|
|
return item.item_type === currentItemType;
|
|
|
});
|
|
|
_context.next = 14;
|
|
|
return updateRandomExam(urlParams.id || urlParams.categoryId, dataCopy);
|
|
|
case 14:
|
|
|
res = _context.sent;
|
|
|
if (res.status === 0) {
|
|
|
message/* default */.ZP.success('保存成功');
|
|
|
if (!notRedirect) _umi_production_exports.history.push("/paperlibrary");
|
|
|
}
|
|
|
return _context.abrupt("return", res);
|
|
|
case 17:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function handleSave(_x) {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleExerciseSave = /*#__PURE__*/function () {
|
|
|
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(notRedirect, type, itemType) {
|
|
|
var body, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
console.log(data);
|
|
|
body = objectSpread2_default()(objectSpread2_default()(objectSpread2_default()({}, data.exercise), urlParams), {}, {
|
|
|
exerciseId: urlParams.categoryId,
|
|
|
sort_by_item_type: data.sort_by_item_type,
|
|
|
difficulty: data.examination_bank.difficulty,
|
|
|
exam_notes: data.examination_bank.exam_notes,
|
|
|
exercise_name: data.examination_bank.name,
|
|
|
time: data.examination_bank.time,
|
|
|
changed_item_type: currentItemType,
|
|
|
item_types: data.item_types,
|
|
|
// is_reset: 1,
|
|
|
sub_discipline_id: data.examination_bank.sub_discipline_id
|
|
|
});
|
|
|
if (!notRedirect || type === 1) body.is_reset = 1;
|
|
|
_context2.next = 5;
|
|
|
return (0,exercise/* putExercise */.wy)(body);
|
|
|
case 5:
|
|
|
res = _context2.sent;
|
|
|
if (res.status === 0) {
|
|
|
message/* default */.ZP.success("修改成功 ");
|
|
|
setCurrentItemType(itemType);
|
|
|
if (!notRedirect) {
|
|
|
_umi_production_exports.history.push("/classrooms/".concat(urlParams.coursesId, "/exercise/").concat(urlParams.categoryId, "/detail?random=true"));
|
|
|
}
|
|
|
}
|
|
|
return _context2.abrupt("return", res);
|
|
|
case 8:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function handleExerciseSave(_x2, _x3, _x4) {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleDelete = function handleDelete(itemType) {
|
|
|
modal/* default */.Z.confirm({
|
|
|
title: '提示',
|
|
|
icon: null,
|
|
|
centered: true,
|
|
|
closable: true,
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u786E\u8BA4\u5220\u9664\u8BE5\u9898\u578B\uFF1F"
|
|
|
}),
|
|
|
onOk: function () {
|
|
|
var _onOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
|
|
var res, _res, _data$item_types4, nextState, _data$item_types5;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
if (!urlParams.id) {
|
|
|
_context3.next = 8;
|
|
|
break;
|
|
|
}
|
|
|
_context3.next = 3;
|
|
|
return deleteItem(urlParams.id, {
|
|
|
item_type: [itemType]
|
|
|
});
|
|
|
case 3:
|
|
|
res = _context3.sent;
|
|
|
if (!(res.status !== 0)) {
|
|
|
_context3.next = 6;
|
|
|
break;
|
|
|
}
|
|
|
return _context3.abrupt("return");
|
|
|
case 6:
|
|
|
_context3.next = 14;
|
|
|
break;
|
|
|
case 8:
|
|
|
_context3.next = 10;
|
|
|
return deletecourseItem(urlParams.categoryId, {
|
|
|
item_type: [itemType]
|
|
|
});
|
|
|
case 10:
|
|
|
_res = _context3.sent;
|
|
|
getData();
|
|
|
if (!(_res.status !== 0)) {
|
|
|
_context3.next = 14;
|
|
|
break;
|
|
|
}
|
|
|
return _context3.abrupt("return");
|
|
|
case 14:
|
|
|
dispatch({
|
|
|
type: 'deleteQuestionType',
|
|
|
payload: itemType
|
|
|
});
|
|
|
if (itemType === currentItemType) {
|
|
|
nextState = reducer(data, {
|
|
|
type: 'deleteQuestionType',
|
|
|
payload: itemType
|
|
|
});
|
|
|
setCurrentItemType(nextState.item_types.length ? nextState.item_types[0].item_type : data === null || data === void 0 || (_data$item_types4 = data.item_types) === null || _data$item_types4 === void 0 || (_data$item_types4 = _data$item_types4[0]) === null || _data$item_types4 === void 0 ? void 0 : _data$item_types4.item_type);
|
|
|
} else {
|
|
|
setCurrentItemType(data === null || data === void 0 || (_data$item_types5 = data.item_types) === null || _data$item_types5 === void 0 || (_data$item_types5 = _data$item_types5[0]) === null || _data$item_types5 === void 0 ? void 0 : _data$item_types5.item_type);
|
|
|
}
|
|
|
case 16:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
function onOk() {
|
|
|
return _onOk.apply(this, arguments);
|
|
|
}
|
|
|
return onOk;
|
|
|
}()
|
|
|
});
|
|
|
};
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var _data$examination_ban;
|
|
|
if (data !== null && data !== void 0 && (_data$examination_ban = data.examination_bank) !== null && _data$examination_ban !== void 0 && _data$examination_ban.name) {
|
|
|
setLoading(false);
|
|
|
}
|
|
|
(0,utils_util/* setDocumentTitle */.Dk)('随机组卷');
|
|
|
}, [data === null || data === void 0 || (_data$examination_ban2 = data.examination_bank) === null || _data$examination_ban2 === void 0 ? void 0 : _data$examination_ban2.name]);
|
|
|
var handlePracticeTest = /*#__PURE__*/function () {
|
|
|
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
|
|
|
var res, _userInfo;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
_context4.next = 2;
|
|
|
return handleExerciseSave(true, 1);
|
|
|
case 2:
|
|
|
res = _context4.sent;
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
_umi_production_exports.history.push("/classrooms/".concat(urlParams.coursesId, "/exercise/").concat(urlParams.categoryId, "/").concat((_userInfo = (0,authority/* userInfo */.eY)()) === null || _userInfo === void 0 ? void 0 : _userInfo.login, "/initate_answer"));
|
|
|
}
|
|
|
// const res = await startSimulateAnswer({ ...urlParams, is_reset: 1 })
|
|
|
// if (res?.exercise?.id) {
|
|
|
// }
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
return function handlePracticeTest() {
|
|
|
return _ref5.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: QuestionInfomodules.questionInfo,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "tc mb20",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(TitleEditor, {
|
|
|
defaultValue: data === null || data === void 0 || (_data$examination_ban3 = data.examination_bank) === null || _data$examination_ban3 === void 0 ? void 0 : _data$examination_ban3.name,
|
|
|
onFinish: ( /*#__PURE__*/function () {
|
|
|
var _ref6 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5(value) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
|
|
|
while (1) switch (_context5.prev = _context5.next) {
|
|
|
case 0:
|
|
|
dispatch({
|
|
|
type: 'updateBaseInfo',
|
|
|
payload: objectSpread2_default()(objectSpread2_default()({}, data.examination_bank), {}, {
|
|
|
name: value
|
|
|
})
|
|
|
});
|
|
|
return _context5.abrupt("return", true);
|
|
|
case 2:
|
|
|
case "end":
|
|
|
return _context5.stop();
|
|
|
}
|
|
|
}, _callee5);
|
|
|
}));
|
|
|
return function (_x5) {
|
|
|
return _ref6.apply(this, arguments);
|
|
|
};
|
|
|
}())
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "center",
|
|
|
className: "mb20",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: "mr30",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionInfomodules.label,
|
|
|
children: "\u7B54\u9898\u65F6\u957F"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: (data === null || data === void 0 || (_data$examination_ban4 = data.examination_bank) === null || _data$examination_ban4 === void 0 ? void 0 : _data$examination_ban4.time) === -1 ? '不限' : (data === null || data === void 0 || (_data$examination_ban5 = data.examination_bank) === null || _data$examination_ban5 === void 0 ? void 0 : _data$examination_ban5.time) || '不限'
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: "mr30",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionInfomodules.label,
|
|
|
children: "\u96BE\u5EA6"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: (_difficultyMap = difficultyMap["".concat(data === null || data === void 0 || (_data$examination_ban6 = data.examination_bank) === null || _data$examination_ban6 === void 0 ? void 0 : _data$examination_ban6.difficulty)]) === null || _difficultyMap === void 0 ? void 0 : _difficultyMap.label
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: "mr30",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionInfomodules.label,
|
|
|
children: "\u8BD5\u9898\u603B\u6570"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: (data === null || data === void 0 || (_data$examination_ban7 = data.examination_bank) === null || _data$examination_ban7 === void 0 ? void 0 : _data$examination_ban7.question_count) || 0
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: QuestionInfomodules.label,
|
|
|
children: "\u603B\u5206"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: (data === null || data === void 0 || (_data$examination_ban8 = data.examination_bank) === null || _data$examination_ban8 === void 0 ? void 0 : _data$examination_ban8.total_score) || 0
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: QuestionInfomodules.content,
|
|
|
style: {
|
|
|
border: (data === null || data === void 0 || (_data$item_types6 = data.item_types) === null || _data$item_types6 === void 0 ? void 0 : _data$item_types6.length) <= 0 && 'none'
|
|
|
},
|
|
|
children: (data === null || data === void 0 || (_data$item_types7 = data.item_types) === null || _data$item_types7 === void 0 ? void 0 : _data$item_types7.length) > 0 ? /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
wrap: false,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
flex: '260px',
|
|
|
className: QuestionInfomodules.leftPart,
|
|
|
children: [!disabled && /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: "mb20",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomButton */.op, {
|
|
|
style: {
|
|
|
margin: '0 15px',
|
|
|
borderRadius: 2
|
|
|
},
|
|
|
onClick: function onClick() {
|
|
|
return setVisibleModalType('setScore');
|
|
|
},
|
|
|
children: "\u6279\u91CF\u8BBE\u7F6E\u5206\u503C"
|
|
|
}), (urlParams === null || urlParams === void 0 ? void 0 : urlParams.id) && /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomButton */.op, {
|
|
|
shape: "default",
|
|
|
onClick: function onClick() {
|
|
|
return setVisibleModalType('questionType');
|
|
|
},
|
|
|
children: "\u6DFB\u52A0\u9898\u578B"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(QuestionInfo_QuestionList, {
|
|
|
list: data.item_types,
|
|
|
onSelect: ( /*#__PURE__*/function () {
|
|
|
var _ref7 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6(itemType) {
|
|
|
var currentItem, dataCopy, _ref8, item_types, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee6$(_context6) {
|
|
|
while (1) switch (_context6.prev = _context6.next) {
|
|
|
case 0:
|
|
|
if (!(itemType === currentItemType)) {
|
|
|
_context6.next = 2;
|
|
|
break;
|
|
|
}
|
|
|
return _context6.abrupt("return");
|
|
|
case 2:
|
|
|
setLoading(true);
|
|
|
currentItem = data.item_types.find(function (item) {
|
|
|
return item.item_type === currentItemType;
|
|
|
});
|
|
|
if (!(currentItemType !== 'PRACTICAL' && currentItem.contents.length > 0 && urlParams !== null && urlParams !== void 0 && urlParams.id)) {
|
|
|
_context6.next = 19;
|
|
|
break;
|
|
|
}
|
|
|
dataCopy = (0,lodash.cloneDeep)(data);
|
|
|
_ref8 = dataCopy || {}, item_types = _ref8.item_types;
|
|
|
dataCopy.item_types = item_types.filter(function (item) {
|
|
|
return item.item_type === currentItemType;
|
|
|
});
|
|
|
_context6.prev = 8;
|
|
|
_context6.next = 11;
|
|
|
return updateRandomExam(urlParams.id || urlParams.categoryId, dataCopy);
|
|
|
case 11:
|
|
|
res = _context6.sent;
|
|
|
if (res.status === 0) {
|
|
|
setCurrentItemType(itemType);
|
|
|
}
|
|
|
_context6.next = 17;
|
|
|
break;
|
|
|
case 15:
|
|
|
_context6.prev = 15;
|
|
|
_context6.t0 = _context6["catch"](8);
|
|
|
case 17:
|
|
|
_context6.next = 20;
|
|
|
break;
|
|
|
case 19:
|
|
|
if (urlParams.categoryId) {
|
|
|
handleExerciseSave(true, 2, itemType);
|
|
|
} else {
|
|
|
handleSave(true);
|
|
|
}
|
|
|
case 20:
|
|
|
setLoading(false);
|
|
|
case 21:
|
|
|
case "end":
|
|
|
return _context6.stop();
|
|
|
}
|
|
|
}, _callee6, null, [[8, 15]]);
|
|
|
}));
|
|
|
return function (_x6) {
|
|
|
return _ref7.apply(this, arguments);
|
|
|
};
|
|
|
}()),
|
|
|
onDelete: handleDelete
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: 1,
|
|
|
className: QuestionInfomodules.rightPart,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
|
|
|
spinning: loading,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(QuestionInfo_QuestionDetail, {
|
|
|
setVisibleModalType: setVisibleModalType,
|
|
|
currentItemType: currentItemType,
|
|
|
onDelete: handleDelete
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(NoData/* default */.Z, {
|
|
|
customText: "\u8BF7\u5148\u8BBE\u7F6E\u8BD5\u5377\u9898\u578B",
|
|
|
styles: {
|
|
|
margin: '70px auto'
|
|
|
},
|
|
|
ButtonTwo: /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
|
|
|
justify: "center",
|
|
|
className: "mt20",
|
|
|
children: (urlParams === null || urlParams === void 0 ? void 0 : urlParams.id) && /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomButton */.op, {
|
|
|
style: {
|
|
|
width: 88
|
|
|
},
|
|
|
onClick: function onClick() {
|
|
|
return setVisibleModalType('questionType');
|
|
|
},
|
|
|
children: "\u6DFB\u52A0\u9898\u578B"
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
}), !!(urlParams !== null && urlParams !== void 0 && urlParams.id) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: QuestionInfomodules.fixedBottom,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(AsyncButton/* AsyncButton */.Z, {
|
|
|
className: "".concat(QuestionInfomodules.previewBtn, " mr20"),
|
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee7() {
|
|
|
var _data$item_types8, _data$item_types9;
|
|
|
var items, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee7$(_context7) {
|
|
|
while (1) switch (_context7.prev = _context7.next) {
|
|
|
case 0:
|
|
|
items = data === null || data === void 0 || (_data$item_types8 = data.item_types) === null || _data$item_types8 === void 0 ? void 0 : _data$item_types8.filter(function (item) {
|
|
|
var _item$contents2, _item$item_banks2;
|
|
|
return ((_item$contents2 = item.contents) === null || _item$contents2 === void 0 ? void 0 : _item$contents2.length) > 0 || (item === null || item === void 0 || (_item$item_banks2 = item.item_banks) === null || _item$item_banks2 === void 0 ? void 0 : _item$item_banks2.length) > 0;
|
|
|
});
|
|
|
if ((_data$item_types9 = data.item_types) !== null && _data$item_types9 !== void 0 && _data$item_types9.length) {
|
|
|
_context7.next = 4;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.warning('试题总数=0,请先设置抽题规则');
|
|
|
return _context7.abrupt("return");
|
|
|
case 4:
|
|
|
if (!((items === null || items === void 0 ? void 0 : items.length) === 0)) {
|
|
|
_context7.next = 7;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.warning('试题总数=0,请先设置抽题规则');
|
|
|
return _context7.abrupt("return");
|
|
|
case 7:
|
|
|
_context7.next = 9;
|
|
|
return handleSave(true);
|
|
|
case 9:
|
|
|
res = _context7.sent;
|
|
|
if (!((res === null || res === void 0 ? void 0 : res.status) === 0)) {
|
|
|
_context7.next = 13;
|
|
|
break;
|
|
|
}
|
|
|
_context7.next = 13;
|
|
|
return handlePreview();
|
|
|
case 13:
|
|
|
case "end":
|
|
|
return _context7.stop();
|
|
|
}
|
|
|
}, _callee7);
|
|
|
})),
|
|
|
children: "\u8BD5\u5377\u9884\u89C8"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(AsyncButton/* AsyncButton */.Z, {
|
|
|
type: "primary",
|
|
|
className: QuestionInfomodules.confirmBtn,
|
|
|
onClick: function onClick() {
|
|
|
return handleSave();
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-baocun1 mr5"
|
|
|
}), "\u4FDD\u5B58\u8BD5\u5377"]
|
|
|
})]
|
|
|
}), !!(urlParams !== null && urlParams !== void 0 && urlParams.categoryId) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: QuestionInfomodules.fixedBottom,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(AsyncButton/* AsyncButton */.Z, {
|
|
|
className: "".concat(QuestionInfomodules.previewBtn, " mr20"),
|
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee8() {
|
|
|
var _data$exercise, _data$exercise2;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee8$(_context8) {
|
|
|
while (1) switch (_context8.prev = _context8.next) {
|
|
|
case 0:
|
|
|
document.body.scrollIntoView();
|
|
|
// history.push(`/classrooms/${urlParams.coursesId}/exercise`)
|
|
|
_umi_production_exports.history.push("/classrooms/".concat(urlParams.coursesId, "/exercise/").concat(data === null || data === void 0 || (_data$exercise = data.exercise) === null || _data$exercise === void 0 ? void 0 : _data$exercise.id, "/detail?random=").concat(data === null || data === void 0 || (_data$exercise2 = data.exercise) === null || _data$exercise2 === void 0 ? void 0 : _data$exercise2.is_random));
|
|
|
case 2:
|
|
|
case "end":
|
|
|
return _context8.stop();
|
|
|
}
|
|
|
}, _callee8);
|
|
|
})),
|
|
|
children: "\u8FD4\u56DE"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(AsyncButton/* AsyncButton */.Z, {
|
|
|
className: "".concat(QuestionInfomodules.previewBtn, " mr20"),
|
|
|
onClick: handlePracticeTest,
|
|
|
children: "\u6A21\u62DF\u8003\u8BD5"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(AsyncButton/* AsyncButton */.Z, {
|
|
|
type: "primary",
|
|
|
className: QuestionInfomodules.confirmBtn,
|
|
|
onClick: function onClick() {
|
|
|
return handleExerciseSave();
|
|
|
},
|
|
|
children: "\u63D0\u4EA4"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(QuestionInfo_QuestionTypeModal, {
|
|
|
open: visibleModalType === 'questionType',
|
|
|
onCancel: function onCancel() {
|
|
|
return setVisibleModalType('');
|
|
|
},
|
|
|
onOk: ( /*#__PURE__*/function () {
|
|
|
var _ref11 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee9(selectedQuestionType) {
|
|
|
var _nextState$item_types, _data$item_types10;
|
|
|
var deletedItemTypes, nextState, nextItemTypes, _iterator, _step, itemType, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee9$(_context9) {
|
|
|
while (1) switch (_context9.prev = _context9.next) {
|
|
|
case 0:
|
|
|
deletedItemTypes = [];
|
|
|
nextState = reducer(data, {
|
|
|
type: 'setQuestionType',
|
|
|
payload: selectedQuestionType
|
|
|
});
|
|
|
nextItemTypes = (nextState === null || nextState === void 0 || (_nextState$item_types = nextState.item_types) === null || _nextState$item_types === void 0 ? void 0 : _nextState$item_types.map(function (item) {
|
|
|
return item.item_type;
|
|
|
})) || [];
|
|
|
_iterator = createForOfIteratorHelper_default()((data === null || data === void 0 || (_data$item_types10 = data.item_types) === null || _data$item_types10 === void 0 ? void 0 : _data$item_types10.map(function (item) {
|
|
|
return item.item_type;
|
|
|
})) || []);
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
itemType = _step.value;
|
|
|
if (!nextItemTypes.includes(itemType)) {
|
|
|
deletedItemTypes.push(itemType);
|
|
|
}
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
if (!(urlParams.id && deletedItemTypes.length > 0)) {
|
|
|
_context9.next = 11;
|
|
|
break;
|
|
|
}
|
|
|
_context9.next = 8;
|
|
|
return deleteItem(urlParams.id, {
|
|
|
item_type: deletedItemTypes
|
|
|
});
|
|
|
case 8:
|
|
|
res = _context9.sent;
|
|
|
if (!(res.status !== 0)) {
|
|
|
_context9.next = 11;
|
|
|
break;
|
|
|
}
|
|
|
return _context9.abrupt("return");
|
|
|
case 11:
|
|
|
dispatch({
|
|
|
type: 'setQuestionType',
|
|
|
payload: selectedQuestionType
|
|
|
});
|
|
|
setCurrentItemType(currentItemType ? currentItemType : nextState.item_types[0].item_type);
|
|
|
setVisibleModalType('');
|
|
|
case 14:
|
|
|
case "end":
|
|
|
return _context9.stop();
|
|
|
}
|
|
|
}, _callee9);
|
|
|
}));
|
|
|
return function (_x7) {
|
|
|
return _ref11.apply(this, arguments);
|
|
|
};
|
|
|
}())
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(SetScoreModal, {
|
|
|
open: visibleModalType === 'setScore',
|
|
|
onCancel: function onCancel() {
|
|
|
setVisibleModalType('');
|
|
|
},
|
|
|
onOk: ( /*#__PURE__*/function () {
|
|
|
var _ref12 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee10(newData) {
|
|
|
var scoreSettings, res, _res2;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee10$(_context10) {
|
|
|
while (1) switch (_context10.prev = _context10.next) {
|
|
|
case 0:
|
|
|
console.log('---newData', newData);
|
|
|
scoreSettings = newData.item_types.map(function (item) {
|
|
|
return {
|
|
|
item_type: item.item_type,
|
|
|
score: item.score
|
|
|
};
|
|
|
});
|
|
|
if (!urlParams.id) {
|
|
|
_context10.next = 9;
|
|
|
break;
|
|
|
}
|
|
|
_context10.next = 5;
|
|
|
return setItemTypeScore(urlParams.id, {
|
|
|
score_settings: scoreSettings
|
|
|
});
|
|
|
case 5:
|
|
|
res = _context10.sent;
|
|
|
if (res.status === 0) {
|
|
|
// getData(urlParams.id)
|
|
|
dispatch({
|
|
|
type: 'init',
|
|
|
payload: newData
|
|
|
});
|
|
|
}
|
|
|
_context10.next = 13;
|
|
|
break;
|
|
|
case 9:
|
|
|
_context10.next = 11;
|
|
|
return setItemTypeScores(urlParams.categoryId, {
|
|
|
score_settings: scoreSettings
|
|
|
});
|
|
|
case 11:
|
|
|
_res2 = _context10.sent;
|
|
|
if (_res2.status === 0) {
|
|
|
// getData(urlParams.id)
|
|
|
dispatch({
|
|
|
type: 'init',
|
|
|
payload: newData
|
|
|
});
|
|
|
}
|
|
|
case 13:
|
|
|
setVisibleModalType('');
|
|
|
case 14:
|
|
|
case "end":
|
|
|
return _context10.stop();
|
|
|
}
|
|
|
}, _callee10);
|
|
|
}));
|
|
|
return function (_x8) {
|
|
|
return _ref12.apply(this, arguments);
|
|
|
};
|
|
|
}())
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(QuestionInfo_RuleModal, {
|
|
|
open: visibleModalType === 'rule',
|
|
|
onCancel: function onCancel() {
|
|
|
return setVisibleModalType('');
|
|
|
},
|
|
|
currentItemType: currentItemType,
|
|
|
setVisibleModalType: setVisibleModalType
|
|
|
}), searchParams.get('type') === 'settings' && /*#__PURE__*/(0,jsx_runtime.jsx)(QuestionInfo_SelectShixunModal, {
|
|
|
open: visibleModalType === 'selectShixun',
|
|
|
onCancel: function onCancel() {
|
|
|
return setVisibleModalType('');
|
|
|
},
|
|
|
onOk: function onOk(selectedRows) {
|
|
|
console.log(selectedRows);
|
|
|
if ((selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.length) <= 0) {
|
|
|
message/* default */.ZP.info('实训数不能为0');
|
|
|
return;
|
|
|
}
|
|
|
dispatch({
|
|
|
type: 'addShixun',
|
|
|
payload: {
|
|
|
shixunList: toConsumableArray_default()(selectedRows)
|
|
|
}
|
|
|
});
|
|
|
setVisibleModalType('');
|
|
|
}
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var Edit_QuestionInfo = (QuestionInfo);
|
|
|
// EXTERNAL MODULE: ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepPreview/index.tsx + 19 modules
|
|
|
var StepPreview = __webpack_require__(42911);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/Edit/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var RandomPaperEdit = function RandomPaperEdit() {
|
|
|
var _data$exercise, _data$exercise2, _userInfo;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)('baseInfo'),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
currentKey = _useState2[0],
|
|
|
setCurrentKey = _useState2[1];
|
|
|
var dvaDispatch = (0,_umi_production_exports.useDispatch)();
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
dvaDispatch({
|
|
|
type: 'globalSetting/footerToggle',
|
|
|
payload: false
|
|
|
});
|
|
|
}, []);
|
|
|
var urlParams = (0,_umi_production_exports.useParams)();
|
|
|
var isEdit = !!(urlParams.id || urlParams.categoryId);
|
|
|
var _useSearchParams = (0,_umi_production_exports.useSearchParams)(),
|
|
|
_useSearchParams2 = slicedToArray_default()(_useSearchParams, 1),
|
|
|
searchParams = _useSearchParams2[0];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (searchParams.get('type') === 'settings') {
|
|
|
setCurrentKey('settings');
|
|
|
}
|
|
|
}, []);
|
|
|
var _useReducer = (0,_react_17_0_2_react.useReducer)(reducer, null),
|
|
|
_useReducer2 = slicedToArray_default()(_useReducer, 2),
|
|
|
data = _useReducer2[0],
|
|
|
dispatch = _useReducer2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
loading = _useState4[0],
|
|
|
setLoading = _useState4[1];
|
|
|
var getData = /*#__PURE__*/function () {
|
|
|
var _ref = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
setLoading(true);
|
|
|
if (!urlParams.categoryId) {
|
|
|
_context.next = 7;
|
|
|
break;
|
|
|
}
|
|
|
_context.next = 4;
|
|
|
return getExerciseRandomExam(urlParams);
|
|
|
case 4:
|
|
|
res = _context.sent;
|
|
|
_context.next = 10;
|
|
|
break;
|
|
|
case 7:
|
|
|
_context.next = 9;
|
|
|
return getRandomExam(urlParams.id);
|
|
|
case 9:
|
|
|
res = _context.sent;
|
|
|
case 10:
|
|
|
setLoading(false);
|
|
|
if (res.status === 0) {
|
|
|
dispatch({
|
|
|
type: 'init',
|
|
|
payload: res
|
|
|
});
|
|
|
}
|
|
|
case 12:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function getData() {
|
|
|
return _ref.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
//试卷库和课堂试卷编辑
|
|
|
if (isEdit) {
|
|
|
getData();
|
|
|
} else {
|
|
|
dispatch({
|
|
|
type: 'init',
|
|
|
payload: {
|
|
|
examination_bank: {
|
|
|
difficulty: 2
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}, [urlParams]);
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
clearData = _useState6[0],
|
|
|
setClearData = _useState6[1];
|
|
|
var handlePreview = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(record, other) {
|
|
|
var _data$item_types;
|
|
|
var new_item_types, body, _res, _clonePreviewData$que, clonePreviewData, _res2, _clonePreviewData$que2, _clonePreviewData, res, _data$item_types2, paperData, sortList;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
new_item_types = data === null || data === void 0 || (_data$item_types = data.item_types) === null || _data$item_types === void 0 ? void 0 : _data$item_types.filter(function (e) {
|
|
|
var _e$item_type;
|
|
|
return (e === null || e === void 0 || (_e$item_type = e.item_type) === null || _e$item_type === void 0 ? void 0 : _e$item_type.toUpperCase()) === (other === null || other === void 0 ? void 0 : other.type);
|
|
|
});
|
|
|
body = {
|
|
|
sort_by_item_type: data.sort_by_item_type,
|
|
|
difficulty: data.examination_bank.difficulty,
|
|
|
exam_notes: data.examination_bank.exam_notes,
|
|
|
name: data.examination_bank.name,
|
|
|
time: data.examination_bank.time,
|
|
|
item_types: data.item_types
|
|
|
}; //随机换一题
|
|
|
if (!(record !== undefined && !(record !== null && record !== void 0 && record.single_question_id))) {
|
|
|
_context2.next = 10;
|
|
|
break;
|
|
|
}
|
|
|
body.seleted_item_bank_ids = record === null || record === void 0 ? void 0 : record.seleted_item_bank_ids;
|
|
|
body.item_types = new_item_types;
|
|
|
_context2.next = 7;
|
|
|
return toggleRandomQuestions(body);
|
|
|
case 7:
|
|
|
_res = _context2.sent;
|
|
|
if ((_res === null || _res === void 0 ? void 0 : _res.status) === 0) {
|
|
|
clonePreviewData = (0,lodash.cloneDeep)(preview.data);
|
|
|
clonePreviewData.questionList = clonePreviewData === null || clonePreviewData === void 0 || (_clonePreviewData$que = clonePreviewData.questionList) === null || _clonePreviewData$que === void 0 ? void 0 : _clonePreviewData$que.map(function (e) {
|
|
|
if (e.type === other.type) {
|
|
|
var _res$questions;
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, e), {}, {
|
|
|
questions: (_res === null || _res === void 0 || (_res$questions = _res.questions) === null || _res$questions === void 0 ? void 0 : _res$questions.questions) || []
|
|
|
});
|
|
|
}
|
|
|
return e;
|
|
|
});
|
|
|
setPreview({
|
|
|
show: true,
|
|
|
data: clonePreviewData
|
|
|
});
|
|
|
}
|
|
|
return _context2.abrupt("return");
|
|
|
case 10:
|
|
|
if (!(record !== undefined && record !== null && record !== void 0 && record.single_question_id)) {
|
|
|
_context2.next = 19;
|
|
|
break;
|
|
|
}
|
|
|
body.seleted_item_bank_ids = record === null || record === void 0 ? void 0 : record.seleted_item_bank_ids;
|
|
|
body.single_question_id = record === null || record === void 0 ? void 0 : record.single_question_id;
|
|
|
body.item_types = new_item_types;
|
|
|
_context2.next = 16;
|
|
|
return toggleRandomQuestions(body);
|
|
|
case 16:
|
|
|
_res2 = _context2.sent;
|
|
|
if ((_res2 === null || _res2 === void 0 ? void 0 : _res2.status) === 0) {
|
|
|
_clonePreviewData = (0,lodash.cloneDeep)(preview.data);
|
|
|
_clonePreviewData.questionList = _clonePreviewData === null || _clonePreviewData === void 0 || (_clonePreviewData$que2 = _clonePreviewData.questionList) === null || _clonePreviewData$que2 === void 0 ? void 0 : _clonePreviewData$que2.map(function (e) {
|
|
|
if (e.type === other.type) {
|
|
|
var _res2$questions;
|
|
|
var new_questions = (0,lodash.cloneDeep)(e === null || e === void 0 ? void 0 : e.questions);
|
|
|
new_questions.splice(other.index, 1, _res2 === null || _res2 === void 0 || (_res2$questions = _res2.questions) === null || _res2$questions === void 0 || (_res2$questions = _res2$questions.questions) === null || _res2$questions === void 0 ? void 0 : _res2$questions[0]);
|
|
|
console.log(e === null || e === void 0 ? void 0 : e.questions, new_questions, other.index, 'new_questions');
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, e), {}, {
|
|
|
questions: new_questions
|
|
|
});
|
|
|
}
|
|
|
return e;
|
|
|
});
|
|
|
setPreview({
|
|
|
show: true,
|
|
|
data: _clonePreviewData
|
|
|
});
|
|
|
}
|
|
|
return _context2.abrupt("return");
|
|
|
case 19:
|
|
|
_context2.next = 21;
|
|
|
return previewRandomPaper(body);
|
|
|
case 21:
|
|
|
res = _context2.sent;
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
paperData = (0,utils_util/* formatRandomPaperData */.ad)(res);
|
|
|
sortList = [];
|
|
|
data === null || data === void 0 || (_data$item_types2 = data.item_types) === null || _data$item_types2 === void 0 || _data$item_types2.forEach(function (e) {
|
|
|
var _paperData$questionLi;
|
|
|
var param = paperData === null || paperData === void 0 || (_paperData$questionLi = paperData.questionList) === null || _paperData$questionLi === void 0 ? void 0 : _paperData$questionLi.find(function (k) {
|
|
|
return e.item_type === k.type;
|
|
|
});
|
|
|
sortList.push(param);
|
|
|
});
|
|
|
console.log(data, 'sortList');
|
|
|
sortList = (0,lodash.compact)(sortList);
|
|
|
paperData.questionList = sortList;
|
|
|
setPreview({
|
|
|
show: true,
|
|
|
data: paperData
|
|
|
});
|
|
|
setClearData(new Date());
|
|
|
}
|
|
|
case 23:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function handlePreview(_x, _x2) {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleTypeScore = function handleTypeScore(item) {
|
|
|
var _clonePreviewData$que3;
|
|
|
var clonePreviewData = (0,lodash.cloneDeep)(preview.data);
|
|
|
clonePreviewData.questionList = clonePreviewData === null || clonePreviewData === void 0 || (_clonePreviewData$que3 = clonePreviewData.questionList) === null || _clonePreviewData$que3 === void 0 ? void 0 : _clonePreviewData$que3.map(function (e) {
|
|
|
if (e.type === item.type) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, e), {}, {
|
|
|
questions_score: item.scoreTotal
|
|
|
});
|
|
|
}
|
|
|
return e;
|
|
|
});
|
|
|
dispatch({
|
|
|
type: 'changeQuestionScore',
|
|
|
payload: {
|
|
|
score: item.score,
|
|
|
itemType: item.type
|
|
|
}
|
|
|
});
|
|
|
setPreview({
|
|
|
show: true,
|
|
|
data: clonePreviewData
|
|
|
});
|
|
|
};
|
|
|
var handleSubmit = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(record) {
|
|
|
var body, _res3, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
body = {
|
|
|
sort_by_item_type: data.sort_by_item_type,
|
|
|
difficulty: data.examination_bank.difficulty,
|
|
|
exam_notes: data.examination_bank.exam_notes,
|
|
|
name: data.examination_bank.name,
|
|
|
time: data.examination_bank.time,
|
|
|
item_types: data.item_types,
|
|
|
sub_discipline_id: data.examination_bank.sub_discipline_id
|
|
|
};
|
|
|
if (!record) {
|
|
|
_context3.next = 7;
|
|
|
break;
|
|
|
}
|
|
|
_context3.next = 4;
|
|
|
return saveQuestionList(objectSpread2_default()(objectSpread2_default()({}, body), record));
|
|
|
case 4:
|
|
|
_res3 = _context3.sent;
|
|
|
if (_res3.status === 0) {
|
|
|
message/* default */.ZP.success("保存成功");
|
|
|
}
|
|
|
return _context3.abrupt("return");
|
|
|
case 7:
|
|
|
_context3.next = 9;
|
|
|
return updateRandomExam(urlParams.id, body);
|
|
|
case 9:
|
|
|
res = _context3.sent;
|
|
|
if (res.status === 0) {
|
|
|
message/* default */.ZP.success('提交成功');
|
|
|
_umi_production_exports.history.push("/paperlibrary?defaultActiveKey=0");
|
|
|
}
|
|
|
case 11:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return function handleSubmit(_x3) {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var courseOptions = useCourseOptions();
|
|
|
var _Form$useForm = es_form/* default */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
baseInfoForm = _Form$useForm2[0];
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)({
|
|
|
show: false,
|
|
|
data: {}
|
|
|
}),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
preview = _useState8[0],
|
|
|
setPreview = _useState8[1];
|
|
|
var disabled = !!(data !== null && data !== void 0 && (_data$exercise = data.exercise) !== null && _data$exercise !== void 0 && _data$exercise.exercise_status) && (data === null || data === void 0 || (_data$exercise2 = data.exercise) === null || _data$exercise2 === void 0 ? void 0 : _data$exercise2.exercise_status) !== 1;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(DataContext.Provider, {
|
|
|
value: {
|
|
|
data: data,
|
|
|
disabled: disabled,
|
|
|
dispatch: dispatch,
|
|
|
setPreview: setPreview,
|
|
|
getData: getData,
|
|
|
handlePreview: handlePreview
|
|
|
},
|
|
|
children: preview.show ? /*#__PURE__*/(0,jsx_runtime.jsx)(StepPreview/* default */.Z, {
|
|
|
data: preview.data,
|
|
|
onExchange: handlePreview,
|
|
|
onTypeScore: handleTypeScore,
|
|
|
submit: handleSubmit,
|
|
|
goBack: function goBack() {
|
|
|
return setPreview({
|
|
|
show: false,
|
|
|
data: {}
|
|
|
});
|
|
|
}
|
|
|
}, clearData) : /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Editmodules.wrapper,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "edu-container",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z, {
|
|
|
className: Editmodules.breadCrumbWrapper,
|
|
|
separator: ">",
|
|
|
items: urlParams !== null && urlParams !== void 0 && urlParams.categoryId ? [{
|
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
|
to: "/classrooms/".concat(urlParams.coursesId, "/exercise"),
|
|
|
children: (_userInfo = (0,authority/* userInfo */.eY)()) === null || _userInfo === void 0 || (_userInfo = _userInfo.course) === null || _userInfo === void 0 ? void 0 : _userInfo.course_name
|
|
|
})
|
|
|
}, {
|
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
|
to: "/classrooms/".concat(urlParams.coursesId, "/exercise"),
|
|
|
children: "\u8BD5\u5377\u5217\u8868"
|
|
|
})
|
|
|
}, {
|
|
|
title: '编辑试卷'
|
|
|
}] : [{
|
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
|
to: "/paperlibrary",
|
|
|
children: "\u8BD5\u5377\u5E93"
|
|
|
})
|
|
|
}, {
|
|
|
title: '随机组卷'
|
|
|
}]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(PaperTab, {
|
|
|
activeKey: currentKey
|
|
|
// className='mb20'
|
|
|
,
|
|
|
tabs: [{
|
|
|
key: 'baseInfo',
|
|
|
label: '试卷基础信息'
|
|
|
}, {
|
|
|
key: 'settings',
|
|
|
label: '组卷配置'
|
|
|
}],
|
|
|
onChange: ( /*#__PURE__*/function () {
|
|
|
var _ref4 = 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:
|
|
|
if (!(key === 'settings')) {
|
|
|
_context4.next = 8;
|
|
|
break;
|
|
|
}
|
|
|
_context4.next = 3;
|
|
|
return baseInfoForm.validateFields();
|
|
|
case 3:
|
|
|
if (isEdit) {
|
|
|
_context4.next = 8;
|
|
|
break;
|
|
|
}
|
|
|
_context4.next = 6;
|
|
|
return createRandomExam(data);
|
|
|
case 6:
|
|
|
res = _context4.sent;
|
|
|
if (res.status === 0) {
|
|
|
_umi_production_exports.history.replace("/randompaper/edit/".concat(res === null || res === void 0 ? void 0 : res.examination_bank_id, "?type=settings"));
|
|
|
}
|
|
|
case 8:
|
|
|
setCurrentKey(key);
|
|
|
case 9:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
return function (_x4) {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}())
|
|
|
}), currentKey === 'baseInfo' && /*#__PURE__*/(0,jsx_runtime.jsx)(Edit_BaseInfo, {
|
|
|
courseOptions: courseOptions,
|
|
|
setCurrentKey: setCurrentKey,
|
|
|
loading: loading,
|
|
|
form: baseInfoForm
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
display: currentKey === 'settings' ? 'block' : 'none'
|
|
|
},
|
|
|
children: data && /*#__PURE__*/(0,jsx_runtime.jsx)(Edit_QuestionInfo, {})
|
|
|
})]
|
|
|
})
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var Edit = (RandomPaperEdit);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 27082:
|
|
|
/*!*********************************************!*\
|
|
|
!*** ./src/utils/hooks/useCustomRequest.ts ***!
|
|
|
\*********************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ U: function() { return /* binding */ useCustomRequest; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_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_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js */ 82242);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js */ 41498);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js */ 79800);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ 59301);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//常见的请求模式,包含loading和改变params。
|
|
|
|
|
|
function useCustomRequest(request, baseParams) {
|
|
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_4__.useState)(baseParams),
|
|
|
_useState2 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState, 2),
|
|
|
params = _useState2[0],
|
|
|
setParams = _useState2[1];
|
|
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_4__.useState)(false),
|
|
|
_useState4 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState3, 2),
|
|
|
loading = _useState4[0],
|
|
|
setLoading = _useState4[1];
|
|
|
var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_4__.useState)(),
|
|
|
_useState6 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState5, 2),
|
|
|
data = _useState6[0],
|
|
|
setData = _useState6[1];
|
|
|
var getData = /*#__PURE__*/function () {
|
|
|
var _ref = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee(newParams) {
|
|
|
var reset,
|
|
|
mergedParams,
|
|
|
res,
|
|
|
_args = arguments;
|
|
|
return _root_workspace_ppte5yg23_SJ5m_develop_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:
|
|
|
reset = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
|
|
|
mergedParams = reset ? baseParams : _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1___default()({}, params), newParams);
|
|
|
setLoading(true);
|
|
|
setParams(mergedParams);
|
|
|
_context.next = 6;
|
|
|
return request(mergedParams);
|
|
|
case 6:
|
|
|
res = _context.sent;
|
|
|
setLoading(false);
|
|
|
setData(res);
|
|
|
return _context.abrupt("return", res);
|
|
|
case 10:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function getData(_x) {
|
|
|
return _ref.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
return [params, loading, getData, data];
|
|
|
}
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 73631:
|
|
|
/*!********************************************************!*\
|
|
|
!*** ./src/assets/images/problemset/folder-closed.png ***!
|
|
|
\********************************************************/
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IArs4c6QAAAZxJREFUOBGtlL1Ow0AMgH2XUIkOLFXVASgTsDHxBIAEzAwMPBQjT8AATGVBgEBCYmHmFcICYmBogCbNYSe52HUTVZWwFJ3PP599Z+WMcy6Af5SwYkWnLYifTyBzq5XNK8YNwbbvYP381ZuaVlN1+HJwAc4d1QYaA+gDsHYANrhGHTdCMtSDMILtwSMDn7ZiANPKwyjeQ0Reo4r1gEoEwRkDb7spdPcBeocMk1Cv00oii5L+fgPwcR/zHfb3AJY2sEpUVLOUhB/l+w7I1iS9TYDFrM3AzhqGDstPZ3li2Z12U2WLvk4fGJh+F0elYN8ZrbWiA7igAP4WR6sFzDAKPgPHP0VnlMsFS5IyyIGoeAamCKybYI5UQLWVE2fgGI/s72wqQXRd9jyxiHgGJtihFxGQm8Qd5XvtF3fEQOrQH9mDm1Z9hyJuEphXIq9uSWSQqv8a4RbAUTFdcs7gifwplYGjT3wzbPFz6Q70EZv8WZoxMP66ApMc86inirNBA8njcFIuvOTXhowPyzuQJiukzi3hQgS7b+I9nJtQn/AHsLGsvlcPPWsAAAAASUVORK5CYII=";
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 31328:
|
|
|
/*!*************************************************!*\
|
|
|
!*** ./src/assets/images/problemset/folder.png ***!
|
|
|
\*************************************************/
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IArs4c6QAAAodJREFUOBGtU0trFEEQ/qZnM5NsWBCfSEjwQdSggmAieAv4uOnFg5eIXgTvEY+ePJqToDf9AcZDFAUF8SgEQUxAjC6+QlhX4xo0G93ZnRnr697umSyKBCyY/aqqq76q6uoF/rN4lu/BmzSsLGFM7P4kAZQCiBTR64nCw/MHvRnj+fuvI7zxtDWJJD1lQulO5TPHnkAqpuAUFKZUqg8da8xI35+/cMh77AjHJ5cakh/oqHa2ZhGHpSb+STxJZA3lqesFG1CuLAdsqLfbb/dlTwQ7GdmG9VGVBuoNfT/nHGHUSnByeAN2binmmDK1gyM7aGvl6gruPvtadCOfvVlxN0PFjsF4qxMptjl7BflirsPAVxJoQjy5eUMqq6bkMgbWF7C4HGMlsnRmZE82xtEdYSwGnRTuhCvVqG3T8bGhHpweKaFWj3HpzqI7Z16SmHxHmKbcVE7yBs+k1uBm8wh6Q4VQJvrZMkEp98EGBB2h3pFUMWJmPLKniKGtXZhZiLC/L8CLhQbmqhHefmmi3pRYOwInY65gRiiM+ZEP9Ic4c7ik+Ye3dePK/W94/bmpbVNO4u2S2rmrOmRvtkEmlHraC9EUgEzo/optVwZM4IiCLivR1WhywwrT75p4WYlkqhTT7xs4vreIke2h3KWHTaUClC/ZnsR3fOTWMnarZi/QulYhr2l0MMDorhA7NhbwodbC5Xs/9FT5d+s6lJJSzHxWJ9ov9Xw8KceYX9LrQ9+6LF6pgs4luqVIIl+G69gp0id1tk+8/byJ77+AV9UEiRTJMnQMOYycuPZpNuhS+7TF+fgkiBSr55+J9eXOm1E86wjpPzrx8aI8hd3U1yryrOcejQ9cXWveP+N/A79g8eaXNDk4AAAAAElFTkSuQmCC";
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
}]); |