|
|
"use strict";
|
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[7918],{
|
|
|
|
|
|
/***/ 99611:
|
|
|
/*!****************************************************************************!*\
|
|
|
!*** ./node_modules/@ant-design/icons/es/icons/EyeOutlined.js + 1 modules ***!
|
|
|
\****************************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"Z": function() { return /* binding */ icons_EyeOutlined; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
|
|
var esm_extends = __webpack_require__(87462);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
|
var react = __webpack_require__(67294);
|
|
|
;// CONCATENATED MODULE: ./node_modules/@ant-design/icons-svg/es/asn/EyeOutlined.js
|
|
|
// This icon file is generated automatically.
|
|
|
var EyeOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z" } }] }, "name": "eye", "theme": "outlined" };
|
|
|
/* harmony default export */ var asn_EyeOutlined = (EyeOutlined);
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/components/AntdIcon.js + 8 modules
|
|
|
var AntdIcon = __webpack_require__(74643);
|
|
|
;// CONCATENATED MODULE: ./node_modules/@ant-design/icons/es/icons/EyeOutlined.js
|
|
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var EyeOutlined_EyeOutlined = function EyeOutlined(props, ref) {
|
|
|
return /*#__PURE__*/react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
|
|
|
ref: ref,
|
|
|
icon: asn_EyeOutlined
|
|
|
}));
|
|
|
};
|
|
|
if (false) {}
|
|
|
/* harmony default export */ var icons_EyeOutlined = (/*#__PURE__*/react.forwardRef(EyeOutlined_EyeOutlined));
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 19368:
|
|
|
/*!**************************************************************************!*\
|
|
|
!*** ./src/pages/Paperlibrary/Random/ExerciseEdit/index.tsx + 1 modules ***!
|
|
|
\**************************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// ESM COMPAT FLAG
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"default": function() { return /* binding */ ExerciseEdit; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js
|
|
|
var regeneratorRuntime = __webpack_require__(17061);
|
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/asyncToGenerator.js
|
|
|
var asyncToGenerator = __webpack_require__(17156);
|
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/toConsumableArray.js
|
|
|
var toConsumableArray = __webpack_require__(861);
|
|
|
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(42122);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(27424);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
|
var react = __webpack_require__(67294);
|
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 8 modules
|
|
|
var _umi_production_exports = __webpack_require__(89214);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/ExerciseEdit/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var ExerciseEditmodules = ({"flex_box_center":"flex_box_center___V5dic","flex_space_between":"flex_space_between___zoM6r","flex_box_vertical_center":"flex_box_vertical_center___WTCR4","flex_box_center_end":"flex_box_center_end___ZhjIT","flex_box_column":"flex_box_column___XGVlz","wrap":"wrap___PXiQq","btns":"btns___Imyyi","tips":"tips___TLB21","crumbs":"crumbs___KmiI7","oneWrap":"oneWrap___YhZqd","title":"title___DVl_J","formWrap":"formWrap___VN5d8","rb":"rb___zNh0G","twoWrap":"twoWrap___YCLWk","list":"list___NWsPr","total":"total___x6P24","tag":"tag___bUrv6","knWarp":"knWarp___cgy7Z","kn":"kn___bdoMc","name":"name___hfjVq","modalColumn":"modalColumn___KXSq6","modalRow":"modalRow___s7fc_","sup":"sup___fa5dL"});
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input/index.js + 5 modules
|
|
|
var input = __webpack_require__(79531);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/form/index.js + 17 modules
|
|
|
var es_form = __webpack_require__(25159);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/modal/index.js + 39 modules
|
|
|
var es_modal = __webpack_require__(72423);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input-number/index.js + 21 modules
|
|
|
var input_number = __webpack_require__(31795);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/message/index.js + 4 modules
|
|
|
var message = __webpack_require__(2453);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/skeleton/index.js + 12 modules
|
|
|
var skeleton = __webpack_require__(21687);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/radio/index.js + 5 modules
|
|
|
var es_radio = __webpack_require__(78045);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(71577);
|
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
|
var fetch = __webpack_require__(84519);
|
|
|
// EXTERNAL MODULE: ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepTwo/List/index.tsx + 5 modules
|
|
|
var List = __webpack_require__(80216);
|
|
|
// EXTERNAL MODULE: ./src/pages/Paperlibrary/Random/AddAndEdit/components/StepTwo/AddTags/index.tsx + 2 modules
|
|
|
var AddTags = __webpack_require__(54304);
|
|
|
// EXTERNAL MODULE: ./node_modules/lodash/lodash.js
|
|
|
var lodash = __webpack_require__(96486);
|
|
|
// EXTERNAL MODULE: ./src/service/exercise.ts
|
|
|
var exercise = __webpack_require__(51412);
|
|
|
// EXTERNAL MODULE: ./src/assets/images/paper/dui.svg
|
|
|
var dui = __webpack_require__(47990);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Paperlibrary/Random/ExerciseEdit/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TextArea = input/* default.TextArea */.Z.TextArea;
|
|
|
var PaperlibraryPage = function PaperlibraryPage(_ref) {
|
|
|
var _editData$exercise, _userInfo$course;
|
|
|
var paperlibrary = _ref.paperlibrary,
|
|
|
user = _ref.user,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
dispatch = _ref.dispatch;
|
|
|
var _Form$useForm = es_form/* default.useForm */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
var _useState = (0,react.useState)({}),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
formValue = _useState2[0],
|
|
|
setFormValue = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)(true),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
loading = _useState4[0],
|
|
|
setLoading = _useState4[1];
|
|
|
var _useState5 = (0,react.useState)(false),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
btnLoading = _useState6[0],
|
|
|
setBtnLoading = _useState6[1];
|
|
|
var _useState7 = (0,react.useState)(false),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
saveLoading = _useState8[0],
|
|
|
setSaveBtnLoading = _useState8[1];
|
|
|
var _useState9 = (0,react.useState)({}),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
editData = _useState10[0],
|
|
|
setEditData = _useState10[1];
|
|
|
var _useState11 = (0,react.useState)([]),
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
listData = _useState12[0],
|
|
|
setListData = _useState12[1];
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var saveCompareData = (0,react.useRef)({
|
|
|
contents: {},
|
|
|
score_settings: {}
|
|
|
});
|
|
|
var userInfo = user.userInfo;
|
|
|
(0,react.useEffect)(function () {
|
|
|
dispatch({
|
|
|
type: 'globalSetting/footerToggle',
|
|
|
payload: false
|
|
|
});
|
|
|
return function () {
|
|
|
dispatch({
|
|
|
type: 'globalSetting/footerToggle',
|
|
|
payload: true
|
|
|
});
|
|
|
};
|
|
|
}, []);
|
|
|
(0,react.useEffect)(function () {
|
|
|
getEditData();
|
|
|
}, []);
|
|
|
var handleValuesChange = function handleValuesChange(changedValues) {
|
|
|
setFormValue(objectSpread2_default()({}, form.getFieldsValue()));
|
|
|
};
|
|
|
var dealList = function dealList(str, data) {
|
|
|
var subDisciplinesList = data || [];
|
|
|
var list = toConsumableArray_default()(subDisciplinesList),
|
|
|
flag = 0,
|
|
|
data = [];
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
var az = '';
|
|
|
for (var j = 0; j < data.length; j++) {
|
|
|
if (data[j][0][str] == list[i][str]) {
|
|
|
flag = 1;
|
|
|
az = j;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
if (flag == 1) {
|
|
|
data[az].push(list[i]);
|
|
|
flag = 0;
|
|
|
} else if (flag == 0) {
|
|
|
var wdy = new Array();
|
|
|
wdy.push(list[i]);
|
|
|
data.push(wdy);
|
|
|
}
|
|
|
}
|
|
|
return data;
|
|
|
};
|
|
|
var calcListData = function calcListData(param) {
|
|
|
var _items2;
|
|
|
var score_settings = param.score_settings,
|
|
|
contents = param.contents;
|
|
|
|
|
|
//生成比较数据
|
|
|
score_settings.forEach(function (e) {
|
|
|
saveCompareData.current.score_settings[e.item_type] = e.score;
|
|
|
});
|
|
|
contents.forEach(function (e) {
|
|
|
var name = "".concat(e.item_type, "_").concat(e.sub_discipline_id, "_").concat(e.tag_discipline_id, "_").concat(e.difficulty);
|
|
|
saveCompareData.current.contents[name] = e.quanlity;
|
|
|
});
|
|
|
//生成一级结构
|
|
|
var items = score_settings === null || score_settings === void 0 ? void 0 : score_settings.map(function (e) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, e), {}, {
|
|
|
item_banks: [],
|
|
|
questionTotal: 0,
|
|
|
scoreTotal: 0
|
|
|
});
|
|
|
});
|
|
|
//相同类型组合
|
|
|
contents === null || contents === void 0 ? void 0 : contents.forEach(function (e) {
|
|
|
var _items, _items$index, _items$index$item_ban;
|
|
|
var index = items.findIndex(function (k) {
|
|
|
return e.item_type === k.item_type;
|
|
|
});
|
|
|
var r = objectSpread2_default()(objectSpread2_default()({}, e), {}, {
|
|
|
disciplines: e.discipline_name,
|
|
|
sub_discipline: e.sub_discipline_name
|
|
|
});
|
|
|
delete r.discipline_name;
|
|
|
delete r.sub_discipline_name;
|
|
|
(_items = items) === null || _items === void 0 ? void 0 : (_items$index = _items[index]) === null || _items$index === void 0 ? void 0 : (_items$index$item_ban = _items$index.item_banks) === null || _items$index$item_ban === void 0 ? void 0 : _items$index$item_ban.push(r);
|
|
|
});
|
|
|
//相同sub_discipline_id组合二维数组
|
|
|
items = items.map(function (e) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, e), {}, {
|
|
|
item_banks: dealList('sub_discipline_id', e.item_banks)
|
|
|
});
|
|
|
});
|
|
|
//生成tag_disciplines数组
|
|
|
items = items.map(function (e) {
|
|
|
var _e$item_banks;
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, e), {}, {
|
|
|
item_banks: (_e$item_banks = e.item_banks) === null || _e$item_banks === void 0 ? void 0 : _e$item_banks.map(function (k) {
|
|
|
var r = {
|
|
|
tag_disciplines: []
|
|
|
};
|
|
|
k === null || k === void 0 ? void 0 : k.forEach(function (s) {
|
|
|
r.disciplines = s.disciplines;
|
|
|
delete s.disciplines;
|
|
|
r.sub_discipline = s.sub_discipline;
|
|
|
delete s.sub_discipline;
|
|
|
r.sub_discipline_id = s.sub_discipline_id;
|
|
|
delete s.sub_discipline_id;
|
|
|
delete s.item_type;
|
|
|
r.tag_disciplines.push(s);
|
|
|
});
|
|
|
r.tag_disciplines = dealList('tag_discipline_id', r.tag_disciplines);
|
|
|
var elseR = r.tag_disciplines.map(function (h) {
|
|
|
var g = {
|
|
|
difficulties: []
|
|
|
};
|
|
|
h === null || h === void 0 ? void 0 : h.forEach(function (q) {
|
|
|
g.name = q.tag_discipline_name;
|
|
|
g.tag_discipline_id = q.tag_discipline_id;
|
|
|
delete q.tag_discipline_name;
|
|
|
delete q.tag_discipline_id;
|
|
|
g.difficulties.push(objectSpread2_default()(objectSpread2_default()({}, q), {}, {
|
|
|
num: q.quanlity,
|
|
|
count: (0,lodash.isNil)(q === null || q === void 0 ? void 0 : q.count) ? q.quanlity : q.count
|
|
|
}));
|
|
|
});
|
|
|
return g;
|
|
|
});
|
|
|
r.tag_disciplines = elseR;
|
|
|
return r;
|
|
|
})
|
|
|
});
|
|
|
});
|
|
|
var record = calculate(items);
|
|
|
var panel = record.panel,
|
|
|
score_num_item = record.score_num_item;
|
|
|
items = (_items2 = items) === null || _items2 === void 0 ? void 0 : _items2.map(function (e, i) {
|
|
|
var _panel$i;
|
|
|
var questionTotal = (panel === null || panel === void 0 ? void 0 : (_panel$i = panel[i]) === null || _panel$i === void 0 ? void 0 : _panel$i.reduce(function (a, b) {
|
|
|
return a + b;
|
|
|
}, 0)) || 0;
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, e), {}, {
|
|
|
scoreTotal: questionTotal * (score_num_item[i] || 0),
|
|
|
questionTotal: questionTotal
|
|
|
});
|
|
|
});
|
|
|
setListData((0,lodash.cloneDeep)(items));
|
|
|
};
|
|
|
var getEditData = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var res, _res$exercise, _res$exercise2, _res$exercise3, _res$exercise4, _res$exercise5, param;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return (0,fetch/* default */.ZP)("/api/exercises/".concat(params.categoryId, "/edit.json"), {
|
|
|
method: 'get',
|
|
|
params: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context.sent;
|
|
|
if (res !== null && res !== void 0 && res.exercise) {
|
|
|
param = {
|
|
|
difficulty: res === null || res === void 0 ? void 0 : (_res$exercise = res.exercise) === null || _res$exercise === void 0 ? void 0 : _res$exercise.difficulty,
|
|
|
exam_notes: res === null || res === void 0 ? void 0 : (_res$exercise2 = res.exercise) === null || _res$exercise2 === void 0 ? void 0 : _res$exercise2.exercise_description,
|
|
|
name: res === null || res === void 0 ? void 0 : (_res$exercise3 = res.exercise) === null || _res$exercise3 === void 0 ? void 0 : _res$exercise3.exercise_name,
|
|
|
time: res === null || res === void 0 ? void 0 : (_res$exercise4 = res.exercise) === null || _res$exercise4 === void 0 ? void 0 : _res$exercise4.time,
|
|
|
num: (res === null || res === void 0 ? void 0 : (_res$exercise5 = res.exercise) === null || _res$exercise5 === void 0 ? void 0 : _res$exercise5.total_num) || 0
|
|
|
};
|
|
|
setLoading(false);
|
|
|
setFormValue(objectSpread2_default()({}, param));
|
|
|
form.setFieldsValue(objectSpread2_default()({}, param));
|
|
|
setEditData(objectSpread2_default()({}, res));
|
|
|
calcListData(objectSpread2_default()({}, res));
|
|
|
// const data = `[{"item_type":"SINGLE","item_banks":[{"disciplines":"系统/运维","sub_discipline":"shell编程","discipline_id":17,"sub_discipline_id":73,"tag_disciplines":[{"tag_discipline_id":774,"name":"2","difficulties":[{"difficulty":1,"count":2,"num":2}]},{"name":"未匹配知识点","tag_discipline_id":656,"difficulties":[{"difficulty":1,"count":4,"num":2},{"difficulty":2,"count":2}]}]},{"disciplines":"系统/运维","sub_discipline":"Linux ","discipline_id":17,"sub_discipline_id":74,"tag_disciplines":[{"tag_discipline_id":657,"name":"未匹配知识点","difficulties":[{"difficulty":1,"count":1,"num":1},{"difficulty":2,"count":1,"num":1}]},{"name":"如果信念有颜色,那一定是中国红","tag_discipline_id":825,"difficulties":[{"difficulty":1,"count":1,"num":1}]}]},{"disciplines":"系统/运维","sub_discipline":"自动化运维","discipline_id":17,"sub_discipline_id":75,"tag_disciplines":[{"tag_discipline_id":727,"name":"自动化运维-公开知识点","difficulties":[{"difficulty":1,"count":1,"num":1},{"difficulty":3,"count":1,"num":1}]}]}],"scoreTotal":18,"score":2,"questionTotal":9},{"item_type":"MULTIPLE","item_banks":[{"disciplines":"系统/运维","sub_discipline":"shell编程","discipline_id":17,"sub_discipline_id":73,"tag_disciplines":[{"tag_discipline_id":656,"name":"未匹配知识点","difficulties":[{"difficulty":1,"count":2,"num":2}]}]}],"scoreTotal":4,"score":2,"questionTotal":2},{"item_type":"JUDGMENT","item_banks":[{"disciplines":"系统/运维","sub_discipline":"自动化运维","discipline_id":17,"sub_discipline_id":75,"tag_disciplines":[{"tag_discipline_id":727,"name":"自动化运维-公开知识点","difficulties":[{"difficulty":1,"count":1,"num":1}]}]},{"disciplines":"系统/运维","sub_discipline":"shell编程","discipline_id":17,"sub_discipline_id":73,"tag_disciplines":[{"tag_discipline_id":656,"name":"未匹配知识点","difficulties":[{"difficulty":1,"count":4},{"difficulty":2,"count":3}]}]}],"scoreTotal":1,"score":1,"questionTotal":1}]`
|
|
|
// setListData(JSON.parse(data))
|
|
|
// console.log(JSON.parse(data))
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function getEditData() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var questionData = [{
|
|
|
type: 'SINGLE',
|
|
|
name: '单选题'
|
|
|
}, {
|
|
|
type: 'MULTIPLE',
|
|
|
name: '多选题'
|
|
|
}, {
|
|
|
type: 'COMPLETION',
|
|
|
name: '填空题'
|
|
|
}, {
|
|
|
type: 'JUDGMENT',
|
|
|
name: '判断题'
|
|
|
}, {
|
|
|
type: 'SUBJECTIVE',
|
|
|
name: '简答题'
|
|
|
}, {
|
|
|
type: 'PROGRAM',
|
|
|
name: '编程题'
|
|
|
}, {
|
|
|
type: 'PRACTICAL',
|
|
|
name: '实训题'
|
|
|
}, {
|
|
|
type: 'COMBINATION',
|
|
|
name: '组合题'
|
|
|
}];
|
|
|
var calculate = function calculate(list) {
|
|
|
var item = {
|
|
|
contents: [],
|
|
|
panel: [],
|
|
|
score_num_item: [],
|
|
|
//每题多少分集合
|
|
|
score_total: [],
|
|
|
error_tips: []
|
|
|
};
|
|
|
list === null || list === void 0 ? void 0 : list.forEach(function (k, index) {
|
|
|
var _item$error_tips, _questionData$find, _k$item_banks;
|
|
|
item.panel.push([]);
|
|
|
item.score_num_item.push(k === null || k === void 0 ? void 0 : k.score);
|
|
|
item.score_total.push(k === null || k === void 0 ? void 0 : k.scoreTotal);
|
|
|
(_item$error_tips = item.error_tips) === null || _item$error_tips === void 0 ? void 0 : _item$error_tips.push({
|
|
|
name: (_questionData$find = questionData.find(function (l) {
|
|
|
return l.type === (k === null || k === void 0 ? void 0 : k.item_type);
|
|
|
})) === null || _questionData$find === void 0 ? void 0 : _questionData$find.name,
|
|
|
score: (k === null || k === void 0 ? void 0 : k.score) || 0,
|
|
|
scoreTotal: k === null || k === void 0 ? void 0 : k.scoreTotal,
|
|
|
item_type: k === null || k === void 0 ? void 0 : k.item_type
|
|
|
});
|
|
|
k === null || k === void 0 ? void 0 : (_k$item_banks = k.item_banks) === null || _k$item_banks === void 0 ? void 0 : _k$item_banks.forEach(function (e) {
|
|
|
var _e$tag_disciplines;
|
|
|
e === null || e === void 0 ? void 0 : (_e$tag_disciplines = e.tag_disciplines) === null || _e$tag_disciplines === void 0 ? void 0 : _e$tag_disciplines.forEach(function (r) {
|
|
|
var _r$difficulties;
|
|
|
r === null || r === void 0 ? void 0 : (_r$difficulties = r.difficulties) === null || _r$difficulties === void 0 ? void 0 : _r$difficulties.forEach(function (s) {
|
|
|
if (s.num) {
|
|
|
item.panel[index].push(s.num);
|
|
|
item.contents.push({
|
|
|
difficulty: s.difficulty,
|
|
|
item_type: k.item_type,
|
|
|
items_count: s.num,
|
|
|
sub_discipline_id: e.sub_discipline_id,
|
|
|
tag_discipline_id: r.tag_discipline_id
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
return item;
|
|
|
};
|
|
|
var toAnswer = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
var _res$exercise6;
|
|
|
var res, _user$userInfo;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
setBtnLoading(true);
|
|
|
_context2.next = 3;
|
|
|
return (0,exercise/* startSimulateAnswer */._F)(objectSpread2_default()(objectSpread2_default()({}, params), {}, {
|
|
|
is_reset: 1
|
|
|
}));
|
|
|
case 3:
|
|
|
res = _context2.sent;
|
|
|
if (res !== null && res !== void 0 && (_res$exercise6 = res.exercise) !== null && _res$exercise6 !== void 0 && _res$exercise6.id) {
|
|
|
_umi_production_exports.history.push("/classrooms/".concat(params.coursesId, "/exercise/").concat(params.categoryId, "/").concat((_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.login, "/initate_answer"));
|
|
|
}
|
|
|
setBtnLoading(false);
|
|
|
case 6:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function toAnswer() {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleChange = function handleChange(e, i) {
|
|
|
var _param$panel, _param$panel$;
|
|
|
var newValue = (0,lodash.cloneDeep)(listData);
|
|
|
newValue[i] = e;
|
|
|
var param = calculate([newValue[i]]);
|
|
|
var sum = param === null || param === void 0 ? void 0 : (_param$panel = param.panel) === null || _param$panel === void 0 ? void 0 : (_param$panel$ = _param$panel[0]) === null || _param$panel$ === void 0 ? void 0 : _param$panel$.reduce(function (a, b) {
|
|
|
return a + b;
|
|
|
}, 0);
|
|
|
newValue[i].questionTotal = sum;
|
|
|
setListData(newValue);
|
|
|
var dom = document.getElementsByClassName('customError');
|
|
|
if (!!dom.length) dom === null || dom === void 0 ? void 0 : dom.forEach(function (e) {
|
|
|
var _e$classList;
|
|
|
e === null || e === void 0 ? void 0 : (_e$classList = e.classList) === null || _e$classList === void 0 ? void 0 : _e$classList.remove("customError");
|
|
|
});
|
|
|
};
|
|
|
var parser = function parser(v) {
|
|
|
var num = parseInt(v);
|
|
|
return (0,lodash.isNaN)(num) ? '' : num;
|
|
|
};
|
|
|
var renderTotal = function renderTotal() {
|
|
|
var param = calculate(listData);
|
|
|
var score_total = param.score_total;
|
|
|
score_total = score_total.reduce(function (a, b) {
|
|
|
return a + b;
|
|
|
}, 0);
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ExerciseEditmodules.total,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("b", {}), " ", /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: ["\u672C\u8BD5\u5377\u603B\u5206", score_total, "\u5206"]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var handleOk = /*#__PURE__*/function () {
|
|
|
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
|
|
|
var name, modal;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
name = 1;
|
|
|
modal = es_modal/* default.confirm */.Z.confirm({
|
|
|
icon: null,
|
|
|
className: 'custom-modal-divider',
|
|
|
centered: true,
|
|
|
width: 500,
|
|
|
maskClosable: false,
|
|
|
keyboard: false,
|
|
|
cancelButtonProps: {
|
|
|
disabled: false
|
|
|
},
|
|
|
title: '配置出卷数量',
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ExerciseEditmodules.modalColumn,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ExerciseEditmodules.modalRow,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("sup", {
|
|
|
className: ExerciseEditmodules.sup,
|
|
|
children: "*"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
flexShrink: 0
|
|
|
},
|
|
|
children: "\u968F\u673A\u51FA\u5377\u6570\u91CF\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
parser: parser,
|
|
|
style: {
|
|
|
width: 120
|
|
|
},
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u8BD5\u5377\u6570\u91CF",
|
|
|
min: 1,
|
|
|
defaultValue: name,
|
|
|
onChange: function onChange(e) {
|
|
|
name = e;
|
|
|
var dom = document.getElementById('model_error');
|
|
|
if (name < 1 || name > 50) {
|
|
|
dom.style.display = 'block';
|
|
|
} else {
|
|
|
dom.style.display = 'none';
|
|
|
}
|
|
|
}
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
display: 'none',
|
|
|
marginLeft: 78
|
|
|
},
|
|
|
id: "model_error",
|
|
|
className: "c-red",
|
|
|
children: "\u8BF7\u8F93\u51651-50\u4E4B\u95F4\u7684\u6574\u6570"
|
|
|
})]
|
|
|
}),
|
|
|
okText: '确认',
|
|
|
cancelText: '取消',
|
|
|
onOk: function () {
|
|
|
var _onOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
|
|
var dom, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
if (!(name < 1 || name > 50)) {
|
|
|
_context3.next = 4;
|
|
|
break;
|
|
|
}
|
|
|
dom = document.getElementById('model_error');
|
|
|
dom.style.display = 'block';
|
|
|
return _context3.abrupt("return", Promise.reject());
|
|
|
case 4:
|
|
|
modal.update({
|
|
|
cancelButtonProps: {
|
|
|
disabled: true
|
|
|
}
|
|
|
});
|
|
|
_context3.next = 7;
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
setTimeout(function () {
|
|
|
resolve('');
|
|
|
}, 4000);
|
|
|
});
|
|
|
case 7:
|
|
|
res = _context3.sent;
|
|
|
modal.update({
|
|
|
cancelButtonProps: {
|
|
|
disabled: false
|
|
|
}
|
|
|
});
|
|
|
if (true) {
|
|
|
es_modal/* default.destroyAll */.Z.destroyAll();
|
|
|
es_modal/* default.confirm */.Z.confirm({
|
|
|
icon: null,
|
|
|
className: 'custom-modal-divider',
|
|
|
centered: true,
|
|
|
width: 500,
|
|
|
title: '提示',
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: ExerciseEditmodules.modalColumn,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
color: '#676A6C',
|
|
|
display: 'flex'
|
|
|
},
|
|
|
className: "font14 mt20 mb10",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
style: {
|
|
|
marginRight: 5
|
|
|
},
|
|
|
src: dui/* default */.Z
|
|
|
}), "\u751F\u6210\u8BD5\u5377\u6210\u529F\u3002"]
|
|
|
})
|
|
|
}),
|
|
|
okText: '确认',
|
|
|
cancelText: '取消',
|
|
|
onOk: function onOk() {
|
|
|
sendData();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
case 10:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
function onOk() {
|
|
|
return _onOk.apply(this, arguments);
|
|
|
}
|
|
|
return onOk;
|
|
|
}()
|
|
|
});
|
|
|
case 2:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
return function handleOk() {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var sendData = function sendData() {
|
|
|
// const body = {
|
|
|
// ...editData?.exercise,
|
|
|
// contents: param.contents,
|
|
|
// exerciseId: params.categoryId,
|
|
|
// score_settings: new_score_settings,
|
|
|
// time: formValue?.time,
|
|
|
// exercise_name: formValue?.name,
|
|
|
// difficulty: formValue?.difficulty,
|
|
|
// exercise_description: formValue?.exam_notes,
|
|
|
// }
|
|
|
// const res = await putExercise(body)
|
|
|
// if (res.status === 0) {
|
|
|
// message.success("修改成功 ")
|
|
|
// history.push(`/classrooms/${params.coursesId}/exercise/${params.categoryId}/detail?random=true`)
|
|
|
// }
|
|
|
};
|
|
|
var handleSave = /*#__PURE__*/function () {
|
|
|
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5() {
|
|
|
var _param$error_tips, _param$contents;
|
|
|
var new_score_settings, new_sort_by_item_type, param, i, _param$panel2, _param$panel2$i, sum, _param$error_tips$i, dom, _param$error_tips$i2, _dom, _param$error_tips$i3, _param$error_tips$i4, compareData, body, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
|
|
|
while (1) switch (_context5.prev = _context5.next) {
|
|
|
case 0:
|
|
|
_context5.next = 2;
|
|
|
return form.validateFields();
|
|
|
case 2:
|
|
|
new_score_settings = [];
|
|
|
new_sort_by_item_type = [];
|
|
|
param = calculate(listData);
|
|
|
i = 0;
|
|
|
case 6:
|
|
|
if (!(i < param.error_tips.length)) {
|
|
|
_context5.next = 22;
|
|
|
break;
|
|
|
}
|
|
|
sum = param === null || param === void 0 ? void 0 : (_param$panel2 = param.panel) === null || _param$panel2 === void 0 ? void 0 : (_param$panel2$i = _param$panel2[i]) === null || _param$panel2$i === void 0 ? void 0 : _param$panel2$i.reduce(function (a, b) {
|
|
|
return a + b;
|
|
|
}, 0);
|
|
|
if (!(param.error_tips[i].score === 0 && sum !== 0)) {
|
|
|
_context5.next = 13;
|
|
|
break;
|
|
|
}
|
|
|
dom = document.getElementById("".concat((_param$error_tips$i = param.error_tips[i]) === null || _param$error_tips$i === void 0 ? void 0 : _param$error_tips$i.item_type, "_score"));
|
|
|
dom.classList.add("customError");
|
|
|
dom.scrollIntoView({
|
|
|
block: "start",
|
|
|
behavior: "smooth"
|
|
|
});
|
|
|
return _context5.abrupt("return");
|
|
|
case 13:
|
|
|
if (!(param.error_tips[i].score !== 0 && sum === 0)) {
|
|
|
_context5.next = 18;
|
|
|
break;
|
|
|
}
|
|
|
_dom = document.getElementById("".concat((_param$error_tips$i2 = param.error_tips[i]) === null || _param$error_tips$i2 === void 0 ? void 0 : _param$error_tips$i2.item_type, "_sum"));
|
|
|
_dom.classList.add("customError");
|
|
|
_dom.scrollIntoView({
|
|
|
block: "start",
|
|
|
behavior: "smooth"
|
|
|
});
|
|
|
return _context5.abrupt("return");
|
|
|
case 18:
|
|
|
if (param.error_tips[i].score !== 0 && sum !== 0) {
|
|
|
new_score_settings === null || new_score_settings === void 0 ? void 0 : new_score_settings.push({
|
|
|
item_type: (_param$error_tips$i3 = param.error_tips[i]) === null || _param$error_tips$i3 === void 0 ? void 0 : _param$error_tips$i3.item_type,
|
|
|
score: ((_param$error_tips$i4 = param.error_tips[i]) === null || _param$error_tips$i4 === void 0 ? void 0 : _param$error_tips$i4.score) || 0
|
|
|
});
|
|
|
new_sort_by_item_type.push(param.error_tips[i].name);
|
|
|
}
|
|
|
case 19:
|
|
|
i++;
|
|
|
_context5.next = 6;
|
|
|
break;
|
|
|
case 22:
|
|
|
if (!(new_score_settings.length === 0)) {
|
|
|
_context5.next = 25;
|
|
|
break;
|
|
|
}
|
|
|
message/* default.warning */.ZP.warning('不允许每个题型的总分和抽题数量都为0');
|
|
|
return _context5.abrupt("return");
|
|
|
case 25:
|
|
|
compareData = {
|
|
|
contents: {},
|
|
|
score_settings: {}
|
|
|
}; //生成比较数据
|
|
|
param === null || param === void 0 ? void 0 : (_param$error_tips = param.error_tips) === null || _param$error_tips === void 0 ? void 0 : _param$error_tips.forEach(function (e) {
|
|
|
compareData.score_settings[e.item_type] = e.score;
|
|
|
});
|
|
|
param === null || param === void 0 ? void 0 : (_param$contents = param.contents) === null || _param$contents === void 0 ? void 0 : _param$contents.forEach(function (e) {
|
|
|
var name = "".concat(e.item_type, "_").concat(e.sub_discipline_id, "_").concat(e.tag_discipline_id, "_").concat(e.difficulty);
|
|
|
compareData.contents[name] = e.items_count;
|
|
|
});
|
|
|
|
|
|
// if (!isEqual(saveCompareData.current, compareData)) {
|
|
|
// Modal.confirm({
|
|
|
// icon: null,
|
|
|
// className: 'custom-modal-divider',
|
|
|
// centered: true,
|
|
|
// width: 514,
|
|
|
// title: '提示',
|
|
|
// content: <div className={styles.modalColumn}>
|
|
|
// <div style={{ color: '#676A6C', display: 'flex' }} className="font14 mt20 mb10"><img style={{ marginRight: 5 }} src={J} />修改后需重新配置出卷数量,对已生成的随机试卷删除,确定要修改吗?</div>
|
|
|
// </div>,
|
|
|
// okText: '确认',
|
|
|
// cancelText: '取消',
|
|
|
// onOk: () => {
|
|
|
// Modal.destroyAll();
|
|
|
// handleOk()
|
|
|
// }
|
|
|
// });
|
|
|
// return;
|
|
|
// }
|
|
|
// sendData()
|
|
|
body = objectSpread2_default()(objectSpread2_default()({}, editData === null || editData === void 0 ? void 0 : editData.exercise), {}, {
|
|
|
contents: param.contents,
|
|
|
exerciseId: params.categoryId,
|
|
|
score_settings: new_score_settings,
|
|
|
time: formValue === null || formValue === void 0 ? void 0 : formValue.time,
|
|
|
exercise_name: formValue === null || formValue === void 0 ? void 0 : formValue.name,
|
|
|
difficulty: formValue === null || formValue === void 0 ? void 0 : formValue.difficulty,
|
|
|
exercise_description: formValue === null || formValue === void 0 ? void 0 : formValue.exam_notes,
|
|
|
num: formValue === null || formValue === void 0 ? void 0 : formValue.num
|
|
|
});
|
|
|
setSaveBtnLoading(true);
|
|
|
_context5.next = 32;
|
|
|
return (0,exercise/* putExercise */.wy)(body);
|
|
|
case 32:
|
|
|
res = _context5.sent;
|
|
|
if (res.status === 0) {
|
|
|
message/* default.success */.ZP.success("修改成功 ");
|
|
|
_umi_production_exports.history.push("/classrooms/".concat(params.coursesId, "/exercise/").concat(params.categoryId, "/detail?random=true"));
|
|
|
}
|
|
|
setSaveBtnLoading(false);
|
|
|
case 35:
|
|
|
case "end":
|
|
|
return _context5.stop();
|
|
|
}
|
|
|
}, _callee5);
|
|
|
}));
|
|
|
return function handleSave() {
|
|
|
return _ref5.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var selectList = dealList('sub_discipline_name', editData === null || editData === void 0 ? void 0 : editData.all_tag_disciplines);
|
|
|
var disabled = (editData === null || editData === void 0 ? void 0 : (_editData$exercise = editData.exercise) === null || _editData$exercise === void 0 ? void 0 : _editData$exercise.exercise_status) !== 1;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
|
className: ExerciseEditmodules.wrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(skeleton/* default */.Z, {
|
|
|
loading: loading,
|
|
|
active: true,
|
|
|
paragraph: {
|
|
|
rows: 5
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ExerciseEditmodules.crumbs,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("b", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "current",
|
|
|
onClick: function onClick() {
|
|
|
return _umi_production_exports.history.push("/classrooms/".concat(params.coursesId, "/exercise"));
|
|
|
},
|
|
|
children: "".concat(userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$course = userInfo.course) === null || _userInfo$course === void 0 ? void 0 : _userInfo$course.course_name, ">")
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "current",
|
|
|
onClick: function onClick() {
|
|
|
return _umi_production_exports.history.push("/classrooms/".concat(params.coursesId, "/exercise"));
|
|
|
},
|
|
|
children: '试卷列表>'
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: "#bebebe"
|
|
|
},
|
|
|
children: '编辑试卷'
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: ExerciseEditmodules.oneWrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ExerciseEditmodules.title,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("b", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u57FA\u672C\u4FE1\u606F"
|
|
|
}), " "]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
|
|
|
className: ExerciseEditmodules.formWrap,
|
|
|
form: form,
|
|
|
layout: "horizontal",
|
|
|
scrollToFirstError: true,
|
|
|
onValuesChange: handleValuesChange
|
|
|
// onFinish={handleFinish}
|
|
|
,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u8BD5\u5377\u540D\u79F0",
|
|
|
name: "name",
|
|
|
rules: [{
|
|
|
required: !disabled,
|
|
|
message: '试卷名称不能为空'
|
|
|
}, {
|
|
|
pattern: /^(?!(\s+$))/,
|
|
|
message: '输入框不能全为空格'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
disabled: disabled,
|
|
|
className: ExerciseEditmodules["in"],
|
|
|
bordered: false,
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u8BD5\u5377\u540D\u79F0\uFF0C\u6700\u591A60\u4E2A\u5B57",
|
|
|
maxLength: 60
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
position: 'relative'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u7B54\u9898\u65F6\u957F:",
|
|
|
name: "time",
|
|
|
rules: [{
|
|
|
required: !disabled,
|
|
|
message: "答题时长不能为空"
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
min: 1,
|
|
|
parser: parser,
|
|
|
max: 9999,
|
|
|
disabled: disabled,
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u7B54\u9898\u65F6\u957F",
|
|
|
style: {
|
|
|
width: 190
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
position: 'absolute',
|
|
|
top: 26,
|
|
|
left: 310
|
|
|
},
|
|
|
children: "\u5206\u949F"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u8BD5\u9898\u96BE\u5EA6",
|
|
|
name: "difficulty",
|
|
|
rules: [{
|
|
|
required: !disabled,
|
|
|
message: "请选择难度"
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default.Group */.ZP.Group, {
|
|
|
disabled: disabled,
|
|
|
style: {
|
|
|
display: "flex",
|
|
|
width: 286,
|
|
|
justifyContent: "space-between"
|
|
|
},
|
|
|
size: 'middle',
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Button */.ZP.Button, {
|
|
|
className: ExerciseEditmodules.rb,
|
|
|
value: 1,
|
|
|
children: "\u7B80\u5355"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Button */.ZP.Button, {
|
|
|
className: ExerciseEditmodules.rb,
|
|
|
value: 2,
|
|
|
children: "\u9002\u4E2D"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Button */.ZP.Button, {
|
|
|
className: ExerciseEditmodules.rb,
|
|
|
value: 3,
|
|
|
children: "\u56F0\u96BE"
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u51FA\u5377\u6570\u91CF:",
|
|
|
name: "num",
|
|
|
rules: [{
|
|
|
required: !disabled,
|
|
|
message: "出卷数量不能为空"
|
|
|
}, {
|
|
|
max: 50,
|
|
|
min: 1,
|
|
|
message: "请输入1~50之间的整数",
|
|
|
type: 'number'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
min: 0,
|
|
|
parser: parser
|
|
|
// max={}
|
|
|
,
|
|
|
disabled: disabled,
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u51FA\u5377\u6570\u91CF",
|
|
|
style: {
|
|
|
width: 190
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
label: "\u8003\u8BD5\u987B\u77E5",
|
|
|
name: "exam_notes",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(TextArea, {
|
|
|
disabled: disabled,
|
|
|
placeholder: "\u8003\u751F\u5FC5\u987B\u4E25\u683C\u9075\u5B88\u8003\u573A\u7EAA\u5F8B\uFF0C\u4E0D\u51C6\u5192\u540D\u9876\u66FF\uFF0C\u4E0D\u51C6\u6709\u4EFB\u4F55\u4F5C\u5F0A\u884C\u4E3A\u3002\u5982\u53D1\u73B0\u8FDD\u7EAA\uFF0C\u5E76\u7ED9\u4E88\u4E25\u5389\u5904\u5206\u3002",
|
|
|
rows: 4,
|
|
|
maxLength: 300
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: ExerciseEditmodules.twoWrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ExerciseEditmodules.tag,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ExerciseEditmodules.name,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("b", {
|
|
|
className: ExerciseEditmodules.num
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u8003\u5BDF\u8303\u56F4"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: ExerciseEditmodules.knWarp,
|
|
|
children: selectList === null || selectList === void 0 ? void 0 : selectList.map(function (e, key) {
|
|
|
var _e$;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(react.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ExerciseEditmodules.kn,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: key + 1
|
|
|
}), " ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: e === null || e === void 0 ? void 0 : (_e$ = e[0]) === null || _e$ === void 0 ? void 0 : _e$.sub_discipline_name
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(AddTags/* default */.Z, {
|
|
|
disabled: true,
|
|
|
type: 1,
|
|
|
value: e === null || e === void 0 ? void 0 : e.map(function (k) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, k), {}, {
|
|
|
id: k.sub_discipline_id,
|
|
|
name: k.tag_discipline_name
|
|
|
});
|
|
|
})
|
|
|
})]
|
|
|
}, key);
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ExerciseEditmodules.name,
|
|
|
style: {
|
|
|
marginTop: 10
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("b", {
|
|
|
className: ExerciseEditmodules.num
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u6559\u7814\u56E2\u961F"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: ExerciseEditmodules.knWarp,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AddTags/* default */.Z, {
|
|
|
disabled: true,
|
|
|
type: 1,
|
|
|
value: editData === null || editData === void 0 ? void 0 : editData.teach_groups
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ExerciseEditmodules.title,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("b", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u9898\u76EE\u9898\u91CF"
|
|
|
}), " "]
|
|
|
}), listData.map(function (e, i) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(List/* default */.Z, {
|
|
|
expansion: false,
|
|
|
disabled: disabled,
|
|
|
listClassName: ExerciseEditmodules.list,
|
|
|
value: e,
|
|
|
onChange: function onChange(e) {
|
|
|
return handleChange(e, i);
|
|
|
}
|
|
|
}, i);
|
|
|
}), renderTotal()]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ExerciseEditmodules.btns,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
onClick: function onClick() {
|
|
|
document.body.scrollIntoView();
|
|
|
_umi_production_exports.history.push("/classrooms/".concat(params.coursesId, "/exercise"));
|
|
|
},
|
|
|
children: "\u8FD4\u56DE"
|
|
|
}), !disabled && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
loading: btnLoading,
|
|
|
type: "primary",
|
|
|
onClick: function onClick() {
|
|
|
return toAnswer();
|
|
|
},
|
|
|
children: "\u6A21\u62DF\u8003\u8BD5"
|
|
|
}), !disabled && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
loading: saveLoading,
|
|
|
onClick: function onClick() {
|
|
|
return handleSave();
|
|
|
},
|
|
|
children: "\u63D0\u4EA4"
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var ExerciseEdit = ((0,_umi_production_exports.connect)(function (_ref6) {
|
|
|
var paperlibrary = _ref6.paperlibrary,
|
|
|
user = _ref6.user,
|
|
|
globalSetting = _ref6.globalSetting;
|
|
|
return {
|
|
|
paperlibrary: paperlibrary,
|
|
|
user: user,
|
|
|
globalSetting: globalSetting
|
|
|
};
|
|
|
})(PaperlibraryPage));
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 47990:
|
|
|
/*!*****************************************!*\
|
|
|
!*** ./src/assets/images/paper/dui.svg ***!
|
|
|
\*****************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* unused harmony export ReactComponent */
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 67294);
|
|
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
|
var __defProp = Object.defineProperty;
|
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
var __defNormalProp = function __defNormalProp(obj, key, value) {
|
|
|
return key in obj ? __defProp(obj, key, {
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true,
|
|
|
value: value
|
|
|
}) : obj[key] = value;
|
|
|
};
|
|
|
var __spreadValues = function __spreadValues(a, b) {
|
|
|
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
|
if (__getOwnPropSymbols) {
|
|
|
var _iterator = _createForOfIteratorHelper(__getOwnPropSymbols(b)),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prop = _step.value;
|
|
|
if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
}
|
|
|
return a;
|
|
|
};
|
|
|
|
|
|
var SvgDui = function SvgDui(props) {
|
|
|
return /* @__PURE__ */React.createElement("svg", __spreadValues({
|
|
|
width: 14,
|
|
|
height: 14,
|
|
|
xmlns: "http://www.w3.org/2000/svg"
|
|
|
}, props), /* @__PURE__ */React.createElement("title", null, "\u9009\u62E9\u5907\u4EFD 2"), /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M6.74 0a6.74 6.74 0 1 0 0 13.48A6.74 6.74 0 0 0 6.74 0Zm3.636 5.017L5.817 9.576c-.09.09-.246.08-.348-.023l-.306-.305L3.12 7.204a.263.263 0 0 1 0-.372l.557-.557a.262.262 0 0 1 .372 0l1.605 1.606 3.794-3.793c.09-.09.246-.08.348.022l.557.557c.103.103.113.259.023.349Z",
|
|
|
fill: "#68C79F",
|
|
|
fillRule: "nonzero"
|
|
|
}));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ __webpack_exports__["Z"] = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTYuNzQgMGE2Ljc0IDYuNzQgMCAxIDAgMCAxMy40OEE2Ljc0IDYuNzQgMCAwIDAgNi43NCAwWm0zLjYzNiA1LjAxN0w1LjgxNyA5LjU3NmMtLjA5LjA5LS4yNDYuMDgtLjM0OC0uMDIzbC0uMzA2LS4zMDVMMy4xMiA3LjIwNGEuMjYzLjI2MyAwIDAgMSAwLS4zNzJsLjU1Ny0uNTU3YS4yNjIuMjYyIDAgMCAxIC4zNzIgMGwxLjYwNSAxLjYwNiAzLjc5NC0zLjc5M2MuMDktLjA5LjI0Ni0uMDguMzQ4LjAyMmwuNTU3LjU1N2MuMTAzLjEwMy4xMTMuMjU5LjAyMy4zNDlaIiBmaWxsPSIjNjhDNzlGIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=");
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 79531:
|
|
|
/*!*********************************************************!*\
|
|
|
!*** ./node_modules/antd/es/input/index.js + 5 modules ***!
|
|
|
\*********************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"Z": function() { return /* binding */ input; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
|
|
var classnames = __webpack_require__(94184);
|
|
|
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
|
var react = __webpack_require__(67294);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/config-provider/context.js
|
|
|
var context = __webpack_require__(53124);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/form/context.js
|
|
|
var form_context = __webpack_require__(65223);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input/style/index.js
|
|
|
var style = __webpack_require__(47673);
|
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/input/Group.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Group = props => {
|
|
|
const {
|
|
|
getPrefixCls,
|
|
|
direction
|
|
|
} = (0,react.useContext)(context/* ConfigContext */.E_);
|
|
|
const {
|
|
|
prefixCls: customizePrefixCls,
|
|
|
className
|
|
|
} = props;
|
|
|
const prefixCls = getPrefixCls('input-group', customizePrefixCls);
|
|
|
const inputPrefixCls = getPrefixCls('input');
|
|
|
const [wrapSSR, hashId] = (0,style/* default */.ZP)(inputPrefixCls);
|
|
|
const cls = classnames_default()(prefixCls, {
|
|
|
[`${prefixCls}-lg`]: props.size === 'large',
|
|
|
[`${prefixCls}-sm`]: props.size === 'small',
|
|
|
[`${prefixCls}-compact`]: props.compact,
|
|
|
[`${prefixCls}-rtl`]: direction === 'rtl'
|
|
|
}, hashId, className);
|
|
|
const formItemContext = (0,react.useContext)(form_context/* FormItemInputContext */.aM);
|
|
|
const groupFormItemContext = (0,react.useMemo)(() => Object.assign(Object.assign({}, formItemContext), {
|
|
|
isFormItemInput: false
|
|
|
}), [formItemContext]);
|
|
|
if (false) {}
|
|
|
return wrapSSR( /*#__PURE__*/react.createElement("span", {
|
|
|
className: cls,
|
|
|
style: props.style,
|
|
|
onMouseEnter: props.onMouseEnter,
|
|
|
onMouseLeave: props.onMouseLeave,
|
|
|
onFocus: props.onFocus,
|
|
|
onBlur: props.onBlur
|
|
|
}, /*#__PURE__*/react.createElement(form_context/* FormItemInputContext.Provider */.aM.Provider, {
|
|
|
value: groupFormItemContext
|
|
|
}, props.children)));
|
|
|
};
|
|
|
/* harmony default export */ var input_Group = (Group);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input/Input.js + 1 modules
|
|
|
var Input = __webpack_require__(82586);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
|
|
var esm_extends = __webpack_require__(87462);
|
|
|
;// CONCATENATED MODULE: ./node_modules/@ant-design/icons-svg/es/asn/EyeInvisibleOutlined.js
|
|
|
// This icon file is generated automatically.
|
|
|
var EyeInvisibleOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z" } }, { "tag": "path", "attrs": { "d": "M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z" } }] }, "name": "eye-invisible", "theme": "outlined" };
|
|
|
/* harmony default export */ var asn_EyeInvisibleOutlined = (EyeInvisibleOutlined);
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/components/AntdIcon.js + 8 modules
|
|
|
var AntdIcon = __webpack_require__(74643);
|
|
|
;// CONCATENATED MODULE: ./node_modules/@ant-design/icons/es/icons/EyeInvisibleOutlined.js
|
|
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var EyeInvisibleOutlined_EyeInvisibleOutlined = function EyeInvisibleOutlined(props, ref) {
|
|
|
return /*#__PURE__*/react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
|
|
|
ref: ref,
|
|
|
icon: asn_EyeInvisibleOutlined
|
|
|
}));
|
|
|
};
|
|
|
if (false) {}
|
|
|
/* harmony default export */ var icons_EyeInvisibleOutlined = (/*#__PURE__*/react.forwardRef(EyeInvisibleOutlined_EyeInvisibleOutlined));
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/EyeOutlined.js + 1 modules
|
|
|
var EyeOutlined = __webpack_require__(99611);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/node_modules/rc-util/es/omit.js
|
|
|
var omit = __webpack_require__(10366);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/node_modules/rc-util/es/ref.js
|
|
|
var es_ref = __webpack_require__(17799);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input/hooks/useRemovePasswordTimeout.js
|
|
|
var useRemovePasswordTimeout = __webpack_require__(72922);
|
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/input/Password.js
|
|
|
var __rest = undefined && undefined.__rest || function (s, e) {
|
|
|
var t = {};
|
|
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
|
}
|
|
|
return t;
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const defaultIconRender = visible => visible ? /*#__PURE__*/react.createElement(EyeOutlined/* default */.Z, null) : /*#__PURE__*/react.createElement(icons_EyeInvisibleOutlined, null);
|
|
|
const ActionMap = {
|
|
|
click: 'onClick',
|
|
|
hover: 'onMouseOver'
|
|
|
};
|
|
|
const Password = /*#__PURE__*/react.forwardRef((props, ref) => {
|
|
|
const {
|
|
|
visibilityToggle = true
|
|
|
} = props;
|
|
|
const visibilityControlled = typeof visibilityToggle === 'object' && visibilityToggle.visible !== undefined;
|
|
|
const [visible, setVisible] = (0,react.useState)(() => visibilityControlled ? visibilityToggle.visible : false);
|
|
|
const inputRef = (0,react.useRef)(null);
|
|
|
react.useEffect(() => {
|
|
|
if (visibilityControlled) {
|
|
|
setVisible(visibilityToggle.visible);
|
|
|
}
|
|
|
}, [visibilityControlled, visibilityToggle]);
|
|
|
// Remove Password value
|
|
|
const removePasswordTimeout = (0,useRemovePasswordTimeout/* default */.Z)(inputRef);
|
|
|
const onVisibleChange = () => {
|
|
|
const {
|
|
|
disabled
|
|
|
} = props;
|
|
|
if (disabled) {
|
|
|
return;
|
|
|
}
|
|
|
if (visible) {
|
|
|
removePasswordTimeout();
|
|
|
}
|
|
|
setVisible(prevState => {
|
|
|
var _a;
|
|
|
const newState = !prevState;
|
|
|
if (typeof visibilityToggle === 'object') {
|
|
|
(_a = visibilityToggle.onVisibleChange) === null || _a === void 0 ? void 0 : _a.call(visibilityToggle, newState);
|
|
|
}
|
|
|
return newState;
|
|
|
});
|
|
|
};
|
|
|
const getIcon = prefixCls => {
|
|
|
const {
|
|
|
action = 'click',
|
|
|
iconRender = defaultIconRender
|
|
|
} = props;
|
|
|
const iconTrigger = ActionMap[action] || '';
|
|
|
const icon = iconRender(visible);
|
|
|
const iconProps = {
|
|
|
[iconTrigger]: onVisibleChange,
|
|
|
className: `${prefixCls}-icon`,
|
|
|
key: 'passwordIcon',
|
|
|
onMouseDown: e => {
|
|
|
// Prevent focused state lost
|
|
|
// https://github.com/ant-design/ant-design/issues/15173
|
|
|
e.preventDefault();
|
|
|
},
|
|
|
onMouseUp: e => {
|
|
|
// Prevent caret position change
|
|
|
// https://github.com/ant-design/ant-design/issues/23524
|
|
|
e.preventDefault();
|
|
|
}
|
|
|
};
|
|
|
return /*#__PURE__*/react.cloneElement( /*#__PURE__*/react.isValidElement(icon) ? icon : /*#__PURE__*/react.createElement("span", null, icon), iconProps);
|
|
|
};
|
|
|
const {
|
|
|
className,
|
|
|
prefixCls: customizePrefixCls,
|
|
|
inputPrefixCls: customizeInputPrefixCls,
|
|
|
size
|
|
|
} = props,
|
|
|
restProps = __rest(props, ["className", "prefixCls", "inputPrefixCls", "size"]);
|
|
|
const {
|
|
|
getPrefixCls
|
|
|
} = react.useContext(context/* ConfigContext */.E_);
|
|
|
const inputPrefixCls = getPrefixCls('input', customizeInputPrefixCls);
|
|
|
const prefixCls = getPrefixCls('input-password', customizePrefixCls);
|
|
|
const suffixIcon = visibilityToggle && getIcon(prefixCls);
|
|
|
const inputClassName = classnames_default()(prefixCls, className, {
|
|
|
[`${prefixCls}-${size}`]: !!size
|
|
|
});
|
|
|
const omittedProps = Object.assign(Object.assign({}, (0,omit/* default */.Z)(restProps, ['suffix', 'iconRender', 'visibilityToggle'])), {
|
|
|
type: visible ? 'text' : 'password',
|
|
|
className: inputClassName,
|
|
|
prefixCls: inputPrefixCls,
|
|
|
suffix: suffixIcon
|
|
|
});
|
|
|
if (size) {
|
|
|
omittedProps.size = size;
|
|
|
}
|
|
|
return /*#__PURE__*/react.createElement(Input/* default */.Z, Object.assign({
|
|
|
ref: (0,es_ref/* composeRef */.sQ)(ref, inputRef)
|
|
|
}, omittedProps));
|
|
|
});
|
|
|
if (false) {}
|
|
|
/* harmony default export */ var input_Password = (Password);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/SearchOutlined.js + 1 modules
|
|
|
var SearchOutlined = __webpack_require__(68795);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/_util/reactNode.js
|
|
|
var reactNode = __webpack_require__(96159);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(71577);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/config-provider/hooks/useSize.js
|
|
|
var useSize = __webpack_require__(98675);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/space/Compact.js
|
|
|
var Compact = __webpack_require__(4173);
|
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/input/Search.js
|
|
|
var Search_rest = undefined && undefined.__rest || function (s, e) {
|
|
|
var t = {};
|
|
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
|
}
|
|
|
return t;
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Search = /*#__PURE__*/react.forwardRef((props, ref) => {
|
|
|
const {
|
|
|
prefixCls: customizePrefixCls,
|
|
|
inputPrefixCls: customizeInputPrefixCls,
|
|
|
className,
|
|
|
size: customizeSize,
|
|
|
suffix,
|
|
|
enterButton = false,
|
|
|
addonAfter,
|
|
|
loading,
|
|
|
disabled,
|
|
|
onSearch: customOnSearch,
|
|
|
onChange: customOnChange,
|
|
|
onCompositionStart,
|
|
|
onCompositionEnd
|
|
|
} = props,
|
|
|
restProps = Search_rest(props, ["prefixCls", "inputPrefixCls", "className", "size", "suffix", "enterButton", "addonAfter", "loading", "disabled", "onSearch", "onChange", "onCompositionStart", "onCompositionEnd"]);
|
|
|
const {
|
|
|
getPrefixCls,
|
|
|
direction
|
|
|
} = react.useContext(context/* ConfigContext */.E_);
|
|
|
const composedRef = react.useRef(false);
|
|
|
const prefixCls = getPrefixCls('input-search', customizePrefixCls);
|
|
|
const inputPrefixCls = getPrefixCls('input', customizeInputPrefixCls);
|
|
|
const {
|
|
|
compactSize
|
|
|
} = (0,Compact/* useCompactItemContext */.ri)(prefixCls, direction);
|
|
|
const size = (0,useSize/* default */.Z)(ctx => {
|
|
|
var _a;
|
|
|
return (_a = customizeSize !== null && customizeSize !== void 0 ? customizeSize : compactSize) !== null && _a !== void 0 ? _a : ctx;
|
|
|
});
|
|
|
const inputRef = react.useRef(null);
|
|
|
const onChange = e => {
|
|
|
if (e && e.target && e.type === 'click' && customOnSearch) {
|
|
|
customOnSearch(e.target.value, e);
|
|
|
}
|
|
|
if (customOnChange) {
|
|
|
customOnChange(e);
|
|
|
}
|
|
|
};
|
|
|
const onMouseDown = e => {
|
|
|
var _a;
|
|
|
if (document.activeElement === ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.input)) {
|
|
|
e.preventDefault();
|
|
|
}
|
|
|
};
|
|
|
const onSearch = e => {
|
|
|
var _a, _b;
|
|
|
if (customOnSearch) {
|
|
|
customOnSearch((_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.input) === null || _b === void 0 ? void 0 : _b.value, e);
|
|
|
}
|
|
|
};
|
|
|
const onPressEnter = e => {
|
|
|
if (composedRef.current || loading) {
|
|
|
return;
|
|
|
}
|
|
|
onSearch(e);
|
|
|
};
|
|
|
const searchIcon = typeof enterButton === 'boolean' ? /*#__PURE__*/react.createElement(SearchOutlined/* default */.Z, null) : null;
|
|
|
const btnClassName = `${prefixCls}-button`;
|
|
|
let button;
|
|
|
const enterButtonAsElement = enterButton || {};
|
|
|
const isAntdButton = enterButtonAsElement.type && enterButtonAsElement.type.__ANT_BUTTON === true;
|
|
|
if (isAntdButton || enterButtonAsElement.type === 'button') {
|
|
|
button = (0,reactNode/* cloneElement */.Tm)(enterButtonAsElement, Object.assign({
|
|
|
onMouseDown,
|
|
|
onClick: e => {
|
|
|
var _a, _b;
|
|
|
(_b = (_a = enterButtonAsElement === null || enterButtonAsElement === void 0 ? void 0 : enterButtonAsElement.props) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
|
onSearch(e);
|
|
|
},
|
|
|
key: 'enterButton'
|
|
|
}, isAntdButton ? {
|
|
|
className: btnClassName,
|
|
|
size
|
|
|
} : {}));
|
|
|
} else {
|
|
|
button = /*#__PURE__*/react.createElement(es_button/* default */.ZP, {
|
|
|
className: btnClassName,
|
|
|
type: enterButton ? 'primary' : undefined,
|
|
|
size: size,
|
|
|
disabled: disabled,
|
|
|
key: "enterButton",
|
|
|
onMouseDown: onMouseDown,
|
|
|
onClick: onSearch,
|
|
|
loading: loading,
|
|
|
icon: searchIcon
|
|
|
}, enterButton);
|
|
|
}
|
|
|
if (addonAfter) {
|
|
|
button = [button, (0,reactNode/* cloneElement */.Tm)(addonAfter, {
|
|
|
key: 'addonAfter'
|
|
|
})];
|
|
|
}
|
|
|
const cls = classnames_default()(prefixCls, {
|
|
|
[`${prefixCls}-rtl`]: direction === 'rtl',
|
|
|
[`${prefixCls}-${size}`]: !!size,
|
|
|
[`${prefixCls}-with-button`]: !!enterButton
|
|
|
}, className);
|
|
|
const handleOnCompositionStart = e => {
|
|
|
composedRef.current = true;
|
|
|
onCompositionStart === null || onCompositionStart === void 0 ? void 0 : onCompositionStart(e);
|
|
|
};
|
|
|
const handleOnCompositionEnd = e => {
|
|
|
composedRef.current = false;
|
|
|
onCompositionEnd === null || onCompositionEnd === void 0 ? void 0 : onCompositionEnd(e);
|
|
|
};
|
|
|
return /*#__PURE__*/react.createElement(Input/* default */.Z, Object.assign({
|
|
|
ref: (0,es_ref/* composeRef */.sQ)(inputRef, ref),
|
|
|
onPressEnter: onPressEnter
|
|
|
}, restProps, {
|
|
|
size: size,
|
|
|
onCompositionStart: handleOnCompositionStart,
|
|
|
onCompositionEnd: handleOnCompositionEnd,
|
|
|
prefixCls: inputPrefixCls,
|
|
|
addonAfter: button,
|
|
|
suffix: suffix,
|
|
|
onChange: onChange,
|
|
|
className: cls,
|
|
|
disabled: disabled
|
|
|
}));
|
|
|
});
|
|
|
if (false) {}
|
|
|
/* harmony default export */ var input_Search = (Search);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input/TextArea.js
|
|
|
var TextArea = __webpack_require__(96330);
|
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/input/index.js
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const input_Input = Input/* default */.Z;
|
|
|
if (false) {}
|
|
|
input_Input.Group = input_Group;
|
|
|
input_Input.Search = input_Search;
|
|
|
input_Input.TextArea = TextArea/* default */.Z;
|
|
|
input_Input.Password = input_Password;
|
|
|
/* harmony default export */ var input = (input_Input);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 33507:
|
|
|
/*!*******************************************************!*\
|
|
|
!*** ./node_modules/antd/es/style/motion/collapse.js ***!
|
|
|
\*******************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__) {
|
|
|
|
|
|
const genCollapseMotion = token => ({
|
|
|
[token.componentCls]: {
|
|
|
// For common/openAnimation
|
|
|
[`${token.antCls}-motion-collapse-legacy`]: {
|
|
|
overflow: 'hidden',
|
|
|
'&-active': {
|
|
|
transition: `height ${token.motionDurationMid} ${token.motionEaseInOut},
|
|
|
opacity ${token.motionDurationMid} ${token.motionEaseInOut} !important`
|
|
|
}
|
|
|
},
|
|
|
[`${token.antCls}-motion-collapse`]: {
|
|
|
overflow: 'hidden',
|
|
|
transition: `height ${token.motionDurationMid} ${token.motionEaseInOut},
|
|
|
opacity ${token.motionDurationMid} ${token.motionEaseInOut} !important`
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
/* harmony default export */ __webpack_exports__["Z"] = (genCollapseMotion);
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
}]); |