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.
1182 lines
51 KiB
1182 lines
51 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[89286],{
|
|
|
|
/***/ 8071:
|
|
/*!********************************************************!*\
|
|
!*** ./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@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
|
|
var regeneratorRuntime = __webpack_require__(7557);
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
|
|
var asyncToGenerator = __webpack_require__(41498);
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/toConsumableArray.js
|
|
var toConsumableArray = __webpack_require__(37205);
|
|
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
|
|
var slicedToArray = __webpack_require__(79800);
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/select/index.js
|
|
var es_select = __webpack_require__(57809);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
|
|
var modal = __webpack_require__(43418);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/row/index.js
|
|
var row = __webpack_require__(95237);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/col/index.js
|
|
var col = __webpack_require__(43604);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 3 modules
|
|
var input = __webpack_require__(92832);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
|
|
var message = __webpack_require__(8591);
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
var fetch = __webpack_require__(58181);
|
|
;// 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@5.6.1@@ant-design/icons/es/icons/ExclamationCircleOutlined.js + 1 modules
|
|
var ExclamationCircleOutlined = __webpack_require__(87169);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
;// CONCATENATED MODULE: ./src/components/Knowledge/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Option = es_select["default"].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_17_0_2_react.useRef)();
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
values = _useState2[0],
|
|
setValues = _useState2[1];
|
|
value = value || [];
|
|
var handleChange = function handleChange(e, valuesmap) {
|
|
if (e) {
|
|
//获取选中的数据
|
|
setValues(toConsumableArray_default()(valuesmap));
|
|
onChange(toConsumableArray_default()(valuesmap));
|
|
} else {
|
|
//获取选中的数据
|
|
setValues([]);
|
|
onChange([]);
|
|
}
|
|
};
|
|
(0,_react_17_0_2_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_17_0_2_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 */.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: 'middle',
|
|
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 */.ZP.warning("请输入知识点名称");
|
|
return _context.abrupt("return", reject());
|
|
case 3:
|
|
if (!(addValue.current.length > 20)) {
|
|
_context.next = 6;
|
|
break;
|
|
}
|
|
message/* default */.ZP.warning("请输入不超过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 = selectvalues;
|
|
_value2.push(res.tag_discipline_id);
|
|
onChange(toConsumableArray_default()(_value2));
|
|
setValues(toConsumableArray_default()(_value2));
|
|
onChange(toConsumableArray_default()(_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"], {
|
|
mode: "multiple",
|
|
disabled: !subId || disabled,
|
|
className: Knowledgemodules.selectWrapper,
|
|
placeholder: "\u8BF7\u9009\u62E9\u77E5\u8BC6\u70B9\uFF0C\u652F\u6301\u9009\u62E9\u591A\u4E2A",
|
|
onChange: handleChange,
|
|
style: {
|
|
width: 490
|
|
},
|
|
showSearch: true,
|
|
allowClear: true,
|
|
value: values
|
|
// value={knowledgeOptions?.filter(item => values?.includes(item?.id) || values?.includes(item?.id + '')).map((item) => item.name)}
|
|
,
|
|
children: knowledgeOptions === null || knowledgeOptions === void 0 ? void 0 : knowledgeOptions.map(function (item) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(Option, {
|
|
value: item.id,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
style: {
|
|
display: 'flex',
|
|
alignItems: 'center'
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
style: {
|
|
overflow: "hidden",
|
|
whiteSpace: "nowrap",
|
|
textOverflow: "ellipsis"
|
|
},
|
|
children: item.name
|
|
}), (item === null || item === void 0 ? void 0 : item.type) === 'personal' && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
style: {
|
|
marginLeft: '5px',
|
|
border: '1px solid #24C074',
|
|
color: '#24C074',
|
|
padding: "0 4px",
|
|
borderRadius: '2px',
|
|
fontSize: "12px",
|
|
height: '20px',
|
|
lineHeight: '20px'
|
|
},
|
|
children: "\u81EA\u7528"
|
|
})]
|
|
})
|
|
}, item.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"
|
|
})]
|
|
})]
|
|
});
|
|
};
|
|
|
|
/***/ }),
|
|
|
|
/***/ 45416:
|
|
/*!**********************************************************!*\
|
|
!*** ./src/components/QuestionEditor/MdEditorInForm.tsx ***!
|
|
\**********************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ h: function() { return /* binding */ MdEditorInForm; },
|
|
/* harmony export */ x: function() { return /* binding */ RegularInput; }
|
|
/* harmony export */ });
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js */ 82242);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectWithoutProperties.js */ 39647);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
/* harmony import */ var _components_markdown_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/components/markdown-editor */ 39517);
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./index.less?modules */ 43809);
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ 59301);
|
|
/* harmony import */ var _components_RenderHtml__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/components/RenderHtml */ 95028);
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
var _excluded = ["value", "onChange", "scrollId"];
|
|
|
|
|
|
|
|
|
|
|
|
var MdEditorInForm = function MdEditorInForm(_ref) {
|
|
var value = _ref.value,
|
|
_onChange = _ref.onChange,
|
|
scrollId = _ref.scrollId,
|
|
props = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_1___default()(_ref, _excluded);
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", {
|
|
id: scrollId || '',
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_components_markdown_editor__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, props), {}, {
|
|
// hidetoolBar
|
|
defaultValue: value,
|
|
onChange: function onChange(a, b) {
|
|
console.log("a:", a, b);
|
|
if (!!(b !== null && b !== void 0 && b.length)) _onChange(a, b);else _onChange(a);
|
|
}
|
|
}))
|
|
});
|
|
};
|
|
var RegularInput = function RegularInput(_ref2) {
|
|
var value = _ref2.value,
|
|
onChange = _ref2.onChange,
|
|
placeholder = _ref2.placeholder,
|
|
_ref2$height = _ref2.height,
|
|
height = _ref2$height === void 0 ? 140 : _ref2$height,
|
|
isEdit = _ref2.isEdit;
|
|
return isEdit ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_components_markdown_editor__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
|
|
watch: true,
|
|
isFocus: true,
|
|
height: height,
|
|
placeholder: placeholder,
|
|
defaultValue: value,
|
|
onChange: onChange
|
|
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", {
|
|
style: {
|
|
cursor: 'pointer'
|
|
},
|
|
children: value ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_components_RenderHtml__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.inputBorder,
|
|
value: value
|
|
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", {
|
|
className: "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.inputBorder, " ").concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.placeholder),
|
|
children: placeholder
|
|
})
|
|
});
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 416:
|
|
/*!*********************************************************!*\
|
|
!*** ./src/components/tpi-code-setting/CodeSetting.tsx ***!
|
|
\*********************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
|
|
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.less */ 38476);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! antd */ 57809);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd */ 78673);
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Option = antd__WEBPACK_IMPORTED_MODULE_3__["default"].Option;
|
|
/* harmony default export */ __webpack_exports__.Z = (function (_ref) {
|
|
var isTheoretical = _ref.isTheoretical,
|
|
onFontSizeChange = _ref.onFontSizeChange,
|
|
cmFontSize = _ref.cmFontSize,
|
|
cmCodeMode = _ref.cmCodeMode,
|
|
autoFormat = _ref.autoFormat,
|
|
onCodeModeChange = _ref.onCodeModeChange,
|
|
onTabToSpace = _ref.onTabToSpace,
|
|
onAutoFormat = _ref.onAutoFormat,
|
|
formatDocument = _ref.formatDocument,
|
|
_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_2__.jsxs)("div", {
|
|
className: "tpi-code-setting ".concat(className),
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("h3", {
|
|
children: "\u4EE3\u7801\u683C\u5F0F"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("section", {
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("b", {
|
|
children: "\u663E\u793A\u6A21\u5F0F"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_3__["default"], {
|
|
bordered: false,
|
|
size: "small",
|
|
value: cmCodeMode,
|
|
onChange: onCodeModeChange,
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Option, {
|
|
value: 'vs',
|
|
children: "\u767D\u8272\u80CC\u666F"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Option, {
|
|
value: 'vs-dark',
|
|
children: "\u9ED1\u8272\u80CC\u666F"
|
|
})]
|
|
})]
|
|
}), !isTheoretical && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.Fragment, {
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("b", {
|
|
children: "\u5B57\u4F53\u5927\u5C0F"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_3__["default"], {
|
|
bordered: false,
|
|
size: "small",
|
|
value: cmFontSize,
|
|
onChange: onFontSizeChange,
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Option, {
|
|
value: 12,
|
|
children: "12px"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Option, {
|
|
value: 14,
|
|
children: "14px"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Option, {
|
|
value: 16,
|
|
children: "16px"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Option, {
|
|
value: 18,
|
|
children: "18px"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Option, {
|
|
value: 20,
|
|
children: "20px"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Option, {
|
|
value: 22,
|
|
children: "22px"
|
|
})]
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("b", {
|
|
children: "Tab\u8F6C\u6362"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(antd__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
|
|
checked: tabToSpace,
|
|
onChange: onTabToSpace
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", {
|
|
className: "file-item",
|
|
onClick: formatDocument,
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("b", {
|
|
style: {
|
|
cursor: "pointer"
|
|
},
|
|
children: "\u683C\u5F0F\u5316\u4EE3\u7801"
|
|
})
|
|
})]
|
|
})]
|
|
}), !isTheoretical && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.Fragment, {
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("h3", {
|
|
children: "\u5FEB\u6377\u952E"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("section", {
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("b", {
|
|
children: "\u4FDD\u5B58\u4EE3\u7801"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span", {
|
|
children: "Ctrl + S"
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("b", {
|
|
children: "\u5524\u51FA\u5FEB\u6377\u952E\u5217\u8868"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span", {
|
|
children: "F1 / Alt + F1"
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("b", {
|
|
children: "\u5DE6\u53F3\u7F29\u8FDB"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span", {
|
|
children: "Ctrl + ]/["
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("b", {
|
|
children: "\u8DF3\u5230\u5339\u914D\u7684\u62EC\u53F7"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span", {
|
|
children: "Ctrl + Shift + \\"
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("b", {
|
|
children: "\u8F6C\u5230\u884C\u9996"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span", {
|
|
children: "Home"
|
|
})]
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", {
|
|
className: "file-item",
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("b", {
|
|
children: "\u8F6C\u5230\u884C\u5C3E"
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span", {
|
|
children: "End"
|
|
})]
|
|
})]
|
|
}), children]
|
|
})]
|
|
});
|
|
});
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8399:
|
|
/*!*******************************************************************!*\
|
|
!*** ./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/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
|
|
var slicedToArray = __webpack_require__(79800);
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__(82242);
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/drawer/index.js + 9 modules
|
|
var drawer = __webpack_require__(43428);
|
|
// EXTERNAL MODULE: ./src/components/monaco-editor/index.jsx + 3 modules
|
|
var monaco_editor = __webpack_require__(72355);
|
|
// EXTERNAL MODULE: ./src/components/tpi-code-setting/CodeSetting.tsx
|
|
var CodeSetting = __webpack_require__(416);
|
|
// EXTERNAL MODULE: ./src/components/modal.tsx
|
|
var modal = __webpack_require__(18766);
|
|
// EXTERNAL MODULE: ./src/utils/urlTool.ts
|
|
var urlTool = __webpack_require__(77587);
|
|
;// CONCATENATED MODULE: ./src/pages/Problems/OjForm/CodePanel/index.less
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
;// 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 = /*#__PURE__*/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";
|
|
return 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_17_0_2_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_17_0_2_react.useRef)();
|
|
var valueRef = (0,_react_17_0_2_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_17_0_2_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, {
|
|
rootClassName: "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"
|
|
})
|
|
})]
|
|
});
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4141:
|
|
/*!**************************************************************************!*\
|
|
!*** ./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/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
|
|
var slicedToArray = __webpack_require__(79800);
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__(82242);
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/drawer/index.js + 9 modules
|
|
var drawer = __webpack_require__(43428);
|
|
// EXTERNAL MODULE: ./src/components/monaco-editor/index.jsx + 3 modules
|
|
var monaco_editor = __webpack_require__(72355);
|
|
// EXTERNAL MODULE: ./src/components/tpi-code-setting/CodeSetting.tsx
|
|
var CodeSetting = __webpack_require__(416);
|
|
// EXTERNAL MODULE: ./src/components/modal.tsx
|
|
var modal = __webpack_require__(18766);
|
|
// EXTERNAL MODULE: ./src/utils/urlTool.ts
|
|
var urlTool = __webpack_require__(77587);
|
|
;// 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@4.17.21@lodash/lodash.js
|
|
var lodash = __webpack_require__(89392);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
;// 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 = /*#__PURE__*/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";
|
|
return 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_17_0_2_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_17_0_2_react.useState)('c'),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
language = _useState2[0],
|
|
setLanguage = _useState2[1];
|
|
var saveLanguageItems = (0,_react_17_0_2_react.useRef)([]);
|
|
(0,_react_17_0_2_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 || (_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_17_0_2_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, {
|
|
rootClassName: "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"
|
|
})
|
|
})]
|
|
});
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 44544:
|
|
/*!**********************************************!*\
|
|
!*** ./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 */ 58181);
|
|
|
|
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
|
|
});
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 61497:
|
|
/*!********************************************!*\
|
|
!*** ./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_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/defineProperty.js */ 85573);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! antd */ 57809);
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ 59301);
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
|
var Option = antd__WEBPACK_IMPORTED_MODULE_3__["default"].Option;
|
|
var Keys = /*#__PURE__*/function (Keys) {
|
|
Keys[Keys["language"] = 0] = "language";
|
|
Keys[Keys["difficult"] = 1] = "difficult";
|
|
Keys[Keys["category"] = 2] = "category";
|
|
Keys[Keys["openOrNot"] = 3] = "openOrNot";
|
|
return Keys;
|
|
}({});
|
|
var Options = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_0___default()({}, 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'
|
|
}]), Keys.difficult, [{
|
|
title: '简单',
|
|
key: 1
|
|
}, {
|
|
title: '中等',
|
|
key: 2
|
|
}, {
|
|
title: '困难',
|
|
key: 3
|
|
}]), Keys.category, [{
|
|
title: '程序设计',
|
|
key: 1
|
|
}, {
|
|
title: '算法',
|
|
key: 2
|
|
}]), Keys.openOrNot, [{
|
|
title: '公开',
|
|
key: 1
|
|
}, {
|
|
title: '私有',
|
|
key: 0
|
|
}]);
|
|
function getSelectOptions(name) {
|
|
return Options[name].map(function (item) {
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.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, []];
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 36808:
|
|
/*!***************************!*\
|
|
!*** ./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 = /*#__PURE__*/function (PageType) {
|
|
PageType["FirstPage"] = "firstPage";
|
|
PageType["PrevPage"] = "prevPage";
|
|
PageType["NextPage"] = "nextPage";
|
|
return PageType;
|
|
}({});
|
|
var QuestionType = /*#__PURE__*/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";
|
|
return QuestionType;
|
|
}({});
|
|
|
|
/***/ }),
|
|
|
|
/***/ 77587:
|
|
/*!******************************!*\
|
|
!*** ./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 */ 7062);
|
|
/* 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];
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 43809:
|
|
/*!**********************************************************!*\
|
|
!*** ./src/components/QuestionEditor/index.less?modules ***!
|
|
\**********************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__) {
|
|
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ __webpack_exports__.Z = ({"wrap":"wrap___ilWvf","deleteIcon":"deleteIcon___JBDG8","keywordTag":"keywordTag___iieCb","questionTitleEditorWrap":"questionTitleEditorWrap___MHB5s","choiceWrap":"choiceWrap___QFkTc","choiceIndex":"choiceIndex___Mr2YO","judgementIndex":"judgementIndex___fUVWK","setAnswerBtn":"setAnswerBtn___Whox5","activeAnswer":"activeAnswer___fGU6Y","activeJudgementAnswer":"activeJudgementAnswer___wJv8P","actionWrapper":"actionWrapper___ERQ7k","addIcon":"addIcon___L9TE0","inputBorder":"inputBorder___Q5tRE","placeholder":"placeholder___p9sFY","blankWrapper":"blankWrapper___nC45e","blankInput":"blankInput___pEHsx","blankInputNumberWrapper":"blankInputNumberWrapper___uEHb0","addBtn":"addBtn___WR5ZI","blankIndex":"blankIndex___x9Pny","baseInputWrapper":"baseInputWrapper___eVsG7","collapseWrapper":"collapseWrapper___ZTysU","panelHeader":"panelHeader___QSN9g","open":"open___B6FU9","close":"close___QX19r","hide":"hide___mn25n"});
|
|
|
|
/***/ }),
|
|
|
|
/***/ 38476:
|
|
/*!****************************************************!*\
|
|
!*** ./src/components/tpi-code-setting/index.less ***!
|
|
\****************************************************/
|
|
/***/ (function() {
|
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |