You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__Paths__Detail__Answer__i...

5197 lines
252 KiB

This file contains ambiguous Unicode characters!

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

"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[68999],{
/***/ 3148:
/*!*******************************************************************************************************************!*\
!*** ./node_modules/_@ant-design_icons@5.4.0@@ant-design/icons/es/icons/ExclamationCircleOutlined.js + 1 modules ***!
\*******************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ icons_ExclamationCircleOutlined; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.25.4@@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__(74932);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.4.2@@ant-design/icons-svg/es/asn/ExclamationCircleOutlined.js
// This icon file is generated automatically.
var ExclamationCircleOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z" } }] }, "name": "exclamation-circle", "theme": "outlined" };
/* harmony default export */ var asn_ExclamationCircleOutlined = (ExclamationCircleOutlined);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.4.0@@ant-design/icons/es/components/AntdIcon.js + 3 modules
var AntdIcon = __webpack_require__(1393);
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons@5.4.0@@ant-design/icons/es/icons/ExclamationCircleOutlined.js
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
var ExclamationCircleOutlined_ExclamationCircleOutlined = function ExclamationCircleOutlined(props, ref) {
return /*#__PURE__*/_react_17_0_2_react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
ref: ref,
icon: asn_ExclamationCircleOutlined
}));
};
/**![exclamation-circle](data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNjYWNhY2EiIHZpZXdCb3g9IjY0IDY0IDg5NiA4OTYiIGZvY3VzYWJsZT0iZmFsc2UiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTUxMiA2NEMyNjQuNiA2NCA2NCAyNjQuNiA2NCA1MTJzMjAwLjYgNDQ4IDQ0OCA0NDggNDQ4LTIwMC42IDQ0OC00NDhTNzU5LjQgNjQgNTEyIDY0em0wIDgyMGMtMjA1LjQgMC0zNzItMTY2LjYtMzcyLTM3MnMxNjYuNi0zNzIgMzcyLTM3MiAzNzIgMTY2LjYgMzcyIDM3Mi0xNjYuNiAzNzItMzcyIDM3MnoiIC8+PHBhdGggZD0iTTQ2NCA2ODhhNDggNDggMCAxMDk2IDAgNDggNDggMCAxMC05NiAwem0yNC0xMTJoNDhjNC40IDAgOC0zLjYgOC04VjI5NmMwLTQuNC0zLjYtOC04LThoLTQ4Yy00LjQgMC04IDMuNi04IDh2MjcyYzAgNC40IDMuNiA4IDggOHoiIC8+PC9zdmc+) */
var RefIcon = /*#__PURE__*/_react_17_0_2_react.forwardRef(ExclamationCircleOutlined_ExclamationCircleOutlined);
if (false) {}
/* harmony default export */ var icons_ExclamationCircleOutlined = (RefIcon);
/***/ }),
/***/ 69458:
/*!**********************************************!*\
!*** ./src/components/AsyncButton/index.tsx ***!
\**********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Z: function() { return /* binding */ AsyncButton; }
/* harmony export */ });
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_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_test6_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_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js */ 7557);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js */ 41498);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js */ 79800);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectWithoutProperties.js */ 39647);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd */ 3113);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react */ 59301);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
var _excluded = ["children"];
var AsyncButton = function AsyncButton(_ref) {
var children = _ref.children,
props = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_4___default()(_ref, _excluded);
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(false),
_useState2 = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState, 2),
btnLoading = _useState2[0],
setBtnLoading = _useState2[1];
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP, _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, props), {}, {
loading: btnLoading,
onClick: ( /*#__PURE__*/function () {
var _ref2 = _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee(e) {
return _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.prev = 0;
setBtnLoading(true);
_context.next = 4;
return props.onClick(e);
case 4:
setBtnLoading(false);
_context.next = 11;
break;
case 7:
_context.prev = 7;
_context.t0 = _context["catch"](0);
console.error(_context.t0);
setBtnLoading(false);
case 11:
case "end":
return _context.stop();
}
}, _callee, null, [[0, 7]]);
}));
return function (_x) {
return _ref2.apply(this, arguments);
};
}()),
children: children
}));
};
/***/ }),
/***/ 53968:
/*!****************************************!*\
!*** ./src/components/Hooks/index.tsx ***!
\****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ y: function() { return /* binding */ useDisableAction; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
var useDisableAction = function useDisableAction(disable) {
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
if (disable) {
var handleKeyDown = function handleKeyDown(event) {
if (event.key === "F12") {
event.preventDefault();
// 执行你的自定义行为
console.log('F12被禁用');
}
};
var handleContextmenu = function handleContextmenu(event) {
event.preventDefault();
};
document.addEventListener("keydown", handleKeyDown);
document.addEventListener("contextmenu", handleContextmenu);
return function () {
document.removeEventListener("keydown", handleKeyDown);
document.removeEventListener("contextmenu", handleContextmenu);
};
}
}, [disable]);
};
/***/ }),
/***/ 32525:
/*!******************************************************!*\
!*** ./src/components/Spinner/index.tsx + 1 modules ***!
\******************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ Spinner; }
});
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
var _umi_production_exports = __webpack_require__(33936);
;// CONCATENATED MODULE: ./src/components/Spinner/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var Spinnermodules = ({"ldsRing":"ldsRing___mpBZC","idsRingWrapper":"idsRingWrapper___Of9_n","ldsring":"ldsring___o0w2t"});
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/components/Spinner/index.tsx
/* harmony default export */ var Spinner = (function (_ref) {
var message = _ref.message,
className = _ref.className,
children = _ref.children,
_ref$style = _ref.style,
style = _ref$style === void 0 ? {} : _ref$style;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "".concat(Spinnermodules.idsRingWrapper, " ").concat(className),
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Spinnermodules.ldsRing,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {})]
}), message ? /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
style: style,
children: message
}) : null, /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Outlet, {})]
});
});
/***/ }),
/***/ 38925:
/*!*****************************************************************!*\
!*** ./src/pages/MyProblem/TestCasePanel/index.tsx + 1 modules ***!
\*****************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Y4: function() { return /* binding */ DetailCommitOut; },
Im: function() { return /* binding */ ExecuteDict; },
ZP: function() { return /* binding */ TestCasePanel; }
});
// UNUSED EXPORTS: getCommitOut
// 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/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/objectSpread2.js
var objectSpread2 = __webpack_require__(82242);
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/defineProperty.js
var defineProperty = __webpack_require__(85573);
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
var input = __webpack_require__(24650);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
var es_button = __webpack_require__(3113);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.4.0@@ant-design/icons/es/icons/DownOutlined.js + 1 modules
var DownOutlined = __webpack_require__(46952);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.4.0@@ant-design/icons/es/icons/UpOutlined.js + 1 modules
var UpOutlined = __webpack_require__(80836);
// EXTERNAL MODULE: ./src/pages/MyProblem/interface.ts
var MyProblem_interface = __webpack_require__(19995);
// EXTERNAL MODULE: ./node_modules/_js-base64@2.6.4@js-base64/base64.js
var base64 = __webpack_require__(24334);
;// CONCATENATED MODULE: ./src/pages/MyProblem/TestCasePanel/index.less
// extracted by mini-css-extract-plugin
// EXTERNAL MODULE: ./src/components/Spinner/index.tsx + 1 modules
var Spinner = __webpack_require__(32525);
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx
var RenderHtml = __webpack_require__(8292);
// EXTERNAL MODULE: ./src/utils/util.tsx
var util = __webpack_require__(16739);
// EXTERNAL MODULE: ./node_modules/_xterm@4.8.1@xterm/lib/xterm.js
var xterm = __webpack_require__(34376);
// EXTERNAL MODULE: ./src/utils/fetch.ts
var utils_fetch = __webpack_require__(67444);
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
var _umi_production_exports = __webpack_require__(33936);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/pages/MyProblem/TestCasePanel/index.tsx
var TextArea = input/* default */.Z.TextArea;
var initialState = {
visible: false,
tabIndex: '0'
};
var ExecuteDict = defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()({}, MyProblem_interface/* ExecuteStatus */.h.NOMATCH, '测试用例结果不匹配'), MyProblem_interface/* ExecuteStatus */.h.OK, '调试通过'), 2, '调试超时'), 3, '调试pod失败'), 4, '编译失败'), 5, '执行失败');
var Types = /*#__PURE__*/function (Types) {
Types[Types["SET_VISIBLE"] = 0] = "SET_VISIBLE";
Types[Types["SET_TABINDEX"] = 1] = "SET_TABINDEX";
return Types;
}(Types || {});
function Reducer(state, action) {
switch (action.type) {
case Types.SET_VISIBLE:
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
visible: action.payload
});
case Types.SET_TABINDEX:
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
tabIndex: action.payload
});
default:
throw new Error();
}
}
function DetailCommitOut(debugResult) {
var status = debugResult.status,
error_msg = debugResult.error_msg,
output = debugResult.output,
input = debugResult.input,
expected_output = debugResult.expected_output,
is_file = debugResult.is_file,
input_file_url = debugResult.input_file_url,
output_file_url = debugResult.output_file_url,
expected_output_file_url = debugResult.expected_output_file_url,
setMonacoValue = debugResult.setMonacoValue,
setData = debugResult.setData;
var outputRef = (0,_react_17_0_2_react.useRef)();
var inputRef = (0,_react_17_0_2_react.useRef)();
var expectedOutputRef = (0,_react_17_0_2_react.useRef)();
var rs = null;
var mdStyle = {
minHeight: 150,
marginBottom: 10,
paddingLeft: 24,
background: '#070f19',
color: '#fff'
};
(0,_react_17_0_2_react.useEffect)(function () {
if (output && !is_file && outputRef.current) {
var term = new xterm.Terminal({
fontSize: 14,
letterSpacing: 1,
cols: 83,
rows: 10
});
term.open(outputRef.current);
var actual_output_format = (0,util/* findEndWhitespace */.pp)(base64.Base64.decode(output));
term.write(actual_output_format);
term.setOption('theme', {
background: '#1e1e1e'
});
}
if (input && !is_file && inputRef.current) {
var term2 = new xterm.Terminal({
fontSize: 14,
letterSpacing: 1,
cols: 83,
rows: 10
});
term2.open(inputRef.current);
term2.write((0,util/* findEndWhitespace */.pp)(input));
term2.setOption('theme', {
background: '#1e1e1e'
});
}
if (expected_output && !is_file && expectedOutputRef.current) {
var term3 = new xterm.Terminal({
fontSize: 14,
letterSpacing: 1,
cols: 83,
rows: 10
});
term3.open(expectedOutputRef.current);
term3.write((0,util/* findEndWhitespace */.pp)(base64.Base64.decode(expected_output)));
term3.setOption('theme', {
background: '#1e1e1e'
});
}
}, [output]);
switch (status) {
case MyProblem_interface/* ExecuteStatus */.h.NOMATCH:
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
className: "c-red",
children: "\u5B9E\u9645\u8F93\u5165\uFF1A"
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
ref: inputRef
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: mdStyle,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
// href={input_file_url}
style: {
fontSize: '16px'
},
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return fetch(input_file_url, {
method: "Get",
headers: {
"Content-Type": "application/octet-stream",
"Accept": "*/*"
}
});
case 2:
res = _context.sent;
_context.t0 = setMonacoValue;
_context.next = 6;
return res.text();
case 6:
_context.t1 = _context.sent;
(0, _context.t0)(_context.t1);
setTimeout(function () {
setData(input_file_url);
}, 200);
// download(input_file_url, input)
case 9:
case "end":
return _context.stop();
}
}, _callee);
}))
// download={expected_output}
// target="_blank"
,
children: input
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
className: "c-red",
children: "\u5B9E\u9645\u8F93\u51FA\uFF1A"
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
ref: outputRef
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: mdStyle,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
// href={output_file_url}
style: {
fontSize: '16px'
},
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
var res;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return (0,utils_fetch/* default */.ZP)(output_file_url, {
method: "Get",
headers: {
"Content-Type": "application/xml",
"Accept": "*/*"
}
});
case 2:
res = _context2.sent;
setMonacoValue(res);
setTimeout(function () {
setData(output_file_url);
}, 200);
// download(output_file_url, output)
case 5:
case "end":
return _context2.stop();
}
}, _callee2);
}))
// download={expected_output} target="_blank"
,
children: output
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
className: "c-red",
children: "\u9884\u671F\u8F93\u51FA\uFF1A"
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
ref: expectedOutputRef
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: mdStyle,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
// href={expected_output_file_url}
style: {
fontSize: '16px'
},
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
var res;
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return fetch(expected_output_file_url, {
method: "Get",
headers: {
"Content-Type": "application/octet-stream",
"Accept": "*/*"
}
});
case 2:
res = _context3.sent;
_context3.t0 = setMonacoValue;
_context3.next = 6;
return res.text();
case 6:
_context3.t1 = _context3.sent;
(0, _context3.t0)(_context3.t1);
setTimeout(function () {
setData(expected_output_file_url);
}, 200);
case 9:
case "end":
return _context3.stop();
}
}, _callee3);
}))
// download={expected_output} target="_blank"
,
children: expected_output
})
})]
});
break;
case MyProblem_interface/* ExecuteStatus */.h.EXECUTEFAILURE:
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
border: '1px #F6F7F9 solid'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
style: {
width: '100%',
height: 40,
background: '#F6F7F9',
lineHeight: '40px',
color: "#666666",
paddingLeft: '12px'
},
children: "\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: input,
style: mdStyle
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: mdStyle,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
// href={input_file_url} style={{fontSize:'16px'}} target="_blank"
onClick: function onClick() {
return (0,util/* download */.LR)(input_file_url, input);
},
children: input
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
border: '1px #F6F7F9 solid',
marginTop: '10px'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
style: {
width: '100%',
height: 40,
background: '#F6F7F9',
lineHeight: '40px',
color: "#666666",
paddingLeft: '12px'
},
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("pre", {
className: "error",
style: {
color: '#E30000',
padding: '0 10px'
},
children: [base64.Base64.decode(error_msg), "111"]
})]
})]
});
break;
case MyProblem_interface/* ExecuteStatus */.h.COMPILEFAILURE:
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
ref: inputRef
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: mdStyle,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
// href={input_file_url} style={{fontSize:'16px'}} target="_blank"
onClick: function onClick() {
return (0,util/* download */.LR)(input_file_url, input);
},
children: input
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
className: "error",
children: base64.Base64.decode(error_msg)
})]
});
break;
case MyProblem_interface/* ExecuteStatus */.h.PODFAILURE:
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
});
break;
case MyProblem_interface/* ExecuteStatus */.h.TIMEOUT:
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
});
break;
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [" ", rs, " "]
});
}
function getCommitOut(debugResult) {
var status = debugResult.status,
error_msg = debugResult.error_msg,
execute_time = debugResult.execute_time,
output = debugResult.output,
input = debugResult.input,
expected_output = debugResult.expected_output,
is_file = debugResult.is_file,
input_file_url = debugResult.input_file_url,
output_file_url = debugResult.output_file_url,
expected_output_file_url = debugResult.expected_output_file_url;
var rs = null;
switch (status) {
case MyProblem_interface/* ExecuteStatus */.h.OK:
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
children: ["\u6267\u884C\u7528\u65F6\uFF1A", execute_time / 1000, "\u79D2"]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u6267\u884C\u7ED3\u679C\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
children: base64.Base64.decode(output)
})]
});
break;
case MyProblem_interface/* ExecuteStatus */.h.NOMATCH:
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
children: ["\u8F93\u5165\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
children: input
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
children: ["\u8F93\u51FA\uFF1A", output && base64.Base64.decode(output)]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
children: ["\u9884\u671F\u8F93\u51FA\uFF1A", expected_output && base64.Base64.decode(expected_output)]
})]
});
break;
case MyProblem_interface/* ExecuteStatus */.h.EXECUTEFAILURE:
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
children: ["\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
children: input
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
className: "error",
children: base64.Base64.decode(error_msg)
})]
});
break;
case MyProblem_interface/* ExecuteStatus */.h.COMPILEFAILURE:
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
children: ["\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
children: input
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
className: "error",
children: base64.Base64.decode(error_msg)
})]
});
break;
case MyProblem_interface/* ExecuteStatus */.h.PODFAILURE:
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
});
break;
case MyProblem_interface/* ExecuteStatus */.h.TIMEOUT:
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
});
break;
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [" ", rs, " "]
});
}
/* harmony default export */ var TestCasePanel = (function (_ref4) {
var input = _ref4.input,
debuging = _ref4.debuging,
submitting = _ref4.submitting,
executingMessage = _ref4.executingMessage,
debugResult = _ref4.debugResult,
onChangeInput = _ref4.onChangeInput,
onDebugCode = _ref4.onDebugCode,
onSubmitCode = _ref4.onSubmitCode,
hack = _ref4.hack,
user = _ref4.user;
var _useReducer = (0,_react_17_0_2_react.useReducer)(Reducer, initialState),
_useReducer2 = slicedToArray_default()(_useReducer, 2),
state = _useReducer2[0],
dispatch = _useReducer2[1];
var visible = state.visible,
tabIndex = state.tabIndex;
var _useSearchParams = (0,_umi_production_exports.useSearchParams)(),
_useSearchParams2 = slicedToArray_default()(_useSearchParams, 1),
searchParams = _useSearchParams2[0];
function onTabIndexChange(e) {
var id = e.target.id;
dispatch({
type: Types.SET_TABINDEX,
payload: id
});
}
function onTriggerCollapse() {
dispatch({
type: Types.SET_VISIBLE,
payload: !visible
});
}
var executeResult = (0,_react_17_0_2_react.useMemo)(function () {
if (debugResult) {
var status = debugResult.status;
return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
children: getCommitOut(debugResult)
});
}
return null;
}, [debugResult]);
function onDebug() {
dispatch({
type: Types.SET_VISIBLE,
payload: true
});
dispatch({
type: Types.SET_TABINDEX,
payload: '1'
});
onDebugCode();
}
var skip = /*#__PURE__*/function () {
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4(text) {
var res;
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
_context4.next = 2;
return (0,utils_fetch/* default */.ZP)("/api/problems/".concat(text, "/start.json"), {
method: 'get',
params: {
hack_user_id: user === null || user === void 0 ? void 0 : user.user_id
}
});
case 2:
res = _context4.sent;
if (res) {
window.location.href = "/myproblems/".concat(res === null || res === void 0 ? void 0 : res.identifier, "?type=1");
}
case 4:
case "end":
return _context4.stop();
}
}, _callee4);
}));
return function skip(_x) {
return _ref5.apply(this, arguments);
};
}();
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "test-case-panel",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "test-case-panel-body ".concat(visible ? 'active' : ''),
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
className: "s-navs",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
className: tabIndex === '0' ? 'active' : '',
id: "0",
onClick: onTabIndexChange,
children: "\u81EA\u5B9A\u4E49\u6D4B\u8BD5\u7528\u4F8B"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
className: tabIndex === '1' ? 'active' : '',
id: "1",
onClick: onTabIndexChange,
children: "\u4EE3\u7801\u6267\u884C\u7ED3\u679C"
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "tab-panel-body ".concat(tabIndex === '0' ? '' : 'hide'),
children: /*#__PURE__*/(0,jsx_runtime.jsx)(TextArea, {
placeholder: "\u8BF7\u586B\u5199\u6D4B\u8BD5\u7528\u4F8B\u7684\u8F93\u5165\u503C\uFF0C\u70B9\u51FB\u201C\u8C03\u8BD5\u4EE3\u7801\u201D",
value: input,
onChange: onChangeInput
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "tab-panel-body ".concat(tabIndex === '1' ? '' : 'hide'),
children: debuging ? /*#__PURE__*/(0,jsx_runtime.jsx)(Spinner/* default */.Z, {
message: executingMessage
}) : debugResult ? /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
style: {
height: 200
},
children: [" ", executeResult, " "]
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
className: "tip",
children: "\u8BF7\u586B\u5199\u6D4B\u8BD5\u7528\u4F8B\u7684\u8F93\u5165\u503C\uFF0C\u70B9\u51FB\u201C\u8C03\u8BD5\u4EE3\u7801\u201D"
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
className: "btn-collapse ".concat(visible ? 'up' : ''),
onClick: onTriggerCollapse,
children: visible ? /*#__PURE__*/(0,jsx_runtime.jsx)(DownOutlined/* default */.Z, {}) : /*#__PURE__*/(0,jsx_runtime.jsx)(UpOutlined/* default */.Z, {})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("footer", {
className: "footer",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u63A7\u5236\u53F0"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "flex-container",
children: [(hack === null || hack === void 0 ? void 0 : hack.is_program) && (hack === null || hack === void 0 ? void 0 : hack.above_question) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
onClick: function onClick() {
return skip(hack === null || hack === void 0 ? void 0 : hack.above_question);
},
id: "oj-prev",
className: "btn-blue",
type: "ghost",
children: "\u4E0A\u4E00\u9898"
}), (hack === null || hack === void 0 ? void 0 : hack.is_program) && (hack === null || hack === void 0 ? void 0 : hack.under_question) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
onClick: function onClick() {
return skip(hack === null || hack === void 0 ? void 0 : hack.under_question);
},
id: "oj-next",
className: "btn-blue",
type: "ghost",
children: "\u4E0B\u4E00\u9898"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: "btn-green",
type: "ghost",
loading: debuging,
onClick: onDebug,
children: "\u8C03\u8BD5\u4EE3\u7801"
}), searchParams.get("qtype") !== '8' && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "primary",
className: "custom-ant-disabled",
loading: submitting,
disabled: submitting,
onClick: function onClick() {
dispatch({
type: Types.SET_VISIBLE,
payload: false
});
// dispatch({
// type: Types.SET_TABINDEX,
// payload: '1'
// })
onSubmitCode();
},
children: "\u8BC4\u6D4B\u5E76\u63D0\u4EA4"
})]
})]
})]
});
});
/***/ }),
/***/ 19995:
/*!******************************************!*\
!*** ./src/pages/MyProblem/interface.ts ***!
\******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ h: function() { return /* binding */ ExecuteStatus; }
/* harmony export */ });
// created_at: "2020-07-09T19:53:54.000+08:00"
// execute_memory: null
// execute_time: 0.269
// id: 872
// language: "C"
// status: 4
var ExecuteStatus = /*#__PURE__*/function (ExecuteStatus) {
ExecuteStatus[ExecuteStatus["NOMATCH"] = -1] = "NOMATCH";
ExecuteStatus[ExecuteStatus["OK"] = 0] = "OK";
ExecuteStatus[ExecuteStatus["TIMEOUT"] = 2] = "TIMEOUT";
ExecuteStatus[ExecuteStatus["PODFAILURE"] = 3] = "PODFAILURE";
ExecuteStatus[ExecuteStatus["COMPILEFAILURE"] = 4] = "COMPILEFAILURE";
ExecuteStatus[ExecuteStatus["EXECUTEFAILURE"] = 5] = "EXECUTEFAILURE";
return ExecuteStatus;
}({});
// "id": "1",
// "status": 2, # -1测试用例结果不匹配; 0: 评测通过; ;2 评测超时;3 创建pod失败; 4 编译失败;5 执行失败
// "error_line": 3, # 错误行数
// "error_msg": "error line 7 input.." , # 报错信息
// "input": "3 4", # 输入
// "output": "7", # 输出
// "execute_time": 3, #执行时间
// "execute_memory": 300, #消耗内存
// "expected_output": "7" # 如果提交模式 会多这个参数
/***/ }),
/***/ 90878:
/*!****************************************!*\
!*** ./src/pages/MyProblem/service.ts ***!
\****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ H7: function() { return /* binding */ resetCode; },
/* harmony export */ MK: function() { return /* binding */ addNotes; },
/* harmony export */ MU: function() { return /* binding */ debugCode; },
/* harmony export */ X6: function() { return /* binding */ getRecordDetail; },
/* harmony export */ bM: function() { return /* binding */ sumbitCode; },
/* harmony export */ fi: function() { return /* binding */ syncCode; },
/* harmony export */ fu: function() { return /* binding */ getProgrammingTopic; },
/* harmony export */ n4: function() { return /* binding */ updateCode; },
/* harmony export */ rX: function() { return /* binding */ getOperationResult; },
/* harmony export */ vl: function() { return /* binding */ triggerPlus; },
/* harmony export */ zO: function() { return /* binding */ getSubmitRecords; }
/* harmony export */ });
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test6_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_test6_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_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/utils/fetch.ts */ 67444);
function getProgrammingTopic(id, params) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .get */ .U2)("myproblems/".concat(id, ".json"), _root_workspace_ppte5yg23_local_v9_test6_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({
hidePopLogin: true
}, params || {}));
}
function sumbitCode(id, params) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/code_submit.json"), params);
}
function debugCode(id, params) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/code_debug.json"), params);
}
function getSubmitRecords(id, params) {
if (params.language) {
params.language = encodeURIComponent(params.language);
}
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .get */ .U2)("myproblems/".concat(id, "/submit_records.json"), params);
}
function getRecordDetail(id) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .get */ .U2)("myproblems/record_detail.json", {
id: id
});
}
function getOperationResult(id, mode) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .get */ .U2)("myproblems/".concat(id, "/result.json"), {
mode: mode
});
}
function addNotes(id, params) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/add_notes.json"), params);
}
function resetCode(id) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/restore_initial_code.json"));
}
function syncCode(id) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/sync_code.json"));
}
function updateCode(id, params) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/update_code.json"), params);
}
function triggerPlus(id, params) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("discusses/".concat(id, "/plus.json"), params);
}
/***/ }),
/***/ 89017:
/*!**************************************************************!*\
!*** ./src/pages/Paths/Detail/Answer/index.tsx + 15 modules ***!
\**************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ Detail_Answer; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectDestructuringEmpty.js
var objectDestructuringEmpty = __webpack_require__(70236);
var objectDestructuringEmpty_default = /*#__PURE__*/__webpack_require__.n(objectDestructuringEmpty);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
var objectSpread2 = __webpack_require__(82242);
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(7557);
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(41498);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/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/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectWithoutProperties.js
var objectWithoutProperties = __webpack_require__(39647);
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
var _umi_production_exports = __webpack_require__(33936);
// 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/message/index.js + 4 modules
var message = __webpack_require__(8591);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/radio/index.js + 5 modules
var es_radio = __webpack_require__(5112);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
var es_button = __webpack_require__(3113);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/checkbox/index.js + 3 modules
var es_checkbox = __webpack_require__(24905);
// 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/spin/index.js + 1 modules
var spin = __webpack_require__(71418);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/progress/index.js + 13 modules
var progress = __webpack_require__(93948);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tooltip/index.js + 3 modules
var tooltip = __webpack_require__(6848);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.4.0@@ant-design/icons/es/icons/MinusSquareOutlined.js + 1 modules
var MinusSquareOutlined = __webpack_require__(72311);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.4.0@@ant-design/icons/es/icons/PlusSquareOutlined.js + 1 modules
var PlusSquareOutlined = __webpack_require__(60765);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.4.0@@ant-design/icons/es/icons/ExclamationCircleOutlined.js + 1 modules
var ExclamationCircleOutlined = __webpack_require__(3148);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.25.4@@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__(74932);
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.4.2@@ant-design/icons-svg/es/asn/LogoutOutlined.js
// This icon file is generated automatically.
var LogoutOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M868 732h-70.3c-4.8 0-9.3 2.1-12.3 5.8-7 8.5-14.5 16.7-22.4 24.5a353.84 353.84 0 01-112.7 75.9A352.8 352.8 0 01512.4 866c-47.9 0-94.3-9.4-137.9-27.8a353.84 353.84 0 01-112.7-75.9 353.28 353.28 0 01-76-112.5C167.3 606.2 158 559.9 158 512s9.4-94.2 27.8-137.8c17.8-42.1 43.4-80 76-112.5s70.5-58.1 112.7-75.9c43.6-18.4 90-27.8 137.9-27.8 47.9 0 94.3 9.3 137.9 27.8 42.2 17.8 80.1 43.4 112.7 75.9 7.9 7.9 15.3 16.1 22.4 24.5 3 3.7 7.6 5.8 12.3 5.8H868c6.3 0 10.2-7 6.7-12.3C798 160.5 663.8 81.6 511.3 82 271.7 82.6 79.6 277.1 82 516.4 84.4 751.9 276.2 942 512.4 942c152.1 0 285.7-78.8 362.3-197.7 3.4-5.3-.4-12.3-6.7-12.3zm88.9-226.3L815 393.7c-5.3-4.2-13-.4-13 6.3v76H488c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h314v76c0 6.7 7.8 10.5 13 6.3l141.9-112a8 8 0 000-12.6z" } }] }, "name": "logout", "theme": "outlined" };
/* harmony default export */ var asn_LogoutOutlined = (LogoutOutlined);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.4.0@@ant-design/icons/es/components/AntdIcon.js + 3 modules
var AntdIcon = __webpack_require__(1393);
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons@5.4.0@@ant-design/icons/es/icons/LogoutOutlined.js
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
var LogoutOutlined_LogoutOutlined = function LogoutOutlined(props, ref) {
return /*#__PURE__*/_react_17_0_2_react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
ref: ref,
icon: asn_LogoutOutlined
}));
};
/**![logout](data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNjYWNhY2EiIHZpZXdCb3g9IjY0IDY0IDg5NiA4OTYiIGZvY3VzYWJsZT0iZmFsc2UiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTg2OCA3MzJoLTcwLjNjLTQuOCAwLTkuMyAyLjEtMTIuMyA1LjgtNyA4LjUtMTQuNSAxNi43LTIyLjQgMjQuNWEzNTMuODQgMzUzLjg0IDAgMDEtMTEyLjcgNzUuOUEzNTIuOCAzNTIuOCAwIDAxNTEyLjQgODY2Yy00Ny45IDAtOTQuMy05LjQtMTM3LjktMjcuOGEzNTMuODQgMzUzLjg0IDAgMDEtMTEyLjctNzUuOSAzNTMuMjggMzUzLjI4IDAgMDEtNzYtMTEyLjVDMTY3LjMgNjA2LjIgMTU4IDU1OS45IDE1OCA1MTJzOS40LTk0LjIgMjcuOC0xMzcuOGMxNy44LTQyLjEgNDMuNC04MCA3Ni0xMTIuNXM3MC41LTU4LjEgMTEyLjctNzUuOWM0My42LTE4LjQgOTAtMjcuOCAxMzcuOS0yNy44IDQ3LjkgMCA5NC4zIDkuMyAxMzcuOSAyNy44IDQyLjIgMTcuOCA4MC4xIDQzLjQgMTEyLjcgNzUuOSA3LjkgNy45IDE1LjMgMTYuMSAyMi40IDI0LjUgMyAzLjcgNy42IDUuOCAxMi4zIDUuOEg4NjhjNi4zIDAgMTAuMi03IDYuNy0xMi4zQzc5OCAxNjAuNSA2NjMuOCA4MS42IDUxMS4zIDgyIDI3MS43IDgyLjYgNzkuNiAyNzcuMSA4MiA1MTYuNCA4NC40IDc1MS45IDI3Ni4yIDk0MiA1MTIuNCA5NDJjMTUyLjEgMCAyODUuNy03OC44IDM2Mi4zLTE5Ny43IDMuNC01LjMtLjQtMTIuMy02LjctMTIuM3ptODguOS0yMjYuM0w4MTUgMzkzLjdjLTUuMy00LjItMTMtLjQtMTMgNi4zdjc2SDQ4OGMtNC40IDAtOCAzLjYtOCA4djU2YzAgNC40IDMuNiA4IDggOGgzMTR2NzZjMCA2LjcgNy44IDEwLjUgMTMgNi4zbDE0MS45LTExMmE4IDggMCAwMDAtMTIuNnoiIC8+PC9zdmc+) */
var RefIcon = /*#__PURE__*/_react_17_0_2_react.forwardRef(LogoutOutlined_LogoutOutlined);
if (false) {}
/* harmony default export */ var icons_LogoutOutlined = (RefIcon);
;// CONCATENATED MODULE: ./src/pages/Paths/Detail/Answer/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var Answermodules = ({"flex_box_center":"flex_box_center___oRroB","flex_space_between":"flex_space_between___EwZpo","flex_box_vertical_center":"flex_box_vertical_center___h0s2T","flex_box_center_end":"flex_box_center_end___u9oIy","flex_box_column":"flex_box_column___eWn0O","bg":"bg___d0evx","wrapper":"wrapper___XG7k8","exerciseAlert":"exerciseAlert___mmZ2f","title":"title___TwvsC","content":"content___ToimS","baseMargin":"baseMargin___pgt51","noWrap":"noWrap___USB5L","singleItem":"singleItem___DpTN1","questionIcons":"questionIcons___o5EXi","green":"green___RdbtB","orange":"orange___hAz9v","greenTip":"greenTip___FWmzA","redTip":"redTip___V8fkj","orangeTip":"orangeTip___WdAZU","pollDesc":"pollDesc___OMWEQ","answered":"answered___GMHdE","unanswer":"unanswer___Sdgip","anchor":"anchor___ykWPG","answerFlag":"answerFlag___uqPvZ","flagActive":"flagActive___eL7Gw","flagHalf":"flagHalf___qjjno","answerStudentFlag":"answerStudentFlag___dXP7Z","answerStudentActive":"answerStudentActive___cdsY4","questionItem":"questionItem___GLdn5","questionScore":"questionScore___Qe2Wf","itemType":"itemType___Fxaxa","itemFlag":"itemFlag___BOnUF","answerWrap":"answerWrap___l00IK","answerSubjective":"answerSubjective___mQ3vJ","otherInput":"otherInput___az3Al","submitButton":"submitButton___h0LsL","randomFlag":"randomFlag___Uqnrj","answerTrue":"answerTrue___X_sHN","answerFalse":"answerFalse___Q_tiD","answerHalf":"answerHalf___wKhZS","renderHtml":"renderHtml___zJDPV","simpleText":"simpleText___TIizh","answerYes":"answerYes___ls1Ow","answerNo":"answerNo___dJ25F","answerInfo":"answerInfo___O6CcX","answerProgress":"answerProgress____lbiz","answerSheetWrap":"answerSheetWrap___ImNC3","answerSheetQuestionTitle":"answerSheetQuestionTitle___tT_u1","answerSheet":"answerSheet___pTDxk","answerSheetItem":"answerSheetItem___yNJnx","qindex":"qindex___sqPo7","markIcon":"markIcon___FzWAZ","active":"active___cUK4F","partialActive":"partialActive___EPnJ1","selected":"selected___QFpb7","countDown":"countDown___Xm36I","cnText":"cnText___jmpxc","red":"red___vhTdA","refreshBtn":"refreshBtn___MU9IM","fold":"fold___c4A4d","cardList":"cardList___J8s0N","withQrcode":"withQrcode___B6Mpa","iframe":"iframe___I8TAS","eduTip":"eduTip___QZZkp","eduQrcode":"eduQrcode___O41E2","eduVideo":"eduVideo___AnwT7","eduUsername":"eduUsername___IIV4W","startAnswer":"startAnswer___UeVL4","eduSubmit":"eduSubmit___pUFQ_","eduTitle":"eduTitle___wAF48","wrpAnswer":"wrpAnswer___OVYaB","simpleMd":"simpleMd___EjMj2","videomodal":"videomodal___jheds","mainPart":"mainPart___e8Qpl","userInfoText":"userInfoText___Y_o8M","answerSheetBottom":"answerSheetBottom___P6mpG","tooltipWrap":"tooltipWrap___QyPZg","leftPart":"leftPart___er3Jw","rightPart":"rightPart___HH4jn","questionPart":"questionPart___UUs3M","questionTypeTitle":"questionTypeTitle___UPDLc","questionTypeInfo":"questionTypeInfo___DxkkU","toIframeBtn":"toIframeBtn___lDyBW","bottom":"bottom___vzCsQ","markBtn":"markBtn___eBNxS","changeButton":"changeButton___iIa_B","prevBtn":"prevBtn___NReo3","analysisWrap":"analysisWrap___qQ9JJ","greyBg":"greyBg___On0yQ","fixHeader":"fixHeader___Tuabq","exerciseTitle":"exerciseTitle___OXdrr","commitModal":"commitModal___Necyx","commitItem":"commitItem___ndc0Y","commitInfoLabel":"commitInfoLabel___z9MX8","commitInfoValue":"commitInfoValue___a86os","cameraHeader":"cameraHeader___pt6r7","dottedLineWrapper":"dottedLineWrapper___RyJk7","leftHalfCircle":"leftHalfCircle___PjJKc","dottedLine":"dottedLine___QUhUk","rightHalfCircle":"rightHalfCircle___Dkp6Z","orangeNum":"orangeNum___oyiWt","teachAnalysis":"teachAnalysis___ETB4N","teachAnalysisModal":"teachAnalysisModal___FZZUr"});
// EXTERNAL MODULE: ./src/utils/util.tsx
var util = __webpack_require__(16739);
// EXTERNAL MODULE: ./src/utils/authority.ts
var authority = __webpack_require__(30584);
// EXTERNAL MODULE: ./src/utils/fullscreen.ts
var fullscreen = __webpack_require__(10415);
// EXTERNAL MODULE: ./src/service/exercise.ts
var service_exercise = __webpack_require__(75278);
// EXTERNAL MODULE: ./src/service/shixuns.ts
var shixuns = __webpack_require__(83976);
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx
var RenderHtml = __webpack_require__(8292);
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 9 modules
var markdown_editor = __webpack_require__(5050);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/pages/Paths/Detail/Answer/components/Simple.tsx
var scoreStatusMapping = {
0: 'c-red-ee4',
1: 'c-green'
};
var Simple = function Simple(_ref) {
var _item$standard_answer, _answerData$exercise, _answerData$exercise2, _item$user_answer, _item$user_answer2, _item$tag_disciplines;
var item = _ref.item,
answerData = _ref.answerData,
isEducation = _ref.isEducation,
sign = _ref.sign,
showBtn = _ref.showBtn,
knowledgeDialog = _ref.knowledgeDialog,
setKnowledgeDialog = _ref.setKnowledgeDialog,
_ref$onBlur = _ref.onBlur,
onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur;
var value = (0,_react_17_0_2_react.useRef)("");
var _useState = (0,_react_17_0_2_react.useState)(),
_useState2 = slicedToArray_default()(_useState, 2),
isShow = _useState2[0],
setIsShow = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(false),
_useState4 = slicedToArray_default()(_useState3, 2),
isFocus = _useState4[0],
setIsFocus = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)(isEducation || false),
_useState6 = slicedToArray_default()(_useState5, 2),
showEditor = _useState6[0],
setShowEditor = _useState6[1];
var timeRef = (0,_react_17_0_2_react.useRef)();
var countDown = function countDown() {
clearInterval(timeRef.current);
timeRef.current = setInterval(function () {
if (isFocus) onBlur(value.current, true);
}, 10 * 1000);
};
var onBeforeunload = function onBeforeunload(e) {
onBlur(value.current);
var confirmationMessage = "确定离开此页面吗?此页数据可能会丢失";
(e || window.event).returnValue = confirmationMessage;
return confirmationMessage;
};
(0,_react_17_0_2_react.useEffect)(function () {
console.log("isFocus:", isFocus);
if (isFocus) {
// window.addEventListener('beforeunload', onBeforeunload)
countDown();
} else {
// window.removeEventListener('beforeunload', onBeforeunload)
}
}, [isFocus]);
(0,_react_17_0_2_react.useEffect)(function () {
setIsShow(item === null || item === void 0 ? void 0 : item.a_flag);
}, [item === null || item === void 0 ? void 0 : item.a_flag]);
(0,_react_17_0_2_react.useEffect)(function () {
return function () {
clearInterval(timeRef.current);
};
}, []);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [(item === null || item === void 0 || (_item$standard_answer = item.standard_answer) === null || _item$standard_answer === void 0 ? void 0 : _item$standard_answer.length) > 0 && ((item === null || item === void 0 ? void 0 : item.can_answer_num) == 0 || !showBtn || item !== null && item !== void 0 && item.user_answer_right) ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "mb20",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
justify: "space-between",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
style: {
marginBottom: 20
},
children: "\u6211\u7684\u7B54\u6848"
}), ((0,authority/* isAdmin */.GJ)() || (0,authority/* isStudent */.dE)() && (answerData === null || answerData === void 0 || (_answerData$exercise = answerData.exercise) === null || _answerData$exercise === void 0 ? void 0 : _answerData$exercise.user_exercise_status) > 0 && (answerData === null || answerData === void 0 || (_answerData$exercise2 = answerData.exercise) === null || _answerData$exercise2 === void 0 ? void 0 : _answerData$exercise2.open_score)) && /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
justify: "end",
className: "mb20",
align: "middle",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "font14",
style: {
color: '#6A7283'
},
children: "\u5F97\u5206"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: "font14 ml10",
children: [(item === null || item === void 0 ? void 0 : item.user_score) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: scoreStatusMapping[Number(item === null || item === void 0 ? void 0 : item.answer_status)] || 'c-orange-ff9',
children: item === null || item === void 0 ? void 0 : item.user_score
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
marginLeft: 5,
color: '#6A7283'
},
children: "\u5206"
})]
}), !(item !== null && item !== void 0 && item.user_score) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "c-red",
children: "\u672A\u8BC4"
})]
})]
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Answermodules.simpleText,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: item === null || item === void 0 || (_item$user_answer = item.user_answer) === null || _item$user_answer === void 0 ? void 0 : _item$user_answer[0],
style: {
color: item !== null && item !== void 0 && item.analysis ? item !== null && item !== void 0 && item.user_answer_right ? "rgb(41, 166, 79)" : "rgb(229, 51, 51)" : ''
}
})
})]
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: item !== null && item !== void 0 && item.standard_answer_show ? item !== null && item !== void 0 && item.user_answer_right ? "c-green" : "c-red" : '',
style: {
marginBottom: 14
},
children: showEditor ? /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z
// hidetoolBar={true}
// hidetoolBar={document.domain === "kepukehuan.educoder.net"}
// height={isEducation ? "60vh" : 150}
, {
watch: true,
isFocus: true,
defaultValue: item === null || item === void 0 || (_item$user_answer2 = item.user_answer) === null || _item$user_answer2 === void 0 ? void 0 : _item$user_answer2[0],
id: item === null || item === void 0 ? void 0 : item.question_id,
className: "mt20",
onChange: function onChange(v) {
value.current = v;
// setIsFocus(true)
setTimeout(function () {
onBlur(value.current);
}, 200);
clearInterval(timeRef.current);
setIsFocus(false);
}
// onBlur={() => {
// setTimeout(() => {
// onBlur(value.current);
// }, 200)
// clearInterval(timeRef.current);
// setIsFocus(false)
// }}
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
onClick: function onClick() {
var _item$user_answer3;
if (!item.repeat_answer && (item === null || item === void 0 || (_item$user_answer3 = item.user_answer) === null || _item$user_answer3 === void 0 ? void 0 : _item$user_answer3.length) > 0 && item.ques_status !== 0) {
message/* default */.ZP.warning('该题不允许再修改答案');
return;
}
// sign.current = true;
setShowEditor(true);
},
className: Answermodules.startAnswer,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "c-blue",
children: "\u70B9\u51FB\u5F00\u59CB\u4F5C\u7B54"
})
})
}), (item === null || item === void 0 ? void 0 : item.standard_answer) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
fontSize: '16px',
marginBottom: 14,
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center'
},
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: ["\u7B54\u9898\u7ED3\u679C", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
marginLeft: 12,
color: item !== null && item !== void 0 && item.user_answer_right ? '#29A64F' : '#E53333'
},
children: item !== null && item !== void 0 && item.user_answer_right ? "\u7B54\u5BF9\u4E86" : "\u7B54\u9519\u4E86"
})]
})
}), (item === null || item === void 0 ? void 0 : item.can_answer_num) > 0 && !(item !== null && item !== void 0 && item.user_answer_right) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
color: '#FF8C29',
marginBottom: 14
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ExclamationCircleOutlined/* default */.Z, {
style: {
marginRight: 10
}
}), "\u6E29\u99A8\u63D0\u793A\uFF1A\u8FD8\u6709 ", item === null || item === void 0 ? void 0 : item.can_answer_num, " \u6B21\u673A\u4F1A\u53EF\u5C1D\u8BD5\u8FDB\u884C\u91CD\u65B0\u7B54\u9898\uFF0C\u91CD\u65B0\u7B54\u9898\u6B63\u786E\u540E\u4E5F\u4F1A\u8BA1\u5165\u603B\u6210\u7EE9\u3002"]
}), ((item === null || item === void 0 ? void 0 : item.can_answer_num) == 0 || (item === null || item === void 0 ? void 0 : item.user_answer_right) || knowledgeDialog) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Answermodules.analysisWrap,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Answermodules.greyBg,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
className: "mb20",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
className: "font14 mr10",
style: {
color: '#6A7283',
lineHeight: '30px'
},
children: "\u3010\u7B54\u6848\u3011"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
style: {
fontSize: 16,
lineHeight: '30px'
},
children: item === null || item === void 0 ? void 0 : item.standard_answer[0]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "font14 mr10 mb20",
style: {
color: '#6A7283',
lineHeight: '30px'
},
children: "\u3010\u89E3\u6790\u3011"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: Answermodules.renderHtml,
value: item === null || item === void 0 ? void 0 : item.analysis
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "font14 mr10",
style: {
color: '#6A7283',
lineHeight: '30px'
},
children: "\u3010\u77E5\u8BC6\u70B9\u3011"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
style: {
fontSize: 16,
lineHeight: '30px'
},
children: item === null || item === void 0 || (_item$tag_disciplines = item.tag_disciplines) === null || _item$tag_disciplines === void 0 ? void 0 : _item$tag_disciplines.join("、")
})]
})]
})
})]
})]
});
};
/* harmony default export */ var components_Simple = (Simple);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
var input = __webpack_require__(24650);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/select/index.js
var es_select = __webpack_require__(57809);
;// CONCATENATED MODULE: ./src/pages/Paths/Detail/Answer/components/Simple2.tsx
var Simple2_Simple = function Simple(_ref) {
var _answerData$exercise, _item$user_answer, _item$user_answer2, _item$standard_answer;
var item = _ref.item,
answerData = _ref.answerData,
isEducation = _ref.isEducation,
_ref$onBlur = _ref.onBlur,
_onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur;
var value = (0,_react_17_0_2_react.useRef)("");
var _useState = (0,_react_17_0_2_react.useState)(),
_useState2 = slicedToArray_default()(_useState, 2),
isShow = _useState2[0],
setIsShow = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(false),
_useState4 = slicedToArray_default()(_useState3, 2),
isFull = _useState4[0],
setIsFull = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)(false),
_useState6 = slicedToArray_default()(_useState5, 2),
isFocus = _useState6[0],
setIsFocus = _useState6[1];
var _useState7 = (0,_react_17_0_2_react.useState)(isEducation || false),
_useState8 = slicedToArray_default()(_useState7, 2),
showEditor = _useState8[0],
setShowEditor = _useState8[1];
var _useState9 = (0,_react_17_0_2_react.useState)(0),
_useState10 = slicedToArray_default()(_useState9, 2),
update = _useState10[0],
setUpdate = _useState10[1];
var title = (0,_react_17_0_2_react.useRef)(item.kp_content || "");
var type = (0,_react_17_0_2_react.useRef)(item.kp_clazz);
var timeRef = (0,_react_17_0_2_react.useRef)();
var totalNum = (0,_react_17_0_2_react.useMemo)(function () {
var _value$current;
return (_value$current = value.current) === null || _value$current === void 0 || (_value$current = _value$current.replace(/[\n|\r|\t]/g, "")) === null || _value$current === void 0 ? void 0 : _value$current.length;
}, [value.current]);
var countDown = function countDown() {
clearInterval(timeRef.current);
timeRef.current = setInterval(function () {
if (isFocus) _onBlur(value.current, title.current, type.current);
}, 30 * 1000);
};
(0,_react_17_0_2_react.useEffect)(function () {
console.log("isFocus:", isFocus);
countDown();
}, [isFocus]);
(0,_react_17_0_2_react.useEffect)(function () {
setIsShow(item === null || item === void 0 ? void 0 : item.a_flag);
}, [item === null || item === void 0 ? void 0 : item.a_flag]);
(0,_react_17_0_2_react.useEffect)(function () {
return function () {
clearInterval(timeRef.current);
};
}, []);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [(answerData === null || answerData === void 0 || (_answerData$exercise = answerData.exercise) === null || _answerData$exercise === void 0 ? void 0 : _answerData$exercise.user_exercise_status) === 1 ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "mt30",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("strong", {
children: "\u4F5C\u6587\u9898\u76EE\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
disabled: true,
className: "mt10",
value: title.current,
onChange: function onChange(e) {
title.current = e.target.value;
setUpdate(update + 1);
},
onBlur: function onBlur() {
_onBlur(value.current, title.current, type.current);
setIsFocus(false);
}
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "mt30",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("strong", {
children: "\u4F5C\u54C1\u7C7B\u578B\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_select["default"], {
disabled: true,
className: "mt10 w100",
placeholder: "\u8BF7\u9009\u62E9\u4F5C\u54C1\u7C7B\u578B",
value: type.current,
onChange: function onChange(value) {
type.current = value;
setUpdate(update + 1);
},
onBlur: function onBlur() {
_onBlur(value.current, title.current, type.current);
setIsFocus(false);
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
value: "科普",
children: "\u79D1\u666E"
}, 1), /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
value: "科幻",
children: "\u79D1\u5E7B"
}, 2)]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
className: "mt10 mb0",
children: "\u4F5C\u54C1\u5185\u5BB9\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Answermodules.simpleText,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: item === null || item === void 0 || (_item$user_answer = item.user_answer) === null || _item$user_answer === void 0 ? void 0 : _item$user_answer[0]
})
})]
}) : /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "mt30",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("strong", {
children: "\u4F5C\u6587\u9898\u76EE\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
className: "mt10",
maxLength: 60,
onBlur: function onBlur() {
return _onBlur(value.current, title.current, type.current);
},
placeholder: "\u8BF7\u8F93\u5165\u4F5C\u6587\u9898\u76EE(\u6700\u591A60\u4E2A\u5B57)",
value: title.current,
onChange: function onChange(e) {
title.current = e.target.value;
setUpdate(update + 1);
}
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "mt30",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("strong", {
children: "\u4F5C\u6587\u7C7B\u578B\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_select["default"], {
className: "mt10 w100",
placeholder: "\u8BF7\u9009\u62E9\u4F5C\u54C1\u7C7B\u578B",
value: type.current,
onChange: function onChange(value) {
type.current = value;
_onBlur(value.current, title.current, type.current);
setUpdate(update + 1);
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
value: "科普",
children: "\u79D1\u666E"
}, 1), /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
value: "科幻",
children: "\u79D1\u5E7B"
}, 2)]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "mt30 mb20",
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: item !== null && item !== void 0 && item.standard_answer_show ? item !== null && item !== void 0 && item.user_answer_right ? "c-green" : "c-red" : '',
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("strong", {
children: "\u4F5C\u6587\u5185\u5BB9\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "mt10 relative",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: "c-blue",
style: {
position: isFull ? "fixed" : "absolute",
top: isFull ? 61 : 4,
left: 10,
zIndex: 106
},
children: ["\u5DF2\u8F93\u5165", totalNum, "\u5B57"]
}), showEditor ? /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
className: Answermodules.simpleMd,
disablePaste: true,
hidetoolBar: isEducation,
height: isEducation ? "60vh" : 150,
isFocus: true,
defaultValue: item === null || item === void 0 || (_item$user_answer2 = item.user_answer) === null || _item$user_answer2 === void 0 ? void 0 : _item$user_answer2[0],
id: item === null || item === void 0 ? void 0 : item.question_id,
onFullScreen: function onFullScreen(status) {
return setIsFull(status);
},
onChange: function onChange(v) {
value.current = v;
setIsFocus(true);
setUpdate(update + 1);
},
onBlur: function onBlur() {
_onBlur(value.current, title.current, type.current);
setIsFocus(false);
}
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
onClick: function onClick() {
return setShowEditor(true);
},
className: Answermodules.startAnswer,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "c-blue",
children: "\u70B9\u51FB\u5F00\u59CB\u4F5C\u7B54"
})
})]
})]
})
})]
}), (0,authority/* isStudent */.dE)() && (item === null || item === void 0 ? void 0 : item.standard_answer) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
className: "mt10 mb0",
children: "\u53C2\u8003\u7B54\u6848\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
border: "1px solid #eee",
background: "#f5f5f5",
borderRadius: 4,
padding: 5
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: item === null || item === void 0 || (_item$standard_answer = item.standard_answer) === null || _item$standard_answer === void 0 ? void 0 : _item$standard_answer[0]
})
})]
})]
});
};
/* harmony default export */ var Simple2 = (Simple2_Simple);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/anchor/index.js + 4 modules
var es_anchor = __webpack_require__(79817);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/table/index.js + 85 modules
var table = __webpack_require__(51945);
// EXTERNAL MODULE: ./node_modules/_dayjs@1.11.13@dayjs/dayjs.min.js
var dayjs_min = __webpack_require__(61186);
var dayjs_min_default = /*#__PURE__*/__webpack_require__.n(dayjs_min);
// EXTERNAL MODULE: ./src/components/monaco-editor/index.jsx + 3 modules
var monaco_editor = __webpack_require__(97704);
;// CONCATENATED MODULE: ./src/pages/Paths/Detail/Answer/components/UserScore/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var UserScoremodules = ({"score":"score___axubN","wrap":"wrap___h8CPy"});
;// CONCATENATED MODULE: ./src/pages/Paths/Detail/Answer/components/UserScore/index.tsx
var UserScore = function UserScore(_ref) {
var score = _ref.score;
return score ? /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: UserScoremodules.wrap,
children: ["\u5F97\u5206", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "".concat(UserScoremodules.score, " ml10 mr5"),
children: score
}), "\u5206"]
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "c-red",
children: "\u672A\u8BC4"
});
};
/* harmony default export */ var components_UserScore = (UserScore);
;// CONCATENATED MODULE: ./src/pages/Paths/Detail/Answer/components/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var componentsmodules = ({"flex_box_center":"flex_box_center___AzNE1","flex_space_between":"flex_space_between___rHC3Q","flex_box_vertical_center":"flex_box_vertical_center___gpKuR","flex_box_center_end":"flex_box_center_end___yll1U","flex_box_column":"flex_box_column___LDgHZ","shixunWrp":"shixunWrp___ypD7O","fill":"fill___YtkJ7","index":"index___FWafv","success":"success___mzJVr","fail":"fail___xUWI0","fillInput":"fillInput___X1glo","shixunWrapper":"shixunWrapper___U1REH","score":"score___MvJPc","name":"name___t4I2r","programWrapper":"programWrapper___dECgn","desc":"desc___ywbEo","content":"content___G7g9j","analysisWrap":"analysisWrap___gQVzK","greyBg":"greyBg___uVgPS"});
;// CONCATENATED MODULE: ./src/pages/Paths/Detail/Answer/components/Shixun.tsx
var Shixun_scoreStatusMapping = {
0: 'c-red-ee4',
1: 'c-green'
};
var Shixun = function Shixun(_ref) {
var _item$shixun, _item$shixun2, _answerData$exercise, _answerData$exercise2, _item$shixun3;
var item = _ref.item,
answerData = _ref.answerData,
exerciseId = _ref.exerciseId,
coursesId = _ref.coursesId;
var _useState = (0,_react_17_0_2_react.useState)([]),
_useState2 = slicedToArray_default()(_useState, 2),
data = _useState2[0],
setData = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)([]),
_useState4 = slicedToArray_default()(_useState3, 2),
challengeData = _useState4[0],
setChallengeData = _useState4[1];
(0,_react_17_0_2_react.useEffect)(function () {
var _item$shixun_details;
if (!(item !== null && item !== void 0 && (_item$shixun_details = item.shixun_details) !== null && _item$shixun_details !== void 0 && _item$shixun_details.length)) {
return;
}
var shixun = [];
var challenge = [];
var _loop = function _loop() {
var _item$shixun_details4;
for (var j = 0; j < (item === null || item === void 0 ? void 0 : item.shixun_details[i].stage_list.length); j++) {
var _item$shixun_details3;
var shixunItem = item === null || item === void 0 ? void 0 : item.shixun_details[i].stage_list[j];
shixun.push(objectSpread2_default()(objectSpread2_default()({}, shixunItem), {
operation: item === null || item === void 0 || (_item$shixun_details3 = item.shixun_details) === null || _item$shixun_details3 === void 0 || (_item$shixun_details3 = _item$shixun_details3[i]) === null || _item$shixun_details3 === void 0 || (_item$shixun_details3 = _item$shixun_details3.shixun_detail) === null || _item$shixun_details3 === void 0 || (_item$shixun_details3 = _item$shixun_details3[0]) === null || _item$shixun_details3 === void 0 ? void 0 : _item$shixun_details3.game_identifier,
is_jupyter: item === null || item === void 0 ? void 0 : item.is_jupyter,
is_jupyter_lab: item === null || item === void 0 ? void 0 : item.is_jupyter_lab
}));
}
if (item !== null && item !== void 0 && (_item$shixun_details4 = item.shixun_details) !== null && _item$shixun_details4 !== void 0 && (_item$shixun_details4 = _item$shixun_details4[i]) !== null && _item$shixun_details4 !== void 0 && _item$shixun_details4.shixun_detail) {
var _item$shixun_details5, _item$shixun_details$;
var finishedChallenge = item === null || item === void 0 || (_item$shixun_details5 = item.shixun_details) === null || _item$shixun_details5 === void 0 || (_item$shixun_details5 = _item$shixun_details5[i]) === null || _item$shixun_details5 === void 0 || (_item$shixun_details5 = _item$shixun_details5.shixun_detail) === null || _item$shixun_details5 === void 0 ? void 0 : _item$shixun_details5[0];
var userScore = item === null || item === void 0 || (_item$shixun_details$ = item.shixun_details[i].stage_list) === null || _item$shixun_details$ === void 0 || (_item$shixun_details$ = _item$shixun_details$.find(function (stageListItem) {
return (stageListItem === null || stageListItem === void 0 ? void 0 : stageListItem.game_identifier) === (finishedChallenge === null || finishedChallenge === void 0 ? void 0 : finishedChallenge.game_identifier);
})) === null || _item$shixun_details$ === void 0 ? void 0 : _item$shixun_details$.user_score;
challenge.push(objectSpread2_default()(objectSpread2_default()({}, finishedChallenge), {}, {
user_score: userScore
}));
}
};
for (var i = 0; i < (item === null || item === void 0 || (_item$shixun_details2 = item.shixun_details) === null || _item$shixun_details2 === void 0 ? void 0 : _item$shixun_details2.length); i++) {
var _item$shixun_details2;
_loop();
}
setChallengeData(challenge);
setData(shixun);
}, [item === null || item === void 0 ? void 0 : item.shixun_details]);
var columns = [{
title: "关卡",
dataIndex: "position",
key: "position",
align: 'center'
}, {
title: "任务名称",
dataIndex: "name",
key: "name",
align: 'center',
render: function render(name) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "overflowHidden1",
style: {
maxWidth: "400px"
},
title: name && name.length > 25 ? name : "",
children: name
});
}
}, {
title: "评测次数",
dataIndex: "evaluate_count",
key: "evaluate_count",
align: 'center',
render: function render(testCount, item) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: item.evaluate_count ? item.evaluate_count : /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "color-grey-9",
children: "--"
})
});
}
}, {
title: "完成时间",
key: "endTime",
dataIndex: "endTime",
align: 'center',
render: function render(endTime, item) {
var timeOver = false;
if (item.finished_time && answerData !== null && answerData !== void 0 && answerData.exercise && answerData !== null && answerData !== void 0 && answerData.exercise_answer_user) {
// issue#29511 exercise.time -1没有设置答题的时间限制则比较完成时间和试卷截至时间
if ((answerData === null || answerData === void 0 ? void 0 : answerData.exercise.time) === -1) {
timeOver = dayjs_min_default()(answerData === null || answerData === void 0 ? void 0 : answerData.exercise.end_time).isBefore(item.finished_time);
} else {
timeOver = dayjs_min_default()(answerData === null || answerData === void 0 ? void 0 : answerData.exercise_answer_user.start_at).add(answerData === null || answerData === void 0 ? void 0 : answerData.exercise.time, "m").isBefore(item.finished_time);
}
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: [item.finished_time || /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "c-grey-999",
children: "--"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "c-orange-ff9 ",
children: timeOver ? "(已超时)" : ""
})]
});
}
}, {
title: "耗时",
dataIndex: "time_consuming",
key: "time_consuming",
align: 'center',
render: function render(time, item) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: item.time_consuming || /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "color-grey-9",
children: "--"
})
});
}
}, {
title: "查看答案",
dataIndex: "view_answer",
key: "view_answer",
align: 'center',
render: function render(exp, item) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: item.view_answer ? "已查看" : "未查看"
});
}
}, {
title: '得分',
dataIndex: 'user_score',
key: 'user_score',
align: 'center',
render: function render(score) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
color: '#FA6400'
},
children: [score, "\u5206"]
});
}
}, {
title: "操作",
dataIndex: "operation",
key: "operation",
align: 'center',
render: function render(value, data, index) {
return value && !data.is_jupyter && !data.is_jupyter_lab ? /*#__PURE__*/(0,jsx_runtime.jsx)(es_anchor/* default */.Z, {
affix: false,
className: "mt10",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_anchor/* default */.Z.Link, {
href: "#challenge_".concat(item === null || item === void 0 ? void 0 : item.question_id).concat(index),
title: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#0152d9',
fontSize: 14
},
children: "\u67E5\u770B"
})
})
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "c-grey-999",
children: "--"
});
}
}];
console.log(challengeData);
var options = {
selectOnLineNumbers: true,
readOnly: true,
minimap: {
enabled: false
},
scrollBeyondLastLine: false
};
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [(item === null || item === void 0 || (_item$shixun = item.shixun) === null || _item$shixun === void 0 ? void 0 : _item$shixun.length) > 0 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: componentsmodules.shixunWrapper,
children: item === null || item === void 0 || (_item$shixun2 = item.shixun) === null || _item$shixun2 === void 0 ? void 0 : _item$shixun2.map(function (val, key) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
className: "mb20",
justify: "space-between",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
flex: "1",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: componentsmodules.score,
children: ["(", val.challenge_score, "\u5206)"]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: componentsmodules.name,
children: [val.challenge_name, " "]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
children: [!val.answer_status && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "font14",
style: {
color: '#FA6400'
},
children: "\u672A\u5B8C\u6210"
}), !!val.answer_status && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "font14",
style: {
color: '#37AD83'
},
children: "\u5DF2\u5B8C\u6210"
})]
})]
});
})
}), (answerData === null || answerData === void 0 || (_answerData$exercise = answerData.exercise) === null || _answerData$exercise === void 0 ? void 0 : _answerData$exercise.student_commit_status) !== 0 || (answerData === null || answerData === void 0 || (_answerData$exercise2 = answerData.exercise) === null || _answerData$exercise2 === void 0 ? void 0 : _answerData$exercise2.user_exercise_status) !== 0 ? /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [!!(data !== null && data !== void 0 && data.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
justify: "space-between",
className: "mb10",
align: "middle",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
className: "font14 c-grey-666",
children: "\u9636\u6BB5\u6210\u7EE9"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(components_UserScore, {
score: item === null || item === void 0 ? void 0 : item.user_score
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
columns: columns,
dataSource: data,
pagination: false
})]
}), !!(challengeData !== null && challengeData !== void 0 && challengeData.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
className: "font16 c-grey-666 mt10",
children: "\u5B9E\u8BAD\u8BE6\u60C5"
}), challengeData === null || challengeData === void 0 ? void 0 : challengeData.map(function (chanllenge, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
id: "challenge_".concat(item === null || item === void 0 ? void 0 : item.question_id).concat(index),
className: "mt5",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: "font14 mr15",
children: [" \u7B2C", chanllenge.position, "\u5173"]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
className: "current c-black font14",
target: "_blank",
to: "/tasks/".concat(coursesId, "/").concat(exerciseId, "/").concat(chanllenge.game_identifier, "/exercise"),
children: chanllenge.name
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
style: {
marginLeft: 'auto'
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(components_UserScore, {
score: chanllenge.user_score
})
})]
}), (chanllenge === null || chanllenge === void 0 ? void 0 : chanllenge.st) === 0 && chanllenge.passed_code && /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
className: componentsmodules.shixunWrp,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("h2", {
children: ["\u7B2C\u4E00\u6B21\u901A\u5173\u7684\u4EE3\u7801\uFF08\u672A\u901A\u5173\u5219\u4E3A\u6700\u540E\u4E00\u6B21\u63D0\u4EA4\u8BC4\u6D4B\u7684\u4EE3\u7801\uFF09", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "c-light-black",
children: chanllenge.path
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(monaco_editor/* default */.ZP, {
height: 300,
language: "python",
theme: "default",
value: chanllenge.passed_code,
options: options
})]
})]
});
})]
})]
}) : /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [(0,authority/* isStudent */.dE)() && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: "c-grey-999 mt20 mb20",
value: item === null || item === void 0 ? void 0 : item.question_title
}), item === null || item === void 0 || (_item$shixun3 = item.shixun) === null || _item$shixun3 === void 0 ? void 0 : _item$shixun3.map(function (shixun, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
className: "font16 c-grey-666 mb5",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: "mr20",
children: ["\u7B2C", shixun === null || shixun === void 0 ? void 0 : shixun.challenge_position, "\u5173 ", shixun === null || shixun === void 0 ? void 0 : shixun.challenge_name]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: [shixun === null || shixun === void 0 ? void 0 : shixun.challenge_score, "\u5206"]
})]
}, index);
})]
})]
});
};
/* harmony default export */ var components_Shixun = (Shixun);
// EXTERNAL MODULE: ./node_modules/_js-base64@2.6.4@js-base64/base64.js
var base64 = __webpack_require__(24334);
;// CONCATENATED MODULE: ./src/pages/Paths/Detail/Answer/components/Program.tsx
var Program_scoreStatusMapping = {
0: 'c-red-ee4',
1: 'c-green'
};
var Program = function Program(_ref) {
var _answerData$exercise, _answerData$exercise2, _answerData$exercise3;
var item = _ref.item,
answerData = _ref.answerData;
var _useState = (0,_react_17_0_2_react.useState)([]),
_useState2 = slicedToArray_default()(_useState, 2),
data = _useState2[0],
setData = _useState2[1];
(0,_react_17_0_2_react.useEffect)(function () {
var _item$evaluate_codes;
if ((item === null || item === void 0 || (_item$evaluate_codes = item.evaluate_codes) === null || _item$evaluate_codes === void 0 ? void 0 : _item$evaluate_codes.length) > 0) {
var _item$evaluate_codes2;
setData(item === null || item === void 0 || (_item$evaluate_codes2 = item.evaluate_codes) === null || _item$evaluate_codes2 === void 0 ? void 0 : _item$evaluate_codes2.map(function (code, index) {
return {
key: index + 1,
error_msg: code !== null && code !== void 0 && code.error_msg ? base64.Base64.decode(code === null || code === void 0 ? void 0 : code.error_msg) : ''
};
}));
} else {
setData([{
key: "--",
error_msg: "--"
}]);
}
}, [item === null || item === void 0 ? void 0 : item.evaluate_codes]);
var columns = [{
title: '评测次数',
dataIndex: 'key',
width: "127px",
key: 'key',
align: 'center',
render: function render(text, record) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: record.key
});
}
}, {
title: '详细信息',
dataIndex: 'error_msg',
key: 'error_msg',
align: 'center',
render: function render(text, record) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: record.error_msg ? record.error_msg : "--"
});
}
}];
var options = {
selectOnLineNumbers: true,
readOnly: true,
minimap: {
enabled: false
},
scrollBeyondLastLine: false
};
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "".concat(componentsmodules.programWrapper),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: componentsmodules.desc,
children: "\u9898\u76EE\u63CF\u8FF0"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: componentsmodules.content,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: item === null || item === void 0 ? void 0 : item.description
})
}), (answerData === null || answerData === void 0 || (_answerData$exercise = answerData.exercise) === null || _answerData$exercise === void 0 ? void 0 : _answerData$exercise.user_exercise_status) === 1 && /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
justify: "space-between",
className: "mt40",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
style: {
fontSize: 14,
color: '#666666'
},
children: "\u6211\u7684\u7B54\u6848"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(components_UserScore, {
score: item === null || item === void 0 ? void 0 : item.user_score
})
})]
}), (item === null || item === void 0 ? void 0 : item.passed_code) && /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
className: componentsmodules.shixunWrp,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("h3", {
children: "\u7B2C\u4E00\u6B21\u8BC4\u6D4B\u901A\u8FC7\u7684\u4EE3\u7801\uFF08\u672A\u901A\u5173\u5219\u4E3A\u6700\u540E\u4E00\u6B21\u63D0\u4EA4\u8BC4\u6D4B\u7684\u4EE3\u7801\uFF09"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(monaco_editor/* default */.ZP, {
style: {
border: '1px solid #ccc'
},
height: 300,
language: "python",
theme: "vs-light",
value: item !== null && item !== void 0 && item.passed_code ? base64.Base64.decode(item === null || item === void 0 ? void 0 : item.passed_code) : "",
options: options
})]
}), (answerData === null || answerData === void 0 || (_answerData$exercise2 = answerData.exercise) === null || _answerData$exercise2 === void 0 ? void 0 : _answerData$exercise2.user_exercise_status) === 1 && (answerData === null || answerData === void 0 || (_answerData$exercise3 = answerData.exercise) === null || _answerData$exercise3 === void 0 ? void 0 : _answerData$exercise3.answer_open) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
background: "#F6F7F9"
},
className: "mt30",
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
padding: "20px",
fontSize: "16px",
display: "flex"
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
whiteSpace: "nowrap"
},
children: "\u3010\u89E3\u6790\u3011"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: (item === null || item === void 0 ? void 0 : item.analysis) || '暂无解析'
})]
})
})]
});
};
/* harmony default export */ var components_Program = (Program);
;// CONCATENATED MODULE: ./src/pages/Paths/Detail/Answer/components/Fill.tsx
var TextArea = input/* default */.Z.TextArea;
var Fill_scoreStatusMapping = {
0: 'c-red-ee4',
1: 'c-green'
};
var Fill = function Fill(_ref) {
var _item$standard_answer2, _item$standard_answer3, _item$tag_disciplines;
var sign = _ref.sign,
item = _ref.item,
answerData = _ref.answerData,
showBtn = _ref.showBtn,
knowledgeDialog = _ref.knowledgeDialog,
setKnowledgeDialog = _ref.setKnowledgeDialog,
_ref$onBlur = _ref.onBlur,
onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur;
var _useState = (0,_react_17_0_2_react.useState)([]),
_useState2 = slicedToArray_default()(_useState, 2),
userAnswer = _useState2[0],
setUserAnswer = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)([]),
_useState4 = slicedToArray_default()(_useState3, 2),
saveStatusArr = _useState4[0],
setSaveStatusArr = _useState4[1];
var currentData = (0,_react_17_0_2_react.useRef)();
(0,_react_17_0_2_react.useEffect)(function () {
var data = [];
var _loop = function _loop(i) {
var _item$user_answer;
var param = (item === null || item === void 0 || (_item$user_answer = item.user_answer) === null || _item$user_answer === void 0 ? void 0 : _item$user_answer.find(function (e) {
return e.choice_id === i + 1;
})) || {
choice_id: i + 1,
answer_text: ''
};
data.push(objectSpread2_default()({}, param));
};
for (var i = 0; i < (item === null || item === void 0 ? void 0 : item.multi_count); i++) {
_loop(i);
}
currentData.current = data;
setUserAnswer(data);
}, [item === null || item === void 0 ? void 0 : item.user_answer]);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [userAnswer === null || userAnswer === void 0 ? void 0 : userAnswer.map(function (answer, index) {
var _item$standard_answer, _saveStatusArr$index, _saveStatusArr$index2, _saveStatusArr$index3;
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
className: "".concat(componentsmodules.baseMargin, " ").concat(componentsmodules.fill),
align: "middle",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
className: componentsmodules.index,
children: ["\u586B\u7A7A\u9879", index + 1]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
flex: '430px',
className: "ml20 mr20",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
placeholder: "\u8BF7\u8F93\u5165\u7B54\u6848",
disabled: (item === null || item === void 0 || (_item$standard_answer = item.standard_answer) === null || _item$standard_answer === void 0 ? void 0 : _item$standard_answer.length) > 0 && ((item === null || item === void 0 ? void 0 : item.can_answer_num) == 0 || !showBtn || (item === null || item === void 0 ? void 0 : item.user_answer_right)),
value: answer === null || answer === void 0 ? void 0 : answer.answer_text,
onChange: function onChange(e) {
userAnswer[index].answer_text = e.target.value;
setUserAnswer(toConsumableArray_default()(userAnswer));
setTimeout( /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var res, newArr, _newArr;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return onBlur(e.target.value, index + 1, userAnswer);
case 2:
res = _context.sent;
if (res.status == 1) {
newArr = saveStatusArr.slice();
newArr[index] = {
status: 'none',
errorText: ''
};
setSaveStatusArr(newArr);
} else {
_newArr = saveStatusArr.slice();
_newArr[index] = {
status: 'fail',
errorText: res.message
};
setSaveStatusArr(_newArr);
}
case 4:
case "end":
return _context.stop();
}
}, _callee);
})), 200);
},
onFocus: function onFocus() {
sign.current = true;
}
// onBlur={(e) => {
// setTimeout(async () => {
// const res = await onBlur(answer?.answer_text, index + 1, userAnswer)
// if (res.status == 1) {
// const newArr = saveStatusArr.slice()
// newArr[index] = { status: 'none', errorText: '' }
// setSaveStatusArr(newArr)
// } else {
// const newArr = saveStatusArr.slice()
// newArr[index] = { status: 'fail', errorText: res.message }
// setSaveStatusArr(newArr)
// }
// }, 200)
// }}
,
className: "".concat(item !== null && item !== void 0 && item.standard_answer_show ? item !== null && item !== void 0 && item.user_answer_right ? "c-green" : "c-red" : '', " ").concat(componentsmodules.fillInput)
})
}), ((_saveStatusArr$index = saveStatusArr[index]) === null || _saveStatusArr$index === void 0 ? void 0 : _saveStatusArr$index.status) === "success" && /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
align: "middle",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
style: {
marginRight: 8
},
className: "iconfont icon-chenggong1 ".concat(componentsmodules.success)
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: componentsmodules.success,
children: "\u4FDD\u5B58\u6210\u529F"
})]
})
}), ((_saveStatusArr$index2 = saveStatusArr[index]) === null || _saveStatusArr$index2 === void 0 ? void 0 : _saveStatusArr$index2.status) === "fail" && /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
align: "middle",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
style: {
marginRight: 8
},
className: "iconfont icon-tishi7 ".concat(componentsmodules.fail)
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: componentsmodules.fail,
children: (_saveStatusArr$index3 = saveStatusArr[index]) === null || _saveStatusArr$index3 === void 0 ? void 0 : _saveStatusArr$index3.errorText
})]
})
})]
}, index);
}), !!(item !== null && item !== void 0 && (_item$standard_answer2 = item.standard_answer) !== null && _item$standard_answer2 !== void 0 && _item$standard_answer2.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
fontSize: '16px',
marginBottom: 14,
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: ["\u7B54\u9898\u7ED3\u679C", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
marginLeft: 12,
color: item !== null && item !== void 0 && item.user_answer_right ? '#29A64F' : '#E53333'
},
children: item !== null && item !== void 0 && item.user_answer_right ? "\u7B54\u5BF9\u4E86" : "\u7B54\u9519\u4E86"
})]
}), (item === null || item === void 0 ? void 0 : item.show_recommend) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
cursor: 'pointer',
color: '#3061D0',
fontSize: '14px'
},
onClick: function onClick() {
setKnowledgeDialog();
},
children: ["\u4E3A\u4F60\u63A8\u8350\u540C\u77E5\u8BC6\u70B9\u9898\u76EE\uFF0C\u7ACB\u5373\u5DE9\u56FA", " >"]
})]
}), (item === null || item === void 0 ? void 0 : item.can_answer_num) > 0 && !(item !== null && item !== void 0 && item.user_answer_right) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
color: '#FF8C29',
marginBottom: 14
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ExclamationCircleOutlined/* default */.Z, {
style: {
marginRight: 10
}
}), "\u6E29\u99A8\u63D0\u793A\uFF1A\u8FD8\u6709 ", item === null || item === void 0 ? void 0 : item.can_answer_num, " \u6B21\u673A\u4F1A\u53EF\u5C1D\u8BD5\u8FDB\u884C\u91CD\u65B0\u7B54\u9898\uFF0C\u91CD\u65B0\u7B54\u9898\u6B63\u786E\u540E\u4E5F\u4F1A\u8BA1\u5165\u603B\u6210\u7EE9\u3002"]
}), ((item === null || item === void 0 ? void 0 : item.can_answer_num) == 0 || (item === null || item === void 0 ? void 0 : item.user_answer_right) || knowledgeDialog) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: componentsmodules.analysisWrap,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: componentsmodules.greyBg,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
className: "mb20",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
className: "font14 mr10",
style: {
color: '#6A7283',
lineHeight: '30px'
},
children: "\u3010\u7B54\u6848\u3011"
}), item === null || item === void 0 || (_item$standard_answer3 = item.standard_answer) === null || _item$standard_answer3 === void 0 ? void 0 : _item$standard_answer3.map(function (answer, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
className: "mr40",
style: {
fontSize: 16,
lineHeight: '30px'
},
children: ["\u586B\u7A7A\u9879", index + 1, ":", answer === null || answer === void 0 ? void 0 : answer.answer_text[0]]
}, index);
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "font14 mr10 mb20",
style: {
color: '#6A7283',
lineHeight: '30px'
},
children: "\u3010\u89E3\u6790\u3011"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: componentsmodules.renderHtml,
value: item === null || item === void 0 ? void 0 : item.analysis
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "font14 mr10",
style: {
color: '#6A7283',
lineHeight: '30px'
},
children: "\u3010\u77E5\u8BC6\u70B9\u3011"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
style: {
fontSize: 16,
lineHeight: '30px'
},
children: item === null || item === void 0 || (_item$tag_disciplines = item.tag_disciplines) === null || _item$tag_disciplines === void 0 ? void 0 : _item$tag_disciplines.join("、")
})]
})]
})
})]
})]
});
};
/* harmony default export */ var components_Fill = (Fill);
;// CONCATENATED MODULE: ./src/pages/Paths/Detail/Answer/components/BFill.tsx
var BFill_TextArea = input/* default */.Z.TextArea;
var BFill = function BFill(_ref) {
var _item$standard_answer2, _item$standard_answer3, _item$standard_answer4, _item$tag_disciplines;
var item = _ref.item,
answerData = _ref.answerData,
_ref$onBlur = _ref.onBlur,
onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur,
_ref$onDebug = _ref.onDebug,
onDebug = _ref$onDebug === void 0 ? function () {} : _ref$onDebug,
setIsSubmitCode = _ref.setIsSubmitCode,
showBtn = _ref.showBtn,
knowledgeDialog = _ref.knowledgeDialog,
setKnowledgeDialog = _ref.setKnowledgeDialog;
var _useState = (0,_react_17_0_2_react.useState)([]),
_useState2 = slicedToArray_default()(_useState, 2),
userAnswer = _useState2[0],
setUserAnswer = _useState2[1];
(0,_react_17_0_2_react.useEffect)(function () {
var _item$standard_answer;
var data = item === null || item === void 0 || (_item$standard_answer = item.standard_answer_with_score) === null || _item$standard_answer === void 0 ? void 0 : _item$standard_answer.map(function (val, index) {
var _item$user_answer;
return objectSpread2_default()(objectSpread2_default()({}, val), {}, {
value: (item === null || item === void 0 || (_item$user_answer = item.user_answer) === null || _item$user_answer === void 0 || (_item$user_answer = _item$user_answer.find(function (item) {
return parseInt(item.choice_id) === index + 1;
})) === null || _item$user_answer === void 0 ? void 0 : _item$user_answer.answer_text) || ''
});
});
setUserAnswer(data);
}, [item === null || item === void 0 ? void 0 : item.standard_answer_with_score]);
// useEffect(() => {
// if (item?.user_answer?.length > 0) {
// let data = new Array(item.multi_count).fill({ value: '' })?.map((val: any, index: any) => {
// return {
// ...val,
// score: item?.standard_answer_with_score?.[index]?.score,
// value: item?.user_answer?.[index]?.answer_text || '',
// }
// })
// setUserAnswer(data);
// }
// }, [item?.user_answer])
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [(item === null || item === void 0 ? void 0 : item.code) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
border: '1px solid #CCCCCC',
padding: '10px',
marginBottom: 20
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
disabledFill: (item === null || item === void 0 || (_item$standard_answer2 = item.standard_answer) === null || _item$standard_answer2 === void 0 ? void 0 : _item$standard_answer2.length) > 0 && ((item === null || item === void 0 ? void 0 : item.can_answer_num) == 0 || !showBtn || (item === null || item === void 0 ? void 0 : item.user_answer_right)),
onFillChange: function onFillChange(e, index) {
var _e$parseInt;
onBlur(e === null || e === void 0 || (_e$parseInt = e[parseInt(index)]) === null || _e$parseInt === void 0 ? void 0 : _e$parseInt.value, parseInt(index) + 1, userAnswer);
setUserAnswer(userAnswer);
},
className: componentsmodules.content,
programFillValue: userAnswer,
showProgramFill: true,
value: base64.Base64.decode((item === null || item === void 0 ? void 0 : item.code) || '')
})
}), !!(item !== null && item !== void 0 && (_item$standard_answer3 = item.standard_answer) !== null && _item$standard_answer3 !== void 0 && _item$standard_answer3.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
fontSize: '16px',
marginBottom: 14,
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center'
},
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: ["\u7B54\u9898\u7ED3\u679C", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
marginLeft: 12,
color: item !== null && item !== void 0 && item.user_answer_right ? '#29A64F' : '#E53333'
},
children: item !== null && item !== void 0 && item.user_answer_right ? "\u7B54\u5BF9\u4E86" : "\u7B54\u9519\u4E86"
})]
})
}), (item === null || item === void 0 ? void 0 : item.can_answer_num) > 0 && !(item !== null && item !== void 0 && item.user_answer_right) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
color: '#FF8C29',
marginBottom: 14
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ExclamationCircleOutlined/* default */.Z, {
style: {
marginRight: 10
}
}), "\u6E29\u99A8\u63D0\u793A\uFF1A\u8FD8\u6709 ", item === null || item === void 0 ? void 0 : item.can_answer_num, " \u6B21\u673A\u4F1A\u53EF\u5C1D\u8BD5\u8FDB\u884C\u91CD\u65B0\u7B54\u9898\uFF0C\u91CD\u65B0\u7B54\u9898\u6B63\u786E\u540E\u4E5F\u4F1A\u8BA1\u5165\u603B\u6210\u7EE9\u3002"]
}), ((item === null || item === void 0 ? void 0 : item.can_answer_num) == 0 || (item === null || item === void 0 ? void 0 : item.user_answer_right) || knowledgeDialog) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: componentsmodules.analysisWrap,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: componentsmodules.greyBg,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
className: "mb20",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
className: "font14 mr10",
style: {
color: '#6A7283',
lineHeight: '30px'
},
children: "\u3010\u7B54\u6848\u3011"
}), item === null || item === void 0 || (_item$standard_answer4 = item.standard_answer) === null || _item$standard_answer4 === void 0 ? void 0 : _item$standard_answer4.map(function (answer, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
className: "mr40",
style: {
fontSize: 16,
lineHeight: '30px'
},
children: ["\u586B\u7A7A\u9879", index + 1, ":", answer === null || answer === void 0 ? void 0 : answer.answer_text]
}, index);
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "font14 mr10 mb20",
style: {
color: '#6A7283',
lineHeight: '30px'
},
children: "\u3010\u89E3\u6790\u3011"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: componentsmodules.renderHtml,
value: item === null || item === void 0 ? void 0 : item.analysis
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "font14 mr10",
style: {
color: '#6A7283',
lineHeight: '30px'
},
children: "\u3010\u77E5\u8BC6\u70B9\u3011"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
style: {
fontSize: 16,
lineHeight: '30px'
},
children: item === null || item === void 0 || (_item$tag_disciplines = item.tag_disciplines) === null || _item$tag_disciplines === void 0 ? void 0 : _item$tag_disciplines.join("、")
})]
})]
})
})]
})]
});
};
/* harmony default export */ var components_BFill = (BFill);
// EXTERNAL MODULE: ./node_modules/_lodash@4.17.21@lodash/lodash.js
var lodash = __webpack_require__(89392);
;// CONCATENATED MODULE: ./src/pages/Paths/Detail/Answer/components/NewAnswerComments/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var NewAnswerCommentsmodules = ({"comments":"comments___m2bmf","greyText":"greyText___PcghL","commentText":"commentText___zEl3a","wrapper":"wrapper___wOIs4","header":"header___Y8N3P","updateTime":"updateTime___BGwXJ","text":"text___ojkmu","date":"date___jCRLE"});
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
var env = __webpack_require__(84666);
;// CONCATENATED MODULE: ./src/pages/Paths/Detail/Answer/components/NewAnswerComments/index.tsx
var NewAnswerComments = function NewAnswerComments(_ref) {
var list = _ref.list,
_ref$hideScore = _ref.hideScore,
hideScore = _ref$hideScore === void 0 ? false : _ref$hideScore;
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: list === null || list === void 0 ? void 0 : list.map(function (v) {
var _v$user, _v$user2, _v$user3, _v$comments, _v$comments2;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "mt20 ".concat(NewAnswerCommentsmodules.wrapper),
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
align: "middle",
className: NewAnswerCommentsmodules.header,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
src: env/* default */.Z.API_SERVER + '/images/' + ((_v$user2 = v.user) === null || _v$user2 === void 0 ? void 0 : _v$user2.image_url)
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "ml10 font16",
children: (_v$user3 = v.user) === null || _v$user3 === void 0 ? void 0 : _v$user3.name
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
className: NewAnswerCommentsmodules.updateTime,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: NewAnswerCommentsmodules.text,
children: "\u8BC4\u9605\u65F6\u95F4"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: NewAnswerCommentsmodules.date,
children: dayjs_min_default()((_v$comments = v.comments) === null || _v$comments === void 0 || (_v$comments = _v$comments[0]) === null || _v$comments === void 0 ? void 0 : _v$comments.updated_at).format('YYYY-MM-DD HH:mm')
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: NewAnswerCommentsmodules.comments,
children: v === null || v === void 0 || (_v$comments2 = v.comments) === null || _v$comments2 === void 0 ? void 0 : _v$comments2.map(function (e, i) {
var _v$user4;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
align: "middle",
justify: "space-between",
children: [!!e.shixun_chanllge_position && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
flexShrink: 0,
marginRight: 10
},
children: ["\u7B2C", e.shixun_chanllge_position, "\u5173"]
}), !hideScore && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
flex: 1
},
children: ["\u539F\u59CB\u5F97\u5206", e === null || e === void 0 ? void 0 : e.origin_score, "\u5206\uFF0C\u4FEE\u6B63\u4E3A", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "c-light-primary",
children: e === null || e === void 0 ? void 0 : e.score
}), "\u5206"]
})]
}), !!e.comment && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [" ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "".concat(NewAnswerCommentsmodules.greyText, " mr10"),
children: "\u8BC4\u8BED"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: NewAnswerCommentsmodules.commentText,
children: e.comment
})]
})]
}, (v === null || v === void 0 || (_v$user4 = v.user) === null || _v$user4 === void 0 ? void 0 : _v$user4.user_id) + '-' + i);
})
})]
}, v === null || v === void 0 || (_v$user = v.user) === null || _v$user === void 0 ? void 0 : _v$user.user_id);
})
});
};
/* harmony default export */ var components_NewAnswerComments = (NewAnswerComments);
// EXTERNAL MODULE: ./src/components/AsyncButton/index.tsx
var AsyncButton = __webpack_require__(69458);
// EXTERNAL MODULE: ./src/components/Hooks/index.tsx
var Hooks = __webpack_require__(53968);
// EXTERNAL MODULE: ./src/utils/constant.ts
var constant = __webpack_require__(5845);
// EXTERNAL MODULE: ./src/utils/fetch.ts
var fetch = __webpack_require__(67444);
// EXTERNAL MODULE: ./src/components/NoData/index.tsx
var NoData = __webpack_require__(53070);
// EXTERNAL MODULE: ./src/pages/MyProblem/service.ts
var service = __webpack_require__(90878);
// EXTERNAL MODULE: ./src/pages/MyProblem/TestCasePanel/index.tsx + 1 modules
var TestCasePanel = __webpack_require__(38925);
;// CONCATENATED MODULE: ./src/pages/Paths/Detail/Answer/components/Buttonloading.tsx
/**
* @description: 自测运行
* @param {*}
* ButtonProps:按钮部分样式等参数
* ButtonText 按钮文字
* form 表单内容
* answerKey 填空字段
* items 为运行调试字段
* submitAnswer 提交答案
* updateAnswerInfo 更新答题信息
* @return {*}
*/
var ButtonLoading = function ButtonLoading(_ref) {
var ButtonProps = _ref.ButtonProps,
ButtonText = _ref.ButtonText,
form = _ref.form,
answerKey = _ref.answerKey,
_ref$hackidentifier = _ref.hackidentifier,
hackidentifier = _ref$hackidentifier === void 0 ? "" : _ref$hackidentifier,
_ref$items = _ref.items,
items = _ref$items === void 0 ? {} : _ref$items,
setIsSubmitCode = _ref.setIsSubmitCode,
submitAnswer = _ref.submitAnswer,
updateAnswerInfo = _ref.updateAnswerInfo;
var _useState = (0,_react_17_0_2_react.useState)(false),
_useState2 = slicedToArray_default()(_useState, 2),
isloading = _useState2[0],
setisloading = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(''),
_useState4 = slicedToArray_default()(_useState3, 2),
identifier = _useState4[0],
setidentifier = _useState4[1];
var param = (0,_umi_production_exports.useParams)();
var _useState5 = (0,_react_17_0_2_react.useState)({}),
_useState6 = slicedToArray_default()(_useState5, 2),
modalshow = _useState6[0],
setmodalshow = _useState6[1];
var isEdit = param.type === 'edit';
var type = window.location.href.includes('problemset') ? 1 : 2;
(0,_react_17_0_2_react.useEffect)(function () {
if (isEdit || hackidentifier) {
setidentifier(hackidentifier || param.id);
}
}, [param]);
(0,_react_17_0_2_react.useEffect)(function () {
return function () {
sessionStorage.removeItem("projectFill");
};
}, []);
function onUpdateCode(_x, _x2) {
return _onUpdateCode.apply(this, arguments);
}
function _onUpdateCode() {
_onUpdateCode = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4(re, id) {
var _stats$filter;
var code, stats, codes, response;
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
code = form.getFieldValue("hack_codes");
stats = form.getFieldValue(answerKey);
if (code.code) {
_context4.next = 5;
break;
}
message/* default */.ZP.info('程序代码不能为空!');
return _context4.abrupt("return");
case 5:
if (code.language) {
_context4.next = 8;
break;
}
message/* default */.ZP.info('编程语言不能为空!');
return _context4.abrupt("return");
case 8:
if (!(stats.length > 0 && ((_stats$filter = stats.filter(function (item) {
return !item.answer_text;
})) === null || _stats$filter === void 0 ? void 0 : _stats$filter.length) > 0)) {
_context4.next = 11;
break;
}
message/* default */.ZP.info('填空项不能为空!');
return _context4.abrupt("return");
case 11:
codes = code.code;
if (stats.length > 0) {
stats === null || stats === void 0 || stats.map(function (item) {
if (item.multi_line) {
codes = codes.substring(0, codes.indexOf('@▁▁@')) + item.answer_text + codes.substring(codes.indexOf('@▁▁@') + 4);
} else {
codes = codes.substring(0, codes.indexOf('@▁@')) + item.answer_text + codes.substring(codes.indexOf('@▁@') + 3);
}
});
}
_context4.next = 15;
return (0,service/* updateCode */.n4)(id, re ? re : {
code: base64.Base64.encode(codes),
language: code.language,
answers: stats === null || stats === void 0 ? void 0 : stats.map(function (item) {
return item.answer_text;
})
});
case 15:
response = _context4.sent;
return _context4.abrupt("return", response);
case 17:
case "end":
return _context4.stop();
}
}, _callee4);
}));
return _onUpdateCode.apply(this, arguments);
}
function onUpdateCodes(_x3, _x4) {
return _onUpdateCodes.apply(this, arguments);
}
function _onUpdateCodes() {
_onUpdateCodes = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5(re, id) {
var stats, codes, response;
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
stats = items.userAnswer;
codes = base64.Base64.decode(items.code); // if (stats.length > 0 && stats.filter((item) => !item.value)?.length > 0) {
// message.info('填空项不能为空!')
// return
// }
if (stats.length > 0) {
stats === null || stats === void 0 || stats.map(function (item) {
if (item.multi_line) {
codes = codes.substring(0, codes.indexOf('@▁▁@')) + item.value + codes.substring(codes.indexOf('@▁▁@') + 4);
} else {
codes = codes.substring(0, codes.indexOf('@▁@')) + item.value + codes.substring(codes.indexOf('@▁@') + 3);
}
});
}
_context5.next = 5;
return (0,service/* updateCode */.n4)(id, re ? re : {
code: base64.Base64.encode(codes),
language: items.language,
answers: stats === null || stats === void 0 ? void 0 : stats.map(function (item) {
return item.value;
})
});
case 5:
response = _context5.sent;
return _context5.abrupt("return", response);
case 7:
case "end":
return _context5.stop();
}
}, _callee5);
}));
return _onUpdateCodes.apply(this, arguments);
}
function getTimeStamp() {
return new Date().getTime();
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, objectSpread2_default()(objectSpread2_default()({
loading: isloading
}, ButtonProps), {}, {
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
var _res, _response, executeCode, startTime, aa, res, formValues, _formValues$hack, _res2, _formValues$hack2, res1, response, _executeCode, _startTime;
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
if (!(ButtonText === '提交代码')) {
_context3.next = 22;
break;
}
setisloading(true);
if (!isloading) {
_context3.next = 4;
break;
}
return _context3.abrupt("return");
case 4:
submitAnswer(false);
_context3.next = 7;
return (0,fetch/* default */.ZP)("/api/problems/".concat(identifier, "/start.json"), {
method: 'get'
});
case 7:
_res = _context3.sent;
_context3.next = 10;
return onUpdateCodes(null, _res === null || _res === void 0 ? void 0 : _res.identifier);
case 10:
_response = _context3.sent;
if (!((_response === null || _response === void 0 ? void 0 : _response.status) === 0)) {
_context3.next = 19;
break;
}
executeCode = /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var _items$userAnswer;
var _yield$getOperationRe, status, message, data, executeTime, isTimeOut;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return (0,service/* getOperationResult */.rX)(_res === null || _res === void 0 ? void 0 : _res.identifier, 'submit');
case 2:
_yield$getOperationRe = _context.sent;
status = _yield$getOperationRe.status;
message = _yield$getOperationRe.message;
data = _yield$getOperationRe.data;
executeTime = getTimeStamp();
isTimeOut = executeTime - startTime > 10 * 1000 * (items === null || items === void 0 || (_items$userAnswer = items.userAnswer) === null || _items$userAnswer === void 0 ? void 0 : _items$userAnswer.length);
if (status !== 0 && !isTimeOut) {
setTimeout(executeCode, 1000);
}
if (!isTimeOut) {
_context.next = 13;
break;
}
modal/* default */.Z.error({
centered: true,
okText: '知道啦',
title: '调试代码超时'
});
setisloading(false);
return _context.abrupt("return");
case 13:
if (status === 0) {
setisloading(false);
// let datas = await Fetch(`/api/myproblems/record_detail.json`, {
// method: 'GET',
// params: {
// id: data?.id
// }
// })
setmodalshow(data);
if (data.status === 2) {
setisloading(false);
modal/* default */.Z.error({
centered: true,
okText: '知道啦',
title: '调试代码超时'
});
}
}
case 14:
case "end":
return _context.stop();
}
}, _callee);
}));
return function executeCode() {
return _ref3.apply(this, arguments);
};
}();
startTime = getTimeStamp();
_context3.next = 16;
return (0,service/* sumbitCode */.bM)(_res === null || _res === void 0 ? void 0 : _res.identifier, {});
case 16:
executeCode();
_context3.next = 20;
break;
case 19:
setisloading(false);
case 20:
!!setIsSubmitCode && setIsSubmitCode(true);
return _context3.abrupt("return");
case 22:
aa = true;
_context3.next = 25;
return form.validateFields().then(function () {
aa = false;
}, function (errInfo) {
var _errInfo$errorFields, _errInfo$errorFields2;
if (errInfo.errorFields[0].name.includes("standard_answers")) {
message/* default */.ZP.error("填空项答案不能为空");
} else {
message/* default */.ZP.error(errInfo.errorFields[0].errors[0]);
}
if (((_errInfo$errorFields = errInfo.errorFields) === null || _errInfo$errorFields === void 0 ? void 0 : _errInfo$errorFields.length) === 0) {
aa = false;
}
form.scrollToField(errInfo === null || errInfo === void 0 || (_errInfo$errorFields2 = errInfo.errorFields) === null || _errInfo$errorFields2 === void 0 || (_errInfo$errorFields2 = _errInfo$errorFields2[0]) === null || _errInfo$errorFields2 === void 0 ? void 0 : _errInfo$errorFields2.name, {
behavior: 'smooth',
block: 'center'
});
aa = true;
});
case 25:
if (!aa) {
_context3.next = 27;
break;
}
return _context3.abrupt("return");
case 27:
setisloading(true);
if (!isloading) {
_context3.next = 30;
break;
}
return _context3.abrupt("return");
case 30:
res = '';
formValues = form.getFieldsValue();
if (identifier) {
_context3.next = 41;
break;
}
_context3.next = 35;
return (0,fetch/* default */.ZP)("/api/problems.json", {
method: 'post',
body: objectSpread2_default()(objectSpread2_default()({}, formValues), {}, {
hack: objectSpread2_default()(objectSpread2_default()({}, formValues === null || formValues === void 0 ? void 0 : formValues.hack), {}, {
sub_discipline_id: formValues === null || formValues === void 0 || (_formValues$hack = formValues.hack) === null || _formValues$hack === void 0 || (_formValues$hack = _formValues$hack.sub_discipline_id) === null || _formValues$hack === void 0 ? void 0 : _formValues$hack[1],
difficult: formValues.difficulty,
item_banks_group_id: formValues.item_banks_group_id
}),
hack_codes: objectSpread2_default()(objectSpread2_default()({}, formValues.hack_codes), {}, {
code: base64.Base64.encode(formValues.hack_codes.code)
}),
hack_sets: [objectSpread2_default()({}, formValues.hack_sets)],
is_blank: true
})
});
case 35:
res = _context3.sent;
identifier = (_res2 = res) === null || _res2 === void 0 ? void 0 : _res2.identifier;
sessionStorage.projectFill = identifier;
setidentifier(identifier);
_context3.next = 44;
break;
case 41:
_context3.next = 43;
return (0,fetch/* default */.ZP)("/api/problems/".concat(identifier, ".json"), {
method: 'put',
body: objectSpread2_default()(objectSpread2_default()({}, formValues), {}, {
hack: objectSpread2_default()(objectSpread2_default()({}, formValues === null || formValues === void 0 ? void 0 : formValues.hack), {}, {
sub_discipline_id: formValues === null || formValues === void 0 || (_formValues$hack2 = formValues.hack) === null || _formValues$hack2 === void 0 || (_formValues$hack2 = _formValues$hack2.sub_discipline_id) === null || _formValues$hack2 === void 0 ? void 0 : _formValues$hack2[1],
difficult: formValues.difficulty,
item_banks_group_id: formValues.item_banks_group_id
}),
hack_codes: objectSpread2_default()(objectSpread2_default()({}, formValues.hack_codes), {}, {
code: base64.Base64.encode(formValues.hack_codes.code)
}),
update_hack_sets: [objectSpread2_default()({}, formValues.hack_sets)],
is_blank: true
})
});
case 43:
res = _context3.sent;
case 44:
_context3.next = 46;
return (0,fetch/* default */.ZP)("/api/problems/".concat(identifier, "/start.json"), {
method: 'get'
});
case 46:
res1 = _context3.sent;
_context3.next = 49;
return onUpdateCode(null, res1 === null || res1 === void 0 ? void 0 : res1.identifier);
case 49:
response = _context3.sent;
if (!((response === null || response === void 0 ? void 0 : response.status) === 0)) {
_context3.next = 58;
break;
}
_executeCode = /*#__PURE__*/function () {
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
var _formValues$standard_;
var _yield$getOperationRe2, status, message, data, executeTime, isTimeOut;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return (0,service/* getOperationResult */.rX)(res1 === null || res1 === void 0 ? void 0 : res1.identifier, 'submit');
case 2:
_yield$getOperationRe2 = _context2.sent;
status = _yield$getOperationRe2.status;
message = _yield$getOperationRe2.message;
data = _yield$getOperationRe2.data;
executeTime = getTimeStamp();
isTimeOut = executeTime - _startTime > (formValues.hack.time_limit + 3) * 1000 * (formValues === null || formValues === void 0 || (_formValues$standard_ = formValues.standard_answers) === null || _formValues$standard_ === void 0 ? void 0 : _formValues$standard_.length);
if (status !== 0 && !isTimeOut) {
setTimeout(_executeCode, 1000);
}
if (!isTimeOut) {
_context2.next = 13;
break;
}
modal/* default */.Z.error({
centered: true,
okText: '知道啦',
title: '调试代码超时'
});
setisloading(false);
return _context2.abrupt("return");
case 13:
if (status === 0) {
setisloading(false);
setmodalshow(data);
if (data.status === 2) {
setisloading(false);
modal/* default */.Z.error({
centered: true,
okText: '知道啦',
title: '调试代码超时'
});
}
}
case 14:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function _executeCode() {
return _ref4.apply(this, arguments);
};
}();
_startTime = getTimeStamp();
_context3.next = 55;
return (0,service/* sumbitCode */.bM)(res1 === null || res1 === void 0 ? void 0 : res1.identifier, {});
case 55:
_executeCode();
_context3.next = 59;
break;
case 58:
setisloading(false);
case 59:
case "end":
return _context3.stop();
}
}, _callee3);
})),
children: ButtonText
})), (modalshow === null || modalshow === void 0 ? void 0 : modalshow.id) && modalshow.status !== 2 && /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
open: (modalshow === null || modalshow === void 0 ? void 0 : modalshow.id) && modalshow.status !== 2,
title: "\u8FD0\u884C\u7ED3\u679C",
width: 1100,
footer: false,
onOk: function onOk() {
setmodalshow({});
updateAnswerInfo();
},
onCancel: function onCancel() {
setmodalshow({});
updateAnswerInfo();
},
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
maxHeight: 600,
overflow: 'auto',
marginBottom: 15
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
marginBottom: 20,
display: 'flex',
justifyContent: 'space-between',
fontSize: 14
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#666666'
},
children: "\u72B6\u6001"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
marginLeft: 12,
color: modalshow.status !== 0 && '#E30000'
},
children: TestCasePanel/* ExecuteDict */.Im[modalshow.status]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#666666'
},
children: "\u63D0\u4EA4\u65F6\u95F4"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
marginLeft: 12
},
children: dayjs_min_default()(modalshow.created_at).format('YYYY-MM-DD HH:mm:ss')
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#666666'
},
children: "\u8BED\u8A00"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
marginLeft: 12
},
children: modalshow.language
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#666666'
},
children: "\u6267\u884C\u7528\u65F6"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
marginLeft: 12
},
children: [modalshow.execute_time, "ms"]
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(TestCasePanel/* DetailCommitOut */.Y4, objectSpread2_default()({}, modalshow))]
})
})]
});
};
/* harmony default export */ var Buttonloading = (ButtonLoading);
;// CONCATENATED MODULE: ./src/pages/Paths/Detail/Answer/index.tsx
var _excluded = ["globalSetting", "loading", "user", "exercise", "dispatch"];
var tagList = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
var Answer = function Answer(_ref) {
var _answerData$exercise4, _answerData$exercise5, _answerData$exercise6, _answerData$exercise7, _answerData$exercise8, _answerData$question_5, _answerData$exercise_14, _answerData$question_6, _answerData$exercise_15, _answerData$exercise_16, _answerData$exercise_17, _answerData$exercise_18, _answerData$exercise_19, _answerData$exercise9, _answerData$exercise_20, _answerData$exercise_21, _answerData$exercise_22;
var globalSetting = _ref.globalSetting,
loading = _ref.loading,
user = _ref.user,
exercise = _ref.exercise,
dispatch = _ref.dispatch,
props = objectWithoutProperties_default()(_ref, _excluded);
var location = (0,_umi_production_exports.useLocation)();
var params = (0,_umi_production_exports.useParams)();
var _useState = (0,_react_17_0_2_react.useState)({}),
_useState2 = slicedToArray_default()(_useState, 2),
answerData = _useState2[0],
setAnswerData = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)({}),
_useState4 = slicedToArray_default()(_useState3, 2),
hideAnswerCard = _useState4[0],
setHideAnswerCard = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)(false),
_useState6 = slicedToArray_default()(_useState5, 2),
isSpin = _useState6[0],
setIsSpin = _useState6[1];
var _useState7 = (0,_react_17_0_2_react.useState)(true),
_useState8 = slicedToArray_default()(_useState7, 2),
showAnswerCard = _useState8[0],
setShowAnswerCard = _useState8[1];
var _useState9 = (0,_react_17_0_2_react.useState)(''),
_useState10 = slicedToArray_default()(_useState9, 2),
iframeUrl = _useState10[0],
setIframeUrl = _useState10[1];
var _useState11 = (0,_react_17_0_2_react.useState)('none'),
_useState12 = slicedToArray_default()(_useState11, 2),
iframeBlock = _useState12[0],
setIframeBlock = _useState12[1];
var _useState13 = (0,_react_17_0_2_react.useState)(window.document.domain === "kepukehuan.educoder.net" ? true : false),
_useState14 = slicedToArray_default()(_useState13, 2),
isEducation = _useState14[0],
setIsEducation = _useState14[1];
var _useState15 = (0,_react_17_0_2_react.useState)(false),
_useState16 = slicedToArray_default()(_useState15, 2),
isSubmitCode = _useState16[0],
setIsSubmitCode = _useState16[1]; // 程序填空是否提交代码,这里用作记录
var _useState17 = (0,_react_17_0_2_react.useState)(null),
_useState18 = slicedToArray_default()(_useState17, 2),
questionItem = _useState18[0],
setQuestionItem = _useState18[1]; //当前题目的相关信息
var iframe = (0,_react_17_0_2_react.useRef)();
var iframeUrlSuffix = (0,_react_17_0_2_react.useRef)();
var _useState19 = (0,_react_17_0_2_react.useState)(0),
_useState20 = slicedToArray_default()(_useState19, 2),
oneindex = _useState20[0],
setoneindex = _useState20[1]; //大题下标
var _useState21 = (0,_react_17_0_2_react.useState)(0),
_useState22 = slicedToArray_default()(_useState21, 2),
twoindex = _useState22[0],
settwoindex = _useState22[1]; //小题下标
var _useState23 = (0,_react_17_0_2_react.useState)(false),
_useState24 = slicedToArray_default()(_useState23, 2),
showConfirm = _useState24[0],
setShowConfirm = _useState24[1];
var _useState25 = (0,_react_17_0_2_react.useState)(false),
_useState26 = slicedToArray_default()(_useState25, 2),
knowledgeDialog = _useState26[0],
_setKnowledgeDialog = _useState26[1]; //推荐知识点弹窗
var _useState27 = (0,_react_17_0_2_react.useState)([]),
_useState28 = slicedToArray_default()(_useState27, 2),
itemBankData = _useState28[0],
setItemBankData = _useState28[1]; //推荐知识题目
var _useState29 = (0,_react_17_0_2_react.useState)(true),
_useState30 = slicedToArray_default()(_useState29, 2),
showBtn = _useState30[0],
setShowBtn = _useState30[1];
var _useState31 = (0,_react_17_0_2_react.useState)({}),
_useState32 = slicedToArray_default()(_useState31, 2),
userAnswer = _useState32[0],
setUserAnswer = _useState32[1];
var divRef = (0,_react_17_0_2_react.useRef)(null);
var questionPartRef = (0,_react_17_0_2_react.useRef)();
(0,Hooks/* useDisableAction */.y)((0,authority/* isStudent */.dE)());
(0,_react_17_0_2_react.useEffect)(function () {
document.body.setAttribute('data-custom', 'auto');
return function () {
document.body.removeAttribute('data-custom');
};
}, []);
(0,_react_17_0_2_react.useEffect)(function () {
var _user$userInfo, _user$userInfo2;
document.body.scrollIntoView();
if (((_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.real_name) === "游客") {
window.location.href = "/classrooms/".concat(params.stageId, "/exercise");
return;
}
if ((_user$userInfo2 = user.userInfo) !== null && _user$userInfo2 !== void 0 && _user$userInfo2.user_id) {
initData();
}
window.addEventListener('message', handleMessage);
return function () {
window.removeEventListener('message', handleMessage);
if (location.pathname.indexOf("/detail") > -1) (0,fullscreen/* exitFull */.BU)();
};
}, [params.exerciseId, user.userInfo.login]);
(0,_react_17_0_2_react.useEffect)(function () {
dispatch({
type: "globalSetting/headerFooterToggle",
payload: false
});
return function () {
dispatch({
type: "globalSetting/headerFooterToggle",
payload: true
});
};
}, []);
(0,_react_17_0_2_react.useEffect)(function () {
var _answerData$exercise_;
setQuestionItem(answerData === null || answerData === void 0 || (_answerData$exercise_ = answerData.exercise_question_types) === null || _answerData$exercise_ === void 0 || (_answerData$exercise_ = _answerData$exercise_[oneindex]) === null || _answerData$exercise_ === void 0 || (_answerData$exercise_ = _answerData$exercise_.items) === null || _answerData$exercise_ === void 0 ? void 0 : _answerData$exercise_[twoindex]);
}, [answerData]);
(0,_react_17_0_2_react.useEffect)(function () {
var _banks, _banks2;
if (!knowledgeDialog) {
setItemBankData([]);
return;
}
var banks = [];
if (questionItem !== null && questionItem !== void 0 && questionItem.recommend_item_banks) {
banks = toConsumableArray_default()(questionItem === null || questionItem === void 0 ? void 0 : questionItem.recommend_item_banks);
}
// 判断推荐知识点是是否答题
if (((_banks = banks) === null || _banks === void 0 ? void 0 : _banks.length) > 0 && !(((_banks2 = banks) === null || _banks2 === void 0 ? void 0 : _banks2[0].is_right) === null)) {
setShowBtn(false);
banks.forEach(function (item) {
item.user_score = item !== null && item !== void 0 && item.is_right ? 1 : 0;
item.question_score = 1;
item.standard_answer = item === null || item === void 0 ? void 0 : item.answer_content;
item.user_answer_right = item === null || item === void 0 ? void 0 : item.is_right;
// 单选 多选 判断
if (['SINGLE', 'MULTIPLE', 'JUDGMENT'].includes(item === null || item === void 0 ? void 0 : item.question_type)) {
item === null || item === void 0 || item.question_choices.forEach(function (choice) {
var exists = item === null || item === void 0 ? void 0 : item.answer_content.includes(choice.choice_id);
choice.user_answer_boolean = exists;
});
}
// 填空
if ((item === null || item === void 0 ? void 0 : item.question_type) === 'COMPLETION') {
item.user_answer = item === null || item === void 0 ? void 0 : item.answer_content;
}
});
setItemBankData(banks);
} else {
banks.forEach(function (item) {
item.user_score = 0;
item.question_score = 1;
});
setItemBankData(banks);
setShowBtn(true);
}
}, [knowledgeDialog]);
var handleMessage = function handleMessage(data) {
if (data.data === 'backExercise') {
(0,util/* copyTextFuc */.RG)(" ", true);
resetIframe();
}
};
var resetIframe = function resetIframe() {
setIframeBlock("none");
setIframeUrl("");
initData();
};
var getSaveHackEvaluate = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var item,
_args = arguments;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
item = _args.length > 0 && _args[0] !== undefined ? _args[0] : questionItem;
_context.next = 3;
return (0,fetch/* default */.ZP)("/api/exercise_questions/".concat(item === null || item === void 0 ? void 0 : item.question_id, "/exercise_answers/save_hack_evaluate.json"), {});
case 3:
case "end":
return _context.stop();
}
}, _callee);
}));
return function getSaveHackEvaluate() {
return _ref2.apply(this, arguments);
};
}(); //生成评测记录
var initData = /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(is_reset) {
var _res$exercise_scores;
var res;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
if (is_reset) {
setAnswerData({});
}
document.body.scrollIntoView();
setIsSpin(true);
_context2.next = 5;
return (0,fetch/* default */.ZP)("/api/exercises/".concat(params.exerciseId, "/subject_exercise_start.json"), {
method: 'GET',
params: {
is_reset: is_reset ? 1 : null
}
});
case 5:
res = _context2.sent;
setIsSpin(false);
res.exercise_types = (res === null || res === void 0 ? void 0 : res.exercise_types) || (res === null || res === void 0 || (_res$exercise_scores = res.exercise_scores) === null || _res$exercise_scores === void 0 ? void 0 : _res$exercise_scores.exercise_types);
res.question_status = res.question_status || createItems((res === null || res === void 0 ? void 0 : res.exercise_question_types) || []);
setAnswerData(objectSpread2_default()({}, res));
return _context2.abrupt("return", res);
case 11:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function initData(_x) {
return _ref3.apply(this, arguments);
};
}();
var createItems = function createItems(item) {
var items = [];
item.forEach(function (e) {
items = items.concat(e.items);
});
items = items.map(function (e) {
return {
ques_status: e === null || e === void 0 ? void 0 : e.ques_status,
question_num: e === null || e === void 0 ? void 0 : e.question_num,
ques_id: e === null || e === void 0 ? void 0 : e.question_id
};
});
return items;
};
var goShixun = /*#__PURE__*/function () {
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(item) {
var res;
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return (item.is_jupyter || item.is_jupyter_lab ? shixuns/* execJupyter */.BK : shixuns/* execShixun */.Ir)({
id: item.shixun_identifier
});
case 2:
res = _context3.sent;
if (res !== null && res !== void 0 && res.game_identifier || res !== null && res !== void 0 && res.identifier) {
if (item.is_jupyter_lab || item.is_jupyter) {
setIframeUrl("/tasks/".concat(res.identifier, "/jupyter?type=exercises&exercisesId=").concat(params.exerciseId, "&coursesId=").concat(params.stageId, "&login=").concat(params.login, "&questionId=").concat(item.question_id, "&isFullScreen=").concat((0,fullscreen/* IsFull */.vp)()).concat(iframeUrlSuffix.current || ""));
} else {
setIframeUrl("/tasks/".concat(res.game_identifier, "?type=exercises&exercisesId=").concat(params.exerciseId, "&coursesId=").concat(params.stageId, "&login=").concat(params.login, "&questionId=").concat(item.question_id, "&isFullScreen=").concat((0,fullscreen/* IsFull */.vp)()).concat(iframeUrlSuffix.current || ""));
}
setIframeBlock("block");
}
if ((res === null || res === void 0 ? void 0 : res.status) === -3) {
(0,util/* bindPhone */.eF)();
} else if ((res === null || res === void 0 ? void 0 : res.status) === 2) {
handleResetGame(res === null || res === void 0 ? void 0 : res.message, item.question_id, item.is_jupyter_lab, item.is_jupyter);
} else if ((res === null || res === void 0 ? void 0 : res.status) === 3) {
handleInBeta(res === null || res === void 0 ? void 0 : res.message);
}
case 5:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return function goShixun(_x2) {
return _ref4.apply(this, arguments);
};
}();
var handleResetGame = function handleResetGame(url, question_id, is_jupyter_lab, is_jupyter) {
var _url;
url = (_url = url) !== null && _url !== void 0 && _url.includes('.json') ? url : "".concat(url, ".json");
modal/* default */.Z.confirm({
centered: true,
title: '提示',
icon: null,
okText: '确定',
cancelText: '取消',
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: "\u5B9E\u8BAD\u5DF2\u7ECF\u66F4\u65B0\u4E86\uFF0C\u6B63\u5728\u4E3A\u60A8\u91CD\u7F6E!"
}),
onOk: function () {
var _onOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
var res, execRes;
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
_context4.next = 2;
return (0,service_exercise/* resetMyGame */.$Q)({
url: url
});
case 2:
res = _context4.sent;
if (res) {
_context4.next = 5;
break;
}
return _context4.abrupt("return");
case 5:
message/* default */.ZP.success("重置成功,正在进入实践项目!");
_context4.next = 8;
return (0,shixuns/* execShixun */.Ir)({
id: res.shixun_identifier
});
case 8:
execRes = _context4.sent;
if (!(execRes !== null && execRes !== void 0 && execRes.game_identifier)) {
_context4.next = 12;
break;
}
goShixun({
shixun_identifier: execRes === null || execRes === void 0 ? void 0 : execRes.game_identifier,
question_id: question_id,
is_jupyter_lab: is_jupyter_lab,
is_jupyter: is_jupyter
});
// openNewWindow(`/tasks/${execRes.game_identifier}`);
return _context4.abrupt("return");
case 12:
if ((execRes === null || execRes === void 0 ? void 0 : execRes.status) === 2) {
handleResetGame(execRes === null || execRes === void 0 ? void 0 : execRes.message, question_id, is_jupyter_lab, is_jupyter);
} else if ((execRes === null || execRes === void 0 ? void 0 : execRes.status) === 3) {
handleInBeta(execRes === null || execRes === void 0 ? void 0 : execRes.message);
}
case 13:
case "end":
return _context4.stop();
}
}, _callee4);
}));
function onOk() {
return _onOk.apply(this, arguments);
}
return onOk;
}()
});
};
var handleInBeta = function handleInBeta(message) {
modal/* default */.Z.confirm({
centered: true,
title: '提示',
icon: null,
okText: '确定',
cancelText: '取消',
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: ["\u76EE\u524D\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5C1A\u5728\u5185\u6D4B\u4E2D\uFF0C\u5C06\u4E8E", message, "\u4E4B\u540E\u5F00\u653E\uFF0C\u8C22\u8C22\uFF01"]
})
});
};
var handleJoinShixun = /*#__PURE__*/function () {
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6(item) {
var _answerData$exercise;
var checkRes;
return regeneratorRuntime_default()().wrap(function _callee6$(_context6) {
while (1) switch (_context6.prev = _context6.next) {
case 0:
_context6.next = 2;
return (0,service_exercise/* checkRedoStatus */.o3)({
exercise_user_id: answerData === null || answerData === void 0 || (_answerData$exercise = answerData.exercise) === null || _answerData$exercise === void 0 ? void 0 : _answerData$exercise.exercise_user_id,
shixun_id: item.shixun_id
});
case 2:
checkRes = _context6.sent;
if (checkRes !== null && checkRes !== void 0 && checkRes.redo) {
modal/* default */.Z.info({
width: 530,
title: '提示',
icon: null,
centered: true,
okText: '确定',
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: "\u60A8\u4E4B\u524D\u5DF2\u7ECF\u6311\u6218\u8FC7\u8BE5\u5B9E\u8BAD\uFF0C\u8003\u8BD5\u8FC7\u7A0B\u4E2D\u9700\u8981\u91CD\u65B0\u6311\u6218"
}),
onOk: function () {
var _onOk2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5() {
var res, newQuestions, index, newItem;
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
_context5.next = 2;
return (0,service_exercise/* resetMyGame */.$Q)({
id: checkRes === null || checkRes === void 0 ? void 0 : checkRes.myshixun_identifier,
url: checkRes === null || checkRes === void 0 ? void 0 : checkRes.url
});
case 2:
res = _context5.sent;
if (res) {
newQuestions = (0,lodash.cloneDeep)(answerData === null || answerData === void 0 ? void 0 : answerData.exercise_question_types);
index = newQuestions === null || newQuestions === void 0 ? void 0 : newQuestions.findIndex(function (e) {
return e.question_type === 5;
});
newQuestions[index].items.find(function (er) {
return er.question_id === item.question_id;
}).redo = false;
newQuestions[index].items.find(function (er) {
return er.question_id === item.question_id;
}).shixun_identifier = res.shixun_identifier;
answerData.exercise_question_types = newQuestions;
setAnswerData(answerData);
newItem = objectSpread2_default()(objectSpread2_default()({}, item), {}, {
shixun_identifier: res.shixun_identifier
});
goShixun(newItem);
}
case 4:
case "end":
return _context5.stop();
}
}, _callee5);
}));
function onOk() {
return _onOk2.apply(this, arguments);
}
return onOk;
}()
});
} else {
goShixun(item);
}
case 4:
case "end":
return _context6.stop();
}
}, _callee6);
}));
return function handleJoinShixun(_x3) {
return _ref5.apply(this, arguments);
};
}();
var handleJoinProgram = /*#__PURE__*/function () {
var _ref6 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee7(item) {
var res;
return regeneratorRuntime_default()().wrap(function _callee7$(_context7) {
while (1) switch (_context7.prev = _context7.next) {
case 0:
if (!item.hack_identifier) {
_context7.next = 5;
break;
}
_context7.next = 3;
return (0,service_exercise/* startProgram */.nF)({
id: item.hack_identifier
});
case 3:
res = _context7.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
setIframeUrl("/myproblems/".concat(res.identifier, "?type=exercises&exercisesId=").concat(params.exerciseId, "&coursesId=").concat(params.stageId, "&login=").concat(params.login, "&questionId=").concat(item.question_id).concat(iframeUrlSuffix.current || ""));
setIframeBlock("block");
}
case 5:
case "end":
return _context7.stop();
}
}, _callee7);
}));
return function handleJoinProgram(_x4) {
return _ref6.apply(this, arguments);
};
}();
var handleChangeSingle = function handleChangeSingle(value, id, key, item) {
if (['SINGLE', 'JUDGMENT'].includes(item.question_type)) {
updateSuggestAnswer(value, id);
return;
}
//答题卡选中
answerData.question_status.find(function (item) {
return item.ques_id === id;
}).ques_status = value ? 1 : 0;
item.user_answer = [];
item.user_answer.push(value);
setAnswerData(objectSpread2_default()({}, answerData));
setShowConfirm(true);
};
var handleChangeSingles = /*#__PURE__*/function () {
var _ref7 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee8(value, id, key, item, items) {
var _items$sub_exercise_q, _items$sub_exercise_q2, _items$sub_exercise_q3;
var answer;
return regeneratorRuntime_default()().wrap(function _callee8$(_context8) {
while (1) switch (_context8.prev = _context8.next) {
case 0:
item.user_answer = [];
item.user_answer.push(value);
items.user_answer = toConsumableArray_default()(item.user_answer); //组合题的是否作答判断也要放在外层
answer = items === null || items === void 0 || (_items$sub_exercise_q = items.sub_exercise_questions) === null || _items$sub_exercise_q === void 0 ? void 0 : _items$sub_exercise_q.filter(function (item) {
var _item$user_answer;
return ((_item$user_answer = item.user_answer) === null || _item$user_answer === void 0 ? void 0 : _item$user_answer.length) === 0;
});
answerData.question_status.find(function (item) {
return item.ques_id === id;
}).ques_status = (answer === null || answer === void 0 ? void 0 : answer.length) === (items === null || items === void 0 || (_items$sub_exercise_q2 = items.sub_exercise_questions) === null || _items$sub_exercise_q2 === void 0 ? void 0 : _items$sub_exercise_q2.length) ? 0 : (answer === null || answer === void 0 ? void 0 : answer.length) > 0 && (answer === null || answer === void 0 ? void 0 : answer.length) < (items === null || items === void 0 || (_items$sub_exercise_q3 = items.sub_exercise_questions) === null || _items$sub_exercise_q3 === void 0 ? void 0 : _items$sub_exercise_q3.length) ? 2 : 1;
setAnswerData(objectSpread2_default()({}, answerData));
case 6:
case "end":
return _context8.stop();
}
}, _callee8);
}));
return function handleChangeSingles(_x5, _x6, _x7, _x8, _x9) {
return _ref7.apply(this, arguments);
};
}();
var handleChangeMultiple = function handleChangeMultiple(value, id, item) {
if (!(value !== null && value !== void 0 && value.length)) return;
if (item.question_type == 'MULTIPLE') {
updateSuggestAnswer(value, id);
return;
}
item.user_answer = value;
answerData.question_status.find(function (item) {
return item.ques_id === id;
}).ques_status = value !== null && value !== void 0 && value.length ? 1 : 0;
setAnswerData(objectSpread2_default()({}, answerData));
setShowConfirm(true);
};
var handleBlurFill = /*#__PURE__*/function () {
var _ref8 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee9(value, index, id, param, item) {
var answers;
return regeneratorRuntime_default()().wrap(function _callee9$(_context9) {
while (1) switch (_context9.prev = _context9.next) {
case 0:
if (value.replaceAll(' ', '')) {
_context9.next = 3;
break;
}
signConfigFuc();
return _context9.abrupt("return", {
status: -4,
message: '答案不能为空'
});
case 3:
if (!['COMPLETION'].includes(item.question_type)) {
_context9.next = 6;
break;
}
updateSuggestAnswer(value, id, index);
return _context9.abrupt("return", {
status: 1,
message: ''
});
case 6:
answerData.question_status.find(function (item) {
return item.ques_id === id;
}).ques_status = param.every(function (k) {
return !!k.answer_text;
}) ? 1 : answerData.question_status.find(function (item) {
return item.ques_id === id;
}).ques_status = param.some(function (k) {
return !!k.answer_text;
}) ? 2 : 0;
answers = {
choice_id: index,
answer_text: value
};
if (item.user_answer.filter(function (item) {
return item.choice_id != index;
})) {
item.user_answer.splice(index - 1, 1, answers);
} else {
item.user_answer.push(answers);
}
setAnswerData(objectSpread2_default()({}, answerData));
setShowConfirm(true);
signConfigFuc();
return _context9.abrupt("return", {
status: 1,
message: ''
});
case 13:
case "end":
return _context9.stop();
}
}, _callee9);
}));
return function handleBlurFill(_x10, _x11, _x12, _x13, _x14) {
return _ref8.apply(this, arguments);
};
}();
var handleBlurBProgram = /*#__PURE__*/function () {
var _ref9 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee10(value, index, id, param, item) {
var _questionItem$standar;
var answers, obj;
return regeneratorRuntime_default()().wrap(function _callee10$(_context10) {
while (1) switch (_context10.prev = _context10.next) {
case 0:
answerData.question_status.find(function (item) {
return item.ques_id === id;
}).ques_status = param.every(function (k) {
return !!k.value;
}) ? 1 : answerData.question_status.find(function (item) {
return item.ques_id === id;
}).ques_status = param.some(function (k) {
return !!k.value;
}) ? 2 : 0;
answers = {
choice_id: index,
answer_text: value
};
if (item.user_answer.filter(function (item) {
return item.choice_id != index;
})) {
item.user_answer.splice(index - 1, 1, answers);
} else {
item.user_answer.push(answers);
}
if (!item.repeat_answer) {
item.israp = true;
}
obj = questionItem === null || questionItem === void 0 || (_questionItem$standar = questionItem.standard_answer_with_score) === null || _questionItem$standar === void 0 ? void 0 : _questionItem$standar.map(function (val, index) {
var _questionItem$user_an;
return objectSpread2_default()(objectSpread2_default()({}, val), {}, {
value: (questionItem === null || questionItem === void 0 || (_questionItem$user_an = questionItem.user_answer) === null || _questionItem$user_an === void 0 || (_questionItem$user_an = _questionItem$user_an.find(function (item) {
return parseInt(item.choice_id) === index + 1;
})) === null || _questionItem$user_an === void 0 ? void 0 : _questionItem$user_an.answer_text) || ''
});
});
setUserAnswer(objectSpread2_default()(objectSpread2_default()({}, questionItem), {}, {
userAnswer: obj
}));
setAnswerData(objectSpread2_default()({}, answerData));
setShowConfirm(true);
case 8:
case "end":
return _context10.stop();
}
}, _callee10);
}));
return function handleBlurBProgram(_x15, _x16, _x17, _x18, _x19) {
return _ref9.apply(this, arguments);
};
}();
var handleBlurSimple = function handleBlurSimple(value, id, item, hideLoading) {
if (!value.replaceAll(' ', '')) {
signConfigFuc();
return;
}
answerData.question_status.find(function (item) {
return item.ques_id === id;
}).ques_status = value ? 1 : 0;
item.user_answer = [];
item.user_answer.push(value);
setAnswerData(objectSpread2_default()({}, answerData));
setShowConfirm(true);
signConfigFuc();
};
var updateSuggestAnswer = function updateSuggestAnswer(value, id, index) {
setItemBankData(function (e) {
var arr = e.map(function (item) {
if ((item === null || item === void 0 ? void 0 : item.question_id) == id) {
if (['SINGLE', 'MULTIPLE', 'JUDGMENT'].includes(item === null || item === void 0 ? void 0 : item.question_type)) {
// 单选 判断 多选
item.user_answer = [];
item.user_answer.push(value);
} else if (['COMPLETION'].includes(item === null || item === void 0 ? void 0 : item.question_type)) {
// 填空
if (!item.user_answer) {
item.user_answer = [];
}
var answers = {
choice_id: index,
answer_text: value
};
if (item.user_answer.filter(function (info) {
return (info === null || info === void 0 ? void 0 : info.choice_id) != index;
})) {
item.user_answer.splice(index - 1, 1, answers);
} else {
item.user_answer.push(answers);
}
}
}
return item;
});
return arr;
});
signConfigFuc();
};
var setClassName = function setClassName(item, type) {
return item !== null && item !== void 0 && item.standard_answer_show ? "edu-".concat(type, "-").concat(item !== null && item !== void 0 && item.user_answer_right ? "green" : "red") : '';
};
var renderSingle = function renderSingle(item, key) {
var _item$question_choice, _item$standard_answer, _item$question_choice2;
var userAnswer = (item === null || item === void 0 || (_item$question_choice = item.question_choices) === null || _item$question_choice === void 0 ? void 0 : _item$question_choice.filter(function (choice) {
return choice.user_answer_boolean;
}).map(function (choice) {
return choice.choice_id;
})) || [];
var disabled = (item === null || item === void 0 || (_item$standard_answer = item.standard_answer) === null || _item$standard_answer === void 0 ? void 0 : _item$standard_answer.length) > 0 && ((item === null || item === void 0 ? void 0 : item.can_answer_num) == 0 || !showBtn || (item === null || item === void 0 ? void 0 : item.user_answer_right));
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Answermodules.baseMargin,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Group */.ZP.Group, {
disabled: disabled,
defaultValue: userAnswer === null || userAnswer === void 0 ? void 0 : userAnswer[0],
onChange: function onChange(e) {
handleChangeSingle(e.target.value, item === null || item === void 0 ? void 0 : item.question_id, key, item);
},
className: setClassName(item, 'radio'),
children: item === null || item === void 0 || (_item$question_choice2 = item.question_choices) === null || _item$question_choice2 === void 0 ? void 0 : _item$question_choice2.map(function (answer, index) {
var isJudge = item.question_type == 2;
var prefix = isJudge ? '' : "".concat(tagList[index], ".");
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Answermodules.answerWrap,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default */.ZP, {
className: Answermodules.noWrap,
value: answer === null || answer === void 0 ? void 0 : answer.choice_id,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#333333'
},
className: "font16 mr3",
children: prefix
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
style: {
width: 740
},
className: Answermodules.renderHtml,
value: answer === null || answer === void 0 ? void 0 : answer.choice_text
})]
})
}, index);
})
})
}), (item === null || item === void 0 ? void 0 : item.standard_answer_show) && /*#__PURE__*/(0,jsx_runtime.jsx)(AnswerDetail, {
item: item
})]
}, item === null || item === void 0 ? void 0 : item.question_title);
};
var renderSingles = function renderSingles(items, keys, i) {
var _items$sub_exercise_q4;
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: items === null || items === void 0 || (_items$sub_exercise_q4 = items.sub_exercise_questions) === null || _items$sub_exercise_q4 === void 0 ? void 0 : _items$sub_exercise_q4.map(function (item, key) {
var _item$standard_answer2, _item$user_answer2, _item$question_choice3;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "".concat(Answermodules.baseMargin, " ").concat(Answermodules.singleItem, " mb20"),
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'baseline',
userSelect: "none",
marginBottom: 40
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
flexShrink: 0,
color: '#999999'
},
className: "font14",
children: ["\uFF08", item === null || item === void 0 ? void 0 : item.question_score, "\u5206\uFF09"]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
flexShrink: 0,
marginRight: 6
},
className: "font16",
children: i + 1 + '.' + (key + 1)
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: item === null || item === void 0 ? void 0 : item.question_title
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Group */.ZP.Group, {
style: {
marginLeft: 66
},
disabled: (item === null || item === void 0 || (_item$standard_answer2 = item.standard_answer) === null || _item$standard_answer2 === void 0 ? void 0 : _item$standard_answer2.length) > 0 && ((item === null || item === void 0 ? void 0 : item.can_answer_num) == 0 || !showBtn || (item === null || item === void 0 ? void 0 : item.user_answer_right)),
defaultValue: item === null || item === void 0 || (_item$user_answer2 = item.user_answer) === null || _item$user_answer2 === void 0 ? void 0 : _item$user_answer2[0],
onChange: function onChange(e) {
handleChangeSingles(e.target.value, items === null || items === void 0 ? void 0 : items.question_id, key, item, items);
},
className: setClassName(item, 'radio'),
children: item === null || item === void 0 || (_item$question_choice3 = item.question_choices) === null || _item$question_choice3 === void 0 ? void 0 : _item$question_choice3.map(function (answer, index) {
var isJudge = item.question_type == 2;
var prefix = isJudge ? '' : "".concat(tagList[index], ".");
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Answermodules.answerWrap,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default */.ZP, {
className: Answermodules.noWrap,
value: answer === null || answer === void 0 ? void 0 : answer.choice_id,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#333333'
},
className: "mr3 font16 ".concat(Answermodules.noWrap),
children: prefix
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
style: {
width: 734
},
className: Answermodules.renderHtml,
value: answer === null || answer === void 0 ? void 0 : answer.choice_text
})]
})
}, index);
})
}), (item === null || item === void 0 ? void 0 : item.standard_answer_show) && /*#__PURE__*/(0,jsx_runtime.jsx)(AnswerDetail, {
item: item
}), (item === null || item === void 0 ? void 0 : item.can_answer_num) > 0 && (item === null || item === void 0 ? void 0 : item.user_score) != (item === null || item === void 0 ? void 0 : item.question_score) && !(item !== null && item !== void 0 && item.user_answer_right) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
display: 'flex',
justifyContent: 'flex-end'
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: "".concat(Answermodules.changeButton, " ml20"),
type: "primary",
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee11() {
var paramsData, res;
return regeneratorRuntime_default()().wrap(function _callee11$(_context11) {
while (1) switch (_context11.prev = _context11.next) {
case 0:
paramsData = {
questionId: item === null || item === void 0 ? void 0 : item.question_id,
exercise_choice_id: item === null || item === void 0 ? void 0 : item.user_answer
};
_context11.next = 3;
return (0,fetch/* default */.ZP)("/api/exercise_questions/".concat(item === null || item === void 0 ? void 0 : item.question_id, "/exercise_answers/subject_exercise_answer.json"), {
method: 'POST',
body: paramsData
});
case 3:
res = _context11.sent;
if (res.status == 0) {
setShowConfirm(false);
initData();
signConfigFuc();
}
case 5:
case "end":
return _context11.stop();
}
}, _callee11);
})),
children: "\u786E\u5B9A"
})
})]
}, key);
})
});
};
var renderMultiple = function renderMultiple(item, key) {
var _item$question_choice4, _item$standard_answer3, _item$question_choice5;
var userAnswer = (item === null || item === void 0 || (_item$question_choice4 = item.question_choices) === null || _item$question_choice4 === void 0 ? void 0 : _item$question_choice4.filter(function (choice) {
return choice.user_answer_boolean;
}).map(function (choice) {
return choice.choice_id;
})) || [];
var disabled = (item === null || item === void 0 || (_item$standard_answer3 = item.standard_answer) === null || _item$standard_answer3 === void 0 ? void 0 : _item$standard_answer3.length) > 0 && ((item === null || item === void 0 ? void 0 : item.can_answer_num) == 0 || !showBtn || (item === null || item === void 0 ? void 0 : item.user_answer_right));
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Answermodules.baseMargin,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z.Group, {
disabled: disabled,
defaultValue: userAnswer,
style: {
flexDirection: 'column'
},
onChange: function onChange(value) {
handleChangeMultiple(value, item === null || item === void 0 ? void 0 : item.question_id, item);
},
className: setClassName(item, 'checkbox'),
children: item === null || item === void 0 || (_item$question_choice5 = item.question_choices) === null || _item$question_choice5 === void 0 ? void 0 : _item$question_choice5.map(function (answer, index) {
var prefix = "".concat(tagList[index], ".");
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Answermodules.answerWrap,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_checkbox/* default */.Z, {
value: answer === null || answer === void 0 ? void 0 : answer.choice_id,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#333333'
},
className: "font16 mr3",
children: prefix
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: Answermodules.renderHtml,
value: answer === null || answer === void 0 ? void 0 : answer.choice_text
})]
})
}, index);
})
})
}), (item === null || item === void 0 ? void 0 : item.standard_answer_show) && /*#__PURE__*/(0,jsx_runtime.jsx)(AnswerDetail, {
item: item
})]
}, item === null || item === void 0 ? void 0 : item.question_title);
};
var renderFill = function renderFill(item, key) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(components_Fill, {
item: item,
sign: sign,
showBtn: showBtn,
answerData: answerData,
knowledgeDialog: knowledgeDialog,
setKnowledgeDialog: function setKnowledgeDialog() {
return _setKnowledgeDialog(true);
},
onBlur: ( /*#__PURE__*/function () {
var _ref11 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee12(value, index, userAnswer) {
return regeneratorRuntime_default()().wrap(function _callee12$(_context12) {
while (1) switch (_context12.prev = _context12.next) {
case 0:
_context12.next = 2;
return handleBlurFill(value, index, item === null || item === void 0 ? void 0 : item.question_id, userAnswer, item);
case 2:
return _context12.abrupt("return", _context12.sent);
case 3:
case "end":
return _context12.stop();
}
}, _callee12);
}));
return function (_x20, _x21, _x22) {
return _ref11.apply(this, arguments);
};
}())
});
};
// 简答题
var renderSimple = function renderSimple(item, key) {
if (isEducation) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(Simple2, {
item: item,
answerData: answerData,
onBlur: function onBlur(value, kp_content, kp_clazz) {
setShowConfirm(true);
},
isEducation: isEducation
});
} else {
return /*#__PURE__*/(0,jsx_runtime.jsx)(components_Simple, {
item: item,
answerData: answerData,
showBtn: showBtn,
knowledgeDialog: knowledgeDialog,
setKnowledgeDialog: function setKnowledgeDialog() {
return _setKnowledgeDialog(true);
},
onBlur: function onBlur(value, hideLoading) {
handleBlurSimple(value, item === null || item === void 0 ? void 0 : item.question_id, item, hideLoading);
signConfigFuc();
},
isEducation: isEducation,
sign: sign
});
}
};
var renderShixun = function renderShixun(item, key) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(components_Shixun, {
item: item,
answerData: answerData,
exerciseId: params.exerciseId,
coursesId: params.stageId
});
};
var renderProgram = function renderProgram(item, key) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(components_Program, {
item: item,
answerData: answerData
});
};
var renderBProgram = function renderBProgram(item, key) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(components_BFill, {
setIsSubmitCode: setIsSubmitCode,
item: item,
answerData: answerData,
showBtn: showBtn,
knowledgeDialog: knowledgeDialog,
setKnowledgeDialog: function setKnowledgeDialog() {
return _setKnowledgeDialog(true);
},
onBlur: ( /*#__PURE__*/function () {
var _ref12 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee13(value, index, userAnswer) {
return regeneratorRuntime_default()().wrap(function _callee13$(_context13) {
while (1) switch (_context13.prev = _context13.next) {
case 0:
_context13.next = 2;
return handleBlurBProgram(value, index, item === null || item === void 0 ? void 0 : item.question_id, userAnswer, item);
case 2:
return _context13.abrupt("return", _context13.sent);
case 3:
case "end":
return _context13.stop();
}
}, _callee13);
}));
return function (_x23, _x24, _x25) {
return _ref12.apply(this, arguments);
};
}())
});
};
var renderAnswerCard = function renderAnswerCard(title, key, index) {
var _answerData$exercise_2, _obj$items;
var obj = answerData === null || answerData === void 0 || (_answerData$exercise_2 = answerData.exercise_question_types) === null || _answerData$exercise_2 === void 0 ? void 0 : _answerData$exercise_2.find(function (item) {
return item.question_type === key;
});
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Answermodules.answerSheetWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Answermodules.answerSheetQuestionTitle,
onClick: function onClick() {
hideAnswerCard[key] = !hideAnswerCard[key];
setHideAnswerCard(objectSpread2_default()({}, hideAnswerCard));
},
children: [!hideAnswerCard[key] && /*#__PURE__*/(0,jsx_runtime.jsx)(MinusSquareOutlined/* default */.Z, {}), hideAnswerCard[key] && /*#__PURE__*/(0,jsx_runtime.jsx)(PlusSquareOutlined/* default */.Z, {}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "ml5 c-grey-666",
children: title
})]
}), !hideAnswerCard[key] && /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
className: Answermodules.answerSheet,
gutter: [20, 20],
children: obj === null || obj === void 0 || (_obj$items = obj.items) === null || _obj$items === void 0 ? void 0 : _obj$items.map(function (item, k) {
if (item.question_type === key) {
var _answerData$question_, _answerData$question_2, _answerData$question_3;
return /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
onClick: function onClick() {
if (index === oneindex && k === twoindex) {
//点击的答题卡选项恰好是当前题目时不该做任何操作
return;
}
if (sign.current) {
sign.current = 'appoint';
skipData.current = {
oneindex: index,
twoindex: k
};
return;
}
// 如果上一题答完题未提交,则取消它的答题状态并且清空答题内容
if (showConfirm) {
setAnswerData(function (e) {
var _e$question_status;
e.exercise_question_types[oneindex].items[twoindex].user_answer = [];
e === null || e === void 0 || (_e$question_status = e.question_status) === null || _e$question_status === void 0 || _e$question_status.forEach(function (val) {
if (val.ques_id === questionItem.question_id && (val === null || val === void 0 ? void 0 : val.ques_status) === 1) {
val.ques_status = 0;
}
});
return e;
});
setShowConfirm(false);
}
signConfigFuc();
skipAppointQuestion({
oneindex: index,
twoindex: k
});
},
className: "\n ".concat(Answermodules.answerSheetItem, "\n ").concat(answerData !== null && answerData !== void 0 && (_answerData$question_ = answerData.question_status) !== null && _answerData$question_ !== void 0 && _answerData$question_.some(function (val) {
return val.ques_id === item.question_id && (val === null || val === void 0 ? void 0 : val.ques_status) === 1;
}) ? Answermodules.active : '', "\n ").concat(answerData !== null && answerData !== void 0 && (_answerData$question_2 = answerData.question_status) !== null && _answerData$question_2 !== void 0 && _answerData$question_2.some(function (val) {
return val.ques_id === item.question_id && (val === null || val === void 0 ? void 0 : val.ques_status) === 2;
}) ? Answermodules.partialActive : '', "\n ").concat(index === oneindex && k === twoindex ? Answermodules.selected : '', "\n "),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: Answermodules.qindex,
children: k + 1
}), (answerData === null || answerData === void 0 || (_answerData$question_3 = answerData.question_status) === null || _answerData$question_3 === void 0 ? void 0 : _answerData$question_3.some(function (val) {
return val.ques_id === item.question_id && (val === null || val === void 0 ? void 0 : val.ques_status) === 2;
})) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
height: 12,
background: '#3061D0',
position: 'absolute',
width: '100%',
bottom: 0
}
}), item.is_marked && /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-biaoji1 ".concat(Answermodules.markIcon)
})]
}, k)
});
}
})
}, key)]
});
};
var renderQuestion = function renderQuestion(item, i, show) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Answermodules.questionItem,
id: "Anchor_".concat(item === null || item === void 0 ? void 0 : item.question_type, "_").concat(i),
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'baseline',
marginBottom: 40,
userSelect: "none"
},
children: [show && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: "".concat(Answermodules.questionScore, " mr10"),
children: [item === null || item === void 0 ? void 0 : item.question_score, "\u5206"]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: "font16 ".concat(Answermodules.noWrap),
children: [i + 1, "\u3001"]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: (item === null || item === void 0 ? void 0 : item.question_type) === 8 ? item === null || item === void 0 ? void 0 : item.description : item === null || item === void 0 ? void 0 : item.question_title
})]
}),
// 单选题
[0, 'SINGLE'].includes(item === null || item === void 0 ? void 0 : item.question_type) && renderSingle(item, item === null || item === void 0 ? void 0 : item.question_type),
// 判断题
[2, 'JUDGMENT'].includes(item === null || item === void 0 ? void 0 : item.question_type) && renderSingle(item, item === null || item === void 0 ? void 0 : item.question_type),
// 多选题
[1, 'MULTIPLE'].includes(item === null || item === void 0 ? void 0 : item.question_type) && renderMultiple(item, item === null || item === void 0 ? void 0 : item.question_type),
// 填空题
[3, 'COMPLETION'].includes(item === null || item === void 0 ? void 0 : item.question_type) && renderFill(objectSpread2_default()({}, item), item === null || item === void 0 ? void 0 : item.question_type),
// 简答题
[4, 'SUBJECTIVE'].includes(item === null || item === void 0 ? void 0 : item.question_type) && renderSimple(item, item === null || item === void 0 ? void 0 : item.question_type),
// 实训题
[5, 'PRACTICAL'].includes(item === null || item === void 0 ? void 0 : item.question_type) && renderShixun(item, item === null || item === void 0 ? void 0 : item.question_type),
// 编程题
[6, 'PROGRAM'].includes(item === null || item === void 0 ? void 0 : item.question_type) && renderProgram(item, item === null || item === void 0 ? void 0 : item.question_type),
// 组合题
[7, 'COMBINATION'].includes(item === null || item === void 0 ? void 0 : item.question_type) && renderSingles(item, item === null || item === void 0 ? void 0 : item.question_type, i),
// 编程题
[8, 'PROGRAM'].includes(item === null || item === void 0 ? void 0 : item.question_type) && renderBProgram(item, item === null || item === void 0 ? void 0 : item.question_type), (item === null || item === void 0 ? void 0 : item.answer_comments) && /*#__PURE__*/(0,jsx_runtime.jsx)(components_NewAnswerComments, {
hideScore: true,
list: item === null || item === void 0 ? void 0 : item.answer_comments
}),
// 实训题 ,答题
[5, 'PRACTICAL'].includes(item === null || item === void 0 ? void 0 : item.question_type) && /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
justify: "end",
className: "mt20",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AsyncButton/* AsyncButton */.Z, {
type: "primary",
className: Answermodules.toIframeBtn,
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee14() {
return regeneratorRuntime_default()().wrap(function _callee14$(_context14) {
while (1) switch (_context14.prev = _context14.next) {
case 0:
_context14.next = 2;
return handleJoinShixun(item);
case 2:
return _context14.abrupt("return", _context14.sent);
case 3:
case "end":
return _context14.stop();
}
}, _callee14);
})),
children: "\u8FDB\u5165\u7B54\u9898"
})
}),
// 编程题 ,答题
[6, 'PROGRAM'].includes(item === null || item === void 0 ? void 0 : item.question_type) && /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
justify: "end",
className: "mt20",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AsyncButton/* AsyncButton */.Z, {
type: "primary",
className: Answermodules.toIframeBtn,
onClick: function onClick() {
return handleJoinProgram(item);
},
children: "\u8FDB\u5165\u7B54\u9898"
})
})]
});
};
var renderCardList = function renderCardList(item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(_react_17_0_2_react.Fragment, {
children: renderAnswerCard((item === null || item === void 0 ? void 0 : item.name) || constant/* QUESTIONTYPE */.f[item.question_type].name, item.question_type, index)
});
};
var sign = (0,_react_17_0_2_react.useRef)(false);
var skipData = (0,_react_17_0_2_react.useRef)({});
var switchType = (0,_react_17_0_2_react.useRef)();
var switchData = (0,_react_17_0_2_react.useRef)({});
var skipPrevQuestion = function skipPrevQuestion() {
var _questionItem$user_an2, _answerData$exercise_3;
window.blur();
if (!(questionItem !== null && questionItem !== void 0 && questionItem.repeat_answer) && (questionItem === null || questionItem === void 0 || (_questionItem$user_an2 = questionItem.user_answer) === null || _questionItem$user_an2 === void 0 ? void 0 : _questionItem$user_an2.length) > 0) {
//如果勾选了不再提示,则手动设为已答
questionItem.ques_status = 1;
}
questionPartRef.current.scrollTo({
top: 0,
left: 0,
behavior: "smooth"
});
if (twoindex === 0) {
oneindex -= 1;
twoindex = answerData.exercise_question_types[oneindex].items.length - 1;
} else {
twoindex -= 1;
}
// if (questionItem?.question_type == 8 && !isSubmitCode) {
// setTimeout(() => {
// getSaveHackEvaluate(questionItem);
// }, 500);
// }
setQuestionItem(answerData === null || answerData === void 0 || (_answerData$exercise_3 = answerData.exercise_question_types) === null || _answerData$exercise_3 === void 0 || (_answerData$exercise_3 = _answerData$exercise_3[oneindex]) === null || _answerData$exercise_3 === void 0 || (_answerData$exercise_3 = _answerData$exercise_3.items) === null || _answerData$exercise_3 === void 0 ? void 0 : _answerData$exercise_3[twoindex]);
setIsSubmitCode(false);
setoneindex(oneindex);
settwoindex(twoindex);
};
var skipNextQuestion = function skipNextQuestion() {
var _questionItem$user_an3, _answerData$exercise_4;
window.blur();
if (!(questionItem !== null && questionItem !== void 0 && questionItem.repeat_answer) && (questionItem === null || questionItem === void 0 || (_questionItem$user_an3 = questionItem.user_answer) === null || _questionItem$user_an3 === void 0 ? void 0 : _questionItem$user_an3.length) > 0) {
//如果勾选了不再提示,则手动设为已答
questionItem.ques_status = 1;
}
questionPartRef.current.scrollTo({
top: 0,
left: 0,
behavior: "smooth"
});
if (answerData.exercise_question_types[oneindex].items.length - 1 === twoindex) {
oneindex = oneindex + 1;
twoindex = 0;
} else {
twoindex = twoindex + 1;
}
// if (questionItem?.question_type == 8 && !isSubmitCode) {
// setTimeout(() => {
// getSaveHackEvaluate(questionItem);
// }, 500);
// }
setQuestionItem(answerData === null || answerData === void 0 || (_answerData$exercise_4 = answerData.exercise_question_types) === null || _answerData$exercise_4 === void 0 || (_answerData$exercise_4 = _answerData$exercise_4[oneindex]) === null || _answerData$exercise_4 === void 0 || (_answerData$exercise_4 = _answerData$exercise_4.items) === null || _answerData$exercise_4 === void 0 ? void 0 : _answerData$exercise_4[twoindex]);
setIsSubmitCode(false);
setoneindex(oneindex);
settwoindex(twoindex);
};
var skipAppointQuestion = function skipAppointQuestion(p) {
var _questionItem$user_an4, _answerData$exercise_5;
var record = p || skipData.current;
if (!(questionItem !== null && questionItem !== void 0 && questionItem.repeat_answer) && (questionItem === null || questionItem === void 0 || (_questionItem$user_an4 = questionItem.user_answer) === null || _questionItem$user_an4 === void 0 ? void 0 : _questionItem$user_an4.length) > 0) {
//如果勾选了不再提示,则手动设为已答
questionItem.ques_status = 1;
}
// if (questionItem?.question_type == 8 && !isSubmitCode) {
// setTimeout(() => {
// getSaveHackEvaluate(questionItem);
// }, 500);
// }
setQuestionItem(answerData === null || answerData === void 0 || (_answerData$exercise_5 = answerData.exercise_question_types) === null || _answerData$exercise_5 === void 0 || (_answerData$exercise_5 = _answerData$exercise_5[record === null || record === void 0 ? void 0 : record.oneindex]) === null || _answerData$exercise_5 === void 0 || (_answerData$exercise_5 = _answerData$exercise_5.items) === null || _answerData$exercise_5 === void 0 ? void 0 : _answerData$exercise_5[record === null || record === void 0 ? void 0 : record.twoindex]);
setIsSubmitCode(false);
setoneindex(record === null || record === void 0 ? void 0 : record.oneindex);
settwoindex(record === null || record === void 0 ? void 0 : record.twoindex);
questionPartRef.current.scrollTo({
top: 0,
left: 0,
behavior: 'smooth'
});
};
// 回答结果详情
var AnswerDetail = function AnswerDetail(_ref14) {
var _item$tag_disciplines;
var props = Object.assign({}, (objectDestructuringEmpty_default()(_ref14), _ref14));
var item = props === null || props === void 0 ? void 0 : props.item;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "mb10",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
fontSize: '16px',
marginBottom: 14,
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: ["\u7B54\u9898\u7ED3\u679C", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
marginLeft: 12,
color: item !== null && item !== void 0 && item.user_answer_right ? '#29A64F' : '#E53333'
},
children: item !== null && item !== void 0 && item.user_answer_right ? "\u7B54\u5BF9\u4E86" : "\u7B54\u9519\u4E86"
})]
}), (item === null || item === void 0 ? void 0 : item.show_recommend) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
cursor: 'pointer',
color: '#3061D0',
fontSize: '14px'
},
onClick: function onClick() {
_setKnowledgeDialog(true);
},
children: ["\u4E3A\u4F60\u63A8\u8350\u540C\u77E5\u8BC6\u70B9\u9898\u76EE\uFF0C\u7ACB\u5373\u5DE9\u56FA", " >"]
})]
}), (item === null || item === void 0 ? void 0 : item.can_answer_num) > 0 && !(item !== null && item !== void 0 && item.user_answer_right) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
color: '#FF8C29',
marginBottom: 14
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ExclamationCircleOutlined/* default */.Z, {
style: {
marginRight: 10
}
}), "\u6E29\u99A8\u63D0\u793A\uFF1A\u8FD8\u6709 ", item === null || item === void 0 ? void 0 : item.can_answer_num, " \u6B21\u673A\u4F1A\u53EF\u5C1D\u8BD5\u8FDB\u884C\u91CD\u65B0\u7B54\u9898\uFF0C\u91CD\u65B0\u7B54\u9898\u6B63\u786E\u540E\u4E5F\u4F1A\u8BA1\u5165\u603B\u6210\u7EE9\u3002"]
}), ((item === null || item === void 0 ? void 0 : item.can_answer_num) == 0 || (item === null || item === void 0 ? void 0 : item.user_answer_right) || knowledgeDialog) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Answermodules.analysisWrap,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Answermodules.greyBg,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
className: "mb20",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
className: "font14 mr10",
style: {
color: '#6A7283',
lineHeight: '30px'
},
children: "\u3010\u7B54\u6848\u3011"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
style: {
fontSize: 16,
lineHeight: '30px'
},
children: item === null || item === void 0 ? void 0 : item.standard_answer_show
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "font14 mr10 mb20",
style: {
color: '#6A7283',
lineHeight: '30px'
},
children: "\u3010\u89E3\u6790\u3011"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: Answermodules.renderHtml,
value: item === null || item === void 0 ? void 0 : item.analysis
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "font14 mr10",
style: {
color: '#6A7283',
lineHeight: '30px'
},
children: "\u3010\u77E5\u8BC6\u70B9\u3011"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
style: {
fontSize: 16,
lineHeight: '30px'
},
children: item === null || item === void 0 || (_item$tag_disciplines = item.tag_disciplines) === null || _item$tag_disciplines === void 0 ? void 0 : _item$tag_disciplines.join("、")
})]
})]
})
})]
});
};
// 退出刷题
var quitExercise = function quitExercise() {
var _answerData$question_4, _answerData$exercise_6;
var a = answerData === null || answerData === void 0 || (_answerData$question_4 = answerData.question_status) === null || _answerData$question_4 === void 0 || (_answerData$question_4 = _answerData$question_4.filter(function (val) {
return val.ques_status === 1;
})) === null || _answerData$question_4 === void 0 ? void 0 : _answerData$question_4.length;
var b = answerData === null || answerData === void 0 || (_answerData$exercise_6 = answerData.exercise_types) === null || _answerData$exercise_6 === void 0 ? void 0 : _answerData$exercise_6.q_counts;
if (b - a > 0) {
modal/* default */.Z.confirm({
title: '提示',
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: ["\u5171 ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#165DFF'
},
children: b
}), " \u9053\u9898\uFF0C\u5F53\u524D\u8FD8\u6709 ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#FF8C29'
},
children: b - a
}), " \u9053\u9898\u672A\u5237\u3002\u786E\u5B9A\u8981\u9000\u51FA\u5417\uFF1F"]
}),
okText: '确认退出',
cancelText: '再看看',
centered: true,
onOk: function onOk() {
_umi_production_exports.history.push("/paths/".concat(params.pathId));
}
});
} else if (b == a) {
var _answerData$exercise2 = answerData === null || answerData === void 0 ? void 0 : answerData.exercise,
user_total_score = _answerData$exercise2.user_total_score,
score_percent = _answerData$exercise2.score_percent,
next_exercise_id = _answerData$exercise2.next_exercise_id;
var _answerData$exercise_7 = answerData === null || answerData === void 0 ? void 0 : answerData.exercise_types,
q_scores = _answerData$exercise_7.q_scores;
// 计算用户的准确率
var accuracy = (user_total_score / q_scores * 100).toFixed(2);
// 判断是否通过通关
var isPass = accuracy >= score_percent;
modal/* default */.Z.confirm({
title: '提示',
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [isPass && !next_exercise_id && "\u6B63\u786E\u7387 ".concat(accuracy, "%\uFF0C\u606D\u559C\u60A8\u5B8C\u6210\u672C\u6B21\u5237\u9898\u4EFB\u52A1\uFF01"), isPass && next_exercise_id && "\u6B63\u786E\u7387 ".concat(accuracy, "%\uFF0C\u606D\u559C\u60A8\u5B8C\u6210\u672C\u6B21\u5237\u9898\u4EFB\u52A1\uFF01\u662F\u5426\u524D\u5F80\u4E0B\u4E00\u9636\u6BB5\u7684\u5237\u9898\u7EC3\u4E60"), !isPass && "\u6B63\u786E\u7387 ".concat(accuracy, "%\uFF0C\u5F88\u9057\u61BE\u60A8\u672A\u5B8C\u6210\u672C\u6B21\u5237\u9898\u4EFB\u52A1\uFF01")]
}),
okText: isPass && !next_exercise_id && '返回课程' || isPass && next_exercise_id && '立即前往' || !isPass && '重新刷题',
cancelText: isPass && next_exercise_id && '稍后再说' || !isPass && '返回课程',
centered: true,
cancelButtonProps: {
style: {
display: isPass && !next_exercise_id && 'none'
}
},
onCancel: function onCancel() {
return _umi_production_exports.history.push("/paths/".concat(params.pathId));
},
onOk: function onOk() {
if (isPass && !next_exercise_id) {
_umi_production_exports.history.push("/paths/".concat(params.pathId));
} else if (isPass && next_exercise_id) {
_umi_production_exports.history.push("/paths/".concat(params.pathId, "/exercise/").concat(params.stageId, "/exerciseId/").concat(next_exercise_id));
} else if (!isPass) {
restPrompt();
}
}
});
}
};
// 重新刷题提示
var restPrompt = function restPrompt() {
modal/* default */.Z.confirm({
title: '提示',
content: '重新刷题会清空之前的全部刷题记录,确定要重新刷题吗?',
okText: '确定',
cancelText: '取消',
centered: true,
onOk: function onOk() {
initData(true);
setIsSubmitCode(false);
setoneindex(0);
settwoindex(0);
},
onCancel: function onCancel() {
_umi_production_exports.history.push("/paths/".concat(params.pathId));
}
});
};
var signConfigFuc = function signConfigFuc() {
switch (sign.current) {
case "prev":
skipPrevQuestion();
initRecommend();
break;
case "next":
skipNextQuestion();
initRecommend();
break;
case "appoint":
skipAppointQuestion();
break;
case "quit":
quitExercise();
break;
default:
}
// if (document.activeElement?.localName === 'textarea') {
// sign.current = true;
// } else {
// sign.current = false;
// }
sign.current = false;
skipData.current = {};
};
// 初始化推荐题目
var initRecommend = function initRecommend() {
setItemBankData([]);
setShowBtn(true);
};
var renderClassifyQuestion = function renderClassifyQuestion() {
var _answerData$exercise_8, _answerData$exercise_9, _answerData$exercise_10, _answerData$exercise_11, _answerData$exercise_12, _answerData$exercise_13;
var currentItem = answerData === null || answerData === void 0 || (_answerData$exercise_8 = answerData.exercise_question_types) === null || _answerData$exercise_8 === void 0 || (_answerData$exercise_8 = _answerData$exercise_8[oneindex].items) === null || _answerData$exercise_8 === void 0 ? void 0 : _answerData$exercise_8[twoindex];
return /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "pt20 mb20",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: Answermodules.questionTypeTitle,
children: [(0,util/* toChineseNumber */.EM)(oneindex + 1), "\u3001", answerData === null || answerData === void 0 || (_answerData$exercise_9 = answerData.exercise_question_types) === null || _answerData$exercise_9 === void 0 || (_answerData$exercise_9 = _answerData$exercise_9[oneindex]) === null || _answerData$exercise_9 === void 0 ? void 0 : _answerData$exercise_9.name]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: Answermodules.questionTypeInfo,
children: ["\uFF08\u5171", answerData === null || answerData === void 0 || (_answerData$exercise_10 = answerData.exercise_question_types) === null || _answerData$exercise_10 === void 0 || (_answerData$exercise_10 = _answerData$exercise_10[oneindex]) === null || _answerData$exercise_10 === void 0 ? void 0 : _answerData$exercise_10.count, "\u9898\uFF1B", (answerData === null || answerData === void 0 || (_answerData$exercise_11 = answerData.exercise_question_types) === null || _answerData$exercise_11 === void 0 || (_answerData$exercise_11 = _answerData$exercise_11[oneindex]) === null || _answerData$exercise_11 === void 0 ? void 0 : _answerData$exercise_11.question_type) === 7 ? "\u5305\u542B".concat(answerData === null || answerData === void 0 || (_answerData$exercise_12 = answerData.exercise_question_types) === null || _answerData$exercise_12 === void 0 || (_answerData$exercise_12 = _answerData$exercise_12[oneindex]) === null || _answerData$exercise_12 === void 0 ? void 0 : _answerData$exercise_12.sub_questions_count, "\u5C0F\u9898") : '', " \u5171", answerData === null || answerData === void 0 || (_answerData$exercise_13 = answerData.exercise_question_types) === null || _answerData$exercise_13 === void 0 || (_answerData$exercise_13 = _answerData$exercise_13[oneindex]) === null || _answerData$exercise_13 === void 0 ? void 0 : _answerData$exercise_13.score, "\u5206\uFF09"]
}), !(currentItem !== null && currentItem !== void 0 && currentItem.repeat_answer) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#E30000',
marginLeft: 20,
fontSize: 14
},
children: "\u6CE8\u610F\uFF1A\u8BE5\u9898\u4F5C\u7B54\u4E4B\u540E\u4E0D\u5141\u8BB8\u4FEE\u6539\u7B54\u6848\u3002"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(_react_17_0_2_react.Fragment, {
children: renderQuestion(currentItem, twoindex, true)
}, twoindex)]
}, oneindex);
};
// 练习答题提交
var _submitAnswer = /*#__PURE__*/function () {
var _ref15 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee15() {
var val,
paramsData,
_questionItem$user_an5,
res,
_args15 = arguments;
return regeneratorRuntime_default()().wrap(function _callee15$(_context15) {
while (1) switch (_context15.prev = _context15.next) {
case 0:
val = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : true;
paramsData = {
questionId: questionItem.question_id,
exercise_choice_id: [0, 1, 2].includes(questionItem.question_type) ? questionItem.user_answer : null
};
if ([3, 8].includes(questionItem.question_type)) {
// 填空题
paramsData.answers = questionItem.user_answer.map(function (item) {
return {
exercise_choice_id: item === null || item === void 0 ? void 0 : item.choice_id,
answer_text: item === null || item === void 0 ? void 0 : item.answer_text
};
});
} else if (questionItem.question_type == 4) {
//简答题
paramsData.answer_text = questionItem === null || questionItem === void 0 || (_questionItem$user_an5 = questionItem.user_answer) === null || _questionItem$user_an5 === void 0 ? void 0 : _questionItem$user_an5[0];
}
_context15.next = 5;
return (0,fetch/* default */.ZP)("/api/exercise_questions/".concat(questionItem.question_id, "/exercise_answers/subject_exercise_answer.json"), {
method: 'POST',
body: paramsData
});
case 5:
res = _context15.sent;
if (res.status == 0 && val) {
setShowConfirm(false);
initData();
signConfigFuc();
}
case 7:
case "end":
return _context15.stop();
}
}, _callee15);
}));
return function submitAnswer() {
return _ref15.apply(this, arguments);
};
}();
// 推荐题作答提交
var submitAnswer2 = /*#__PURE__*/function () {
var _ref16 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee16() {
var _paramsData$item_bank, _answerData$exercise3;
var paramsData, _paramsData$item_bank2, res;
return regeneratorRuntime_default()().wrap(function _callee16$(_context16) {
while (1) switch (_context16.prev = _context16.next) {
case 0:
paramsData = {
exercise_question_id: questionItem.question_id,
// 练习题目得id
item_banks: [] // 被推荐题目数据
};
itemBankData.forEach(function (item) {
var _item$user_answer3;
if (item !== null && item !== void 0 && item.user_answer && (item === null || item === void 0 || (_item$user_answer3 = item.user_answer) === null || _item$user_answer3 === void 0 ? void 0 : _item$user_answer3.length) > 0) {
paramsData === null || paramsData === void 0 || paramsData.item_banks.push({
item_bank_id: item === null || item === void 0 ? void 0 : item.question_id,
choice_id: ['SINGLE', 'MULTIPLE', 'JUDGMENT'].includes(item === null || item === void 0 ? void 0 : item.question_type) ? item === null || item === void 0 ? void 0 : item.user_answer[0] : null,
answers: ['COMPLETION'].includes(item === null || item === void 0 ? void 0 : item.question_type) ? item === null || item === void 0 ? void 0 : item.user_answer : null
});
}
});
if (!((itemBankData === null || itemBankData === void 0 ? void 0 : itemBankData.length) > (paramsData === null || paramsData === void 0 || (_paramsData$item_bank = paramsData.item_banks) === null || _paramsData$item_bank === void 0 ? void 0 : _paramsData$item_bank.length))) {
_context16.next = 5;
break;
}
message/* default */.ZP.error("\u8FD8\u6709".concat((itemBankData === null || itemBankData === void 0 ? void 0 : itemBankData.length) - (paramsData === null || paramsData === void 0 || (_paramsData$item_bank2 = paramsData.item_banks) === null || _paramsData$item_bank2 === void 0 ? void 0 : _paramsData$item_bank2.length), "\u9898\u6CA1\u6709\u4F5C\u7B54\uFF01"));
return _context16.abrupt("return");
case 5:
_context16.next = 7;
return (0,fetch/* default */.ZP)("/api/subject_exercises/".concat(answerData === null || answerData === void 0 || (_answerData$exercise3 = answerData.exercise) === null || _answerData$exercise3 === void 0 ? void 0 : _answerData$exercise3.subject_exercise_id, "/answer.json"), {
method: 'post',
body: paramsData
});
case 7:
res = _context16.sent;
if (res.status == 0) {
setItemBankData(function (e) {
var arr = e.map(function (item) {
res.data.forEach(function (item2) {
var _item;
if ((item2 === null || item2 === void 0 ? void 0 : item2.item_bank_id) == ((_item = item) === null || _item === void 0 ? void 0 : _item.question_id)) {
item.user_score = item2 !== null && item2 !== void 0 && item2.is_right ? 1 : 0;
item.question_score = 1;
item.user_answer_right = item2 === null || item2 === void 0 ? void 0 : item2.is_right;
item2.standard_answer = item2 === null || item2 === void 0 ? void 0 : item2.answer_content;
item = objectSpread2_default()(objectSpread2_default()({}, item), item2);
}
});
return item;
});
return arr;
});
divRef.current.scrollTo(0, 0);
setShowBtn(false);
}
case 9:
case "end":
return _context16.stop();
}
}, _callee16);
}));
return function submitAnswer2() {
return _ref16.apply(this, arguments);
};
}();
return /*#__PURE__*/(0,jsx_runtime.jsxs)(spin/* default */.Z, {
size: 'middle',
spinning: isSpin,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("iframe", {
style: {
display: iframeBlock
},
id: "iframeShixuns",
className: Answermodules.iframe,
src: iframeUrl,
ref: iframe,
frameBorder: "0"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Answermodules.fixHeader,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
wrap: false,
align: "middle",
className: "edu-container",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: (0,util/* exerciseTips */.vB)(answerData === null || answerData === void 0 || (_answerData$exercise4 = answerData.exercise) === null || _answerData$exercise4 === void 0 ? void 0 : _answerData$exercise4.exercise_status)
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
className: "".concat(Answermodules.exerciseTitle, " ml10"),
title: answerData === null || answerData === void 0 || (_answerData$exercise5 = answerData.exercise) === null || _answerData$exercise5 === void 0 ? void 0 : _answerData$exercise5.subject_exercise_name,
children: answerData === null || answerData === void 0 || (_answerData$exercise6 = answerData.exercise) === null || _answerData$exercise6 === void 0 ? void 0 : _answerData$exercise6.subject_exercise_name
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
style: {
marginLeft: 'auto'
},
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(AsyncButton/* AsyncButton */.Z, {
className: "".concat(Answermodules.submitButton, " ml10"),
onClick: function onClick() {
if (sign.current) {
sign.current = 'quit';
return;
}
quitExercise();
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(icons_LogoutOutlined, {}), "\u9000\u51FA"]
})
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
className: "edu-container ".concat(Answermodules.wrapper, " ").concat(isEducation && Answermodules.wrpAnswer),
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
className: "".concat(isEducation ? "mt70" : "", " ").concat(Answermodules.mainPart),
wrap: false,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
flex: showAnswerCard ? "280px" : "0px",
className: isEducation ? "mb100" : "",
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Answermodules.leftPart,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
children: [showAnswerCard && /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
flex: "1",
style: {
background: '#fff',
marginBottom: '10px',
padding: '20px'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
marginBottom: 15
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#5F6368'
},
children: "\u59D3\u540D"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "ml10 ".concat(Answermodules.userInfoText),
children: (answerData === null || answerData === void 0 || (_answerData$exercise7 = answerData.exercise) === null || _answerData$exercise7 === void 0 ? void 0 : _answerData$exercise7.user_name) || '- -'
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#5F6368'
},
children: "\u5B66\u53F7"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "ml10 ".concat(Answermodules.userInfoText),
children: (answerData === null || answerData === void 0 || (_answerData$exercise8 = answerData.exercise) === null || _answerData$exercise8 === void 0 ? void 0 : _answerData$exercise8.student_id) || '- -'
})]
})]
}), showAnswerCard && /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
className: "bg-white",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
className: Answermodules.answerInfo,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
justify: "space-between",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: "\u7B54\u9898\u8FDB\u5EA6"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
className: Answermodules.answerProgress,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#165DFF'
},
children: answerData === null || answerData === void 0 || (_answerData$question_5 = answerData.question_status) === null || _answerData$question_5 === void 0 || (_answerData$question_5 = _answerData$question_5.filter(function (val) {
return val.ques_status === 1;
})) === null || _answerData$question_5 === void 0 ? void 0 : _answerData$question_5.length
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
color: '#999999'
},
children: ["/", answerData === null || answerData === void 0 || (_answerData$exercise_14 = answerData.exercise_types) === null || _answerData$exercise_14 === void 0 ? void 0 : _answerData$exercise_14.q_counts]
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(progress/* default */.Z, {
strokeColor: "#165dffa6",
trailColor: "#0000000d",
percent: (answerData === null || answerData === void 0 || (_answerData$question_6 = answerData.question_status) === null || _answerData$question_6 === void 0 || (_answerData$question_6 = _answerData$question_6.filter(function (val) {
return val.ques_status === 1;
})) === null || _answerData$question_6 === void 0 ? void 0 : _answerData$question_6.length) / (answerData === null || answerData === void 0 || (_answerData$exercise_15 = answerData.exercise_types) === null || _answerData$exercise_15 === void 0 ? void 0 : _answerData$exercise_15.q_counts) * 100,
showInfo: false
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: "c-grey-333",
children: ["\u5171 ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#165DFF'
},
children: (answerData === null || answerData === void 0 || (_answerData$exercise_16 = answerData.exercise_types) === null || _answerData$exercise_16 === void 0 ? void 0 : _answerData$exercise_16.q_counts) || (answerData === null || answerData === void 0 || (_answerData$exercise_17 = answerData.exercise_scores) === null || _answerData$exercise_17 === void 0 || (_answerData$exercise_17 = _answerData$exercise_17.exercise_types) === null || _answerData$exercise_17 === void 0 ? void 0 : _answerData$exercise_17.q_counts)
}), " \u9898\uFF1A"]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: "c-grey-333",
children: ["\u6EE1\u5206 ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#FA6400'
},
children: (answerData === null || answerData === void 0 || (_answerData$exercise_18 = answerData.exercise_types) === null || _answerData$exercise_18 === void 0 ? void 0 : _answerData$exercise_18.q_scores) || (answerData === null || answerData === void 0 || (_answerData$exercise_19 = answerData.exercise_scores) === null || _answerData$exercise_19 === void 0 || (_answerData$exercise_19 = _answerData$exercise_19.exercise_types) === null || _answerData$exercise_19 === void 0 ? void 0 : _answerData$exercise_19.q_scores)
}), " \u5206"]
})]
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
className: Answermodules.dottedLineWrapper,
align: "middle",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
className: Answermodules.leftHalfCircle
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
flex: 1,
className: Answermodules.dottedLine
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
className: Answermodules.rightHalfCircle
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
flex: "1",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
className: "".concat(Answermodules.cardList, " ").concat((_answerData$exercise9 = answerData.exercise) !== null && _answerData$exercise9 !== void 0 && _answerData$exercise9.open_phone_video_recording ? Answermodules.withQrcode : ''),
children: answerData === null || answerData === void 0 || (_answerData$exercise_20 = answerData.exercise_question_types) === null || _answerData$exercise_20 === void 0 ? void 0 : _answerData$exercise_20.map(function (er, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(_react_17_0_2_react.Fragment, {
children: renderCardList(er, index)
}, er.question_type);
})
})
})
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
justify: "space-around",
align: "middle",
className: Answermodules.answerSheetBottom,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
className: Answermodules.tooltipWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: Answermodules.answerYes
}), "\u5DF2\u7B54"]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
className: Answermodules.tooltipWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "".concat(Answermodules.answerNo, " ml10"),
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
height: '50%',
width: '100%',
background: '#0152d9'
}
})
}), "\u90E8\u5206\u7B54\u9898"]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
className: Answermodules.tooltipWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "".concat(Answermodules.answerNo, " ml10")
}), "\u672A\u7B54"]
})]
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Answermodules.fold,
onClick: function onClick() {
return setShowAnswerCard(!showAnswerCard);
},
children: [showAnswerCard && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: "\u6536\u8D77\u7B54\u9898\u5361",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "icon-zuojiantou iconfont c-grey-c"
})
}), !showAnswerCard && /*#__PURE__*/(0,jsx_runtime.jsxs)(tooltip/* default */.Z, {
title: "\u5C55\u5F00",
children: [" ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "icon-youjiantou iconfont c-grey-c"
})]
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
flex: "1",
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
className: [Answermodules.rightPart, 'ml20'].join(' '),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "".concat(Answermodules.questionPart, " pl30 pr30"),
ref: questionPartRef,
children: renderClassifyQuestion()
}), /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
className: Answermodules.bottom,
align: "middle",
justify: "end",
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
style: {
display: 'flex'
},
children: [(oneindex != 0 || twoindex != 0) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: "".concat(Answermodules.changeButton, " ").concat(Answermodules.prevBtn, " mr20"),
type: "default",
onClick: function onClick() {
if (sign.current) {
sign.current = 'prev';
return;
}
skipPrevQuestion();
},
children: "\u4E0A\u4E00\u9898"
}), !showConfirm && !(oneindex === (answerData === null || answerData === void 0 || (_answerData$exercise_21 = answerData.exercise_question_types) === null || _answerData$exercise_21 === void 0 ? void 0 : _answerData$exercise_21.length) - 1 && twoindex === (answerData === null || answerData === void 0 || (_answerData$exercise_22 = answerData.exercise_question_types) === null || _answerData$exercise_22 === void 0 || (_answerData$exercise_22 = _answerData$exercise_22[oneindex]) === null || _answerData$exercise_22 === void 0 || (_answerData$exercise_22 = _answerData$exercise_22.items) === null || _answerData$exercise_22 === void 0 ? void 0 : _answerData$exercise_22.length) - 1) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: Answermodules.changeButton,
type: "primary",
onClick: function onClick() {
if (sign.current) {
sign.current = 'next';
return;
}
skipNextQuestion();
},
children: "\u4E0B\u4E00\u9898"
}), showConfirm && ![7, 'COMBINATION', 8, 'PROGRAM'].includes(questionItem === null || questionItem === void 0 ? void 0 : questionItem.question_type) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: "".concat(Answermodules.changeButton),
type: "primary",
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee17() {
return regeneratorRuntime_default()().wrap(function _callee17$(_context17) {
while (1) switch (_context17.prev = _context17.next) {
case 0:
_submitAnswer();
case 1:
case "end":
return _context17.stop();
}
}, _callee17);
})),
children: "\u786E\u5B9A"
}), showConfirm && [8, 'PROGRAM'].includes(questionItem === null || questionItem === void 0 ? void 0 : questionItem.question_type) && /*#__PURE__*/(0,jsx_runtime.jsx)(Buttonloading, {
setIsSubmitCode: setIsSubmitCode,
ButtonProps: {
type: 'primary',
className: "".concat(Answermodules.changeButton)
},
ButtonText: "\u63D0\u4EA4\u4EE3\u7801",
items: userAnswer,
hackidentifier: questionItem === null || questionItem === void 0 ? void 0 : questionItem.hack_identifier,
submitAnswer: function submitAnswer(e) {
return _submitAnswer(e);
},
updateAnswerInfo: function updateAnswerInfo() {
setShowConfirm(false);
initData();
signConfigFuc();
}
})]
})
})]
})
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(modal/* default */.Z, {
width: 930,
centered: true,
keyboard: false,
title: "\u540C\u77E5\u8BC6\u70B9\u9898\u76EE\u63A8\u8350",
open: knowledgeDialog,
footer: null,
onCancel: function onCancel() {
_setKnowledgeDialog(false);
if (!showBtn) {
initData();
setShowBtn(true);
}
},
children: [(itemBankData === null || itemBankData === void 0 ? void 0 : itemBankData.length) > 0 ? /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
maxHeight: 500,
overflowY: 'auto'
},
ref: divRef,
children: itemBankData.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "mb10",
children: renderQuestion(item, index, false)
});
})
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(NoData/* default */.Z, {}), (itemBankData === null || itemBankData === void 0 ? void 0 : itemBankData.length) > 0 && showBtn ? /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
width: '100%',
display: 'flex',
justifyContent: 'flex-end',
padding: '25px 0px 20px 0px'
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AsyncButton/* AsyncButton */.Z, {
type: "primary",
className: Answermodules.toIframeBtn,
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee18() {
return regeneratorRuntime_default()().wrap(function _callee18$(_context18) {
while (1) switch (_context18.prev = _context18.next) {
case 0:
_context18.next = 2;
return submitAnswer2();
case 2:
return _context18.abrupt("return", _context18.sent);
case 3:
case "end":
return _context18.stop();
}
}, _callee18);
})),
children: "\u786E\u5B9A"
})
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
height: 20
}
})]
})]
});
};
/* harmony default export */ var Detail_Answer = ((0,_umi_production_exports.connect)(function (_ref19) {
var loading = _ref19.loading,
user = _ref19.user,
exercise = _ref19.exercise,
globalSetting = _ref19.globalSetting;
return {
globalSetting: globalSetting,
user: user,
exercise: exercise,
loading: loading.effects
};
})(Answer));
/***/ }),
/***/ 10415:
/*!*********************************!*\
!*** ./src/utils/fullscreen.ts ***!
\*********************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BU: function() { return /* binding */ exitFull; },
/* harmony export */ Dj: function() { return /* binding */ requestFullScreen; },
/* harmony export */ gH: function() { return /* binding */ fullscreenChange; },
/* harmony export */ vp: function() { return /* binding */ IsFull; }
/* harmony export */ });
function requestFullScreen(element) {
try {
if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if (element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
}
} catch (e) {
console.log(e, ":e");
}
}
function exitFull() {
if (window.top.document.webkitExitFullscreen) {
window.top.document.webkitExitFullscreen();
} else if (document.exitFullscreen) {
window.top.document.exitFullscreen();
} else if (document.msExitFullscreen) {
window.top.document.msExitFullscreen();
} else if (document.mozCancelFullScreen) {
window.top.document.mozCancelFullScreen();
}
}
// esliint disabled
var fullscreenChange = function fullscreenChange() {
//['fullscreenchange','msfullscreenchange','webkitfullscreenchange', 'mozfullscreenchange']
if (document.webkitExitFullscreen) {
// document.webkitExitFullscreen()
return 'webkitfullscreenchange';
} else if (document.exitFullscreen) {
// document.exitFullscreen()
return 'fullscreenchange';
} else if (document.msExitFullscreen) {
// document.msExitFullscreen()
return 'msfullscreenchange';
} else if (document.mozCancelFullScreen) {
// document.mozCancelFullScreen()
return 'mozfullscreenchange';
}
};
//判断是否全屏
function IsFull() {
var fullscreenElement = window.top.document.fullscreenElement || window.top.document.mozFullscreenElement || window.top.document.webkitFullscreenElement;
var fullscreenEnabled = document.fullscreenEnabled || document.mozFullscreenEnabled || document.webkitFullscreenEnabled;
console.log("fullscreenElement", fullscreenElement);
if (fullscreenElement == null) {
return false;
} else {
return true;
}
}
// document.addEventListener("mozfullscreenchange", function (event) {
// console.log("mozfullscreenchange ", event);
// if (IsFull()) {
// console.log('进入全屏')
// $("#closescreen").show();
// $("#openscreen").hide();
// } else {
// console.log('退出全屏')
// $("#closescreen").hide();
// $("#openscreen").show();
// }
// });
// document.addEventListener("webkitfullscreenchange", function (event) {
// console.log("webkitfullscreenchange", event);
// if (IsFull()) {
// console.log('进入全屏')
// $("#closescreen").show();
// $("#openscreen").hide();
// } else {
// console.log('退出全屏')
// $("#closescreen").hide();
// $("#openscreen").show();
// }
// });
// document.addEventListener("msfullscreenchange", function (event) {
// console.log("msfullscreenchange", event);
// if (IsFull()) {
// console.log('进入全屏')
// $("#closescreen").show();
// $("#openscreen").hide();
// } else {
// console.log('退出全屏')
// $("#closescreen").hide();
// $("#openscreen").show();
// }
// });
/***/ })
}]);