You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3565 lines
169 KiB
3565 lines
169 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[34994],{
|
|
|
|
/***/ 31662:
|
|
/*!************************************************************************!*\
|
|
!*** ./node_modules/@ant-design/icons/es/icons/CloseCircleOutlined.js ***!
|
|
\************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ 1413);
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 67294);
|
|
/* harmony import */ var _ant_design_icons_svg_es_asn_CloseCircleOutlined__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ant-design/icons-svg/es/asn/CloseCircleOutlined */ 51213);
|
|
/* harmony import */ var _components_AntdIcon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AntdIcon */ 7918);
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
var CloseCircleOutlined = function CloseCircleOutlined(props, ref) {
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_AntdIcon__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)({}, props), {}, {
|
|
ref: ref,
|
|
icon: _ant_design_icons_svg_es_asn_CloseCircleOutlined__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z
|
|
}));
|
|
};
|
|
CloseCircleOutlined.displayName = 'CloseCircleOutlined';
|
|
/* harmony default export */ __webpack_exports__["Z"] = (/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(CloseCircleOutlined));
|
|
|
|
/***/ }),
|
|
|
|
/***/ 81088:
|
|
/*!*********************************************************************************!*\
|
|
!*** ./node_modules/@ant-design/icons/es/icons/PoweroffOutlined.js + 1 modules ***!
|
|
\*********************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"Z": function() { return /* binding */ icons_PoweroffOutlined; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__(1413);
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
var react = __webpack_require__(67294);
|
|
;// CONCATENATED MODULE: ./node_modules/@ant-design/icons-svg/es/asn/PoweroffOutlined.js
|
|
// This icon file is generated automatically.
|
|
var PoweroffOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M705.6 124.9a8 8 0 00-11.6 7.2v64.2c0 5.5 2.9 10.6 7.5 13.6a352.2 352.2 0 0162.2 49.8c32.7 32.8 58.4 70.9 76.3 113.3a355 355 0 0127.9 138.7c0 48.1-9.4 94.8-27.9 138.7a355.92 355.92 0 01-76.3 113.3 353.06 353.06 0 01-113.2 76.4c-43.8 18.6-90.5 28-138.5 28s-94.7-9.4-138.5-28a353.06 353.06 0 01-113.2-76.4A355.92 355.92 0 01184 650.4a355 355 0 01-27.9-138.7c0-48.1 9.4-94.8 27.9-138.7 17.9-42.4 43.6-80.5 76.3-113.3 19-19 39.8-35.6 62.2-49.8 4.7-2.9 7.5-8.1 7.5-13.6V132c0-6-6.3-9.8-11.6-7.2C178.5 195.2 82 339.3 80 506.3 77.2 745.1 272.5 943.5 511.2 944c239 .5 432.8-193.3 432.8-432.4 0-169.2-97-315.7-238.4-386.7zM480 560h64c4.4 0 8-3.6 8-8V88c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8z" } }] }, "name": "poweroff", "theme": "outlined" };
|
|
/* harmony default export */ var asn_PoweroffOutlined = (PoweroffOutlined);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/components/AntdIcon.js + 6 modules
|
|
var AntdIcon = __webpack_require__(7918);
|
|
;// CONCATENATED MODULE: ./node_modules/@ant-design/icons/es/icons/PoweroffOutlined.js
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
var PoweroffOutlined_PoweroffOutlined = function PoweroffOutlined(props, ref) {
|
|
return /*#__PURE__*/react.createElement(AntdIcon/* default */.Z, (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, props), {}, {
|
|
ref: ref,
|
|
icon: asn_PoweroffOutlined
|
|
}));
|
|
};
|
|
PoweroffOutlined_PoweroffOutlined.displayName = 'PoweroffOutlined';
|
|
/* harmony default export */ var icons_PoweroffOutlined = (/*#__PURE__*/react.forwardRef(PoweroffOutlined_PoweroffOutlined));
|
|
|
|
/***/ }),
|
|
|
|
/***/ 62752:
|
|
/*!*********************************************************!*\
|
|
!*** ./src/components/CustomTree/index.tsx + 1 modules ***!
|
|
\*********************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"Z": function() { return /* binding */ components_CustomTree; }
|
|
});
|
|
|
|
// 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/antd/es/tree/style/index.js + 1 modules
|
|
var style = __webpack_require__(62216);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/tree/index.js + 9 modules
|
|
var tree = __webpack_require__(54205);
|
|
// 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/slicedToArray.js
|
|
var slicedToArray = __webpack_require__(27424);
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectWithoutProperties.js
|
|
var objectWithoutProperties = __webpack_require__(70215);
|
|
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
var react = __webpack_require__(67294);
|
|
// EXTERNAL MODULE: ./src/service/problemset.ts
|
|
var problemset = __webpack_require__(75968);
|
|
;// CONCATENATED MODULE: ./src/components/CustomTree/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var CustomTreemodules = ({"flex_box_center":"flex_box_center___SFmJH","flex_space_between":"flex_space_between___f2H1D","flex_box_vertical_center":"flex_box_vertical_center___hW_hp","flex_box_center_end":"flex_box_center_end___yklmJ","flex_box_column":"flex_box_column___m0oUw","customTree":"customTree___ZhEHU","name":"name___RIkn2"});
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
;// CONCATENATED MODULE: ./src/components/CustomTree/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["value", "onChange", "defaultValue", "disabled"];
|
|
|
|
|
|
|
|
|
|
var CustomTree = function CustomTree(_ref) {
|
|
var value = _ref.value,
|
|
onChange = _ref.onChange,
|
|
defaultValue = _ref.defaultValue,
|
|
disabled = _ref.disabled,
|
|
props = objectWithoutProperties_default()(_ref, _excluded);
|
|
var _useState = (0,react.useState)([]),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
treeData = _useState2[0],
|
|
setTreeData = _useState2[1];
|
|
var _useState3 = (0,react.useState)('1'),
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
keyIndex = _useState4[0],
|
|
setKeyIndex = _useState4[1];
|
|
// const sign = useRef(true)
|
|
|
|
(0,react.useEffect)(function () {
|
|
getData();
|
|
}, []);
|
|
var getData = /*#__PURE__*/function () {
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
var res, item;
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
while (1) switch (_context.prev = _context.next) {
|
|
case 0:
|
|
_context.next = 2;
|
|
return (0,problemset/* getPaperList */.NZ)({});
|
|
case 2:
|
|
res = _context.sent;
|
|
// setFolderLoading(false)
|
|
if (res !== null && res !== void 0 && res.data) {
|
|
item = [{
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
title: '根目录',
|
|
className: CustomTreemodules.name,
|
|
children: "\u6839\u76EE\u5F55"
|
|
}),
|
|
value: 0,
|
|
key: 0,
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-wenjianjia2 c-light-primary mr10",
|
|
style: {
|
|
lineHeight: '19px'
|
|
}
|
|
}),
|
|
children: transformTreeKey(res.data || [])
|
|
}];
|
|
setTreeData(item);
|
|
setKeyIndex('2');
|
|
}
|
|
case 4:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
}));
|
|
return function getData() {
|
|
return _ref2.apply(this, arguments);
|
|
};
|
|
}();
|
|
var transformTreeKey = function transformTreeKey(items) {
|
|
function mapTree(org) {
|
|
var realChildren = org.children;
|
|
var haveChildren = Array.isArray(realChildren) && realChildren.length > 0;
|
|
var key = org === null || org === void 0 ? void 0 : org.group_id;
|
|
return {
|
|
//分别将我们查询出来的值做出改变他的key
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
title: org === null || org === void 0 ? void 0 : org.name,
|
|
className: CustomTreemodules.name,
|
|
children: org === null || org === void 0 ? void 0 : org.name
|
|
}),
|
|
value: key,
|
|
key: key,
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-wenjianjia2 c-light-primary mr10",
|
|
style: {
|
|
lineHeight: '19px'
|
|
}
|
|
}),
|
|
//判断它是否存在子集,若果存在就进行再次进行遍历操作,知道不存在子集便对其他的元素进行操作
|
|
children: haveChildren ? realChildren === null || realChildren === void 0 ? void 0 : realChildren.map(function (e) {
|
|
return mapTree(e);
|
|
}) : []
|
|
};
|
|
}
|
|
return items === null || items === void 0 ? void 0 : items.map(function (org) {
|
|
return mapTree(org);
|
|
});
|
|
};
|
|
var param = defaultValue ? {
|
|
defaultExpandedKeys: [0]
|
|
} : {
|
|
selectedKeys: value,
|
|
defaultExpandedKeys: value
|
|
};
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: CustomTreemodules.customTree,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(tree/* default */.Z, objectSpread2_default()(objectSpread2_default()({}, param), {}, {
|
|
showIcon: true,
|
|
treeData: treeData,
|
|
onSelect: onChange,
|
|
disabled: disabled
|
|
}, props), keyIndex)
|
|
});
|
|
};
|
|
/* harmony default export */ var components_CustomTree = (CustomTree);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 73221:
|
|
/*!********************************************************!*\
|
|
!*** ./src/components/Knowledge/index.tsx + 1 modules ***!
|
|
\********************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"N": function() { return /* binding */ Knowledge; }
|
|
});
|
|
|
|
// 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/antd/es/message/style/index.js + 1 modules
|
|
var style = __webpack_require__(14934);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/message/index.js + 1 modules
|
|
var message = __webpack_require__(12461);
|
|
// 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/antd/es/input/style/index.js + 1 modules
|
|
var input_style = __webpack_require__(69463);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input/index.js + 5 modules
|
|
var input = __webpack_require__(75008);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/row/style/index.js
|
|
var row_style = __webpack_require__(13062);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/row/index.js
|
|
var row = __webpack_require__(71230);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/col/style/index.js
|
|
var col_style = __webpack_require__(89032);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/col/index.js
|
|
var col = __webpack_require__(15746);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/modal/style/index.js + 1 modules
|
|
var modal_style = __webpack_require__(35611);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/modal/index.js + 7 modules
|
|
var modal = __webpack_require__(85402);
|
|
// 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/slicedToArray.js
|
|
var slicedToArray = __webpack_require__(27424);
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/select/style/index.js + 1 modules
|
|
var select_style = __webpack_require__(95985);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/select/index.js
|
|
var es_select = __webpack_require__(34041);
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
var react = __webpack_require__(67294);
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
var fetch = __webpack_require__(84519);
|
|
;// CONCATENATED MODULE: ./src/components/Knowledge/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Knowledgemodules = ({"wrap":"wrap___F7E3F","selectWrapper":"selectWrapper____kESB","tips":"tips___aHjQY","linkBtn":"linkBtn___uggVr","mainText":"mainText____S1I0"});
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/ExclamationCircleOutlined.js
|
|
var ExclamationCircleOutlined = __webpack_require__(87588);
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
;// CONCATENATED MODULE: ./src/components/Knowledge/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Option = es_select/* default.Option */.Z.Option;
|
|
var Knowledge = function Knowledge(_ref) {
|
|
var subId = _ref.subId,
|
|
value = _ref.value,
|
|
selectvalues = _ref.selectvalues,
|
|
disabled = _ref.disabled,
|
|
_ref$knowledgeOptions = _ref.knowledgeOptions,
|
|
knowledgeOptions = _ref$knowledgeOptions === void 0 ? [] : _ref$knowledgeOptions,
|
|
_ref$onChange = _ref.onChange,
|
|
onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
_ref$onAddKnowledgeFi = _ref.onAddKnowledgeFinish,
|
|
onAddKnowledgeFinish = _ref$onAddKnowledgeFi === void 0 ? function () {} : _ref$onAddKnowledgeFi;
|
|
var addValue = (0,react.useRef)();
|
|
var _useState = (0,react.useState)([]),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
values = _useState2[0],
|
|
setValues = _useState2[1];
|
|
value = value || [];
|
|
var handleChange = function handleChange(e, valuesmap) {
|
|
if (e) {
|
|
//获取选中的数据
|
|
setValues([valuesmap.key]);
|
|
onChange([valuesmap.key]);
|
|
} else {
|
|
//获取选中的数据
|
|
setValues([]);
|
|
onChange([]);
|
|
}
|
|
};
|
|
(0,react.useEffect)(function () {
|
|
if ((selectvalues === null || selectvalues === void 0 ? void 0 : selectvalues.length) > 0) {
|
|
setValues(toConsumableArray_default()(selectvalues));
|
|
onChange(toConsumableArray_default()(selectvalues));
|
|
}
|
|
}, [knowledgeOptions]);
|
|
(0,react.useEffect)(function () {
|
|
var _value;
|
|
if (((_value = value) === null || _value === void 0 ? void 0 : _value.length) > 0) {
|
|
onChange(toConsumableArray_default()(value));
|
|
}
|
|
}, [knowledgeOptions]);
|
|
var handleAdd = function handleAdd(e) {
|
|
e.preventDefault();
|
|
addValue.current = '';
|
|
modal/* default.confirm */.Z.confirm({
|
|
centered: true,
|
|
width: 640,
|
|
okText: '确定',
|
|
cancelText: '取消',
|
|
icon: null,
|
|
title: '新建知识点',
|
|
className: 'custom-modal-divider',
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "font14",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
className: "mb20",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(ExclamationCircleOutlined/* default */.Z, {
|
|
style: {
|
|
color: '#FF8C29'
|
|
}
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
className: "ml10 ".concat(Knowledgemodules.mainText),
|
|
children: ["\u65B0\u5EFA\u7684\u77E5\u8BC6\u70B9\u4EC5\u672C\u4EBA\u53EF\u89C1\uFF0C\u5E73\u53F0\u5BA1\u6838\u5217\u5165\u516C\u5F00\u77E5\u8BC6\u70B9\u540E\uFF0C\u5BF9\u6240\u6709\u7528\u6237\u53EF\u89C1\u3002", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u5E73\u53F0\u6709\u6743\u5220\u9664\u4E0D\u5408\u9002\u7684\u77E5\u8BC6\u70B9\uFF0C\u8BF7\u8BA4\u771F\u586B\u5199\u77E5\u8BC6\u70B9\u540D\u79F0\u3002"]
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
maxLength: 20,
|
|
size: "large",
|
|
showCount: true,
|
|
placeholder: "\u8BF7\u8F93\u5165\u77E5\u8BC6\u70B9\u540D\u79F0",
|
|
defaultValue: addValue.current,
|
|
onChange: function onChange(e) {
|
|
addValue.current = e.target.value;
|
|
}
|
|
})]
|
|
}),
|
|
onOk: function onOk() {
|
|
return new Promise( /*#__PURE__*/function () {
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(resolve, reject) {
|
|
var res, _value2;
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
while (1) switch (_context.prev = _context.next) {
|
|
case 0:
|
|
if (addValue.current) {
|
|
_context.next = 3;
|
|
break;
|
|
}
|
|
message/* default.warn */.ZP.warn("请输入知识点名称");
|
|
return _context.abrupt("return", reject());
|
|
case 3:
|
|
if (!(addValue.current.length > 20)) {
|
|
_context.next = 6;
|
|
break;
|
|
}
|
|
message/* default.warn */.ZP.warn("请输入不超过20字的知识点名称");
|
|
return _context.abrupt("return", reject());
|
|
case 6:
|
|
_context.next = 8;
|
|
return (0,fetch/* default */.ZP)("/api/tag_disciplines.json", {
|
|
method: 'post',
|
|
body: {
|
|
name: addValue.current,
|
|
sub_discipline_id: subId
|
|
}
|
|
});
|
|
case 8:
|
|
res = _context.sent;
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
onAddKnowledgeFinish({
|
|
id: res.tag_discipline_id,
|
|
name: addValue.current,
|
|
type: 'personal'
|
|
});
|
|
// values.push(res.tag_discipline_id)
|
|
// value.push(res.tag_discipline_id)
|
|
_value2 = [];
|
|
_value2.push(res.tag_discipline_id);
|
|
onChange([].concat(_value2));
|
|
setValues([res.tag_discipline_id]);
|
|
onChange([].concat(_value2));
|
|
}
|
|
return _context.abrupt("return", resolve());
|
|
case 11:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
}));
|
|
return function (_x, _x2) {
|
|
return _ref2.apply(this, arguments);
|
|
};
|
|
}());
|
|
}
|
|
});
|
|
};
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
wrap: false,
|
|
align: "middle",
|
|
className: Knowledgemodules.wrap,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_select/* default */.Z, {
|
|
disabled: !subId || disabled,
|
|
className: Knowledgemodules.selectWrapper,
|
|
placeholder: "\u8BF7\u9009\u62E9\u77E5\u8BC6\u70B9",
|
|
onChange: handleChange,
|
|
style: {
|
|
width: 490
|
|
},
|
|
showSearch: true,
|
|
allowClear: true,
|
|
value: knowledgeOptions === null || knowledgeOptions === void 0 ? void 0 : knowledgeOptions.filter(function (item) {
|
|
return (values === null || values === void 0 ? void 0 : values.includes(item === null || item === void 0 ? void 0 : item.id)) || (values === null || values === void 0 ? void 0 : values.includes((item === null || item === void 0 ? void 0 : item.id) + ''));
|
|
}).map(function (item) {
|
|
return item.name;
|
|
}),
|
|
children: knowledgeOptions === null || knowledgeOptions === void 0 ? void 0 : knowledgeOptions.map(function (item) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(Option, {
|
|
value: item.name,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
style: {
|
|
display: 'flex',
|
|
justifyContent: 'space-between'
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
style: {
|
|
overflow: "hidden",
|
|
whiteSpace: "nowrap",
|
|
textOverflow: "ellipsis"
|
|
},
|
|
children: item.name
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
children: item.type === 'personal' ? '(自用)' : ''
|
|
})]
|
|
})
|
|
}, item.id);
|
|
})
|
|
})
|
|
}), subId && /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
className: "ml20",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Knowledgemodules.tips,
|
|
children: "\u6CA1\u6709\u5408\u9002\u7684\u77E5\u8BC6\u70B9\uFF1F"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Knowledgemodules.linkBtn,
|
|
onClick: handleAdd,
|
|
children: "\u65B0\u5EFA\u77E5\u8BC6\u70B9"
|
|
})]
|
|
})]
|
|
});
|
|
};
|
|
|
|
/***/ }),
|
|
|
|
/***/ 76695:
|
|
/*!*************************************************************!*\
|
|
!*** ./src/components/SplitContainer/index.tsx + 1 modules ***!
|
|
\*************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"Z": function() { return /* binding */ SplitContainer; }
|
|
});
|
|
|
|
// 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);
|
|
;// CONCATENATED MODULE: ./src/components/SplitContainer/index.less
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
;// CONCATENATED MODULE: ./src/components/SplitContainer/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
/* harmony default export */ var SplitContainer = (function (_ref) {
|
|
var _ref$defaultX = _ref.defaultX,
|
|
defaultX = _ref$defaultX === void 0 ? '40%' : _ref$defaultX,
|
|
leftChild = _ref.leftChild,
|
|
rightChild = _ref.rightChild,
|
|
className = _ref.className,
|
|
_ref$hideResize = _ref.hideResize,
|
|
hideResize = _ref$hideResize === void 0 ? false : _ref$hideResize;
|
|
var _useState = (0,react.useState)(defaultX),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
moveX = _useState2[0],
|
|
setMoveX = _useState2[1];
|
|
var resizeXFlag = (0,react.useRef)();
|
|
function onResizeStart() {
|
|
resizeXFlag.current = true;
|
|
}
|
|
(0,react.useEffect)(function () {
|
|
function onMove(e) {
|
|
if (resizeXFlag.current) {
|
|
setMoveX(e.pageX);
|
|
}
|
|
}
|
|
function onMouseUp() {
|
|
resizeXFlag.current = false;
|
|
}
|
|
window.addEventListener('mousemove', onMove);
|
|
window.addEventListener('mouseup', onMouseUp);
|
|
return function () {
|
|
window.removeEventListener('mousemove', onMove);
|
|
window.removeEventListener('mouseup', onMouseUp);
|
|
};
|
|
}, []);
|
|
var leftPanelWidth = typeof moveX === 'number' && moveX !== 0.01 ? "".concat(moveX, "px") : defaultX;
|
|
var rightPanelWidth = "calc(100% - ".concat(hideResize ? "0px" : "4px", " - ").concat(leftPanelWidth, ")");
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "split-panel-container ".concat(className),
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
style: {
|
|
width: leftPanelWidth,
|
|
display: moveX === 0.01 ? 'none' : ''
|
|
},
|
|
children: leftChild
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
className: "resize-x-bar",
|
|
onMouseDown: onResizeStart,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
className: "btn-resize",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("svg", {
|
|
width: "16",
|
|
height: "13",
|
|
viewBox: "0 0 16 13",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("path", {
|
|
d: "M12.245 7.53H5.647v1.882h6.598v2.823L16 8.471l-3.755-3.765V7.53zM10.353 4.706H3.755v2.823L0 3.765 3.755 0v2.824h6.598v1.882z"
|
|
})
|
|
})
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
style: {
|
|
width: rightPanelWidth
|
|
},
|
|
children: rightChild
|
|
})]
|
|
});
|
|
});
|
|
|
|
/***/ }),
|
|
|
|
/***/ 77696:
|
|
/*!*********************************************************!*\
|
|
!*** ./src/components/tpi-code-setting/CodeSetting.tsx ***!
|
|
\*********************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony import */ var antd_es_switch_style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/es/switch/style */ 5812);
|
|
/* harmony import */ var antd_es_switch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! antd/es/switch */ 94594);
|
|
/* harmony import */ var antd_es_select_style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/es/select/style */ 95985);
|
|
/* harmony import */ var antd_es_select__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! antd/es/select */ 34041);
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ 67294);
|
|
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./index.less */ 12867);
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ 85893);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Option = antd_es_select__WEBPACK_IMPORTED_MODULE_5__/* ["default"].Option */ .Z.Option;
|
|
/* harmony default export */ __webpack_exports__["Z"] = (function (_ref) {
|
|
var onFontSizeChange = _ref.onFontSizeChange,
|
|
cmFontSize = _ref.cmFontSize,
|
|
cmCodeMode = _ref.cmCodeMode,
|
|
autoFormat = _ref.autoFormat,
|
|
onCodeModeChange = _ref.onCodeModeChange,
|
|
onTabToSpace = _ref.onTabToSpace,
|
|
onAutoFormat = _ref.onAutoFormat,
|
|
_ref$className = _ref.className,
|
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
tabToSpace = _ref.tabToSpace,
|
|
children = _ref.children;
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
|
|
className: "tpi-code-setting ".concat(className),
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("h3", {
|
|
children: "\u4EE3\u7801\u683C\u5F0F"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("section", {
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("b", {
|
|
children: "\u663E\u793A\u6A21\u5F0F"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(antd_es_select__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {
|
|
bordered: false,
|
|
size: "small",
|
|
value: cmCodeMode,
|
|
onChange: onCodeModeChange,
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(Option, {
|
|
value: 'vs',
|
|
children: "\u767D\u8272\u80CC\u666F"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(Option, {
|
|
value: 'vs-dark',
|
|
children: "\u9ED1\u8272\u80CC\u666F"
|
|
})]
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("b", {
|
|
children: "\u5B57\u4F53\u5927\u5C0F"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(antd_es_select__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {
|
|
bordered: false,
|
|
size: "small",
|
|
value: cmFontSize,
|
|
onChange: onFontSizeChange,
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(Option, {
|
|
value: 12,
|
|
children: "12px"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(Option, {
|
|
value: 14,
|
|
children: "14px"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(Option, {
|
|
value: 16,
|
|
children: "16px"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(Option, {
|
|
value: 18,
|
|
children: "18px"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(Option, {
|
|
value: 20,
|
|
children: "20px"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(Option, {
|
|
value: 22,
|
|
children: "22px"
|
|
})]
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("b", {
|
|
children: "Tab\u8F6C\u6362"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(antd_es_switch__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
|
|
checked: tabToSpace,
|
|
onChange: onTabToSpace
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("b", {
|
|
children: "\u4EE3\u7801\u81EA\u52A8\u683C\u5F0F\u5316"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(antd_es_switch__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
|
|
checked: autoFormat,
|
|
onChange: onAutoFormat
|
|
})]
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("h3", {
|
|
children: "\u5FEB\u6377\u952E"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("section", {
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("b", {
|
|
children: "\u4FDD\u5B58\u4EE3\u7801"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("span", {
|
|
children: "Ctrl + S"
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("b", {
|
|
children: "\u5524\u51FA\u5FEB\u6377\u952E\u5217\u8868"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("span", {
|
|
children: "F1 / Alt + F1"
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("b", {
|
|
children: "\u5DE6\u53F3\u7F29\u8FDB"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("span", {
|
|
children: "Ctrl + ]/["
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("b", {
|
|
children: "\u8DF3\u5230\u5339\u914D\u7684\u62EC\u53F7"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("span", {
|
|
children: "Ctrl + Shift + \\"
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("b", {
|
|
children: "\u8F6C\u5230\u884C\u9996"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("span", {
|
|
children: "Home"
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("b", {
|
|
children: "\u8F6C\u5230\u884C\u5C3E"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("span", {
|
|
children: "End"
|
|
})]
|
|
})]
|
|
}), children]
|
|
});
|
|
});
|
|
|
|
/***/ }),
|
|
|
|
/***/ 20654:
|
|
/*!*******************************************************************!*\
|
|
!*** ./src/pages/Problems/OjForm/CodePanel/index.tsx + 1 modules ***!
|
|
\*******************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"Z": function() { return /* binding */ CodePanel; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/drawer/style/index.js + 1 modules
|
|
var style = __webpack_require__(11400);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/drawer/index.js + 6 modules
|
|
var drawer = __webpack_require__(63463);
|
|
// 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/@babel/runtime/helpers/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__(42122);
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
var react = __webpack_require__(67294);
|
|
// EXTERNAL MODULE: ./src/components/monaco-editor/index.jsx + 3 modules
|
|
var monaco_editor = __webpack_require__(8691);
|
|
// EXTERNAL MODULE: ./src/components/tpi-code-setting/CodeSetting.tsx
|
|
var CodeSetting = __webpack_require__(77696);
|
|
// EXTERNAL MODULE: ./src/components/modal.tsx
|
|
var modal = __webpack_require__(12264);
|
|
// EXTERNAL MODULE: ./src/utils/urlTool.ts
|
|
var urlTool = __webpack_require__(63778);
|
|
;// CONCATENATED MODULE: ./src/pages/Problems/OjForm/CodePanel/index.less
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
;// CONCATENATED MODULE: ./src/pages/Problems/OjForm/CodePanel/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
//@ts-ignore
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var initialState = {
|
|
theme: (0,urlTool/* fromStore */.G)('cmCodeMode', 'vs-dark'),
|
|
fontSize: (0,urlTool/* fromStore */.G)('cmFontSize', 14),
|
|
showEditorSetting: false,
|
|
tabToSpace: (0,urlTool/* fromStore */.G)('cmTabToSpace', true)
|
|
};
|
|
var Types;
|
|
(function (Types) {
|
|
Types[Types["set_font_size"] = 0] = "set_font_size";
|
|
Types[Types["set_theme"] = 1] = "set_theme";
|
|
Types[Types["on_tab_to_space"] = 2] = "on_tab_to_space";
|
|
Types[Types["set_show_editor_setting"] = 3] = "set_show_editor_setting";
|
|
})(Types || (Types = {}));
|
|
function reducer(state, action) {
|
|
switch (action.type) {
|
|
case Types.set_show_editor_setting:
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
showEditorSetting: action.payload
|
|
});
|
|
case Types.set_theme:
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
theme: action.payload
|
|
});
|
|
case Types.set_font_size:
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
fontSize: action.payload
|
|
});
|
|
case Types.on_tab_to_space:
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
tabToSpace: action.payload
|
|
});
|
|
default:
|
|
throw new Error();
|
|
}
|
|
}
|
|
/* harmony default export */ var CodePanel = (function (_ref) {
|
|
var isLoading = _ref.isLoading,
|
|
value = _ref.value,
|
|
_onChange = _ref.onChange,
|
|
language = _ref.language,
|
|
onUpdateCode = _ref.onUpdateCode,
|
|
_ref$ActionBarRender = _ref.ActionBarRender,
|
|
ActionBarRender = _ref$ActionBarRender === void 0 ? function (onShowCodeSetting) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(DefaultActionBar, {
|
|
onShowCodeSetting: onShowCodeSetting
|
|
});
|
|
} : _ref$ActionBarRender;
|
|
var _useReducer = (0,react.useReducer)(reducer, initialState),
|
|
_useReducer2 = slicedToArray_default()(_useReducer, 2),
|
|
state = _useReducer2[0],
|
|
dispatch = _useReducer2[1];
|
|
var theme = state.theme,
|
|
fontSize = state.fontSize,
|
|
showEditorSetting = state.showEditorSetting,
|
|
tabToSpace = state.tabToSpace;
|
|
var timeRef = (0,react.useRef)();
|
|
var valueRef = (0,react.useRef)();
|
|
var codeSettingOption = {
|
|
onFontSizeChange: function onFontSizeChange(val) {
|
|
dispatch({
|
|
type: Types.set_font_size,
|
|
payload: val
|
|
});
|
|
(0,urlTool/* toStore */.t)('cmFontSize', val);
|
|
},
|
|
tabToSpace: tabToSpace,
|
|
cmFontSize: fontSize,
|
|
className: 'oj',
|
|
cmCodeMode: theme,
|
|
onTabToSpace: function onTabToSpace(checked) {
|
|
dispatch({
|
|
type: Types.on_tab_to_space,
|
|
payload: checked
|
|
});
|
|
(0,urlTool/* toStore */.t)('cmTabToSpace', checked);
|
|
},
|
|
onCodeModeChange: function onCodeModeChange(val) {
|
|
dispatch({
|
|
type: Types.set_theme,
|
|
payload: val
|
|
});
|
|
(0,urlTool/* toStore */.t)('cmCodeMode', val);
|
|
}
|
|
};
|
|
function onHideCodeSetting() {
|
|
dispatch({
|
|
type: Types.set_show_editor_setting,
|
|
payload: false
|
|
});
|
|
}
|
|
function onShowCodeSetting() {
|
|
dispatch({
|
|
type: Types.set_show_editor_setting,
|
|
payload: true
|
|
});
|
|
}
|
|
var editorOption = {
|
|
value: value,
|
|
language: language,
|
|
// onChange,
|
|
theme: theme,
|
|
height: 'calc(100% - 56px)',
|
|
options: {
|
|
fontSize: fontSize,
|
|
insertSpaces: tabToSpace
|
|
},
|
|
onChange: function onChange(value) {
|
|
_onChange(value);
|
|
valueRef.current = value;
|
|
clearTimeout(timeRef.current);
|
|
timeRef.current = setTimeout(function () {
|
|
onUpdateCode(valueRef.current);
|
|
}, 10000);
|
|
},
|
|
onEditBlur: function onEditBlur(value) {
|
|
if (!!valueRef.current) onUpdateCode(valueRef.current);
|
|
}
|
|
};
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(react.Fragment, {
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "code-panel-container",
|
|
children: [ActionBarRender(onShowCodeSetting), !isLoading && /*#__PURE__*/(0,jsx_runtime.jsx)(monaco_editor/* default */.ZP, objectSpread2_default()({}, editorOption))]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(drawer/* default */.Z, {
|
|
className: "oj",
|
|
title: null,
|
|
placement: "right",
|
|
closable: false,
|
|
open: showEditorSetting,
|
|
onClose: onHideCodeSetting,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(CodeSetting/* default */.Z, objectSpread2_default()({}, codeSettingOption))
|
|
})
|
|
})]
|
|
});
|
|
});
|
|
function DefaultActionBar(_ref2) {
|
|
var onShowCodeSetting = _ref2.onShowCodeSetting;
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "action-bar",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
children: "\u5B66\u5458\u521D\u59CB\u4EE3\u7801\u6587\u4EF6"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
onClick: onShowCodeSetting,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-shezhi"
|
|
})
|
|
})]
|
|
});
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 46533:
|
|
/*!**************************************************************************!*\
|
|
!*** ./src/pages/Problems/OjForm/CodeProgramPanel/index.tsx + 1 modules ***!
|
|
\**************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"Z": function() { return /* binding */ CodeProgramPanel; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/drawer/style/index.js + 1 modules
|
|
var style = __webpack_require__(11400);
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/drawer/index.js + 6 modules
|
|
var drawer = __webpack_require__(63463);
|
|
// 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/@babel/runtime/helpers/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__(42122);
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
var react = __webpack_require__(67294);
|
|
// EXTERNAL MODULE: ./src/components/monaco-editor/index.jsx + 3 modules
|
|
var monaco_editor = __webpack_require__(8691);
|
|
// EXTERNAL MODULE: ./src/components/tpi-code-setting/CodeSetting.tsx
|
|
var CodeSetting = __webpack_require__(77696);
|
|
// EXTERNAL MODULE: ./src/components/modal.tsx
|
|
var modal = __webpack_require__(12264);
|
|
// EXTERNAL MODULE: ./src/utils/urlTool.ts
|
|
var urlTool = __webpack_require__(63778);
|
|
;// CONCATENATED MODULE: ./src/pages/Problems/OjForm/CodeProgramPanel/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var CodeProgramPanelmodules = ({"code-panel-container":"code-panel-container___RFtv_","action-oj-bar":"action-oj-bar___ByFmZ","active":"active___s9gT5"});
|
|
// EXTERNAL MODULE: ./node_modules/lodash/lodash.js
|
|
var lodash = __webpack_require__(96486);
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
;// CONCATENATED MODULE: ./src/pages/Problems/OjForm/CodeProgramPanel/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
//@ts-ignore
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var initialState = {
|
|
theme: (0,urlTool/* fromStore */.G)('cmCodeMode', 'vs-dark'),
|
|
fontSize: (0,urlTool/* fromStore */.G)('cmFontSize', 14),
|
|
showEditorSetting: false,
|
|
tabToSpace: (0,urlTool/* fromStore */.G)('cmTabToSpace', true)
|
|
};
|
|
var Types;
|
|
(function (Types) {
|
|
Types[Types["set_font_size"] = 0] = "set_font_size";
|
|
Types[Types["set_theme"] = 1] = "set_theme";
|
|
Types[Types["on_tab_to_space"] = 2] = "on_tab_to_space";
|
|
Types[Types["set_show_editor_setting"] = 3] = "set_show_editor_setting";
|
|
})(Types || (Types = {}));
|
|
function reducer(state, action) {
|
|
switch (action.type) {
|
|
case Types.set_show_editor_setting:
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
showEditorSetting: action.payload
|
|
});
|
|
case Types.set_theme:
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
theme: action.payload
|
|
});
|
|
case Types.set_font_size:
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
fontSize: action.payload
|
|
});
|
|
case Types.on_tab_to_space:
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
tabToSpace: action.payload
|
|
});
|
|
default:
|
|
throw new Error();
|
|
}
|
|
}
|
|
/* harmony default export */ var CodeProgramPanel = (function (_ref) {
|
|
var _value$find;
|
|
var isLoading = _ref.isLoading,
|
|
_ref$value = _ref.value,
|
|
value = _ref$value === void 0 ? [] : _ref$value,
|
|
onChange = _ref.onChange;
|
|
var _useReducer = (0,react.useReducer)(reducer, initialState),
|
|
_useReducer2 = slicedToArray_default()(_useReducer, 2),
|
|
state = _useReducer2[0],
|
|
dispatch = _useReducer2[1];
|
|
var theme = state.theme,
|
|
fontSize = state.fontSize,
|
|
showEditorSetting = state.showEditorSetting,
|
|
tabToSpace = state.tabToSpace;
|
|
var _useState = (0,react.useState)('c'),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
language = _useState2[0],
|
|
setLanguage = _useState2[1];
|
|
var saveLanguageItems = (0,react.useRef)([]);
|
|
(0,react.useEffect)(function () {
|
|
if (!!(value !== null && value !== void 0 && value.length)) {
|
|
saveLanguageItems.current = (0,lodash.cloneDeep)(value);
|
|
}
|
|
}, [value]);
|
|
var codeSettingOption = {
|
|
onFontSizeChange: function onFontSizeChange(val) {
|
|
dispatch({
|
|
type: Types.set_font_size,
|
|
payload: val
|
|
});
|
|
(0,urlTool/* toStore */.t)('cmFontSize', val);
|
|
},
|
|
tabToSpace: tabToSpace,
|
|
cmFontSize: fontSize,
|
|
className: 'oj',
|
|
cmCodeMode: theme,
|
|
onTabToSpace: function onTabToSpace(checked) {
|
|
dispatch({
|
|
type: Types.on_tab_to_space,
|
|
payload: checked
|
|
});
|
|
(0,urlTool/* toStore */.t)('cmTabToSpace', checked);
|
|
},
|
|
onCodeModeChange: function onCodeModeChange(val) {
|
|
dispatch({
|
|
type: Types.set_theme,
|
|
payload: val
|
|
});
|
|
(0,urlTool/* toStore */.t)('cmCodeMode', val);
|
|
}
|
|
};
|
|
function onHideCodeSetting() {
|
|
dispatch({
|
|
type: Types.set_show_editor_setting,
|
|
payload: false
|
|
});
|
|
}
|
|
function onShowCodeSetting() {
|
|
dispatch({
|
|
type: Types.set_show_editor_setting,
|
|
payload: true
|
|
});
|
|
}
|
|
function onCodeChange(v) {
|
|
var _saveLanguageItems$cu;
|
|
var item = (_saveLanguageItems$cu = saveLanguageItems.current) === null || _saveLanguageItems$cu === void 0 ? void 0 : _saveLanguageItems$cu.map(function (e) {
|
|
if (e.language === language) {
|
|
e.code = v;
|
|
return e;
|
|
}
|
|
return e;
|
|
});
|
|
saveLanguageItems.current = (0,lodash.cloneDeep)(item);
|
|
onChange(item);
|
|
}
|
|
var editorOption = {
|
|
key: language,
|
|
value: value === null || value === void 0 ? void 0 : (_value$find = value.find(function (e) {
|
|
return e.language === language;
|
|
})) === null || _value$find === void 0 ? void 0 : _value$find.code,
|
|
language: language,
|
|
onChange: onCodeChange,
|
|
theme: theme,
|
|
height: 'calc(100% - 56px)',
|
|
options: {
|
|
fontSize: fontSize,
|
|
insertSpaces: tabToSpace
|
|
}
|
|
};
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(react.Fragment, {
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: CodeProgramPanelmodules["code-panel-container"],
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(DefaultActionBar, {
|
|
languageItems: value,
|
|
onLanguage: function onLanguage(v) {
|
|
return setLanguage(v);
|
|
},
|
|
language: language,
|
|
onShowCodeSetting: onShowCodeSetting
|
|
}), !isLoading && /*#__PURE__*/(0,jsx_runtime.jsx)(monaco_editor/* default */.ZP, objectSpread2_default()({}, editorOption))]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(drawer/* default */.Z, {
|
|
className: "oj",
|
|
title: null,
|
|
placement: "right",
|
|
closable: false,
|
|
open: showEditorSetting,
|
|
onClose: onHideCodeSetting,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(CodeSetting/* default */.Z, objectSpread2_default()({}, codeSettingOption))
|
|
})
|
|
})]
|
|
});
|
|
});
|
|
function DefaultActionBar(_ref2) {
|
|
var languageItems = _ref2.languageItems,
|
|
language = _ref2.language,
|
|
onShowCodeSetting = _ref2.onShowCodeSetting,
|
|
onLanguage = _ref2.onLanguage;
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: CodeProgramPanelmodules["action-oj-bar"],
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
children: "\u5B66\u5458\u521D\u59CB\u4EE3\u7801\u6587\u4EF6"
|
|
}), languageItems === null || languageItems === void 0 ? void 0 : languageItems.map(function (e) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: language === (e === null || e === void 0 ? void 0 : e.language) ? CodeProgramPanelmodules.active : '',
|
|
onClick: function onClick() {
|
|
return onLanguage(e === null || e === void 0 ? void 0 : e.language);
|
|
},
|
|
children: e === null || e === void 0 ? void 0 : e.language
|
|
}, e === null || e === void 0 ? void 0 : e.language);
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
onClick: onShowCodeSetting,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-shezhi"
|
|
})
|
|
})]
|
|
});
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 74658:
|
|
/*!*********************************************!*\
|
|
!*** ./src/pages/Problems/OjForm/index.tsx ***!
|
|
\*********************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ "Types": function() { return /* binding */ Types; }
|
|
/* harmony export */ });
|
|
/* harmony import */ var antd_es_popconfirm_style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/es/popconfirm/style */ 33219);
|
|
/* harmony import */ var antd_es_popconfirm__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(/*! antd/es/popconfirm */ 65360);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectDestructuringEmpty_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js */ 13012);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectDestructuringEmpty_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectDestructuringEmpty_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
/* harmony import */ var antd_es_space_style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! antd/es/space/style */ 6516);
|
|
/* harmony import */ var antd_es_space__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(/*! antd/es/space */ 26713);
|
|
/* harmony import */ var antd_es_radio_style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! antd/es/radio/style */ 83822);
|
|
/* harmony import */ var antd_es_radio__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(/*! antd/es/radio */ 29924);
|
|
/* harmony import */ var antd_es_checkbox_style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd/es/checkbox/style */ 82000);
|
|
/* harmony import */ var antd_es_checkbox__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(/*! antd/es/checkbox */ 32808);
|
|
/* harmony import */ var antd_es_input_number_style__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! antd/es/input-number/style */ 25359);
|
|
/* harmony import */ var antd_es_input_number__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(/*! antd/es/input-number */ 87799);
|
|
/* harmony import */ var antd_es_cascader_style__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! antd/es/cascader/style */ 95847);
|
|
/* harmony import */ var antd_es_cascader__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! antd/es/cascader */ 45239);
|
|
/* harmony import */ var antd_es_select_style__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd/es/select/style */ 95985);
|
|
/* harmony import */ var antd_es_select__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! antd/es/select */ 34041);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js */ 74704);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_8__);
|
|
/* harmony import */ var antd_es_spin_style__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! antd/es/spin/style */ 22536);
|
|
/* harmony import */ var antd_es_spin__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! antd/es/spin */ 11382);
|
|
/* harmony import */ var antd_es_button_style__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! antd/es/button/style */ 29913);
|
|
/* harmony import */ var antd_es_button__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! antd/es/button */ 71577);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/toConsumableArray.js */ 861);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_11__);
|
|
/* harmony import */ var antd_es_message_style__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! antd/es/message/style */ 14934);
|
|
/* harmony import */ var antd_es_message__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! antd/es/message */ 12461);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js */ 17061);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13__);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/asyncToGenerator.js */ 17156);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_14__);
|
|
/* harmony import */ var antd_es_form_style__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! antd/es/form/style */ 75627);
|
|
/* harmony import */ var antd_es_form__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! antd/es/form */ 51018);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/slicedToArray.js */ 27424);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_16__);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/objectSpread2.js */ 42122);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17__);
|
|
/* harmony import */ var antd_es_collapse_style__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! antd/es/collapse/style */ 49263);
|
|
/* harmony import */ var antd_es_collapse__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! antd/es/collapse */ 54907);
|
|
/* harmony import */ var antd_es_modal_style__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! antd/es/modal/style */ 35611);
|
|
/* harmony import */ var antd_es_modal__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! antd/es/modal */ 85402);
|
|
/* harmony import */ var antd_es_input_style__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! antd/es/input/style */ 69463);
|
|
/* harmony import */ var antd_es_input__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! antd/es/input */ 75008);
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! react */ 67294);
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./index.less?modules */ 77969);
|
|
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./util */ 52238);
|
|
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! umi */ 89214);
|
|
/* harmony import */ var js_base64__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! js-base64 */ 19575);
|
|
/* harmony import */ var js_base64__WEBPACK_IMPORTED_MODULE_25___default = /*#__PURE__*/__webpack_require__.n(js_base64__WEBPACK_IMPORTED_MODULE_25__);
|
|
/* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! @ant-design/icons */ 81088);
|
|
/* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(/*! @ant-design/icons */ 31662);
|
|
/* harmony import */ var _components_markdown_editor__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! @/components/markdown-editor */ 55373);
|
|
/* harmony import */ var _service__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./service */ 38005);
|
|
/* harmony import */ var _service_exercise__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! @/service/exercise */ 51412);
|
|
/* harmony import */ var _components_SplitContainer__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! @/components/SplitContainer */ 76695);
|
|
/* harmony import */ var _CodePanel__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./CodePanel */ 20654);
|
|
/* harmony import */ var _CodeProgramPanel__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./CodeProgramPanel */ 46533);
|
|
/* harmony import */ var _utils_fetch__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! @/utils/fetch */ 84519);
|
|
/* harmony import */ var _utils_util__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! @/utils/util */ 29427);
|
|
/* harmony import */ var _utils_env__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! @/utils/env */ 59758);
|
|
/* harmony import */ var _components_Knowledge__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! @/components/Knowledge */ 73221);
|
|
/* harmony import */ var _components_CustomTree__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! @/components/CustomTree */ 62752);
|
|
/* harmony import */ var _pages_Shixuns_Edit_body_Level_Challenges_components_UploadFile__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! @/pages/Shixuns/Edit/body/Level/Challenges/components/UploadFile */ 29201);
|
|
/* harmony import */ var _service_paperlibrary__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! @/service/paperlibrary */ 24410);
|
|
/* harmony import */ var _utils_enum__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! @/utils/enum */ 70960);
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! react/jsx-runtime */ 85893);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//@ts-ignore
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TextArea = antd_es_input__WEBPACK_IMPORTED_MODULE_41__/* ["default"].TextArea */ .Z.TextArea;
|
|
var confirm = antd_es_modal__WEBPACK_IMPORTED_MODULE_42__/* ["default"].confirm */ .Z.confirm;
|
|
var Panel = antd_es_collapse__WEBPACK_IMPORTED_MODULE_43__/* ["default"].Panel */ .Z.Panel;
|
|
function getTimeStamp() {
|
|
return new Date().getTime();
|
|
}
|
|
var initialState = {
|
|
loading: true,
|
|
user: null,
|
|
disciplines: [],
|
|
dicts: null,
|
|
status: 0,
|
|
data: undefined,
|
|
lastedUpdateTime: 0
|
|
};
|
|
var Types;
|
|
(function (Types) {
|
|
Types[Types["SET_INITAL_DATA"] = 0] = "SET_INITAL_DATA";
|
|
Types[Types["SET_LOADING"] = 1] = "SET_LOADING";
|
|
Types[Types["SET_STATUS"] = 2] = "SET_STATUS";
|
|
})(Types || (Types = {}));
|
|
function reducer(state, action) {
|
|
switch (action.type) {
|
|
case Types.SET_INITAL_DATA:
|
|
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, state), action.payload);
|
|
case Types.SET_LOADING:
|
|
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, state), {}, {
|
|
loading: action.payload
|
|
});
|
|
case Types.SET_STATUS:
|
|
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, state), {}, {
|
|
status: action.payload
|
|
});
|
|
default:
|
|
throw new Error();
|
|
}
|
|
}
|
|
|
|
//problems/new?difficult=3&sub_discipline_id=95&tag_discipline_id=105&newoj=1&pages=1
|
|
///problems/p2mblri6/edit
|
|
//* 从课堂试卷编辑入口进来 http://localhost:8000/problems/i4b5wuhn/edit?type=exercises&express_id=2510&callback_url=/classrooms/1309/exercise/2510/edit
|
|
/* harmony default export */ __webpack_exports__["default"] = (function () {
|
|
var _data$hack, _data$hack4;
|
|
var _useSearchParams = (0,umi__WEBPACK_IMPORTED_MODULE_24__.useSearchParams)(),
|
|
_useSearchParams2 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_16___default()(_useSearchParams, 1),
|
|
searchParams = _useSearchParams2[0];
|
|
var location = (0,umi__WEBPACK_IMPORTED_MODULE_24__.useLocation)();
|
|
var _useParams = (0,umi__WEBPACK_IMPORTED_MODULE_24__.useParams)(),
|
|
id = _useParams.id;
|
|
var _Form$useForm = antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].useForm */ .Z.useForm(),
|
|
_Form$useForm2 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_16___default()(_Form$useForm, 1),
|
|
form = _Form$useForm2[0];
|
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_21__.useState)(),
|
|
_useState2 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_16___default()(_useState, 2),
|
|
formValue = _useState2[0],
|
|
setFormValue = _useState2[1];
|
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_21__.useState)([]),
|
|
_useState4 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_16___default()(_useState3, 2),
|
|
knowledgeOptions = _useState4[0],
|
|
setKnowledgeOptions = _useState4[1];
|
|
var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_21__.useState)([]),
|
|
_useState6 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_16___default()(_useState5, 2),
|
|
uploadData = _useState6[0],
|
|
setUploadData = _useState6[1];
|
|
var _useReducer = (0,react__WEBPACK_IMPORTED_MODULE_21__.useReducer)(reducer, initialState),
|
|
_useReducer2 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_16___default()(_useReducer, 2),
|
|
state = _useReducer2[0],
|
|
dispatch = _useReducer2[1];
|
|
var loading = state.loading,
|
|
data = state.data,
|
|
user = state.user,
|
|
disciplines = state.disciplines,
|
|
dicts = state.dicts,
|
|
status = state.status;
|
|
var hack_sets = data === null || data === void 0 ? void 0 : data.hack_sets;
|
|
var test_set_average = data === null || data === void 0 ? void 0 : (_data$hack = data.hack) === null || _data$hack === void 0 ? void 0 : _data$hack.test_set_average;
|
|
var _getJsonFromUrl = (0,_utils_util__WEBPACK_IMPORTED_MODULE_33__/* .getJsonFromUrl */ .oP)(),
|
|
callback_url = _getJsonFromUrl.callback_url,
|
|
express_id = _getJsonFromUrl.express_id,
|
|
score = _getJsonFromUrl.score,
|
|
question_id = _getJsonFromUrl.question_id,
|
|
type = _getJsonFromUrl.type;
|
|
var _useState7 = (0,react__WEBPACK_IMPORTED_MODULE_21__.useState)([]),
|
|
_useState8 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_16___default()(_useState7, 2),
|
|
MyGroup = _useState8[0],
|
|
setMyGroup = _useState8[1];
|
|
var _useState9 = (0,react__WEBPACK_IMPORTED_MODULE_21__.useState)(false),
|
|
_useState10 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_16___default()(_useState9, 2),
|
|
ischecked = _useState10[0],
|
|
setischecked = _useState10[1];
|
|
var _useState11 = (0,react__WEBPACK_IMPORTED_MODULE_21__.useState)(false),
|
|
_useState12 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_16___default()(_useState11, 2),
|
|
isshows = _useState12[0],
|
|
setisshows = _useState12[1];
|
|
var isProgram = type === '1';
|
|
var categorys = (0,react__WEBPACK_IMPORTED_MODULE_21__.useMemo)(function () {
|
|
var rs = [];
|
|
if (disciplines) {
|
|
(0,_util__WEBPACK_IMPORTED_MODULE_23__/* .getDisciplineOptions */ .D0)(disciplines, rs);
|
|
}
|
|
return rs;
|
|
}, [disciplines]);
|
|
var initData = (0,react__WEBPACK_IMPORTED_MODULE_21__.useCallback)( /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_14___default()( /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13___default()().mark(function _callee() {
|
|
var timeStamp,
|
|
discips,
|
|
response,
|
|
rs,
|
|
res,
|
|
category,
|
|
_user,
|
|
code,
|
|
language,
|
|
_hack_sets,
|
|
description,
|
|
difficult,
|
|
name,
|
|
open_or_not,
|
|
sub_discipline_id,
|
|
tag_discipline_id,
|
|
time_limit,
|
|
_test_set_average,
|
|
test_set_score,
|
|
_status,
|
|
tag_discipline_ids,
|
|
item_banks_group_id,
|
|
_res$is_file,
|
|
is_file,
|
|
hide_actual_output,
|
|
code_compile_score,
|
|
languages,
|
|
is_my,
|
|
codes,
|
|
_getDisciplineIds,
|
|
_getDisciplineIds2,
|
|
ids,
|
|
dictData,
|
|
new_hack_sets,
|
|
_getJsonFromUrl2,
|
|
lastedUpdateTime,
|
|
newCodes,
|
|
_tagIds$split,
|
|
_tagIds$split2,
|
|
_yield$getUser,
|
|
_user2,
|
|
_getJsonFromUrl3,
|
|
_difficult,
|
|
_sub_discipline_id,
|
|
_tag_discipline_id,
|
|
tagIds,
|
|
banksIds,
|
|
_getDisciplineIds3,
|
|
_getDisciplineIds4,
|
|
_ids,
|
|
_dictData,
|
|
bankstime,
|
|
_args = arguments;
|
|
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13___default()().wrap(function _callee$(_context) {
|
|
while (1) switch (_context.prev = _context.next) {
|
|
case 0:
|
|
timeStamp = _args.length > 0 && _args[0] !== undefined ? _args[0] : 0;
|
|
discips = disciplines;
|
|
if (!(discips.length === 0)) {
|
|
_context.next = 7;
|
|
break;
|
|
}
|
|
_context.next = 5;
|
|
return (0,_service__WEBPACK_IMPORTED_MODULE_27__/* .getDisciplines */ .d1)('new_question');
|
|
case 5:
|
|
response = _context.sent;
|
|
discips = response.disciplines;
|
|
case 7:
|
|
if (!id) {
|
|
_context.next = 15;
|
|
break;
|
|
}
|
|
rs = {
|
|
disciplines: discips
|
|
};
|
|
_context.next = 11;
|
|
return (0,_service__WEBPACK_IMPORTED_MODULE_27__/* .getProgrammingTopic */ .fu)(id);
|
|
case 11:
|
|
res = _context.sent;
|
|
if (res.message) {
|
|
if (res.status === '401') {
|
|
// history.push('/user/login')
|
|
document.location.href = '/user/login';
|
|
}
|
|
} else {
|
|
// console.log(res.hack_sets, 'response1')
|
|
category = res.category, _user = res.user, code = res.code, language = res.language, _hack_sets = res.hack_sets, description = res.description, difficult = res.difficult, name = res.name, open_or_not = res.open_or_not, sub_discipline_id = res.sub_discipline_id, tag_discipline_id = res.tag_discipline_id, time_limit = res.time_limit, _test_set_average = res.test_set_average, test_set_score = res.test_set_score, _status = res.status, tag_discipline_ids = res.tag_discipline_ids, item_banks_group_id = res.item_banks_group_id, _res$is_file = res.is_file, is_file = _res$is_file === void 0 ? false : _res$is_file, hide_actual_output = res.hide_actual_output, code_compile_score = res.code_compile_score, languages = res.languages, is_my = res.is_my, codes = res.codes; //
|
|
_getDisciplineIds = (0,_util__WEBPACK_IMPORTED_MODULE_23__/* .getDisciplineIds */ .y3)(discips, sub_discipline_id), _getDisciplineIds2 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_16___default()(_getDisciplineIds, 2), ids = _getDisciplineIds2[0], dictData = _getDisciplineIds2[1];
|
|
setischecked(hide_actual_output);
|
|
// console.log('----',hack_sets);
|
|
new_hack_sets = is_file ? [{
|
|
input: '',
|
|
output: '',
|
|
score: 100,
|
|
position: 1
|
|
}] : _hack_sets;
|
|
if (is_file) {
|
|
setUploadData(_hack_sets);
|
|
form.setFieldsValue({
|
|
'hack_sets': new_hack_sets
|
|
});
|
|
} else {
|
|
setUploadData([]);
|
|
}
|
|
|
|
//@ts-ignore
|
|
_getJsonFromUrl2 = (0,_utils_util__WEBPACK_IMPORTED_MODULE_33__/* .getJsonFromUrl */ .oP)(), lastedUpdateTime = _getJsonFromUrl2.lastedUpdateTime;
|
|
newCodes = codes === null || codes === void 0 ? void 0 : codes.map(function (e) {
|
|
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, e), {}, {
|
|
code: js_base64__WEBPACK_IMPORTED_MODULE_25__.Base64.decode(e === null || e === void 0 ? void 0 : e.code)
|
|
});
|
|
});
|
|
rs = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, rs), {}, {
|
|
loading: false,
|
|
user: _user,
|
|
dicts: dictData,
|
|
status: _status,
|
|
lastedUpdateTime: timeStamp ? timeStamp : lastedUpdateTime ? lastedUpdateTime : 0,
|
|
data: {
|
|
hack_codes: {
|
|
language: language,
|
|
code: js_base64__WEBPACK_IMPORTED_MODULE_25__.Base64.decode(code)
|
|
},
|
|
hack: {
|
|
category: category,
|
|
difficult: difficult,
|
|
name: name,
|
|
description: description,
|
|
open_or_not: open_or_not,
|
|
time_limit: time_limit,
|
|
test_set_average: _test_set_average,
|
|
test_set_score: test_set_score,
|
|
sub_discipline_id: ids,
|
|
tag_discipline_ids: tag_discipline_ids,
|
|
languages: languages,
|
|
score: score || 1,
|
|
item_banks_group_ids: item_banks_group_id,
|
|
is_file: is_file,
|
|
is_my: is_my,
|
|
code_compile_score: code_compile_score
|
|
},
|
|
hack_sets: new_hack_sets,
|
|
tags: tag_discipline_ids,
|
|
codes: newCodes
|
|
}
|
|
});
|
|
if (parseInt(code_compile_score) > 0) {
|
|
setisshows(true);
|
|
}
|
|
dispatch({
|
|
type: Types.SET_INITAL_DATA,
|
|
payload: rs
|
|
});
|
|
setFormValue({
|
|
hack: {
|
|
category: category,
|
|
difficult: difficult,
|
|
name: name,
|
|
description: description,
|
|
open_or_not: open_or_not,
|
|
time_limit: time_limit,
|
|
test_set_average: _test_set_average,
|
|
test_set_score: test_set_score,
|
|
sub_discipline_id: ids,
|
|
tag_discipline_ids: tag_discipline_ids,
|
|
score: score || 1,
|
|
item_banks_group_ids: item_banks_group_id,
|
|
is_file: is_file
|
|
},
|
|
codes: newCodes
|
|
});
|
|
handleSetKnowledge(ids === null || ids === void 0 ? void 0 : ids[0], ids === null || ids === void 0 ? void 0 : ids[1], discips);
|
|
}
|
|
_context.next = 25;
|
|
break;
|
|
case 15:
|
|
_context.next = 17;
|
|
return (0,_service__WEBPACK_IMPORTED_MODULE_27__/* .getUser */ .PR)();
|
|
case 17:
|
|
_yield$getUser = _context.sent;
|
|
_user2 = _yield$getUser.user;
|
|
//@ts-ignore
|
|
_getJsonFromUrl3 = (0,_utils_util__WEBPACK_IMPORTED_MODULE_33__/* .getJsonFromUrl */ .oP)(), _difficult = _getJsonFromUrl3.difficult, _sub_discipline_id = _getJsonFromUrl3.sub_discipline_id, _tag_discipline_id = _getJsonFromUrl3.tag_discipline_id, tagIds = _getJsonFromUrl3.tagIds, banksIds = _getJsonFromUrl3.banksIds;
|
|
_getDisciplineIds3 = (0,_util__WEBPACK_IMPORTED_MODULE_23__/* .getDisciplineIds */ .y3)(discips, parseInt(_sub_discipline_id, 10)), _getDisciplineIds4 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_16___default()(_getDisciplineIds3, 2), _ids = _getDisciplineIds4[0], _dictData = _getDisciplineIds4[1];
|
|
bankstime = [Number(banksIds)];
|
|
dispatch({
|
|
type: Types.SET_INITAL_DATA,
|
|
payload: {
|
|
loading: false,
|
|
user: _user2,
|
|
disciplines: discips,
|
|
status: 0,
|
|
dicts: _dictData,
|
|
data: {
|
|
hack_codes: {
|
|
language: 'C',
|
|
code: ''
|
|
},
|
|
hack: {
|
|
category: null,
|
|
difficult: parseInt(_difficult, 10),
|
|
time_limit: 3,
|
|
description: '',
|
|
test_set_score: true,
|
|
test_set_average: true,
|
|
open_or_not: true,
|
|
sub_discipline_id: _ids,
|
|
tag_discipline_id: tagIds && (tagIds === null || tagIds === void 0 ? void 0 : (_tagIds$split = tagIds.split(',')) === null || _tagIds$split === void 0 ? void 0 : _tagIds$split.map(function (x) {
|
|
return Number(x);
|
|
})),
|
|
name: '',
|
|
item_banks_group_ids: bankstime,
|
|
is_file: false
|
|
},
|
|
tags: _tag_discipline_id ? _tag_discipline_id === null || _tag_discipline_id === void 0 ? void 0 : _tag_discipline_id.split(',').map(function (t) {
|
|
return parseInt(t, 10);
|
|
}) : [],
|
|
hack_sets: [{
|
|
input: '',
|
|
output: '',
|
|
score: 100,
|
|
position: 1
|
|
}]
|
|
}
|
|
}
|
|
});
|
|
setFormValue({
|
|
hack: {
|
|
category: null,
|
|
difficult: parseInt(_difficult, 10),
|
|
time_limit: 3,
|
|
description: '',
|
|
test_set_average: true,
|
|
open_or_not: true,
|
|
sub_discipline_id: _ids,
|
|
tag_discipline_id: tagIds && (tagIds === null || tagIds === void 0 ? void 0 : (_tagIds$split2 = tagIds.split(',')) === null || _tagIds$split2 === void 0 ? void 0 : _tagIds$split2.map(function (x) {
|
|
return Number(x);
|
|
})),
|
|
name: '',
|
|
item_banks_group_id: bankstime,
|
|
is_file: false
|
|
}
|
|
});
|
|
handleSetKnowledge(_ids === null || _ids === void 0 ? void 0 : _ids[0], _ids === null || _ids === void 0 ? void 0 : _ids[1], discips);
|
|
case 25:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
})), [id, disciplines]);
|
|
(0,react__WEBPACK_IMPORTED_MODULE_21__.useEffect)(function () {
|
|
try {
|
|
initData();
|
|
} catch (error) {
|
|
console.log(error, '----');
|
|
// history.replace('/user/login', { from: location.pathname })
|
|
}
|
|
}, []);
|
|
(0,react__WEBPACK_IMPORTED_MODULE_21__.useEffect)(function () {
|
|
//获取我的分组信息
|
|
function init() {
|
|
return _init.apply(this, arguments);
|
|
}
|
|
function _init() {
|
|
_init = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_14___default()( /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13___default()().mark(function _callee2() {
|
|
var data;
|
|
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13___default()().wrap(function _callee2$(_context2) {
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
case 0:
|
|
_context2.next = 2;
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_32__/* .get */ .U2)('item_banks_groups/mine.json');
|
|
case 2:
|
|
data = _context2.sent;
|
|
setMyGroup(data);
|
|
case 4:
|
|
case "end":
|
|
return _context2.stop();
|
|
}
|
|
}, _callee2);
|
|
}));
|
|
return _init.apply(this, arguments);
|
|
}
|
|
init();
|
|
}, []);
|
|
var handleSetKnowledge = function handleSetKnowledge(id, subId, discips) {
|
|
var _discips$find, _discips$find$sub_dis, _discips$find$sub_dis2;
|
|
var options = discips === null || discips === void 0 ? void 0 : (_discips$find = discips.find(function (item) {
|
|
return item.id === id;
|
|
})) === null || _discips$find === void 0 ? void 0 : (_discips$find$sub_dis = _discips$find.sub_disciplines) === null || _discips$find$sub_dis === void 0 ? void 0 : (_discips$find$sub_dis2 = _discips$find$sub_dis.find(function (subItem) {
|
|
return subItem.id === subId;
|
|
})) === null || _discips$find$sub_dis2 === void 0 ? void 0 : _discips$find$sub_dis2.tag_disciplines;
|
|
|
|
// setKnowledgeOptions(options || []);
|
|
};
|
|
function onSubmit(_x, _x2, _x3) {
|
|
return _onSubmit.apply(this, arguments);
|
|
}
|
|
function _onSubmit() {
|
|
_onSubmit = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_14___default()( /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13___default()().mark(function _callee5(values, type, is_cover) {
|
|
var _values, hack_sets, hack_codes, hack, tags, codes, update_hack_sets, new_hack_sets, sumScore, new_list, _iterator, _step, item, newCodes, res, _yield$updateExercise, _status2, _yield$addProgramming, identifier, exam_identifier, _res, _yield$addExerciseQue, _status3;
|
|
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13___default()().wrap(function _callee5$(_context5) {
|
|
while (1) switch (_context5.prev = _context5.next) {
|
|
case 0:
|
|
_values = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, values), hack_sets = _values.hack_sets, hack_codes = _values.hack_codes, hack = _values.hack, tags = _values.tags, codes = _values.codes;
|
|
hack.hide_actual_output = ischecked;
|
|
update_hack_sets = [];
|
|
new_hack_sets = [];
|
|
sumScore = 0;
|
|
new_list = hack !== null && hack !== void 0 && hack.is_file ? uploadData.map(function (e, i) {
|
|
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, e), {}, {
|
|
position: i + 1
|
|
});
|
|
}) : hack_sets.map(function (e) {
|
|
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, e), {}, {
|
|
is_file: false
|
|
});
|
|
});
|
|
_iterator = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_8___default()(new_list);
|
|
try {
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
item = _step.value;
|
|
sumScore += item.score;
|
|
if (item.id && item.id >= 0) {
|
|
update_hack_sets.push(item);
|
|
} else {
|
|
new_hack_sets.push(item);
|
|
}
|
|
}
|
|
} catch (err) {
|
|
_iterator.e(err);
|
|
} finally {
|
|
_iterator.f();
|
|
}
|
|
if (new_list !== null && new_list !== void 0 && new_list.length) {
|
|
_context5.next = 11;
|
|
break;
|
|
}
|
|
antd_es_message__WEBPACK_IMPORTED_MODULE_45__/* ["default"].error */ .ZP.error('测试集不能为空');
|
|
return _context5.abrupt("return");
|
|
case 11:
|
|
sumScore += parseInt(hack.code_compile_score || 0);
|
|
if (!(sumScore !== 100 && !hack.test_set_score)) {
|
|
_context5.next = 15;
|
|
break;
|
|
}
|
|
antd_es_message__WEBPACK_IMPORTED_MODULE_45__/* ["default"].error */ .ZP.error('测试集的评分占比之和必须等于100');
|
|
return _context5.abrupt("return");
|
|
case 15:
|
|
if (!(new_list !== null && new_list !== void 0 && new_list.some(function (e) {
|
|
return !e.output;
|
|
}))) {
|
|
_context5.next = 18;
|
|
break;
|
|
}
|
|
antd_es_message__WEBPACK_IMPORTED_MODULE_45__/* ["default"].error */ .ZP.error('测试集输出不能为空');
|
|
return _context5.abrupt("return");
|
|
case 18:
|
|
newCodes = {};
|
|
if (isProgram) {
|
|
codes === null || codes === void 0 ? void 0 : codes.forEach(function (e) {
|
|
newCodes[e.language] = e !== null && e !== void 0 && e.code ? js_base64__WEBPACK_IMPORTED_MODULE_25__.Base64.encode(e === null || e === void 0 ? void 0 : e.code) : '';
|
|
});
|
|
} else {
|
|
hack_codes.code = js_base64__WEBPACK_IMPORTED_MODULE_25__.Base64.encode(hack_codes === null || hack_codes === void 0 ? void 0 : hack_codes.code);
|
|
}
|
|
hack.sub_discipline_id = hack.sub_discipline_id[1];
|
|
dispatch({
|
|
type: Types.SET_LOADING,
|
|
payload: true
|
|
});
|
|
if (!callback_url) {
|
|
hack.score = hack.difficult * 100;
|
|
}
|
|
//编辑
|
|
if (!id) {
|
|
_context5.next = 50;
|
|
break;
|
|
}
|
|
_context5.next = 26;
|
|
return (0,_service__WEBPACK_IMPORTED_MODULE_27__/* .updateProgrammingTopic */ .l_)(id, {
|
|
hack: hack,
|
|
hack_codes: hack_codes,
|
|
hack_sets: new_hack_sets,
|
|
update_hack_sets: update_hack_sets,
|
|
tags: tags,
|
|
is_cover: is_cover,
|
|
languages: hack.languages,
|
|
codes: newCodes
|
|
});
|
|
case 26:
|
|
if (!callback_url) {
|
|
_context5.next = 45;
|
|
break;
|
|
}
|
|
_context5.next = 29;
|
|
return (0,_service__WEBPACK_IMPORTED_MODULE_27__/* .publishProgrammingTopic */ .j2)(id);
|
|
case 29:
|
|
if (!callback_url.includes('paperlibrary')) {
|
|
_context5.next = 35;
|
|
break;
|
|
}
|
|
_context5.next = 32;
|
|
return (0,_service_paperlibrary__WEBPACK_IMPORTED_MODULE_38__/* .createOrModifyQuestion */ .oF)({
|
|
id: express_id,
|
|
question_id: question_id,
|
|
item_type: _utils_enum__WEBPACK_IMPORTED_MODULE_39__/* .QuestionType.Program */ .c.Program,
|
|
name: hack.name,
|
|
question_score: hack.score,
|
|
difficulty: hack.difficult,
|
|
sub_discipline_id: hack.sub_discipline_id,
|
|
tag_discipline_ids: hack.tag_discipline_ids,
|
|
item_banks_group_ids: hack.item_banks_group_ids
|
|
// identifier: id
|
|
});
|
|
case 32:
|
|
res = _context5.sent;
|
|
if (res.status === 0) {
|
|
umi__WEBPACK_IMPORTED_MODULE_24__.history.replace(callback_url);
|
|
}
|
|
return _context5.abrupt("return");
|
|
case 35:
|
|
_context5.next = 37;
|
|
return (0,_service__WEBPACK_IMPORTED_MODULE_27__/* .updateExerciseQuestion */ .GM)(question_id, {
|
|
question_type: 6,
|
|
question_score: hack.score,
|
|
question_title: hack.name,
|
|
description: hack.description,
|
|
sub_discipline_id: hack.sub_discipline_id,
|
|
tag_discipline_ids: hack.tag_discipline_ids,
|
|
item_banks_group_ids: hack.item_banks_group_ids,
|
|
identifier: id
|
|
});
|
|
case 37:
|
|
_yield$updateExercise = _context5.sent;
|
|
_status2 = _yield$updateExercise.status;
|
|
if (!(_status2 === 0)) {
|
|
_context5.next = 43;
|
|
break;
|
|
}
|
|
if (!(type === 'start')) {
|
|
_context5.next = 42;
|
|
break;
|
|
}
|
|
return _context5.abrupt("return");
|
|
case 42:
|
|
umi__WEBPACK_IMPORTED_MODULE_24__.history.replace(callback_url);
|
|
case 43:
|
|
_context5.next = 47;
|
|
break;
|
|
case 45:
|
|
// window.location.reload()
|
|
antd_es_message__WEBPACK_IMPORTED_MODULE_45__/* ["default"].success */ .ZP.success('保存成功');
|
|
initData(getTimeStamp());
|
|
case 47:
|
|
dispatch({
|
|
type: Types.SET_LOADING,
|
|
payload: false
|
|
});
|
|
_context5.next = 80;
|
|
break;
|
|
case 50:
|
|
_context5.next = 52;
|
|
return (0,_service__WEBPACK_IMPORTED_MODULE_27__/* .addProgrammingTopic */ .zQ)({
|
|
hack: hack,
|
|
hack_codes: hack_codes,
|
|
hack_sets: new_list,
|
|
tags: tags,
|
|
examination_bank_id: express_id || null
|
|
});
|
|
case 52:
|
|
_yield$addProgramming = _context5.sent;
|
|
identifier = _yield$addProgramming.identifier;
|
|
exam_identifier = _yield$addProgramming.exam_identifier;
|
|
dispatch({
|
|
type: Types.SET_LOADING,
|
|
payload: false
|
|
});
|
|
if (!(type === 'start')) {
|
|
_context5.next = 58;
|
|
break;
|
|
}
|
|
return _context5.abrupt("return");
|
|
case 58:
|
|
if (!identifier) {
|
|
_context5.next = 80;
|
|
break;
|
|
}
|
|
if (callback_url) {
|
|
_context5.next = 63;
|
|
break;
|
|
}
|
|
umi__WEBPACK_IMPORTED_MODULE_24__.history.replace("/problems/".concat(identifier, "/edit?lastedUpdateTime=").concat(getTimeStamp()));
|
|
_context5.next = 80;
|
|
break;
|
|
case 63:
|
|
_context5.next = 65;
|
|
return (0,_service__WEBPACK_IMPORTED_MODULE_27__/* .publishProgrammingTopic */ .j2)(identifier);
|
|
case 65:
|
|
if (id) {
|
|
_context5.next = 79;
|
|
break;
|
|
}
|
|
if (!callback_url.includes('paperlibrary')) {
|
|
_context5.next = 72;
|
|
break;
|
|
}
|
|
_context5.next = 69;
|
|
return (0,_service_paperlibrary__WEBPACK_IMPORTED_MODULE_38__/* .createOrModifyQuestion */ .oF)({
|
|
id: express_id,
|
|
item_type: _utils_enum__WEBPACK_IMPORTED_MODULE_39__/* .QuestionType.Program */ .c.Program,
|
|
name: hack.name,
|
|
question_score: hack.score,
|
|
difficulty: hack.difficult,
|
|
sub_discipline_id: hack.sub_discipline_id,
|
|
tag_discipline_ids: hack.tag_discipline_ids,
|
|
identifier: exam_identifier
|
|
});
|
|
case 69:
|
|
_res = _context5.sent;
|
|
if (_res.status === 0) {
|
|
umi__WEBPACK_IMPORTED_MODULE_24__.history.replace(callback_url);
|
|
}
|
|
return _context5.abrupt("return");
|
|
case 72:
|
|
_context5.next = 74;
|
|
return (0,_service__WEBPACK_IMPORTED_MODULE_27__/* .addExerciseQuestion */ .MK)(parseInt(express_id, 10), {
|
|
question_type: 6,
|
|
question_score: hack.score,
|
|
question_title: hack.name,
|
|
identifier: identifier,
|
|
tag_discipline_ids: hack.tag_discipline_ids
|
|
});
|
|
case 74:
|
|
_yield$addExerciseQue = _context5.sent;
|
|
_status3 = _yield$addExerciseQue.status;
|
|
if (_status3 === 0) {
|
|
umi__WEBPACK_IMPORTED_MODULE_24__.history.replace(callback_url);
|
|
}
|
|
_context5.next = 80;
|
|
break;
|
|
case 79:
|
|
umi__WEBPACK_IMPORTED_MODULE_24__.history.replace(callback_url);
|
|
case 80:
|
|
case "end":
|
|
return _context5.stop();
|
|
}
|
|
}, _callee5);
|
|
}));
|
|
return _onSubmit.apply(this, arguments);
|
|
}
|
|
function onPublish() {
|
|
form.submit();
|
|
setTimeout( /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_14___default()( /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13___default()().mark(function _callee3() {
|
|
var response;
|
|
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13___default()().wrap(function _callee3$(_context3) {
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
case 0:
|
|
_context3.next = 2;
|
|
return (0,_service__WEBPACK_IMPORTED_MODULE_27__/* .publishProgrammingTopic */ .j2)(id);
|
|
case 2:
|
|
response = _context3.sent;
|
|
if (response.status === 0) {
|
|
antd_es_message__WEBPACK_IMPORTED_MODULE_45__/* ["default"].success */ .ZP.success('发布成功');
|
|
dispatch({
|
|
type: Types.SET_STATUS,
|
|
payload: 1
|
|
});
|
|
} else {
|
|
antd_es_message__WEBPACK_IMPORTED_MODULE_45__/* ["default"].info */ .ZP.info(response.message);
|
|
}
|
|
case 4:
|
|
case "end":
|
|
return _context3.stop();
|
|
}
|
|
}, _callee3);
|
|
})), 400);
|
|
}
|
|
function onCancelPublish() {
|
|
return _onCancelPublish.apply(this, arguments);
|
|
}
|
|
function _onCancelPublish() {
|
|
_onCancelPublish = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_14___default()( /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13___default()().mark(function _callee6() {
|
|
var response;
|
|
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13___default()().wrap(function _callee6$(_context6) {
|
|
while (1) switch (_context6.prev = _context6.next) {
|
|
case 0:
|
|
_context6.next = 2;
|
|
return (0,_service__WEBPACK_IMPORTED_MODULE_27__/* .cancelPublishProgrammingTopic */ .ZS)(id);
|
|
case 2:
|
|
response = _context6.sent;
|
|
if (response.status === 0) {
|
|
antd_es_message__WEBPACK_IMPORTED_MODULE_45__/* ["default"].success */ .ZP.success('撤销发布成功');
|
|
dispatch({
|
|
type: Types.SET_STATUS,
|
|
payload: 0
|
|
});
|
|
} else {
|
|
antd_es_message__WEBPACK_IMPORTED_MODULE_45__/* ["default"].info */ .ZP.info(response.message);
|
|
}
|
|
case 4:
|
|
case "end":
|
|
return _context6.stop();
|
|
}
|
|
}, _callee6);
|
|
}));
|
|
return _onCancelPublish.apply(this, arguments);
|
|
}
|
|
function onTriggerPublish() {
|
|
//立即发布
|
|
if (status === 0) {
|
|
confirm({
|
|
title: '提示',
|
|
content: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)(react__WEBPACK_IMPORTED_MODULE_21__.Fragment, {
|
|
children: [" ", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)("div", {
|
|
children: "\u53D1\u5E03\u540E\u5373\u53EF\u5E94\u7528\u5230\u81EA\u5DF1\u7BA1\u7406\u7684\u8BFE\u5802"
|
|
}), " ", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)("div", {
|
|
children: " \u662F\u5426\u786E\u8BA4\u53D1\u5E03?"
|
|
}), " "]
|
|
}),
|
|
okText: '确定',
|
|
cancelText: '取消',
|
|
onOk: function onOk() {
|
|
onPublish();
|
|
}
|
|
});
|
|
} else {
|
|
confirm({
|
|
title: '提示',
|
|
content: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)("p", {
|
|
children: "\u662F\u5426\u786E\u8BA4\u64A4\u9500\u53D1\u5E03\uFF1F"
|
|
}),
|
|
okText: '确定',
|
|
cancelText: '取消',
|
|
onOk: function onOk() {
|
|
onCancelPublish();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
function onChallenge() {
|
|
return _onChallenge.apply(this, arguments);
|
|
}
|
|
function _onChallenge() {
|
|
_onChallenge = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_14___default()( /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13___default()().mark(function _callee8() {
|
|
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13___default()().wrap(function _callee8$(_context8) {
|
|
while (1) switch (_context8.prev = _context8.next) {
|
|
case 0:
|
|
_context8.t0 = onSubmit;
|
|
_context8.next = 3;
|
|
return form.getFieldValue();
|
|
case 3:
|
|
_context8.t1 = _context8.sent;
|
|
(0, _context8.t0)(_context8.t1, 'start');
|
|
setTimeout( /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_14___default()( /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13___default()().mark(function _callee7() {
|
|
var _yield$startChallenge, identifier;
|
|
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13___default()().wrap(function _callee7$(_context7) {
|
|
while (1) switch (_context7.prev = _context7.next) {
|
|
case 0:
|
|
_context7.next = 2;
|
|
return (0,_service__WEBPACK_IMPORTED_MODULE_27__/* .startChallenge */ .uE)(id);
|
|
case 2:
|
|
_yield$startChallenge = _context7.sent;
|
|
identifier = _yield$startChallenge.identifier;
|
|
if (isProgram) {
|
|
window.location.href = "/myproblems/".concat(identifier, "?type=1");
|
|
} else {
|
|
window.location.href = "/myproblems/".concat(identifier);
|
|
}
|
|
case 5:
|
|
case "end":
|
|
return _context7.stop();
|
|
}
|
|
}, _callee7);
|
|
})), 400);
|
|
case 6:
|
|
case "end":
|
|
return _context8.stop();
|
|
}
|
|
}, _callee8);
|
|
}));
|
|
return _onChallenge.apply(this, arguments);
|
|
}
|
|
function onBack() {
|
|
if (callback_url) {
|
|
umi__WEBPACK_IMPORTED_MODULE_24__.history.replace(callback_url);
|
|
} else {
|
|
if (isProgram) {
|
|
var _localStorage$getItem;
|
|
var item = (_localStorage$getItem = localStorage.getItem('program_homework')) === null || _localStorage$getItem === void 0 ? void 0 : _localStorage$getItem.split(',');
|
|
umi__WEBPACK_IMPORTED_MODULE_24__.history.push("/classrooms/".concat(item === null || item === void 0 ? void 0 : item[0], "/program_homework/").concat(item === null || item === void 0 ? void 0 : item[1], "/detail"));
|
|
} else {
|
|
umi__WEBPACK_IMPORTED_MODULE_24__.history.replace("/problemset");
|
|
}
|
|
}
|
|
}
|
|
var handleUploadRatio = function handleUploadRatio(testSetData) {
|
|
var code_compile_score = parseInt(form.getFieldValue('hack').code_compile_score) || 0;
|
|
var score = Math.floor((100 - code_compile_score) / testSetData.length);
|
|
var lastScore = score + (100 - code_compile_score) % testSetData.length;
|
|
// const score = Math.floor(100 / testSetData.length)
|
|
// const lastScore = score + 100 % testSetData.length
|
|
|
|
testSetData = testSetData.map(function (item, index) {
|
|
if (index === testSetData.length - 1) {
|
|
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, item), {}, {
|
|
score: lastScore
|
|
});
|
|
}
|
|
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, item), {}, {
|
|
score: score
|
|
});
|
|
});
|
|
setUploadData(testSetData);
|
|
};
|
|
function onChangeScore(e) {
|
|
if (!e.target.value) {
|
|
handleUploadRatio(uploadData);
|
|
}
|
|
dispatch({
|
|
type: Types.SET_INITAL_DATA,
|
|
payload: {
|
|
data: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, data), {}, {
|
|
hack: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, data.hack), {}, {
|
|
test_set_score: e.target.value
|
|
})
|
|
})
|
|
}
|
|
});
|
|
}
|
|
function onChangeFile(e) {
|
|
dispatch({
|
|
type: Types.SET_INITAL_DATA,
|
|
payload: {
|
|
data: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, data), {}, {
|
|
hack: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, data.hack), {}, {
|
|
is_file: e.target.value
|
|
})
|
|
})
|
|
}
|
|
});
|
|
}
|
|
function onChangehide(e) {
|
|
setischecked(e.target.checked);
|
|
}
|
|
function onChangeAverage(e) {
|
|
var value = e.target.value;
|
|
if (value) {
|
|
handleUploadRatio(uploadData);
|
|
}
|
|
dispatch({
|
|
type: Types.SET_INITAL_DATA,
|
|
payload: {
|
|
data: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, data), {}, {
|
|
hack: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, data.hack), {}, {
|
|
test_set_average: value
|
|
})
|
|
})
|
|
}
|
|
});
|
|
}
|
|
function onAddTestCase() {
|
|
var rs = form.getFieldValue('hack_sets');
|
|
var by = parseInt(form.getFieldValue('hack').code_compile_score) || 0;
|
|
var len = rs.length + 1;
|
|
var averageMark = Math.floor((100 - by) / len);
|
|
var remainder = (100 - by) % len;
|
|
rs.map(function (item, index) {
|
|
if (test_set_average) {
|
|
item.score = averageMark;
|
|
}
|
|
item.position = index + 1;
|
|
return item;
|
|
});
|
|
rs.push({
|
|
input: '',
|
|
output: '',
|
|
position: len,
|
|
score: test_set_average ? averageMark + remainder : 0
|
|
});
|
|
form.setFieldsValue({
|
|
'hack_sets': rs
|
|
});
|
|
dispatch({
|
|
type: Types.SET_INITAL_DATA,
|
|
payload: {
|
|
data: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, data), {}, {
|
|
hack_sets: rs
|
|
})
|
|
}
|
|
});
|
|
}
|
|
function onAddTestCases() {
|
|
var rs = form.getFieldValue('hack_sets');
|
|
var by = parseInt(form.getFieldValue('hack').code_compile_score) || 0;
|
|
var len = rs.length;
|
|
var averageMark = Math.floor((100 - by) / len);
|
|
var remainder = (100 - by) % len;
|
|
rs.map(function (item, index) {
|
|
if (test_set_average) {
|
|
item.score = averageMark;
|
|
if (index === rs.length - 1) {
|
|
item.score = averageMark + remainder;
|
|
}
|
|
}
|
|
item.position = index + 1;
|
|
return item;
|
|
});
|
|
form.setFieldsValue({
|
|
'hack_sets': rs
|
|
});
|
|
dispatch({
|
|
type: Types.SET_INITAL_DATA,
|
|
payload: {
|
|
data: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, data), {}, {
|
|
hack_sets: rs
|
|
})
|
|
}
|
|
});
|
|
}
|
|
(0,react__WEBPACK_IMPORTED_MODULE_21__.useEffect)(function () {
|
|
if (test_set_average) {
|
|
var by = parseInt(form.getFieldValue('hack').code_compile_score) || 0;
|
|
var len = hack_sets === null || hack_sets === void 0 ? void 0 : hack_sets.length;
|
|
var averageMark = Math.floor((100 - by) / len);
|
|
var remainder = (100 - by) % len;
|
|
hack_sets === null || hack_sets === void 0 ? void 0 : hack_sets.map(function (item, index) {
|
|
item.score = averageMark;
|
|
item.position = index + 1;
|
|
if (index === len - 1) {
|
|
item.score = averageMark + remainder;
|
|
}
|
|
return item;
|
|
});
|
|
dispatch({
|
|
type: Types.SET_INITAL_DATA,
|
|
payload: {
|
|
data: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, data), {}, {
|
|
hack_sets: hack_sets
|
|
})
|
|
}
|
|
});
|
|
form.setFieldsValue({
|
|
'hack_sets': hack_sets
|
|
});
|
|
}
|
|
}, [test_set_average]);
|
|
function onRemoveTestCase(index) {
|
|
var sets = form.getFieldValue('hack_sets');
|
|
var by = parseInt(form.getFieldValue('hack').code_compile_score) || 0;
|
|
var len = (sets === null || sets === void 0 ? void 0 : sets.length) - 1;
|
|
var averageMark = Math.floor((100 - by) / len);
|
|
var remainder = (100 - by) % len;
|
|
sets.splice(index, 1);
|
|
sets === null || sets === void 0 ? void 0 : sets.map(function (item, index) {
|
|
if (test_set_average) {
|
|
item.score = averageMark;
|
|
if (index === len - 1) {
|
|
item.score = averageMark + remainder;
|
|
}
|
|
}
|
|
item.position = index + 1;
|
|
return item;
|
|
});
|
|
dispatch({
|
|
type: Types.SET_INITAL_DATA,
|
|
payload: {
|
|
data: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, data), {}, {
|
|
hack_sets: sets
|
|
})
|
|
}
|
|
});
|
|
form.setFieldsValue({
|
|
'hack_sets': sets
|
|
});
|
|
}
|
|
function onChangeLanguage(language) {
|
|
dispatch({
|
|
type: Types.SET_INITAL_DATA,
|
|
payload: {
|
|
data: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, data), {}, {
|
|
hack_codes: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, data.hack_codes), {}, {
|
|
language: language
|
|
})
|
|
})
|
|
}
|
|
});
|
|
}
|
|
var handleValuesChange = function handleValuesChange(changedValues) {
|
|
var _changedValues$hack;
|
|
if (changedValues !== null && changedValues !== void 0 && (_changedValues$hack = changedValues.hack) !== null && _changedValues$hack !== void 0 && _changedValues$hack.sub_discipline_id) {
|
|
var _changedValues$hack2, _disciplines$find, _disciplines$find$sub, _disciplines$find$sub2, _form$getFieldsValue;
|
|
var _changedValues$hack$s = changedValues === null || changedValues === void 0 ? void 0 : (_changedValues$hack2 = changedValues.hack) === null || _changedValues$hack2 === void 0 ? void 0 : _changedValues$hack2.sub_discipline_id,
|
|
_changedValues$hack$s2 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_16___default()(_changedValues$hack$s, 2),
|
|
_id = _changedValues$hack$s2[0],
|
|
subId = _changedValues$hack$s2[1];
|
|
var options = disciplines === null || disciplines === void 0 ? void 0 : (_disciplines$find = disciplines.find(function (item) {
|
|
return item.id === _id;
|
|
})) === null || _disciplines$find === void 0 ? void 0 : (_disciplines$find$sub = _disciplines$find.sub_disciplines) === null || _disciplines$find$sub === void 0 ? void 0 : (_disciplines$find$sub2 = _disciplines$find$sub.find(function (subItem) {
|
|
return subItem.id === subId;
|
|
})) === null || _disciplines$find$sub2 === void 0 ? void 0 : _disciplines$find$sub2.tag_disciplines;
|
|
|
|
// setKnowledgeOptions(options);
|
|
var fieldData = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, form.getFieldsValue()), {}, {
|
|
hack: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, (_form$getFieldsValue = form.getFieldsValue()) === null || _form$getFieldsValue === void 0 ? void 0 : _form$getFieldsValue.hack), {}, {
|
|
tag_discipline_ids: []
|
|
})
|
|
});
|
|
form.setFieldsValue(fieldData);
|
|
setFormValue(fieldData);
|
|
} else {
|
|
setFormValue(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, form.getFieldsValue()));
|
|
}
|
|
};
|
|
var handleAddKnowledgeFinish = function handleAddKnowledgeFinish(item) {
|
|
setKnowledgeOptions([].concat(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_11___default()(knowledgeOptions), [_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, item)]));
|
|
};
|
|
(0,react__WEBPACK_IMPORTED_MODULE_21__.useEffect)(function () {
|
|
var _data$hack2, _data$hack2$sub_disci;
|
|
if (data !== null && data !== void 0 && (_data$hack2 = data.hack) !== null && _data$hack2 !== void 0 && (_data$hack2$sub_disci = _data$hack2.sub_discipline_id) !== null && _data$hack2$sub_disci !== void 0 && _data$hack2$sub_disci[1]) {
|
|
var _data$hack3, _data$hack3$sub_disci;
|
|
getTagData(data === null || data === void 0 ? void 0 : (_data$hack3 = data.hack) === null || _data$hack3 === void 0 ? void 0 : (_data$hack3$sub_disci = _data$hack3.sub_discipline_id) === null || _data$hack3$sub_disci === void 0 ? void 0 : _data$hack3$sub_disci[1]);
|
|
}
|
|
}, [data === null || data === void 0 ? void 0 : (_data$hack4 = data.hack) === null || _data$hack4 === void 0 ? void 0 : _data$hack4.sub_discipline_id]);
|
|
//进来的时候 取一次值
|
|
var getTagData = /*#__PURE__*/function () {
|
|
var _ref3 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_14___default()( /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13___default()().mark(function _callee4(id) {
|
|
var res;
|
|
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13___default()().wrap(function _callee4$(_context4) {
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
case 0:
|
|
_context4.next = 2;
|
|
return (0,_service_exercise__WEBPACK_IMPORTED_MODULE_28__/* .getTagDiscipline */ .YY)({
|
|
sub_discipline_id: id
|
|
});
|
|
case 2:
|
|
res = _context4.sent;
|
|
setKnowledgeOptions(res.tag_disciplines);
|
|
case 4:
|
|
case "end":
|
|
return _context4.stop();
|
|
}
|
|
}, _callee4);
|
|
}));
|
|
return function getTagData(_x4) {
|
|
return _ref3.apply(this, arguments);
|
|
};
|
|
}();
|
|
//调用接口 获取knowledgeOptions
|
|
function onChangeSubDiscipline(values) {
|
|
// getTagData(values?.[1])
|
|
var subId = values[1];
|
|
var _getDisciplineIds5 = (0,_util__WEBPACK_IMPORTED_MODULE_23__/* .getDisciplineIds */ .y3)(disciplines, subId),
|
|
_getDisciplineIds6 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_16___default()(_getDisciplineIds5, 2),
|
|
dictData = _getDisciplineIds6[1];
|
|
form.setFieldsValue({
|
|
tags: []
|
|
});
|
|
dispatch({
|
|
type: Types.SET_INITAL_DATA,
|
|
payload: {
|
|
dicts: dictData,
|
|
data: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, data), {}, {
|
|
hack: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, data.hack), {}, {
|
|
sub_discipline_id: values
|
|
}),
|
|
tags: []
|
|
})
|
|
}
|
|
});
|
|
}
|
|
var addUploadFnc = function addUploadFnc(files) {
|
|
var _form$getFieldValue, _form$getFieldValue$f;
|
|
var isFuc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
if (isFuc) {
|
|
return function () {
|
|
dispatch({
|
|
type: Types.SET_INITAL_DATA,
|
|
payload: {
|
|
data: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, data), {}, {
|
|
hack: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, data.hack), {}, {
|
|
is_file: true
|
|
})
|
|
})
|
|
}
|
|
});
|
|
form.setFieldsValue({
|
|
hack: {
|
|
is_file: true
|
|
}
|
|
});
|
|
};
|
|
}
|
|
var newFiles = files === null || files === void 0 ? void 0 : files.map(function (e) {
|
|
return {
|
|
input: e.input,
|
|
output: e.output,
|
|
score: 0,
|
|
position: 1
|
|
};
|
|
});
|
|
var sets = (_form$getFieldValue = form.getFieldValue('hack_sets')) === null || _form$getFieldValue === void 0 ? void 0 : (_form$getFieldValue$f = _form$getFieldValue.filter(function (e) {
|
|
return e.input || e.output;
|
|
})) === null || _form$getFieldValue$f === void 0 ? void 0 : _form$getFieldValue$f.concat(newFiles);
|
|
var by = parseInt(form.getFieldValue('hack').code_compile_score) || 0;
|
|
var len = sets === null || sets === void 0 ? void 0 : sets.length;
|
|
var averageMark = Math.floor((100 - by) / len);
|
|
var remainder = (100 - by) % len;
|
|
sets === null || sets === void 0 ? void 0 : sets.map(function (item, index) {
|
|
if (test_set_average) {
|
|
item.score = averageMark;
|
|
if (index === len - 1) {
|
|
item.score = averageMark + remainder;
|
|
}
|
|
}
|
|
item.position = index + 1;
|
|
return item;
|
|
});
|
|
dispatch({
|
|
type: Types.SET_INITAL_DATA,
|
|
payload: {
|
|
data: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, data), {}, {
|
|
hack_sets: sets,
|
|
hack: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, data.hack), {}, {
|
|
is_file: false
|
|
})
|
|
})
|
|
}
|
|
});
|
|
form.setFieldsValue({
|
|
'hack_sets': sets,
|
|
hack: {
|
|
is_file: false
|
|
}
|
|
});
|
|
};
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_spin__WEBPACK_IMPORTED_MODULE_46__/* ["default"] */ .Z, {
|
|
spinning: loading,
|
|
delay: 500,
|
|
children: !data ? null : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)(react__WEBPACK_IMPORTED_MODULE_21__.Fragment, {
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)("header", {
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_22__/* ["default"].header */ .Z.header,
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)("div", {
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)("img", {
|
|
src: "".concat(_utils_env__WEBPACK_IMPORTED_MODULE_34__/* ["default"].IMG_SERVER */ .Z.IMG_SERVER, "/images/").concat(user === null || user === void 0 ? void 0 : user.image_url),
|
|
alt: "user",
|
|
width: 30
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)("span", {
|
|
children: user === null || user === void 0 ? void 0 : user.name
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)("h2", {
|
|
children: [" ", data === null || data === void 0 ? void 0 : data.hack.name, " "]
|
|
}), id ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)("a", {
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_22__/* ["default"].btn_back */ .Z.btn_back,
|
|
onClick: onBack,
|
|
children: [" ", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(_ant_design_icons__WEBPACK_IMPORTED_MODULE_47__/* ["default"] */ .Z, {}), "\u9000\u51FA"]
|
|
}) : null]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"] */ .Z, {
|
|
form: form,
|
|
initialValues: data,
|
|
layout: "vertical",
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_22__/* ["default"]["oj-form-container"] */ .Z["oj-form-container"],
|
|
onValuesChange: handleValuesChange,
|
|
onFinish: function onFinish(v, s) {
|
|
if (searchParams.get("exercise") && !callback_url.includes('paperlibrary')) {
|
|
antd_es_modal__WEBPACK_IMPORTED_MODULE_42__/* ["default"].confirm */ .Z.confirm({
|
|
title: '保存提示',
|
|
content: '此题目已存在试题库中,是否将修改后的试题覆盖试题库的原题?',
|
|
okText: '覆盖原题',
|
|
cancelText: '不覆盖',
|
|
onOk: function onOk() {
|
|
return onSubmit(v, s, 1);
|
|
},
|
|
onCancel: function onCancel() {
|
|
return onSubmit(v, s, 0);
|
|
}
|
|
});
|
|
return;
|
|
}
|
|
|
|
// if (data?.hack?.is_my) {
|
|
// Modal.confirm({
|
|
// title: '保存提示',
|
|
// content: '此题目已存在试题库中,是否将修改后的试题覆盖试题库的原题?',
|
|
// okText: '确认',
|
|
// cancelText: '取消',
|
|
// onOk: () => onSubmit(v, s,1),
|
|
// onCancel:()=>onSubmit(v, s,0),
|
|
// })
|
|
// return
|
|
// }
|
|
onSubmit(v, s);
|
|
},
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(_components_SplitContainer__WEBPACK_IMPORTED_MODULE_29__/* ["default"] */ .Z, {
|
|
leftChild: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(LeftPanel, {
|
|
onAddTestCases: onAddTestCases,
|
|
form: form,
|
|
handleAddKnowledgeFinish: handleAddKnowledgeFinish,
|
|
MyGroup: MyGroup,
|
|
formValue: formValue,
|
|
knowledgeOptions: knowledgeOptions,
|
|
onChangeLanguage: onChangeLanguage,
|
|
onChangeSubDiscipline: onChangeSubDiscipline,
|
|
onRemoveTestCase: onRemoveTestCase,
|
|
onAddTestCase: onAddTestCase,
|
|
dicts: dicts,
|
|
categorys: categorys,
|
|
callback_url: callback_url,
|
|
hack: data.hack,
|
|
onChangeScore: onChangeScore,
|
|
onChangehide: onChangehide,
|
|
onChangeAverage: onChangeAverage,
|
|
onChangeFile: onChangeFile,
|
|
uploadData: uploadData,
|
|
setUploadData: setUploadData,
|
|
handleUploadRatio: handleUploadRatio,
|
|
ischecked: ischecked,
|
|
isshows: isshows,
|
|
isProgram: isProgram,
|
|
addUploadFnc: addUploadFnc
|
|
}),
|
|
rightChild: isProgram ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
name: "codes",
|
|
style: {
|
|
marginBottom: 0
|
|
},
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(_CodeProgramPanel__WEBPACK_IMPORTED_MODULE_31__/* ["default"] */ .Z, {})
|
|
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
name: ['hack_codes', 'code'],
|
|
style: {
|
|
marginBottom: 0
|
|
},
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(_CodePanel__WEBPACK_IMPORTED_MODULE_30__/* ["default"] */ .Z, {
|
|
language: data.hack_codes.language
|
|
})
|
|
})
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)("div", {
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_22__/* ["default"].footer */ .Z.footer,
|
|
children: !id ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)(react__WEBPACK_IMPORTED_MODULE_21__.Fragment, {
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_button__WEBPACK_IMPORTED_MODULE_48__/* ["default"] */ .Z, {
|
|
onClick: onBack,
|
|
children: "\u53D6\u6D88"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_button__WEBPACK_IMPORTED_MODULE_48__/* ["default"] */ .Z, {
|
|
loading: loading,
|
|
type: "primary",
|
|
htmlType: "submit",
|
|
children: "\u4FDD\u5B58"
|
|
})]
|
|
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)(react__WEBPACK_IMPORTED_MODULE_21__.Fragment, {
|
|
children: [isProgram && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_button__WEBPACK_IMPORTED_MODULE_48__/* ["default"] */ .Z, {
|
|
onClick: onBack,
|
|
type: "primary",
|
|
ghost: true,
|
|
children: "\u9000\u51FA\u7F16\u8F91"
|
|
}), callback_url ? null : isProgram ? null : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_button__WEBPACK_IMPORTED_MODULE_48__/* ["default"] */ .Z, {
|
|
type: status ? 'default' : 'primary',
|
|
onClick: onTriggerPublish,
|
|
children: status ? '撤销发布' : '立即发布'
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_button__WEBPACK_IMPORTED_MODULE_48__/* ["default"] */ .Z, {
|
|
loading: loading,
|
|
type: "primary",
|
|
htmlType: "submit",
|
|
children: "\u4FDD\u5B58"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_button__WEBPACK_IMPORTED_MODULE_48__/* ["default"] */ .Z, {
|
|
type: "primary",
|
|
onClick: onChallenge,
|
|
children: status ? '开始挑战' : '模拟挑战'
|
|
})]
|
|
})
|
|
})]
|
|
})]
|
|
})
|
|
});
|
|
});
|
|
function LeftPanel(_ref5) {
|
|
var _location, _location$search, _formValue$hack, _formValue$hack$sub_d;
|
|
var form = _ref5.form,
|
|
onAddTestCases = _ref5.onAddTestCases,
|
|
handleAddKnowledgeFinish = _ref5.handleAddKnowledgeFinish,
|
|
ischecked = _ref5.ischecked,
|
|
MyGroup = _ref5.MyGroup,
|
|
formValue = _ref5.formValue,
|
|
knowledgeOptions = _ref5.knowledgeOptions,
|
|
categorys = _ref5.categorys,
|
|
hack = _ref5.hack,
|
|
callback_url = _ref5.callback_url,
|
|
onChangeAverage = _ref5.onChangeAverage,
|
|
onChangeScore = _ref5.onChangeScore,
|
|
onChangehide = _ref5.onChangehide,
|
|
onChangeFile = _ref5.onChangeFile,
|
|
onAddTestCase = _ref5.onAddTestCase,
|
|
onRemoveTestCase = _ref5.onRemoveTestCase,
|
|
onChangeSubDiscipline = _ref5.onChangeSubDiscipline,
|
|
onChangeLanguage = _ref5.onChangeLanguage,
|
|
uploadData = _ref5.uploadData,
|
|
setUploadData = _ref5.setUploadData,
|
|
handleUploadRatio = _ref5.handleUploadRatio,
|
|
isshows = _ref5.isshows,
|
|
isProgram = _ref5.isProgram,
|
|
addUploadFnc = _ref5.addUploadFnc;
|
|
var is_random = ((_location = location) === null || _location === void 0 ? void 0 : (_location$search = _location.search) === null || _location$search === void 0 ? void 0 : _location$search.includes('select')) || false;
|
|
var _useState13 = (0,react__WEBPACK_IMPORTED_MODULE_21__.useState)(isshows),
|
|
_useState14 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_16___default()(_useState13, 2),
|
|
isshow = _useState14[0],
|
|
setisshow = _useState14[1];
|
|
var test_set_average = hack.test_set_average,
|
|
test_set_score = hack.test_set_score;
|
|
var _useState15 = (0,react__WEBPACK_IMPORTED_MODULE_21__.useState)(false),
|
|
_useState16 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_16___default()(_useState15, 2),
|
|
showUploadFile = _useState16[0],
|
|
setShowUploadFile = _useState16[1];
|
|
var handleRemove = function handleRemove(item, key) {
|
|
var newList = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_11___default()(uploadData);
|
|
newList.splice(key, 1);
|
|
if (test_set_average) {
|
|
handleUploadRatio(newList);
|
|
} else {
|
|
setUploadData(newList);
|
|
}
|
|
};
|
|
var handleInputChange = function handleInputChange(e, key) {
|
|
console.log(e, key);
|
|
var testData = uploadData.map(function (test, testIndex) {
|
|
if (testIndex === key) {
|
|
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_17___default()({}, test), {}, {
|
|
score: e.target.value ? Number(e.target.value) : 0
|
|
});
|
|
}
|
|
return test;
|
|
});
|
|
setUploadData(testData);
|
|
};
|
|
var addUploadData = function addUploadData(files) {
|
|
if (!(files !== null && files !== void 0 && files.length)) return;
|
|
|
|
//文件
|
|
if (files !== null && files !== void 0 && files[0].is_file) {
|
|
addUploadFnc(files, true)();
|
|
var newList = uploadData.concat(files);
|
|
if (hack.test_set_average) {
|
|
handleUploadRatio(newList);
|
|
} else {
|
|
setUploadData(newList);
|
|
}
|
|
}
|
|
|
|
//文本
|
|
if (!(files !== null && files !== void 0 && files[0].is_file)) {
|
|
addUploadFnc(files);
|
|
}
|
|
};
|
|
function onStopPropagation(e) {
|
|
e.stopPropagation();
|
|
}
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)("div", {
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_22__/* ["default"]["oj-left-panel"] */ .Z["oj-left-panel"],
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)("div", {
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_22__/* ["default"]["oj-form-info"] */ .Z["oj-form-info"],
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)("div", {
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_22__/* ["default"].field */ .Z.field,
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
label: "\u96BE\u6613\u5EA6",
|
|
name: ['hack', 'difficult'],
|
|
rules: [{
|
|
required: true,
|
|
message: '请选择难易度'
|
|
}],
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_select__WEBPACK_IMPORTED_MODULE_49__/* ["default"] */ .Z, {
|
|
disabled: is_random,
|
|
children: (0,_util__WEBPACK_IMPORTED_MODULE_23__/* .getSelectOptions */ .jw)(_util__WEBPACK_IMPORTED_MODULE_23__/* .Keys.difficult */ .R8.difficult)
|
|
})
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
label: "\u8BFE\u7A0B(\u5408\u7406\u7684\u8BFE\u7A0B\u5206\u7C7B\u6709\u5229\u4E8E\u5FEB\u901F\u68C0\u7D22)",
|
|
name: ['hack', 'sub_discipline_id'],
|
|
rules: [{
|
|
required: true,
|
|
message: '请选择课程'
|
|
}],
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_cascader__WEBPACK_IMPORTED_MODULE_50__/* ["default"] */ .Z, {
|
|
disabled: is_random,
|
|
allowClear: false,
|
|
options: categorys,
|
|
placeholder: "\u8BF7\u9009\u62E9",
|
|
onChange: onChangeSubDiscipline
|
|
})
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)("div", {
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_22__/* ["default"].field */ .Z.field,
|
|
children: [callback_url && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
label: "\u5206\u6570",
|
|
name: ['hack', 'score'],
|
|
rules: [{
|
|
required: true,
|
|
message: '请输入分数'
|
|
}],
|
|
extra: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)("span", {
|
|
style: {
|
|
position: "absolute",
|
|
left: 100,
|
|
top: 5
|
|
},
|
|
children: "\u5206"
|
|
}),
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_input_number__WEBPACK_IMPORTED_MODULE_51__/* ["default"] */ .Z, {
|
|
disabled: is_random,
|
|
min: 1,
|
|
max: 100
|
|
})
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
label: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)("div", {
|
|
children: "\u5355\u4E2A\u6D4B\u8BD5\u96C6\u8BC4\u6D4B\u65F6\u957F\u9650\u5236 "
|
|
}),
|
|
name: ['hack', 'time_limit'],
|
|
rules: [{
|
|
required: true,
|
|
message: '请输入单个测试集评测时长限制'
|
|
}, {
|
|
type: 'number',
|
|
min: 3,
|
|
message: '最小限制时间是3秒'
|
|
}],
|
|
extra: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)("span", {
|
|
style: {
|
|
position: "absolute",
|
|
left: 100,
|
|
top: 5
|
|
},
|
|
children: "\u79D2"
|
|
}),
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_input_number__WEBPACK_IMPORTED_MODULE_51__/* ["default"] */ .Z, {
|
|
min: 3
|
|
})
|
|
}), isProgram ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
label: "\u7F16\u7A0B\u8BED\u8A00",
|
|
style: {
|
|
paddingBottom: 16
|
|
},
|
|
name: ['hack', 'languages'],
|
|
rules: [{
|
|
required: true,
|
|
message: '请选择编程语言'
|
|
}],
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)(antd_es_checkbox__WEBPACK_IMPORTED_MODULE_52__/* ["default"].Group */ .Z.Group, {
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_checkbox__WEBPACK_IMPORTED_MODULE_52__/* ["default"] */ .Z, {
|
|
value: 'C',
|
|
children: "C"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_checkbox__WEBPACK_IMPORTED_MODULE_52__/* ["default"] */ .Z, {
|
|
value: 'C++',
|
|
children: "C++"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_checkbox__WEBPACK_IMPORTED_MODULE_52__/* ["default"] */ .Z, {
|
|
value: 'Java',
|
|
children: "Java"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_checkbox__WEBPACK_IMPORTED_MODULE_52__/* ["default"] */ .Z, {
|
|
value: 'Python',
|
|
children: "Python"
|
|
})]
|
|
})
|
|
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
label: "\u7F16\u7A0B\u8BED\u8A00",
|
|
name: ['hack_codes', 'language'],
|
|
style: {
|
|
paddingBottom: 16
|
|
},
|
|
rules: [{
|
|
required: true,
|
|
message: '请选择编程语言'
|
|
}],
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_select__WEBPACK_IMPORTED_MODULE_49__/* ["default"] */ .Z, {
|
|
onChange: onChangeLanguage,
|
|
children: (0,_util__WEBPACK_IMPORTED_MODULE_23__/* .getSelectOptions */ .jw)(_util__WEBPACK_IMPORTED_MODULE_23__/* .Keys.language */ .R8.language)
|
|
})
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
label: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)("span", {
|
|
children: ["\u77E5\u8BC6\u70B9\uFF1A", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)("span", {
|
|
className: "c-grey-999",
|
|
children: "\uFF08\u6240\u6709\u81EA\u5EFA\u77E5\u8BC6\u70B9\u4EC5\u672C\u4EBA\u53EF\u89C1\uFF0C\u88ABEduCoder\u5E73\u53F0\u5BA1\u6838\u901A\u8FC7\u4E3A\u5B98\u65B9\u77E5\u8BC6\u70B9\u540E\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF09"
|
|
})]
|
|
}),
|
|
name: ['hack', 'tag_discipline_ids']
|
|
// rules={[{ message: '请选择知识点' }]}
|
|
,
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(_components_Knowledge__WEBPACK_IMPORTED_MODULE_35__/* .Knowledge */ .N, {
|
|
selectvalues: (hack === null || hack === void 0 ? void 0 : hack.tag_discipline_id) || (hack === null || hack === void 0 ? void 0 : hack.tag_discipline_ids)
|
|
// value={[]}
|
|
,
|
|
disabled: is_random,
|
|
subId: formValue === null || formValue === void 0 ? void 0 : (_formValue$hack = formValue.hack) === null || _formValue$hack === void 0 ? void 0 : (_formValue$hack$sub_d = _formValue$hack.sub_discipline_id) === null || _formValue$hack$sub_d === void 0 ? void 0 : _formValue$hack$sub_d[1],
|
|
knowledgeOptions: knowledgeOptions,
|
|
onAddKnowledgeFinish: handleAddKnowledgeFinish
|
|
})
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
label: '加入文件夹目录',
|
|
name: ['hack', 'item_banks_group_ids'],
|
|
labelCol: {
|
|
span: 24
|
|
},
|
|
wrapperCol: {
|
|
span: 24
|
|
},
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(_components_CustomTree__WEBPACK_IMPORTED_MODULE_36__/* ["default"] */ .Z, {
|
|
disabled: is_random
|
|
})
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
label: "\u4EFB\u52A1\u540D\u79F0",
|
|
name: ['hack', 'name'],
|
|
rules: [{
|
|
required: true,
|
|
message: '请输入任务名称'
|
|
}],
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_input__WEBPACK_IMPORTED_MODULE_41__/* ["default"] */ .Z, {
|
|
maxLength: 60,
|
|
placeholder: "\u8BF7\u8F93\u5165\u4EFB\u52A1\u540D\u79F0",
|
|
suffix: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)("span", {
|
|
children: 60 - hack.name.length
|
|
})
|
|
})
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
name: ['hack', "description"],
|
|
valuePropName: "defaultValue",
|
|
rules: [{
|
|
required: true,
|
|
message: '请输入描述内容'
|
|
}],
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(_components_markdown_editor__WEBPACK_IMPORTED_MODULE_26__/* ["default"] */ .Z, {
|
|
miniToolbar: true,
|
|
id: "moop_cases_content",
|
|
noStorage: true,
|
|
height: 200
|
|
})
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)("div", {
|
|
className: "tst-case-info",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)("h3", {
|
|
className: "flex-container",
|
|
style: {
|
|
justifyContent: 'space-between'
|
|
},
|
|
children: [" \u6D4B\u8BD5\u7528\u4F8B\u4E0E\u7CFB\u7EDF\u8BC4\u5206\u89C4\u5219", !hack.is_file && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_button__WEBPACK_IMPORTED_MODULE_48__/* ["default"] */ .Z, {
|
|
type: "primary",
|
|
ghost: true,
|
|
onClick: onAddTestCase,
|
|
children: "\u6DFB\u52A0\u6D4B\u8BD5\u7528\u4F8B"
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
name: ['hack', 'test_set_score'],
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)(antd_es_radio__WEBPACK_IMPORTED_MODULE_53__/* ["default"].Group */ .ZP.Group, {
|
|
onChange: onChangeScore,
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)(antd_es_radio__WEBPACK_IMPORTED_MODULE_53__/* ["default"] */ .ZP, {
|
|
value: true,
|
|
children: ["\u901A\u8FC7\u5168\u90E8\u6D4B\u8BD5\u96C6", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)("span", {
|
|
className: "tip",
|
|
children: " \uFF08\u5B66\u5458\u8BC4\u6D4B\uFF0C\u4EC5\u5F53\u6240\u6709\u6D4B\u8BD5\u96C6\u90FD\u6B63\u786E\u65F6\uFF0C\u624D\u83B7\u5F97\u4E00\u6B21\u6027\u5956\u52B1\uFF09"
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)(antd_es_radio__WEBPACK_IMPORTED_MODULE_53__/* ["default"] */ .ZP, {
|
|
value: false,
|
|
children: ["\u901A\u8FC7\u90E8\u5206\u6D4B\u8BD5\u96C6", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)("span", {
|
|
className: "tip",
|
|
children: " \uFF08\u5B66\u5458\u8BC4\u6D4B\uFF0C\u901A\u8FC7\u6D4B\u8BD5\u96C6\u5373\u53EF\u83B7\u5F97\u5BF9\u5E94\u5956\u52B1\uFF09"
|
|
})]
|
|
})]
|
|
})
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_checkbox__WEBPACK_IMPORTED_MODULE_52__/* ["default"] */ .Z, {
|
|
style: {
|
|
marginBottom: '5px'
|
|
},
|
|
checked: ischecked,
|
|
onChange: onChangehide,
|
|
children: "\u9690\u85CF\u5B9E\u9645\u8F93\u51FA \uFF08\u9009\u4E2D\uFF0C\u5219\u5728\u5B66\u751F\u8003\u8BD5\u8FC7\u7A0B\u4E2D\u65E0\u6CD5\u770B\u5230\u5B9E\u9645\u8F93\u51FA\u7ED3\u679C\uFF0C\u4EC5\u5C55\u793A\u662F\u5426\u8BC4\u6D4B\u662F\u5426\u901A\u8FC7\uFF09"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_22__/* ["default"].testJi */ .Z.testJi,
|
|
name: ['hack', 'is_file'],
|
|
label: "\u7528\u4F8B\u7C7B\u578B:",
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_radio__WEBPACK_IMPORTED_MODULE_53__/* ["default"].Group */ .ZP.Group, {
|
|
onChange: onChangeFile,
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)(antd_es_space__WEBPACK_IMPORTED_MODULE_54__/* ["default"] */ .Z, {
|
|
direction: "horizontal",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_radio__WEBPACK_IMPORTED_MODULE_53__/* ["default"] */ .ZP, {
|
|
value: false,
|
|
children: "\u6587\u672C"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_radio__WEBPACK_IMPORTED_MODULE_53__/* ["default"] */ .ZP, {
|
|
value: true,
|
|
children: "\u6587\u4EF6"
|
|
})]
|
|
})
|
|
})
|
|
}), !hack.test_set_score && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
name: ['hack', 'test_set_average'],
|
|
label: "\u7CFB\u7EDF\u8BC4\u5206\u5360\u6BD4",
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)(antd_es_radio__WEBPACK_IMPORTED_MODULE_53__/* ["default"].Group */ .ZP.Group, {
|
|
onChange: onChangeAverage,
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_radio__WEBPACK_IMPORTED_MODULE_53__/* ["default"] */ .ZP, {
|
|
value: true,
|
|
children: "\u5747\u5206\u6BD4\u4F8B"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_radio__WEBPACK_IMPORTED_MODULE_53__/* ["default"] */ .ZP, {
|
|
value: false,
|
|
children: "\u81EA\u5B9A\u4E49\u6BD4\u4F8B"
|
|
})]
|
|
})
|
|
}), !hack.test_set_score && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)("div", {
|
|
style: {
|
|
marginBottom: '20px',
|
|
marginTop: '-10px'
|
|
},
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)("div", {
|
|
style: {
|
|
display: 'flex',
|
|
height: '30px',
|
|
marginBottom: '10px'
|
|
},
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_checkbox__WEBPACK_IMPORTED_MODULE_52__/* ["default"] */ .Z, {
|
|
checked: isshow,
|
|
style: {
|
|
display: 'flex',
|
|
alignItems: 'center'
|
|
},
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_22__/* ["default"].checkboxs */ .Z.checkboxs,
|
|
onChange: function onChange(e) {
|
|
setisshow(e.target.checked);
|
|
form.setFieldsValue({
|
|
hack: {
|
|
code_compile_score: 0
|
|
}
|
|
});
|
|
if (hack.test_set_average) {
|
|
if (hack.is_file) {
|
|
handleUploadRatio(uploadData);
|
|
} else {
|
|
onAddTestCases();
|
|
// handleShareRatio(testSetList)
|
|
}
|
|
}
|
|
},
|
|
children: "\u542F\u7528\u7F16\u8BD1\u901A\u8FC7\u5373\u53EF\u5F97\u5206"
|
|
}), isshow && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)("span", {
|
|
style: {
|
|
display: 'flex'
|
|
},
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
rules: [{
|
|
required: true,
|
|
message: '请输入编译得分'
|
|
}],
|
|
name: ['hack', 'code_compile_score'],
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_input_number__WEBPACK_IMPORTED_MODULE_51__/* ["default"] */ .Z, {
|
|
onChange: function onChange() {
|
|
if (hack.test_set_average) {
|
|
if (hack.is_file) {
|
|
handleUploadRatio(uploadData);
|
|
} else {
|
|
onAddTestCases();
|
|
}
|
|
}
|
|
},
|
|
parser: function parser(e) {
|
|
return isNaN(parseInt(e)) ? '' : parseInt(e);
|
|
},
|
|
min: 0,
|
|
max: 100,
|
|
style: {
|
|
width: '90px',
|
|
margin: '5px 0px'
|
|
}
|
|
})
|
|
}), " ", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)("span", {
|
|
style: {
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
marginLeft: '5px'
|
|
},
|
|
children: "%"
|
|
})]
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)("span", {
|
|
style: {
|
|
color: '#999',
|
|
fontSize: '12px',
|
|
marginLeft: '-8px'
|
|
},
|
|
children: "\uFF08\u8BF7\u6CE8\u610F\u8BE5\u5B9E\u8BAD\u9898\u662F\u5426\u6709\u7F16\u8BD1\u8FC7\u7A0B\uFF0C\u82E5\u6CA1\u6709\u5219\u65E0\u6CD5\u83B7\u5F97\u7F16\u8BD1\u5F97\u5206\uFF09"
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)("div", {
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_22__/* ["default"].upBtn */ .Z.upBtn,
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_button__WEBPACK_IMPORTED_MODULE_48__/* ["default"] */ .Z, {
|
|
ghost: true,
|
|
type: "primary",
|
|
className: "mb20",
|
|
onClick: function onClick() {
|
|
return setShowUploadFile(true);
|
|
},
|
|
children: "\u6279\u91CF\u4E0A\u4F20\u6D4B\u8BD5\u7528\u4F8B"
|
|
}), (hack === null || hack === void 0 ? void 0 : hack.is_file) && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(_pages_Shixuns_Edit_body_Level_Challenges_components_UploadFile__WEBPACK_IMPORTED_MODULE_37__/* .UploadTable */ .Y2, {
|
|
disabled: hack === null || hack === void 0 ? void 0 : hack.test_set_average,
|
|
inputChange: handleInputChange,
|
|
showScore: !hack.test_set_score,
|
|
data: uploadData,
|
|
onRemove: handleRemove
|
|
})]
|
|
}), !hack.is_file && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].List */ .Z.List, {
|
|
name: "hack_sets",
|
|
children: function children(fields, _ref6) {
|
|
_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectDestructuringEmpty_js__WEBPACK_IMPORTED_MODULE_1___default()(_ref6);
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_collapse__WEBPACK_IMPORTED_MODULE_43__/* ["default"] */ .Z, {
|
|
accordion: true,
|
|
children: fields.map(function (field, index) {
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)(Panel, {
|
|
header: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)("a", {
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_22__/* ["default"]["test-case-name"] */ .Z["test-case-name"],
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)("span", {
|
|
children: ["\u6D4B\u8BD5\u7528\u4F8B", index + 1]
|
|
}), !test_set_score ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.Fragment, {
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
name: [field.name, 'score'],
|
|
fieldKey: [field.fieldKey, 'score'],
|
|
rules: [{
|
|
required: true,
|
|
message: "\u8BF7\u8F93\u5165\u6D4B\u8BD5\u96C6".concat(index + 1, "\u8BC4\u5206")
|
|
}],
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_input_number__WEBPACK_IMPORTED_MODULE_51__/* ["default"] */ .Z, {
|
|
onClick: onStopPropagation,
|
|
min: 0,
|
|
max: 100,
|
|
disabled: test_set_average
|
|
})
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)("span", {
|
|
children: "%"
|
|
})]
|
|
}) : null]
|
|
}),
|
|
extra: index > 0 ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)("div", {
|
|
onClick: onStopPropagation,
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_popconfirm__WEBPACK_IMPORTED_MODULE_55__/* ["default"] */ .Z, {
|
|
okText: "\u786E\u5B9A",
|
|
cancelText: "\u53D6\u6D88",
|
|
title: '确定删除测试集' + (index + 1),
|
|
onConfirm: function onConfirm() {
|
|
onRemoveTestCase(index);
|
|
},
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(_ant_design_icons__WEBPACK_IMPORTED_MODULE_56__/* ["default"] */ .Z, {
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_22__/* ["default"]["btn-remove-case"] */ .Z["btn-remove-case"]
|
|
})
|
|
})
|
|
}) : null,
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
label: "\u8F93\u5165",
|
|
name: [field.name, 'input'],
|
|
fieldKey: [field.fieldKey, 'input'],
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(TextArea, {})
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_44__/* ["default"].Item */ .Z.Item, {
|
|
label: "\u8F93\u51FA",
|
|
name: [field.name, 'output'],
|
|
fieldKey: [field.fieldKey, 'output'],
|
|
rules: [{
|
|
required: true,
|
|
message: '请输入输出内容'
|
|
}],
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(TextArea, {})
|
|
})]
|
|
}, "".concat(field.key, "--").concat(index));
|
|
})
|
|
});
|
|
}
|
|
})]
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_40__.jsx)(_pages_Shixuns_Edit_body_Level_Challenges_components_UploadFile__WEBPACK_IMPORTED_MODULE_37__/* ["default"] */ .ZP, {
|
|
rootIdentifier: null,
|
|
visible: showUploadFile,
|
|
onClose: function onClose() {
|
|
return setShowUploadFile(false);
|
|
},
|
|
onOK: addUploadData,
|
|
multiple: true,
|
|
defaultMultipleValue: hack === null || hack === void 0 ? void 0 : hack.is_file
|
|
})]
|
|
});
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 38005:
|
|
/*!**********************************************!*\
|
|
!*** ./src/pages/Problems/OjForm/service.ts ***!
|
|
\**********************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ "GM": function() { return /* binding */ updateExerciseQuestion; },
|
|
/* harmony export */ "MK": function() { return /* binding */ addExerciseQuestion; },
|
|
/* harmony export */ "PR": function() { return /* binding */ getUser; },
|
|
/* harmony export */ "ZS": function() { return /* binding */ cancelPublishProgrammingTopic; },
|
|
/* harmony export */ "d1": function() { return /* binding */ getDisciplines; },
|
|
/* harmony export */ "fu": function() { return /* binding */ getProgrammingTopic; },
|
|
/* harmony export */ "j2": function() { return /* binding */ publishProgrammingTopic; },
|
|
/* harmony export */ "l_": function() { return /* binding */ updateProgrammingTopic; },
|
|
/* harmony export */ "uE": function() { return /* binding */ startChallenge; },
|
|
/* harmony export */ "zQ": function() { return /* binding */ addProgrammingTopic; }
|
|
/* harmony export */ });
|
|
/* unused harmony export addTag */
|
|
/* harmony import */ var _utils_fetch_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/utils/fetch.ts */ 84519);
|
|
|
|
function getUser() {
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_0__/* .get */ .U2)('problems/new.json');
|
|
}
|
|
function getDisciplines() {
|
|
var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'question';
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_0__/* .get */ .U2)("disciplines.json", {
|
|
source: source
|
|
});
|
|
}
|
|
function getProgrammingTopic(id) {
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_0__/* .get */ .U2)("problems/".concat(id, "/edit.json"));
|
|
}
|
|
function updateProgrammingTopic(id, params) {
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_0__/* .put */ .gz)("problems/".concat(id, ".json"), params);
|
|
}
|
|
function addProgrammingTopic(params) {
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)("problems.json", params);
|
|
}
|
|
function addExerciseQuestion(exerciseId, params) {
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)("exercises/".concat(exerciseId, "/exercise_questions.json"), params);
|
|
}
|
|
function updateExerciseQuestion(id, params) {
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_0__/* .put */ .gz)("exercise_questions/".concat(id, ".json"), params);
|
|
}
|
|
function publishProgrammingTopic(id) {
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)("problems/".concat(id, "/publish.json"));
|
|
}
|
|
function cancelPublishProgrammingTopic(id) {
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)("problems/".concat(id, "/cancel_publish.json"));
|
|
}
|
|
function startChallenge(id) {
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_0__/* .get */ .U2)("problems/".concat(id, "/start.json"));
|
|
}
|
|
function addTag(sub_discipline_id, name) {
|
|
return post("tag_disciplines.json", {
|
|
name: name,
|
|
sub_discipline_id: sub_discipline_id
|
|
});
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 52238:
|
|
/*!********************************************!*\
|
|
!*** ./src/pages/Problems/OjForm/util.tsx ***!
|
|
\********************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ "D0": function() { return /* binding */ getDisciplineOptions; },
|
|
/* harmony export */ "R8": function() { return /* binding */ Keys; },
|
|
/* harmony export */ "jw": function() { return /* binding */ getSelectOptions; },
|
|
/* harmony export */ "y3": function() { return /* binding */ getDisciplineIds; }
|
|
/* harmony export */ });
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/defineProperty.js */ 38416);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
/* harmony import */ var antd_es_select_style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/es/select/style */ 95985);
|
|
/* harmony import */ var antd_es_select__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd/es/select */ 34041);
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ 67294);
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/jsx-runtime */ 85893);
|
|
|
|
|
|
|
|
var _Options;
|
|
|
|
|
|
var Option = antd_es_select__WEBPACK_IMPORTED_MODULE_4__/* ["default"].Option */ .Z.Option;
|
|
var Keys;
|
|
(function (Keys) {
|
|
Keys[Keys["language"] = 0] = "language";
|
|
Keys[Keys["difficult"] = 1] = "difficult";
|
|
Keys[Keys["category"] = 2] = "category";
|
|
Keys[Keys["openOrNot"] = 3] = "openOrNot";
|
|
})(Keys || (Keys = {}));
|
|
var Options = (_Options = {}, _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_0___default()(_Options, Keys.language, [{
|
|
title: 'C',
|
|
key: 'C'
|
|
}, {
|
|
title: 'C++',
|
|
key: 'C++'
|
|
}, {
|
|
title: 'Python',
|
|
key: 'Python'
|
|
}, {
|
|
title: 'Java',
|
|
key: 'Java'
|
|
}, {
|
|
title: 'JavaScript',
|
|
key: 'JavaScript'
|
|
}, {
|
|
title: 'Ruby',
|
|
key: 'Ruby'
|
|
}]), _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_0___default()(_Options, Keys.difficult, [{
|
|
title: '简单',
|
|
key: 1
|
|
}, {
|
|
title: '中等',
|
|
key: 2
|
|
}, {
|
|
title: '困难',
|
|
key: 3
|
|
}]), _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_0___default()(_Options, Keys.category, [{
|
|
title: '程序设计',
|
|
key: 1
|
|
}, {
|
|
title: '算法',
|
|
key: 2
|
|
}]), _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_0___default()(_Options, Keys.openOrNot, [{
|
|
title: '公开',
|
|
key: 1
|
|
}, {
|
|
title: '私有',
|
|
key: 0
|
|
}]), _Options);
|
|
function getSelectOptions(name) {
|
|
return Options[name].map(function (item) {
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(Option, {
|
|
value: item.key,
|
|
children: [" ", item.title, " "]
|
|
}, item.title);
|
|
});
|
|
}
|
|
function getDisciplineOptions(data, result) {
|
|
data.map(function (value) {
|
|
var id = value.id,
|
|
name = value.name,
|
|
sub_disciplines = value.sub_disciplines;
|
|
var item = {
|
|
value: id,
|
|
label: name
|
|
};
|
|
result.push(item);
|
|
if (sub_disciplines && sub_disciplines.length > 0) {
|
|
item.children = [];
|
|
getDisciplineOptions(sub_disciplines, item.children);
|
|
}
|
|
});
|
|
}
|
|
function getDisciplineIds(data, sub_disciplines_id) {
|
|
var rs = [];
|
|
for (var index = 0; index < data.length; index++) {
|
|
var _value$sub_discipline;
|
|
var value = data[index];
|
|
if (((_value$sub_discipline = value.sub_disciplines) === null || _value$sub_discipline === void 0 ? void 0 : _value$sub_discipline.length) > 0) {
|
|
rs[0] = value.id;
|
|
for (var j = 0; j < value.sub_disciplines.length; j++) {
|
|
var item = value.sub_disciplines[j];
|
|
if (item.id === sub_disciplines_id) {
|
|
rs[1] = item.id;
|
|
return [rs, item.tag_disciplines || item.sub_disciplines || []];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return [rs, []];
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 70960:
|
|
/*!***************************!*\
|
|
!*** ./src/utils/enum.ts ***!
|
|
\***************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ "c": function() { return /* binding */ QuestionType; }
|
|
/* harmony export */ });
|
|
/* unused harmony export PageType */
|
|
var PageType;
|
|
(function (PageType) {
|
|
PageType["FirstPage"] = "firstPage";
|
|
PageType["PrevPage"] = "prevPage";
|
|
PageType["NextPage"] = "nextPage";
|
|
})(PageType || (PageType = {}));
|
|
var QuestionType;
|
|
(function (QuestionType) {
|
|
QuestionType[QuestionType["Single"] = 0] = "Single";
|
|
QuestionType[QuestionType["Multiple"] = 1] = "Multiple";
|
|
QuestionType[QuestionType["Judge"] = 2] = "Judge";
|
|
QuestionType[QuestionType["Fill"] = 3] = "Fill";
|
|
QuestionType[QuestionType["Subjective"] = 4] = "Subjective";
|
|
QuestionType[QuestionType["Shixun"] = 5] = "Shixun";
|
|
QuestionType[QuestionType["Program"] = 6] = "Program";
|
|
QuestionType[QuestionType["Combine"] = 7] = "Combine";
|
|
})(QuestionType || (QuestionType = {}));
|
|
|
|
/***/ }),
|
|
|
|
/***/ 63778:
|
|
/*!******************************!*\
|
|
!*** ./src/utils/urlTool.ts ***!
|
|
\******************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ "G": function() { return /* binding */ fromStore; },
|
|
/* harmony export */ "t": function() { return /* binding */ toStore; }
|
|
/* harmony export */ });
|
|
/* harmony import */ var store__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! store */ 58971);
|
|
/* harmony import */ var store__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(store__WEBPACK_IMPORTED_MODULE_0__);
|
|
var isDev = (/* unused pure expression or super */ null && ("production" === 'development'));
|
|
|
|
function toStore(key, val) {
|
|
var _config = store__WEBPACK_IMPORTED_MODULE_0___default().get('__ec');
|
|
if (!_config) _config = {};
|
|
_config[key] = val;
|
|
store__WEBPACK_IMPORTED_MODULE_0___default().set('__ec', _config);
|
|
}
|
|
function fromStore(key, defaultVal) {
|
|
var _config = store__WEBPACK_IMPORTED_MODULE_0___default().get('__ec');
|
|
if (!_config) return defaultVal;
|
|
return _config[key] === undefined ? defaultVal : _config[key];
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 77969:
|
|
/*!******************************************************!*\
|
|
!*** ./src/pages/Problems/OjForm/index.less?modules ***!
|
|
\******************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__) {
|
|
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ __webpack_exports__["Z"] = ({"header":"header___HqHSe","checkboxs":"checkboxs___ObBnD","field":"field___w_sM6","oj-form-container":"oj-form-container____odYP","oj-left-panel":"oj-left-panel___emEB2","oj-form-info":"oj-form-info___m00Ag","footer":"footer___O4iSJ","test-case-name":"test-case-name___miZcb","btn-remove-case":"btn-remove-case___cHap2","icon-tag":"icon-tag___gmyTb","btn_back":"btn_back___tNmX3","testJi":"testJi___L3fHb","upBtn":"upBtn___RGH6X"});
|
|
|
|
/***/ }),
|
|
|
|
/***/ 12867:
|
|
/*!****************************************************!*\
|
|
!*** ./src/components/tpi-code-setting/index.less ***!
|
|
\****************************************************/
|
|
/***/ (function() {
|
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 26713:
|
|
/*!*********************************************************!*\
|
|
!*** ./node_modules/antd/es/space/index.js + 1 modules ***!
|
|
\*********************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"u": function() { return /* binding */ SpaceContext; },
|
|
"Z": function() { return /* binding */ space; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
|
var esm_extends = __webpack_require__(87462);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
var defineProperty = __webpack_require__(4942);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
|
|
var slicedToArray = __webpack_require__(97685);
|
|
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
|
var classnames = __webpack_require__(94184);
|
|
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/Children/toArray.js
|
|
var toArray = __webpack_require__(50344);
|
|
// 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/_util/hooks/useFlexGapSupport.js
|
|
var useFlexGapSupport = __webpack_require__(98082);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/space/Item.js
|
|
|
|
|
|
|
|
|
|
function Item(_ref) {
|
|
var className = _ref.className,
|
|
direction = _ref.direction,
|
|
index = _ref.index,
|
|
marginDirection = _ref.marginDirection,
|
|
children = _ref.children,
|
|
split = _ref.split,
|
|
wrap = _ref.wrap;
|
|
var _React$useContext = react.useContext(SpaceContext),
|
|
horizontalSize = _React$useContext.horizontalSize,
|
|
verticalSize = _React$useContext.verticalSize,
|
|
latestIndex = _React$useContext.latestIndex,
|
|
supportFlexGap = _React$useContext.supportFlexGap;
|
|
var style = {};
|
|
if (!supportFlexGap) {
|
|
if (direction === 'vertical') {
|
|
if (index < latestIndex) {
|
|
style = {
|
|
marginBottom: horizontalSize / (split ? 2 : 1)
|
|
};
|
|
}
|
|
} else {
|
|
style = (0,esm_extends/* default */.Z)((0,esm_extends/* default */.Z)({}, index < latestIndex && (0,defineProperty/* default */.Z)({}, marginDirection, horizontalSize / (split ? 2 : 1))), wrap && {
|
|
paddingBottom: verticalSize
|
|
});
|
|
}
|
|
}
|
|
if (children === null || children === undefined) {
|
|
return null;
|
|
}
|
|
return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement("div", {
|
|
className: className,
|
|
style: style
|
|
}, children), index < latestIndex && split && /*#__PURE__*/react.createElement("span", {
|
|
className: "".concat(className, "-split"),
|
|
style: style
|
|
}, split));
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/space/Compact.js
|
|
var Compact = __webpack_require__(4173);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/es/space/index.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;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var SpaceContext = /*#__PURE__*/react.createContext({
|
|
latestIndex: 0,
|
|
horizontalSize: 0,
|
|
verticalSize: 0,
|
|
supportFlexGap: false
|
|
});
|
|
var spaceSize = {
|
|
small: 8,
|
|
middle: 16,
|
|
large: 24
|
|
};
|
|
function getNumberSize(size) {
|
|
return typeof size === 'string' ? spaceSize[size] : size || 0;
|
|
}
|
|
var Space = function Space(props) {
|
|
var _classNames;
|
|
var _React$useContext = react.useContext(context/* ConfigContext */.E_),
|
|
getPrefixCls = _React$useContext.getPrefixCls,
|
|
space = _React$useContext.space,
|
|
directionConfig = _React$useContext.direction;
|
|
var _props$size = props.size,
|
|
size = _props$size === void 0 ? (space === null || space === void 0 ? void 0 : space.size) || 'small' : _props$size,
|
|
align = props.align,
|
|
className = props.className,
|
|
children = props.children,
|
|
_props$direction = props.direction,
|
|
direction = _props$direction === void 0 ? 'horizontal' : _props$direction,
|
|
customizePrefixCls = props.prefixCls,
|
|
split = props.split,
|
|
style = props.style,
|
|
_props$wrap = props.wrap,
|
|
wrap = _props$wrap === void 0 ? false : _props$wrap,
|
|
otherProps = __rest(props, ["size", "align", "className", "children", "direction", "prefixCls", "split", "style", "wrap"]);
|
|
var supportFlexGap = (0,useFlexGapSupport/* default */.Z)();
|
|
var _React$useMemo = react.useMemo(function () {
|
|
return (Array.isArray(size) ? size : [size, size]).map(function (item) {
|
|
return getNumberSize(item);
|
|
});
|
|
}, [size]),
|
|
_React$useMemo2 = (0,slicedToArray/* default */.Z)(_React$useMemo, 2),
|
|
horizontalSize = _React$useMemo2[0],
|
|
verticalSize = _React$useMemo2[1];
|
|
var childNodes = (0,toArray/* default */.Z)(children, {
|
|
keepEmpty: true
|
|
});
|
|
var mergedAlign = align === undefined && direction === 'horizontal' ? 'center' : align;
|
|
var prefixCls = getPrefixCls('space', customizePrefixCls);
|
|
var cn = classnames_default()(prefixCls, "".concat(prefixCls, "-").concat(direction), (_classNames = {}, (0,defineProperty/* default */.Z)(_classNames, "".concat(prefixCls, "-rtl"), directionConfig === 'rtl'), (0,defineProperty/* default */.Z)(_classNames, "".concat(prefixCls, "-align-").concat(mergedAlign), mergedAlign), _classNames), className);
|
|
var itemClassName = "".concat(prefixCls, "-item");
|
|
var marginDirection = directionConfig === 'rtl' ? 'marginLeft' : 'marginRight';
|
|
// Calculate latest one
|
|
var latestIndex = 0;
|
|
var nodes = childNodes.map(function (child, i) {
|
|
if (child !== null && child !== undefined) {
|
|
latestIndex = i;
|
|
}
|
|
var key = child && child.key || "".concat(itemClassName, "-").concat(i);
|
|
return /*#__PURE__*/react.createElement(Item, {
|
|
className: itemClassName,
|
|
key: key,
|
|
direction: direction,
|
|
index: i,
|
|
marginDirection: marginDirection,
|
|
split: split,
|
|
wrap: wrap
|
|
}, child);
|
|
});
|
|
var spaceContext = react.useMemo(function () {
|
|
return {
|
|
horizontalSize: horizontalSize,
|
|
verticalSize: verticalSize,
|
|
latestIndex: latestIndex,
|
|
supportFlexGap: supportFlexGap
|
|
};
|
|
}, [horizontalSize, verticalSize, latestIndex, supportFlexGap]);
|
|
// =========================== Render ===========================
|
|
if (childNodes.length === 0) {
|
|
return null;
|
|
}
|
|
var gapStyle = {};
|
|
if (wrap) {
|
|
gapStyle.flexWrap = 'wrap';
|
|
// Patch for gap not support
|
|
if (!supportFlexGap) {
|
|
gapStyle.marginBottom = -verticalSize;
|
|
}
|
|
}
|
|
if (supportFlexGap) {
|
|
gapStyle.columnGap = horizontalSize;
|
|
gapStyle.rowGap = verticalSize;
|
|
}
|
|
return /*#__PURE__*/react.createElement("div", (0,esm_extends/* default */.Z)({
|
|
className: cn,
|
|
style: (0,esm_extends/* default */.Z)((0,esm_extends/* default */.Z)({}, gapStyle), style)
|
|
}, otherProps), /*#__PURE__*/react.createElement(SpaceContext.Provider, {
|
|
value: spaceContext
|
|
}, nodes));
|
|
};
|
|
var CompoundedSpace = Space;
|
|
CompoundedSpace.Compact = Compact/* default */.ZP;
|
|
/* harmony default export */ var space = (CompoundedSpace);
|
|
|
|
/***/ })
|
|
|
|
}]); |