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.
3095 lines
137 KiB
3095 lines
137 KiB
(self["webpackChunk"] = self["webpackChunk"] || []).push([[20700],{
|
|
|
|
/***/ 30055:
|
|
/*!**********************************************!*\
|
|
!*** ./src/components/AsyncButton/index.tsx ***!
|
|
\**********************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Z: function() { return /* binding */ AsyncButton; }
|
|
/* harmony export */ });
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js */ 82242);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_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_test4_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_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_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_test4_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_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_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_test4_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_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_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_test4_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_test4_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_test4_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_test4_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_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, props), {}, {
|
|
loading: btnLoading,
|
|
onClick: ( /*#__PURE__*/function () {
|
|
var _ref2 = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test4_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_test4_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
|
|
}));
|
|
};
|
|
|
|
/***/ }),
|
|
|
|
/***/ 70245:
|
|
/*!********************************************************!*\
|
|
!*** ./src/pages/tasks/Jupyter/index.tsx + 17 modules ***!
|
|
\********************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
// ESM COMPAT FLAG
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"default": function() { return /* binding */ Jupyter; }
|
|
});
|
|
|
|
// 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/typeof.js
|
|
var helpers_typeof = __webpack_require__(31468);
|
|
var typeof_default = /*#__PURE__*/__webpack_require__.n(helpers_typeof);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
|
|
var regeneratorRuntime = __webpack_require__(7557);
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
|
|
var asyncToGenerator = __webpack_require__(41498);
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
|
|
var slicedToArray = __webpack_require__(79800);
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
// EXTERNAL MODULE: ./node_modules/_@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__(48938);
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
var env = __webpack_require__(63648);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/statistic/index.js + 5 modules
|
|
var statistic = __webpack_require__(31797);
|
|
// 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/modal/index.js + 16 modules
|
|
var modal = __webpack_require__(43418);
|
|
// 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/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/drawer/index.js + 9 modules
|
|
var drawer = __webpack_require__(43428);
|
|
// EXTERNAL MODULE: ./src/components/AsyncButton/index.tsx
|
|
var AsyncButton = __webpack_require__(30055);
|
|
// EXTERNAL MODULE: ./src/pages/Classrooms/Lists/Exercise/components/Unlock.tsx
|
|
var Unlock = __webpack_require__(43454);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/PoweroffOutlined.js + 1 modules
|
|
var PoweroffOutlined = __webpack_require__(76618);
|
|
;// CONCATENATED MODULE: ./src/pages/tasks/Jupyter/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Jupytermodules = ({"bg":"bg___yy2b4","header":"header___TfSCG","dragingMask":"dragingMask___i_1VX","content":"content___b8rIE","leftContainer":"leftContainer___BJcma","tabNav":"tabNav___uSNI4","mdContent":"mdContent___F9FMQ","resizeBar":"resizeBar___WbCV9","has-unity-3d":"has-unity-3d___BFusq","btn-resize":"btn-resize___Zfl7O","rightCotainer":"rightCotainer___iorUm","user":"user___I7MqL","titleWrap":"titleWrap___rJVb0","title":"title___jJ_Uz","endTimeWrap":"endTimeWrap___CSA6g","colorGray":"colorGray___oa4MJ","main":"main___LPfvU","loadFail":"loadFail___CrCok","reload":"reload___dIu1q","failIcon":"failIcon___g2eIS","failWrap":"failWrap___nbGWb","failReload":"failReload___nOEAI","dataSetButton":"dataSetButton___Oe8Wq","ac":"ac___XyH5r","dataSetText":"dataSetText___ltceD","dataSetOpen":"dataSetOpen___YeOkS","footer":"footer____7Qyw","start":"start___mqFxv","liWarp":"liWarp___MZgVd","li":"li___Pwqoe","disabled":"disabled___shXs_"});
|
|
// EXTERNAL MODULE: ./src/service/task.ts
|
|
var task = __webpack_require__(80721);
|
|
;// CONCATENATED MODULE: ./src/pages/tasks/Jupyter/components/Answer/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Answermodules = ({"drawerWrap":"drawerWrap___usUlu","drawer":"drawer___o0tZt","title":"title___N0L4E","titleIcon":"titleIcon___KdORp","filePathWrap":"filePathWrap___UnfcQ","filePathContent":"filePathContent___DE1uf","folderName":"folderName___aiFc7","copy":"copy___u1LKa","listWrap":"listWrap___rwuBa","item":"item___V_PLr","itemText":"itemText___uj01z","disableTips":"disableTips___fbeqZ"});
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 2 modules
|
|
var RenderHtml = __webpack_require__(29792);
|
|
// EXTERNAL MODULE: ./node_modules/_react-copy-to-clipboard@5.0.2@react-copy-to-clipboard/lib/index.js
|
|
var lib = __webpack_require__(56102);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
;// CONCATENATED MODULE: ./src/pages/tasks/Jupyter/components/Answer/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var useTips = function useTips() {
|
|
var _useState = (0,_react_17_0_2_react.useState)(false),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
tipsVisible = _useState2[0],
|
|
setTipsVisible = _useState2[1];
|
|
var showTipsIdRef = (0,_react_17_0_2_react.useRef)();
|
|
var hideTipsIdRef = (0,_react_17_0_2_react.useRef)();
|
|
var hideTips = function hideTips() {
|
|
clearTimeout(hideTipsIdRef.current);
|
|
hideTipsIdRef.current = window.setTimeout(function () {
|
|
setTipsVisible(false);
|
|
}, 1500);
|
|
};
|
|
var showTips = function showTips() {
|
|
clearTimeout(showTipsIdRef.current);
|
|
showTipsIdRef.current = window.setTimeout(function () {
|
|
setTipsVisible(true);
|
|
hideTips();
|
|
}, 500);
|
|
};
|
|
return [tipsVisible, showTips];
|
|
};
|
|
var DisableCopyTips = function DisableCopyTips(_ref) {
|
|
var visible = _ref.visible,
|
|
x = _ref.x,
|
|
y = _ref.y;
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Answermodules.disableTips,
|
|
style: visible ? {
|
|
top: y,
|
|
left: x
|
|
} : {
|
|
display: 'none'
|
|
},
|
|
children: "\u7981\u6B62\u590D\u5236\u53C2\u8003\u7B54\u6848"
|
|
});
|
|
};
|
|
var DataSet = function DataSet(_ref2) {
|
|
var _answerData$standard_;
|
|
var visible = _ref2.visible,
|
|
cancel = _ref2.cancel,
|
|
answerData = _ref2.answerData;
|
|
var _useTips = useTips(),
|
|
_useTips2 = slicedToArray_default()(_useTips, 2),
|
|
tipsVisible = _useTips2[0],
|
|
showTips = _useTips2[1];
|
|
var _useState3 = (0,_react_17_0_2_react.useState)({
|
|
x: 0,
|
|
y: 0
|
|
}),
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
tipsPosition = _useState4[0],
|
|
setTipsPosition = _useState4[1];
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(drawer/* default */.Z, {
|
|
placement: "right",
|
|
closable: false,
|
|
mask: true,
|
|
zIndex: 998,
|
|
onClose: cancel,
|
|
width: 600,
|
|
open: visible === 2,
|
|
rootClassName: Answermodules.drawerWrap,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Answermodules.drawer,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("h2", {
|
|
className: Answermodules.title,
|
|
style: {
|
|
display: 'flex',
|
|
paddingRight: 20,
|
|
justifyContent: 'space-between'
|
|
},
|
|
children: ["\u53C2\u8003\u7B54\u6848 ", !(answerData !== null && answerData !== void 0 && answerData.disable_copy) && /*#__PURE__*/(0,jsx_runtime.jsx)(lib.CopyToClipboard, {
|
|
text: answerData === null || answerData === void 0 || (_answerData$standard_ = answerData.standard_answer) === null || _answerData$standard_ === void 0 ? void 0 : _answerData$standard_.substring(3, (answerData === null || answerData === void 0 ? void 0 : answerData.standard_answer.length) - 3),
|
|
onCopy: function onCopy() {
|
|
return message/* default */.ZP.success('复制成功');
|
|
},
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
style: {
|
|
fontSize: 16,
|
|
fontWeight: 400
|
|
},
|
|
children: "\u590D\u5236"
|
|
})
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "pl20 pr20",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
style: {
|
|
userSelect: answerData !== null && answerData !== void 0 && answerData.disable_copy ? 'none' : 'auto'
|
|
},
|
|
onMouseOver: function onMouseOver(e) {
|
|
setTipsPosition({
|
|
x: e.clientX,
|
|
y: e.clientY
|
|
});
|
|
showTips();
|
|
},
|
|
children: [(answerData === null || answerData === void 0 ? void 0 : answerData.disable_copy) && /*#__PURE__*/(0,jsx_runtime.jsx)(DisableCopyTips, {
|
|
visible: tipsVisible,
|
|
x: tipsPosition.x,
|
|
y: tipsPosition.y
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
value: answerData === null || answerData === void 0 ? void 0 : answerData.standard_answer
|
|
})]
|
|
})
|
|
})]
|
|
})
|
|
});
|
|
};
|
|
/* harmony default export */ var Answer = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
var loading = _ref3.loading,
|
|
globalSetting = _ref3.globalSetting;
|
|
return {
|
|
globalSetting: globalSetting,
|
|
loading: loading
|
|
};
|
|
})(DataSet));
|
|
// EXTERNAL MODULE: ./src/pages/tasks/service/index.js
|
|
var service = __webpack_require__(67935);
|
|
// 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/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/CloseOutlined.js + 1 modules
|
|
var CloseOutlined = __webpack_require__(99267);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.1@@babel/runtime/helpers/esm/extends.js
|
|
var esm_extends = __webpack_require__(5016);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.4.2@@ant-design/icons-svg/es/asn/FileTextOutlined.js
|
|
// This icon file is generated automatically.
|
|
var FileTextOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z" } }] }, "name": "file-text", "theme": "outlined" };
|
|
/* harmony default export */ var asn_FileTextOutlined = (FileTextOutlined);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/components/AntdIcon.js + 3 modules
|
|
var AntdIcon = __webpack_require__(7657);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/FileTextOutlined.js
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
|
|
var FileTextOutlined_FileTextOutlined = function FileTextOutlined(props, ref) {
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
|
|
ref: ref,
|
|
icon: asn_FileTextOutlined
|
|
}));
|
|
};
|
|
|
|
/** */
|
|
var RefIcon = /*#__PURE__*/_react_17_0_2_react.forwardRef(FileTextOutlined_FileTextOutlined);
|
|
if (false) {}
|
|
/* harmony default export */ var icons_FileTextOutlined = (RefIcon);
|
|
// EXTERNAL MODULE: ./node_modules/_react-infinite-scroller@1.2.4@react-infinite-scroller/index.js
|
|
var _react_infinite_scroller_1_2_4_react_infinite_scroller = __webpack_require__(26724);
|
|
var _react_infinite_scroller_1_2_4_react_infinite_scroller_default = /*#__PURE__*/__webpack_require__.n(_react_infinite_scroller_1_2_4_react_infinite_scroller);
|
|
;// CONCATENATED MODULE: ./src/pages/tasks/Jupyter/components/DataSet/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var DataSetmodules = ({"drawerWrap":"drawerWrap___dkOcq","drawer":"drawer___ntUC2","title":"title___Z2x84","closeBtn":"closeBtn___V3pCn","titleIcon":"titleIcon___mIUoJ","filePathWrap":"filePathWrap___ib1bc","filePathContent":"filePathContent___JrvtY","folderName":"folderName___m5MVw","copy":"copy___EPMue","listWrap":"listWrap___QzkC1","item":"item___msJ9l","itemText":"itemText___u5GrX"});
|
|
;// CONCATENATED MODULE: ./src/pages/tasks/Jupyter/components/DataSet/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var DataSet_DataSet = function DataSet(_ref) {
|
|
var globalSetting = _ref.globalSetting,
|
|
loading = _ref.loading,
|
|
dispatch = _ref.dispatch,
|
|
visible = _ref.visible,
|
|
identifier = _ref.identifier,
|
|
cancel = _ref.cancel;
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
dataList = _useState2[0],
|
|
setDataList = _useState2[1];
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(),
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
count = _useState4[0],
|
|
setCount = _useState4[1];
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(),
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
folderName = _useState6[0],
|
|
setFolderName = _useState6[1];
|
|
var _useState7 = (0,_react_17_0_2_react.useState)(),
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
hasMore = _useState8[0],
|
|
setHasMore = _useState8[1];
|
|
var _useState9 = (0,_react_17_0_2_react.useState)({
|
|
page: 1,
|
|
limit: 20,
|
|
identifier: null
|
|
}),
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
params = _useState10[0],
|
|
setParams = _useState10[1];
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
if (!identifier) {
|
|
return;
|
|
}
|
|
params.identifier = identifier;
|
|
setParams(params);
|
|
getDataSetList(params);
|
|
}, [identifier]);
|
|
var getDataSetList = /*#__PURE__*/function () {
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(query) {
|
|
var res, _res$data_sets;
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
while (1) switch (_context.prev = _context.next) {
|
|
case 0:
|
|
_context.next = 2;
|
|
return (0,task/* getDataSets */.a$)(query);
|
|
case 2:
|
|
res = _context.sent;
|
|
if (res) {
|
|
// setDataList(res.data_sets || []);
|
|
setDataList(function (prevItems) {
|
|
return [].concat(toConsumableArray_default()(prevItems || []), toConsumableArray_default()(res.data_sets || []));
|
|
});
|
|
setHasMore(((_res$data_sets = res.data_sets) === null || _res$data_sets === void 0 ? void 0 : _res$data_sets.length) === 20);
|
|
setCount(res.data_sets_count);
|
|
setFolderName(res.folder_name);
|
|
}
|
|
case 4:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
}));
|
|
return function getDataSetList(_x) {
|
|
return _ref2.apply(this, arguments);
|
|
};
|
|
}();
|
|
var handleInfiniteOnLoad = function handleInfiniteOnLoad() {
|
|
params.page = params.page + 1;
|
|
setParams(params);
|
|
getDataSetList(params);
|
|
};
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(drawer/* default */.Z, {
|
|
placement: "right",
|
|
closable: false,
|
|
mask: false,
|
|
onClose: cancel,
|
|
width: 330,
|
|
zIndex: 998,
|
|
open: visible === 1,
|
|
rootClassName: DataSetmodules.drawerWrap,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: DataSetmodules.drawer,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("h2", {
|
|
className: DataSetmodules.title,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(CloseOutlined/* default */.Z, {
|
|
className: DataSetmodules.closeBtn,
|
|
onClick: cancel
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-base ".concat(DataSetmodules.titleIcon)
|
|
}), "\u6570\u636E\u96C6"]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: DataSetmodules.filePathWrap,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: "ml50",
|
|
children: "\u6587\u4EF6\u8DEF\u5F84"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: DataSetmodules.filePathContent,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: DataSetmodules.folderName,
|
|
children: folderName
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(lib.CopyToClipboard, {
|
|
text: folderName,
|
|
onCopy: function onCopy() {
|
|
return message/* default */.ZP.success('复制成功');
|
|
},
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: "".concat(DataSetmodules.copy, " current"),
|
|
children: "\u590D\u5236\u5730\u5740"
|
|
})
|
|
})]
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: DataSetmodules.listWrap,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)((_react_infinite_scroller_1_2_4_react_infinite_scroller_default()), {
|
|
initialLoad: false,
|
|
pageStart: 1,
|
|
threshold: 20,
|
|
loadMore: function loadMore(page) {
|
|
return handleInfiniteOnLoad();
|
|
},
|
|
hasMore: hasMore,
|
|
useWindow: false,
|
|
children: dataList.map(function (item, index) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: DataSetmodules.item,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
className: DataSetmodules.itemText,
|
|
title: item.title,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(icons_FileTextOutlined, {
|
|
style: {
|
|
color: '#28b887',
|
|
fontSize: 25
|
|
}
|
|
}), item.title]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(lib.CopyToClipboard, {
|
|
text: item.file_path,
|
|
onCopy: function onCopy() {
|
|
return message/* default */.ZP.success('复制成功');
|
|
},
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: "".concat(DataSetmodules.copy, " current"),
|
|
children: "\u590D\u5236\u5730\u5740"
|
|
})
|
|
})]
|
|
});
|
|
})
|
|
})
|
|
})]
|
|
})
|
|
});
|
|
};
|
|
/* harmony default export */ var components_DataSet = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
var loading = _ref3.loading,
|
|
globalSetting = _ref3.globalSetting;
|
|
return {
|
|
globalSetting: globalSetting,
|
|
loading: loading
|
|
};
|
|
})(DataSet_DataSet));
|
|
;// CONCATENATED MODULE: ./src/pages/tasks/Jupyter/components/PassModal/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var PassModalmodules = ({"wrap":"wrap___SEtIN","bg":"bg___JE5ml"});
|
|
;// CONCATENATED MODULE: ./src/pages/tasks/Jupyter/components/PassModal/index.tsx
|
|
|
|
|
|
var PassModal = function PassModal(_ref) {
|
|
var showModal = _ref.showModal,
|
|
setShowModal = _ref.setShowModal;
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: PassModalmodules.wrap,
|
|
style: {
|
|
display: showModal ? 'flex' : 'none'
|
|
},
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: PassModalmodules.bg,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
onClick: function onClick() {
|
|
return setShowModal(false);
|
|
},
|
|
className: "iconfont icon-roundclose"
|
|
})
|
|
})
|
|
});
|
|
};
|
|
/* harmony default export */ var components_PassModal = (PassModal);
|
|
// EXTERNAL MODULE: ./src/pages/tasks/choose-repository/test-cast-list/success.svg
|
|
var success = __webpack_require__(5060);
|
|
// EXTERNAL MODULE: ./src/pages/tasks/choose-repository/test-cast-list/failer.svg
|
|
var failer = __webpack_require__(98837);
|
|
// EXTERNAL MODULE: ./src/pages/tasks/choose-repository/test-cast-list/mark.svg
|
|
var mark = __webpack_require__(70446);
|
|
// EXTERNAL MODULE: ./node_modules/_diff-match-patch@1.0.5@diff-match-patch/index.js
|
|
var _diff_match_patch_1_0_5_diff_match_patch = __webpack_require__(79818);
|
|
var _diff_match_patch_1_0_5_diff_match_patch_default = /*#__PURE__*/__webpack_require__.n(_diff_match_patch_1_0_5_diff_match_patch);
|
|
;// CONCATENATED MODULE: ./src/pages/tasks/Jupyter/components/Case/diffPanel.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var diffPanelmodules = ({"diff-panel-container":"diff-panel-container___DRHwS","line-break":"line-break____1HJq","empty":"empty___VD8sP","diff-panel-container-2":"diff-panel-container-2___T3Rde"});
|
|
;// CONCATENATED MODULE: ./src/pages/tasks/Jupyter/components/Case/diffPanel.jsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var dmp = new (_diff_match_patch_1_0_5_diff_match_patch_default())();
|
|
dmp.Diff_EditCost = 8;
|
|
var initialState = {
|
|
oldStr: '',
|
|
newStr: ''
|
|
};
|
|
function reducer(state, action) {
|
|
switch (action.type) {
|
|
case 'init':
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), action.payload);
|
|
default:
|
|
throw new Error();
|
|
}
|
|
}
|
|
function format(diff, type) {
|
|
var pattern_amp = /&/g;
|
|
var pattern_lt = /</g;
|
|
var pattern_gt = />/g;
|
|
var operation = diff[0],
|
|
data = diff[1] || '';
|
|
var text = data.replace(pattern_amp, '&').replace(pattern_lt, '<').replace(pattern_gt, '>');
|
|
var isEmpty = !text.trim();
|
|
if (type === 'oldStr') {
|
|
switch (operation) {
|
|
case _diff_match_patch_1_0_5_diff_match_patch.DIFF_DELETE:
|
|
return "<ins class=".concat(isEmpty ? 'empty' : '', ">") + text + '</ins>';
|
|
case _diff_match_patch_1_0_5_diff_match_patch.DIFF_EQUAL:
|
|
return '<span>' + text + '</span>';
|
|
}
|
|
} else {
|
|
switch (operation) {
|
|
case _diff_match_patch_1_0_5_diff_match_patch.DIFF_INSERT:
|
|
return "<del class=".concat(isEmpty ? 'empty' : '', ">") + text + '</del>';
|
|
case _diff_match_patch_1_0_5_diff_match_patch.DIFF_EQUAL:
|
|
return '<span>' + text + '</span>';
|
|
}
|
|
}
|
|
}
|
|
/* harmony default export */ var diffPanel = (function (_ref) {
|
|
var _output, _actual_output;
|
|
var output = _ref.output,
|
|
actual_output = _ref.actual_output;
|
|
var _useReducer = (0,_react_17_0_2_react.useReducer)(reducer, initialState),
|
|
_useReducer2 = slicedToArray_default()(_useReducer, 2),
|
|
state = _useReducer2[0],
|
|
dispatch = _useReducer2[1];
|
|
output = (_output = output) === null || _output === void 0 ? void 0 : _output.replace(/\n/g, '\r').replace(/\u0020/g, ' ').replace(/\u0000/g, "\\u0000");
|
|
actual_output = (_actual_output = actual_output) === null || _actual_output === void 0 ? void 0 : _actual_output.replace(/\n/g, '\r').replace(/\u0020/g, ' ').replace(/\u0000/g, "\\u0000");
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
var diffs = dmp.diff_main(output || '', actual_output || '');
|
|
dmp.diff_cleanupEfficiency(diffs);
|
|
var oldStr = diffs.map(function (diff) {
|
|
return format(diff, 'oldStr');
|
|
}).join('');
|
|
var newStr = diffs.map(function (diff) {
|
|
return format(diff, 'newStr');
|
|
}).join('');
|
|
dispatch({
|
|
type: 'init',
|
|
payload: {
|
|
oldStr: oldStr,
|
|
newStr: newStr
|
|
}
|
|
});
|
|
}, [output, actual_output]);
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: diffPanelmodules['diff-panel-container'],
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
dangerouslySetInnerHTML: {
|
|
__html: state.oldStr
|
|
}
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
dangerouslySetInnerHTML: {
|
|
__html: state.newStr
|
|
}
|
|
})]
|
|
});
|
|
});
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
var util = __webpack_require__(82338);
|
|
;// CONCATENATED MODULE: ./src/pages/tasks/Jupyter/components/Case/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Casemodules = ({"choose-game-item":"choose-game-item___sJBZO","output-title-container":"output-title-container___HnzHt","output-title":"output-title___cQCt2","test-case-list":"test-case-list___ULWwO","test-header":"test-header___HMjcY","active":"active___YxidH","resize-y-bar":"resize-y-bar___es6Oh","test-result":"test-result___zXN_Y","markdown-body":"markdown-body___EHEjV","success":"success___ZvFU2","failer":"failer___lQvRe","count":"count___lVWvy","test-case-item":"test-case-item___ptoQn","case-header":"case-header___UDkvN","iconfont":"iconfont___XT_ll","description":"description___BJIlI","item-desc":"item-desc___e8tqN","show":"show___nh0Ha","item-tip":"item-tip___H05sn","arrow-down":"arrow-down___DcvbX","test-title":"test-title___2XlIU","arrow-right":"arrow-right___a5kiA","case-info":"case-info___akfl1","test-case-run-header":"test-case-run-header___rIpIu","test-case-run-wrp":"test-case-run-wrp___hfxtY","title":"title___ldXVu","warp":"warp_____VWp","spin":"spin___OU0Kn","spinTest":"spinTest___UNIX8","diff-panel-container":"diff-panel-container___xo1_S"});
|
|
;// CONCATENATED MODULE: ./src/pages/tasks/Jupyter/components/Case/panel.jsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var panel_dmp = new (_diff_match_patch_1_0_5_diff_match_patch_default())();
|
|
panel_dmp.Diff_EditCost = 8;
|
|
var panel_initialState = {
|
|
oldStr: '',
|
|
newStr: ''
|
|
};
|
|
function panel_reducer(state, action) {
|
|
switch (action.type) {
|
|
case 'init':
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), action.payload);
|
|
default:
|
|
throw new Error();
|
|
}
|
|
}
|
|
function panel_format(diff, type) {
|
|
var pattern_amp = /&/g;
|
|
var pattern_lt = /</g;
|
|
var pattern_gt = />/g;
|
|
var operation = diff[0],
|
|
data = diff[1] || '';
|
|
var text = data.replace(pattern_amp, '&').replace(pattern_lt, '<').replace(pattern_gt, '>');
|
|
var isEmpty = !text.trim();
|
|
if (type === 'oldStr') {
|
|
switch (operation) {
|
|
case _diff_match_patch_1_0_5_diff_match_patch.DIFF_DELETE:
|
|
return "<ins class=".concat(isEmpty ? 'empty' : '', ">") + text + '</ins>';
|
|
case _diff_match_patch_1_0_5_diff_match_patch.DIFF_EQUAL:
|
|
return '<span>' + text + '</span>';
|
|
}
|
|
} else {
|
|
switch (operation) {
|
|
case _diff_match_patch_1_0_5_diff_match_patch.DIFF_INSERT:
|
|
return "<del class=".concat(isEmpty ? 'empty' : '', ">") + text + '</del>';
|
|
case _diff_match_patch_1_0_5_diff_match_patch.DIFF_EQUAL:
|
|
return '<span>' + text + '</span>';
|
|
}
|
|
}
|
|
}
|
|
/* harmony default export */ var panel = (function (_ref) {
|
|
var _output, _actual_output;
|
|
var output = _ref.output,
|
|
actual_output = _ref.actual_output;
|
|
var _useReducer = (0,_react_17_0_2_react.useReducer)(panel_reducer, panel_initialState),
|
|
_useReducer2 = slicedToArray_default()(_useReducer, 2),
|
|
state = _useReducer2[0],
|
|
dispatch = _useReducer2[1];
|
|
output = (_output = output) === null || _output === void 0 ? void 0 : _output.replace(/\n/g, '\r');
|
|
actual_output = (_actual_output = actual_output) === null || _actual_output === void 0 ? void 0 : _actual_output.replace(/\n/g, '\r');
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
var diffs = panel_dmp.diff_main(output || '', actual_output || '');
|
|
panel_dmp.diff_cleanupEfficiency(diffs);
|
|
var oldStr = diffs.map(function (diff) {
|
|
return panel_format(diff, 'oldStr');
|
|
}).join('');
|
|
var newStr = diffs.map(function (diff) {
|
|
return panel_format(diff, 'newStr');
|
|
}).join('');
|
|
dispatch({
|
|
type: 'init',
|
|
payload: {
|
|
oldStr: oldStr,
|
|
newStr: newStr
|
|
}
|
|
});
|
|
}, [output, actual_output]);
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
style: {
|
|
width: '100%'
|
|
},
|
|
className: "c-white ".concat(diffPanelmodules['diff-panel-container'], " ").concat(diffPanelmodules['diff-panel-container-2']),
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
style: {
|
|
minHeight: 0,
|
|
padding: '0px 12px'
|
|
},
|
|
dangerouslySetInnerHTML: {
|
|
__html: state.oldStr
|
|
}
|
|
})
|
|
});
|
|
});
|
|
// EXTERNAL MODULE: ./src/utils/authority.ts
|
|
var authority = __webpack_require__(65241);
|
|
;// CONCATENATED MODULE: ./src/pages/tasks/Jupyter/components/Case/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function TestCaseItem(_ref) {
|
|
var ts_mem = _ref.ts_mem,
|
|
ts_time = _ref.ts_time,
|
|
input = _ref.input,
|
|
output = _ref.output,
|
|
actual_output = _ref.actual_output,
|
|
is_file = _ref.is_file,
|
|
output_file_url = _ref.output_file_url,
|
|
result = _ref.result,
|
|
compile_success = _ref.compile_success,
|
|
title = _ref.title,
|
|
isActive = _ref.isActive,
|
|
id = _ref.id,
|
|
onActive = _ref.onActive,
|
|
is_public = _ref.is_public,
|
|
test_sets_view = _ref.test_sets_view,
|
|
identity = _ref.identity,
|
|
is_invisible = _ref.is_invisible,
|
|
actual_output_visible = _ref.actual_output_visible,
|
|
user = _ref.user;
|
|
var _useState = (0,_react_17_0_2_react.useState)(false),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
rawOutput = _useState2[0],
|
|
setRawOutput = _useState2[1];
|
|
if (is_invisible && (user === null || user === void 0 ? void 0 : user.identity_number) > 5) {
|
|
output = '该预期输出不可查看';
|
|
}
|
|
if (actual_output_visible && (user === null || user === void 0 ? void 0 : user.identity_number) > 5) {
|
|
actual_output = '该实际输出不可查看';
|
|
}
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
className: Casemodules['test-case-item'],
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
|
|
className: Casemodules["case-header"],
|
|
style: {
|
|
borderWidth: isActive ? 1 : 0
|
|
},
|
|
onClick: function onClick() {
|
|
if (!(0,authority/* getRoleAuth */.I2)([authority/* RoleType */.GD.CertifiedTeacher, authority/* RoleType */.GD.SuperAdmin, authority/* RoleType */.GD.Operation]) && !is_public) {
|
|
message/* default */.ZP.info('本测试集不可解锁');
|
|
return;
|
|
}
|
|
onActive(id);
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("h2", {
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: isActive ? Casemodules['arrow-down'] : Casemodules['arrow-right']
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Casemodules["test-title"],
|
|
children: title
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Casemodules["case-info"],
|
|
children: [!ts_mem ? null : /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
className: Casemodules["description"],
|
|
children: ["\u6D88\u8017\u5185\u5B58", ts_mem, "MB"]
|
|
}), !ts_time ? null : /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
className: Casemodules["description"],
|
|
children: [" \u4EE3\u7801\u6267\u884C\u65F6\u957F\uFF1A", ts_time, "\u79D2 "]
|
|
}), !is_public ? /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-suo1"
|
|
}) : null, compile_success > 0 ? /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
width: 16,
|
|
src: result ? success/* default */.Z : failer/* default */.Z
|
|
}) : null]
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "".concat(Casemodules['item-desc'], " ").concat(Casemodules['choose-game-item'], " ").concat(isActive ? Casemodules.show : Casemodules.hide),
|
|
children: [input && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
style: {
|
|
color: 'white',
|
|
display: 'flex',
|
|
alignItems: 'center'
|
|
},
|
|
children: ["\u6D4B\u8BD5\u8F93\u5165", input && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
style: {
|
|
width: '33%'
|
|
},
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(panel, {
|
|
output: input
|
|
})
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
className: Casemodules["output-title-container"],
|
|
style: {
|
|
marginTop: 10
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
style: {
|
|
color: '#747a7f'
|
|
},
|
|
children: "\u2014\u2014\u9884\u671F\u8F93\u51FA\u2014\u2014"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
className: Casemodules["output-title"],
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
style: {
|
|
color: '#fff'
|
|
},
|
|
children: "\u2014\u2014\u5B9E\u9645\u8F93\u51FA\u2014\u2014"
|
|
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: "c-blue current",
|
|
onClick: function onClick() {
|
|
return setRawOutput(!rawOutput);
|
|
},
|
|
children: rawOutput ? '展示格式化输出' : '展示原始输出'
|
|
})]
|
|
})]
|
|
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Casemodules["diff-panel-container"],
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "tc",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
className: "underline",
|
|
onClick: function onClick() {
|
|
return (0,util/* download */.LR)(output_file_url, output);
|
|
},
|
|
children: output
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "tc",
|
|
children: !!compile_success ? /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
className: "underline",
|
|
onClick: function onClick() {
|
|
return (0,util/* download */.LR)(actual_output, output);
|
|
},
|
|
children: output
|
|
}) : actual_output
|
|
})]
|
|
}), !is_file && !rawOutput && /*#__PURE__*/(0,jsx_runtime.jsx)(diffPanel, {
|
|
output: output,
|
|
actual_output: actual_output
|
|
}), !is_file && rawOutput && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Casemodules["diff-panel-container"],
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "",
|
|
children: output
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "",
|
|
children: actual_output
|
|
})]
|
|
})]
|
|
})]
|
|
});
|
|
}
|
|
/* harmony default export */ var Case = (function (_ref2) {
|
|
var test_sets = _ref2.test_sets,
|
|
gamesData = _ref2.gamesData,
|
|
loading = _ref2.loading,
|
|
codeMessage = _ref2.codeMessage,
|
|
jupyterData = _ref2.jupyterData;
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(-1),
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
index = _useState4[0],
|
|
setIndex = _useState4[1];
|
|
var resizeBarEl = (0,_react_17_0_2_react.useRef)();
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
if (resizeBarEl.current) {
|
|
var onMouseDown = function onMouseDown(e) {
|
|
h = jupyterDom.offsetHeight;
|
|
dragging = true;
|
|
startY = e.pageY;
|
|
(0,util/* pointerEvents */.kk)('none');
|
|
document.onselectstart = function () {
|
|
return false;
|
|
};
|
|
};
|
|
var onMouseUp = function onMouseUp() {
|
|
dragging = false;
|
|
(0,util/* pointerEvents */.kk)('auto');
|
|
document.onselectstart = null;
|
|
};
|
|
var onMouseMove = function onMouseMove(e) {
|
|
if (dragging) {
|
|
var delta = startY - e.pageY;
|
|
var resizeH = h + delta;
|
|
if (resizeH < 200) {
|
|
resizeH = 200;
|
|
}
|
|
if (resizeH > window.innerHeight - 130) {
|
|
resizeH = window.innerHeight - 130;
|
|
}
|
|
jupyterDom.style.height = resizeH + 'px';
|
|
}
|
|
};
|
|
var jupyterDom = document.getElementById('jupyter-test-case-list');
|
|
var h = 0;
|
|
var dragging = false;
|
|
var startY = 0;
|
|
var dom = document.getElementById('jupyter-y-bar');
|
|
dom === null || dom === void 0 || dom.addEventListener('mousedown', onMouseDown);
|
|
document.addEventListener('mousemove', onMouseMove);
|
|
document.addEventListener('mouseup', onMouseUp);
|
|
return function () {
|
|
var dom = document.getElementById('jupyter-y-bar');
|
|
dom === null || dom === void 0 || dom.removeEventListener('mousedown', onMouseDown);
|
|
document.removeEventListener('mousemove', onMouseMove);
|
|
document.removeEventListener('mouseup', onMouseUp);
|
|
};
|
|
}
|
|
}, [resizeBarEl]);
|
|
function trigger(id) {
|
|
setIndex(id === index ? -1 : id);
|
|
}
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
id: "jupyter-test-case-list",
|
|
className: Casemodules["test-case-list"],
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Casemodules["resize-y-bar"],
|
|
id: 'jupyter-y-bar',
|
|
ref: resizeBarEl,
|
|
draggable: false,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-guangbiao",
|
|
draggable: false
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Casemodules.warp,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(spin/* default */.Z, {
|
|
tip: codeMessage,
|
|
spinning: loading,
|
|
className: Casemodules.spinTest,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Casemodules['title'],
|
|
style: {
|
|
color: 'white'
|
|
},
|
|
children: "\u6D4B\u8BD5\u7ED3\u679C\uFF1A"
|
|
}), gamesData !== null && gamesData !== void 0 && gamesData.last_compile_output ? /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
className: "".concat(Casemodules["test-result"], " ").concat((gamesData === null || gamesData === void 0 ? void 0 : gamesData.sets_error_count) === 0 ? Casemodules.success : Casemodules.failer),
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
className: Casemodules["count"],
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
width: 16,
|
|
src: (gamesData === null || gamesData === void 0 ? void 0 : gamesData.sets_error_count) === 0 ? success/* default */.Z : mark/* default */.Z
|
|
}), (gamesData === null || gamesData === void 0 ? void 0 : gamesData.test_sets_count) - (gamesData === null || gamesData === void 0 ? void 0 : gamesData.sets_error_count), "/", gamesData === null || gamesData === void 0 ? void 0 : gamesData.test_sets_count]
|
|
}), (gamesData === null || gamesData === void 0 ? void 0 : gamesData.sets_error_count) == 0 ? /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Casemodules["count"],
|
|
children: "\u5168\u90E8\u901A\u8FC7"
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
dangerouslySetInnerHTML: {
|
|
__html: gamesData === null || gamesData === void 0 ? void 0 : gamesData.last_compile_output
|
|
}
|
|
})]
|
|
}) : null, !loading && test_sets.map(function (item, i) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(TestCaseItem, objectSpread2_default()(objectSpread2_default()({
|
|
title: "\u6D4B\u8BD5\u7528\u4F8B".concat(i + 1)
|
|
}, item), {}, {
|
|
isActive: index === i,
|
|
id: i,
|
|
user: jupyterData === null || jupyterData === void 0 ? void 0 : jupyterData.user,
|
|
onActive: trigger
|
|
}), 'item' + i);
|
|
})]
|
|
})
|
|
})]
|
|
});
|
|
});
|
|
// EXTERNAL MODULE: ./src/components/ImagesIcon/index.ts + 32 modules
|
|
var ImagesIcon = __webpack_require__(5421);
|
|
// EXTERNAL MODULE: ./src/pages/tasks/resize-enlarge.png
|
|
var resize_enlarge = __webpack_require__(21978);
|
|
// EXTERNAL MODULE: ./src/pages/tasks/resize-small.png
|
|
var resize_small = __webpack_require__(52787);
|
|
;// CONCATENATED MODULE: ./src/pages/tasks/Jupyter/components/ResizeIcon/index.tsx
|
|
|
|
|
|
|
|
|
|
var ResizeIcon = function ResizeIcon(_ref) {
|
|
var noDragging = _ref.noDragging,
|
|
moveX = _ref.moveX;
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(_react_17_0_2_react.Fragment, {
|
|
children: noDragging ? /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
className: "trapezoid ".concat(moveX === 0.01 ? 'enlarge' : ''),
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
src: moveX === 0.01 ? resize_enlarge : resize_small,
|
|
alt: "resize-icon",
|
|
width: 20
|
|
})
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
className: "btn-resize",
|
|
draggable: false,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("svg", {
|
|
width: "16",
|
|
height: "13",
|
|
viewBox: "0 0 16 13",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("path", {
|
|
d: "M12.245 7.53H5.647v1.882h6.598v2.823L16 8.471l-3.755-3.765V7.53zM10.353 4.706H3.755v2.823L0 3.765 3.755 0v2.824h6.598v1.882z"
|
|
})
|
|
})
|
|
})
|
|
});
|
|
};
|
|
/* harmony default export */ var components_ResizeIcon = (ResizeIcon);
|
|
;// CONCATENATED MODULE: ./src/pages/tasks/Jupyter/reducer.ts
|
|
|
|
var reducer_reducer = function reducer(state, action) {
|
|
switch (action.type) {
|
|
case 'MOVE_X':
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
moveX: action.payload
|
|
});
|
|
case 'SET_DRAGMODULE':
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
showDragModule: action.payload
|
|
});
|
|
case 'TRIGGER_RIGHT_PANEL_MASK':
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
showDragMask: action.payload
|
|
});
|
|
}
|
|
};
|
|
// EXTERNAL MODULE: ./src/components/mediator.js
|
|
var mediator = __webpack_require__(14555);
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
var fetch = __webpack_require__(1833);
|
|
;// CONCATENATED MODULE: ./src/pages/tasks/Jupyter/tool.png
|
|
var tool_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAgCAYAAAB6kdqOAAABZ0lEQVRYR+2YrU7FQBBGzzwEPAMSi+M6MARDggNJgiIkWLiSBIFCkyCuQECCQFIcEstb8AYf2ZvmhpbuT9ttUpJWdma+OZ3O7k5rRC5Jh8ARsBPzjdhvgXczew75WSyJpCdgP+aXaP8ws63OQJK2gbdSYJ6Y1Od2WRpmZlb4nIIVqgEFhUKwbXTGByRpDzgBdnu+kr7hD8CLSboGLvqqZYp/dEDK1LR9mZZNXwEys6u+ql3iJbm8E5C3eFOFYn2VrUKS1oADYL1M+gW8mtl3DOK3PQuQpE1gAWzUkn8CZ6Hzqg6bC+gcuPFU4s7MTlOrlAvITQFuGijMbOaSS/pzLwXKB+QdCQKiXqAUkJqP06rs1B00liFNFeqqVQEaXYXmbc6ypn7J3UNtgUa3ysa1D5XLfDw7dedl1BCYZWOcgHJWIKb1f15Z7EkGtq+G/NXEP3DCFPl79xnkTln3u+U4JWJAH/czo/gBVkc5pun3NGoAAAAASUVORK5CYII=";
|
|
// EXTERNAL MODULE: ./src/components/modal.tsx
|
|
var components_modal = __webpack_require__(35729);
|
|
// EXTERNAL MODULE: ./src/components/vnc-setting/index.tsx + 4 modules
|
|
var vnc_setting = __webpack_require__(35042);
|
|
// EXTERNAL MODULE: ./src/utils/fullscreen.ts
|
|
var fullscreen = __webpack_require__(72674);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/ExclamationCircleOutlined.js + 1 modules
|
|
var ExclamationCircleOutlined = __webpack_require__(87169);
|
|
// EXTERNAL MODULE: ./src/service/exercise.ts
|
|
var exercise = __webpack_require__(26037);
|
|
;// CONCATENATED MODULE: ./src/pages/tasks/Jupyter/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["globalSetting", "loading", "dispatch"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Countdown = statistic/* default */.Z.Countdown;
|
|
var Status = /*#__PURE__*/function (Status) {
|
|
Status[Status["LoadFail"] = 1] = "LoadFail";
|
|
Status[Status["ReLoad"] = 2] = "ReLoad";
|
|
Status[Status["Success"] = 3] = "Success";
|
|
return Status;
|
|
}(Status || {});
|
|
/**
|
|
*
|
|
*/
|
|
var Jupyter_initialState = {
|
|
moveX: '40%',
|
|
showDragModule: false,
|
|
showDragMask: false
|
|
};
|
|
var TaskJupyterPage = function TaskJupyterPage(_ref) {
|
|
var _url$, _jupyterData$user, _jupyterData$user2, _url$active;
|
|
var globalSetting = _ref.globalSetting,
|
|
loading = _ref.loading,
|
|
dispatch = _ref.dispatch,
|
|
props = objectWithoutProperties_default()(_ref, _excluded);
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
var _useSearchParams = (0,_umi_production_exports.useSearchParams)(),
|
|
_useSearchParams2 = slicedToArray_default()(_useSearchParams, 1),
|
|
searchParams = _useSearchParams2[0];
|
|
var location = (0,_umi_production_exports.useLocation)();
|
|
var token = (0,_react_17_0_2_react.useRef)();
|
|
var _useState = (0,_react_17_0_2_react.useState)(true),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
spinning = _useState2[0],
|
|
setSpinning = _useState2[1];
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(false),
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
btnLoading = _useState4[0],
|
|
setBtnLoading = _useState4[1];
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(0),
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
btnTime = _useState6[0],
|
|
setBtnTime = _useState6[1];
|
|
var _useState7 = (0,_react_17_0_2_react.useState)(0),
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
active = _useState8[0],
|
|
setActive = _useState8[1];
|
|
var _useState9 = (0,_react_17_0_2_react.useState)(true),
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
urlSign = _useState10[0],
|
|
setUrlSign = _useState10[1];
|
|
var _useState11 = (0,_react_17_0_2_react.useState)(false),
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
caseVisible = _useState12[0],
|
|
setCaseVisible = _useState12[1];
|
|
var jupyterMessageFlag = (0,_react_17_0_2_react.useRef)(true);
|
|
var _useState13 = (0,_react_17_0_2_react.useState)({}),
|
|
_useState14 = slicedToArray_default()(_useState13, 2),
|
|
jupyterData = _useState14[0],
|
|
setJupyterData = _useState14[1];
|
|
var _useState15 = (0,_react_17_0_2_react.useState)({}),
|
|
_useState16 = slicedToArray_default()(_useState15, 2),
|
|
gamesData = _useState16[0],
|
|
setGamesData = _useState16[1];
|
|
var _useState17 = (0,_react_17_0_2_react.useState)(),
|
|
_useState18 = slicedToArray_default()(_useState17, 2),
|
|
url = _useState18[0],
|
|
setUrl = _useState18[1];
|
|
var urlRef = (0,_react_17_0_2_react.useRef)();
|
|
var port = (0,_react_17_0_2_react.useRef)();
|
|
var _useState19 = (0,_react_17_0_2_react.useState)(Status.Success),
|
|
_useState20 = slicedToArray_default()(_useState19, 2),
|
|
status = _useState20[0],
|
|
setStatus = _useState20[1];
|
|
var _useState21 = (0,_react_17_0_2_react.useState)(),
|
|
_useState22 = slicedToArray_default()(_useState21, 2),
|
|
time = _useState22[0],
|
|
setTime = _useState22[1];
|
|
var _useState23 = (0,_react_17_0_2_react.useState)(),
|
|
_useState24 = slicedToArray_default()(_useState23, 2),
|
|
endTime = _useState24[0],
|
|
setEndTime = _useState24[1];
|
|
var _useState25 = (0,_react_17_0_2_react.useState)(false),
|
|
_useState26 = slicedToArray_default()(_useState25, 2),
|
|
isOpenDrawer = _useState26[0],
|
|
setIsOpenDrawer = _useState26[1];
|
|
var _useState27 = (0,_react_17_0_2_react.useState)(''),
|
|
_useState28 = slicedToArray_default()(_useState27, 2),
|
|
codeMessage = _useState28[0],
|
|
setCodeMessage = _useState28[1];
|
|
var timer = (0,_react_17_0_2_react.useRef)(null);
|
|
var saveJupyterData = (0,_react_17_0_2_react.useRef)({});
|
|
var clickEvaluating = (0,_react_17_0_2_react.useRef)(false);
|
|
var intervalRef = (0,_react_17_0_2_react.useRef)();
|
|
var _useReducer = (0,_react_17_0_2_react.useReducer)(reducer_reducer, Jupyter_initialState),
|
|
_useReducer2 = slicedToArray_default()(_useReducer, 2),
|
|
state = _useReducer2[0],
|
|
redcuerDispatch = _useReducer2[1];
|
|
var _useState29 = (0,_react_17_0_2_react.useState)(false),
|
|
_useState30 = slicedToArray_default()(_useState29, 2),
|
|
isToolBar = _useState30[0],
|
|
setIsToolBar = _useState30[1];
|
|
var _useState31 = (0,_react_17_0_2_react.useState)(true),
|
|
_useState32 = slicedToArray_default()(_useState31, 2),
|
|
showTool = _useState32[0],
|
|
setShowTool = _useState32[1];
|
|
var _useState33 = (0,_react_17_0_2_react.useState)(false),
|
|
_useState34 = slicedToArray_default()(_useState33, 2),
|
|
checkboxData = _useState34[0],
|
|
setcheckboxData = _useState34[1];
|
|
var exerciseDataRef = (0,_react_17_0_2_react.useRef)();
|
|
var _useState35 = (0,_react_17_0_2_react.useState)(false),
|
|
_useState36 = slicedToArray_default()(_useState35, 2),
|
|
istimeshow = _useState36[0],
|
|
setistimeshow = _useState36[1];
|
|
var _useState37 = (0,_react_17_0_2_react.useState)(false),
|
|
_useState38 = slicedToArray_default()(_useState37, 2),
|
|
showModal = _useState38[0],
|
|
setShowModal = _useState38[1];
|
|
var countRef = (0,_react_17_0_2_react.useRef)(checkboxData);
|
|
countRef.current = checkboxData;
|
|
console.log("---------jupyterDat11111a", jupyterData);
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
dispatch({
|
|
type: 'globalSetting/headerFooterToggle',
|
|
payload: false
|
|
});
|
|
if (searchParams.get("exercisesId") && searchParams.get("coursesId") !== 'coursesId') {
|
|
getExerciseData();
|
|
}
|
|
return function () {
|
|
dispatch({
|
|
type: 'globalSetting/headerFooterToggle',
|
|
payload: true
|
|
});
|
|
};
|
|
}, []);
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
if (btnTime !== 0) {
|
|
clearInterval(timer.current);
|
|
timer.current = setInterval(function () {
|
|
setBtnTime(btnTime - 1);
|
|
}, 1000);
|
|
} else {
|
|
clearInterval(timer.current);
|
|
}
|
|
}, [btnTime]);
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
window.addEventListener('message', handleJupyterMessage);
|
|
return function () {
|
|
window.removeEventListener('message', handleJupyterMessage);
|
|
};
|
|
}, []);
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
handleGetJupyterData();
|
|
}, [params.identifier]);
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
if (jupyterData.myshixun_identifier) {
|
|
handleGetJupyterTPIUrl();
|
|
}
|
|
if (jupyterData.tpm_modified) {
|
|
updateCode();
|
|
}
|
|
}, [jupyterData]);
|
|
var getExerciseData = /*#__PURE__*/function () {
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
var res;
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
while (1) switch (_context.prev = _context.next) {
|
|
case 0:
|
|
_context.next = 2;
|
|
return (0,exercise/* getExerciseStartAnswer */._B)({
|
|
categoryId: searchParams.get("exercisesId"),
|
|
login: searchParams.get("login")
|
|
});
|
|
case 2:
|
|
res = _context.sent;
|
|
exerciseDataRef.current = res;
|
|
case 4:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
}));
|
|
return function getExerciseData() {
|
|
return _ref2.apply(this, arguments);
|
|
};
|
|
}();
|
|
var updateCode = function updateCode() {
|
|
tipReset({
|
|
title: '更新通知',
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
children: ["\u5173\u5361\u4EFB\u52A1\u7684\u4EE3\u7801\u6587\u4EF6\u6709\u66F4\u65B0\u5566~", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), " \u66F4\u65B0\u64CD\u4F5C\u5C06\u4FDD\u7559\u5DF2\u5B8C\u6210\u7684\u8BC4\u6D4B\u8BB0\u5F55\u548C\u6210\u7EE9\u3002", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u8FD8\u672A\u5B8C\u6210\u8BC4\u6D4B\u7684\u4EFB\u52A1\u4EE3\u7801\uFF0C\u8BF7\u81EA\u884C\u4FDD\u5B58\uFF01"]
|
|
})
|
|
});
|
|
};
|
|
var submitWork = /*#__PURE__*/function () {
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
|
var iframe;
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
case 0:
|
|
iframe = document.getElementById('taskJupyterIframe');
|
|
iframe.contentWindow.postMessage('saveCode', '*');
|
|
return _context3.abrupt("return", new Promise(function (resolve, reject) {
|
|
setTimeout( /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
case 0:
|
|
_context2.next = 2;
|
|
return (0,fetch/* default */.ZP)("/api/homework_commons/".concat(searchParams.get("homework_common_id"), "/student_works.json"), {
|
|
method: 'post',
|
|
body: {
|
|
myshixun_identifier: jupyterData === null || jupyterData === void 0 ? void 0 : jupyterData.myshixun_identifier
|
|
}
|
|
});
|
|
case 2:
|
|
resolve();
|
|
case 3:
|
|
case "end":
|
|
return _context2.stop();
|
|
}
|
|
}, _callee2);
|
|
})), 2000);
|
|
}));
|
|
case 3:
|
|
case "end":
|
|
return _context3.stop();
|
|
}
|
|
}, _callee3);
|
|
}));
|
|
return function submitWork() {
|
|
return _ref3.apply(this, arguments);
|
|
};
|
|
}();
|
|
var handleJupyterMessage = function handleJupyterMessage(e) {
|
|
if ((e === null || e === void 0 ? void 0 : e.data) === 'jupytermessage' && jupyterMessageFlag.current) {
|
|
jupyterMessageFlag.current = false;
|
|
handleSaveWithTPI();
|
|
if (!clickEvaluating.current) {
|
|
setTimeout(function () {
|
|
return jupyterMessageFlag.current = true;
|
|
}, 500);
|
|
}
|
|
// setTimeout(() => jupyterMessageFlag.current = true, 500)
|
|
}
|
|
};
|
|
var handleSaveWithTPI = /*#__PURE__*/function () {
|
|
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
|
|
var _urlRef$current;
|
|
var res, _exerciseDataRef$curr, _exerciseDataRef$curr2;
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
case 0:
|
|
_context4.next = 2;
|
|
return (0,task/* saveWithTPI */.zE)({
|
|
identifier: params.identifier,
|
|
jupyter_port: port.current,
|
|
token: token.current,
|
|
jupyter_domain: (_urlRef$current = urlRef.current) === null || _urlRef$current === void 0 || (_urlRef$current = _urlRef$current[0]) === null || _urlRef$current === void 0 ? void 0 : _urlRef$current.domain,
|
|
exercise_id: searchParams.get("exercisesId") //试卷id
|
|
});
|
|
case 2:
|
|
res = _context4.sent;
|
|
if (!(res.status === 0)) {
|
|
_context4.next = 7;
|
|
break;
|
|
}
|
|
if (clickEvaluating.current) {
|
|
// 点击评测的时候执行
|
|
getGame(res === null || res === void 0 ? void 0 : res.data);
|
|
} else {
|
|
message/* default */.ZP.success('保存成功!');
|
|
}
|
|
_context4.next = 10;
|
|
break;
|
|
case 7:
|
|
if (!(res.status === -5 && typeof_default()(res === null || res === void 0 ? void 0 : res.message) === "object")) {
|
|
_context4.next = 10;
|
|
break;
|
|
}
|
|
(0,_umi_production_exports.getDvaApp)()._store.dispatch({
|
|
type: 'exercise/setActionTabs',
|
|
payload: {
|
|
key: 'student-unlock',
|
|
exerciseParams: objectSpread2_default()(objectSpread2_default()({}, ((_exerciseDataRef$curr = exerciseDataRef.current) === null || _exerciseDataRef$curr === void 0 ? void 0 : _exerciseDataRef$curr.exercise) || {}), {}, {
|
|
errorMessage: res === null || res === void 0 ? void 0 : res.message,
|
|
exercise_user_id: (_exerciseDataRef$curr2 = exerciseDataRef.current) === null || _exerciseDataRef$curr2 === void 0 || (_exerciseDataRef$curr2 = _exerciseDataRef$curr2.exercise) === null || _exerciseDataRef$curr2 === void 0 ? void 0 : _exerciseDataRef$curr2.exercise_user_id,
|
|
id: searchParams.get("exercisesId")
|
|
})
|
|
}
|
|
});
|
|
return _context4.abrupt("return");
|
|
case 10:
|
|
case "end":
|
|
return _context4.stop();
|
|
}
|
|
}, _callee4);
|
|
}));
|
|
return function handleSaveWithTPI() {
|
|
return _ref5.apply(this, arguments);
|
|
};
|
|
}();
|
|
var getGame = /*#__PURE__*/function () {
|
|
var _ref6 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6(re) {
|
|
var _saveJupyterData$curr, _saveJupyterData$curr2;
|
|
var _params, rs, count, time_out, finalTime, fnc;
|
|
return regeneratorRuntime_default()().wrap(function _callee6$(_context6) {
|
|
while (1) switch (_context6.prev = _context6.next) {
|
|
case 0:
|
|
_params = {
|
|
extras: {
|
|
exercise_id: searchParams.get("exercisesId"),
|
|
//试卷id
|
|
question_id: searchParams.get("questionId"),
|
|
// 题目id
|
|
challenge_id: jupyterData === null || jupyterData === void 0 ? void 0 : jupyterData.challenge_id // 关卡id
|
|
},
|
|
sec_key: re === null || re === void 0 ? void 0 : re.sec_key,
|
|
resubmit: re === null || re === void 0 ? void 0 : re.resubmit,
|
|
first: 1,
|
|
content_modified: 0
|
|
};
|
|
if (searchParams.get("homework_common_id")) {
|
|
_params.extras = {
|
|
homework_common_id: searchParams.get("homework_common_id")
|
|
};
|
|
}
|
|
_context6.next = 4;
|
|
return (0,service/* codeGameBuild */.Xy)((_saveJupyterData$curr = saveJupyterData.current) === null || _saveJupyterData$curr === void 0 ? void 0 : _saveJupyterData$curr.game_identifier, _params);
|
|
case 4:
|
|
rs = _context6.sent;
|
|
if (!(rs.status === -1)) {
|
|
_context6.next = 14;
|
|
break;
|
|
}
|
|
if (!(searchParams.get("type") === 'exercises')) {
|
|
_context6.next = 9;
|
|
break;
|
|
}
|
|
window.parent.location.href = "/classrooms/".concat(searchParams.get("coursesId"), "/exercise/").concat(searchParams.get("exercisesId"), "/detail");
|
|
return _context6.abrupt("return");
|
|
case 9:
|
|
setBtnLoading(false);
|
|
setBtnTime(10);
|
|
clickEvaluating.current = false;
|
|
jupyterMessageFlag.current = true;
|
|
return _context6.abrupt("return");
|
|
case 14:
|
|
count = 1;
|
|
time_out = false;
|
|
finalTime = ((_saveJupyterData$curr2 = saveJupyterData.current) === null || _saveJupyterData$curr2 === void 0 ? void 0 : _saveJupyterData$curr2.exec_time) + 11;
|
|
fnc = /*#__PURE__*/function () {
|
|
var _ref7 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5() {
|
|
var _saveJupyterData$curr3, _saveJupyterData$curr4, _saveJupyterData$curr5;
|
|
var source;
|
|
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
|
|
while (1) switch (_context5.prev = _context5.next) {
|
|
case 0:
|
|
_context5.next = 2;
|
|
return (0,service/* getCodeGameStatus */.Qo)((_saveJupyterData$curr3 = saveJupyterData.current) === null || _saveJupyterData$curr3 === void 0 ? void 0 : _saveJupyterData$curr3.game_identifier, {
|
|
resubmit: re === null || re === void 0 ? void 0 : re.resubmit,
|
|
time_out: time_out,
|
|
port: (_saveJupyterData$curr4 = saveJupyterData.current) === null || _saveJupyterData$curr4 === void 0 ? void 0 : _saveJupyterData$curr4.port,
|
|
sec_key: re === null || re === void 0 ? void 0 : re.sec_key,
|
|
challenge_id: (_saveJupyterData$curr5 = saveJupyterData.current) === null || _saveJupyterData$curr5 === void 0 ? void 0 : _saveJupyterData$curr5.challenge_id
|
|
});
|
|
case 2:
|
|
source = _context5.sent;
|
|
if ((source === null || source === void 0 ? void 0 : source.running_code_status) === null || (source === null || source === void 0 ? void 0 : source.running_code_status) === 1 || (source === null || source === void 0 ? void 0 : source.running_code_status) === 2 || (source === null || source === void 0 ? void 0 : source.running_code_status) === 0) {
|
|
count = count + 1;
|
|
if (count > finalTime) {
|
|
time_out = true;
|
|
}
|
|
if (time_out) {
|
|
message/* default */.ZP.info('本次评测超时');
|
|
}
|
|
if ((source === null || source === void 0 ? void 0 : source.running_code_status) === 1 || (source === null || source === void 0 ? void 0 : source.running_code_status) === 2) {
|
|
setCodeMessage(source === null || source === void 0 ? void 0 : source.running_code_message);
|
|
}
|
|
setTimeout(function () {
|
|
fnc();
|
|
}, 1000);
|
|
} else {
|
|
if (source.status === 2) {
|
|
// message.success('评测通过');
|
|
setShowModal(true);
|
|
}
|
|
setGamesData(objectSpread2_default()({}, source));
|
|
setCaseVisible(true);
|
|
setBtnLoading(false);
|
|
setCodeMessage('');
|
|
setBtnTime(10);
|
|
clickEvaluating.current = false;
|
|
jupyterMessageFlag.current = true;
|
|
}
|
|
case 4:
|
|
case "end":
|
|
return _context5.stop();
|
|
}
|
|
}, _callee5);
|
|
}));
|
|
return function fnc() {
|
|
return _ref7.apply(this, arguments);
|
|
};
|
|
}();
|
|
fnc();
|
|
case 19:
|
|
case "end":
|
|
return _context6.stop();
|
|
}
|
|
}, _callee6);
|
|
}));
|
|
return function getGame(_x) {
|
|
return _ref6.apply(this, arguments);
|
|
};
|
|
}();
|
|
var handleGetJupyterData = /*#__PURE__*/function () {
|
|
var _ref8 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee7() {
|
|
var res;
|
|
return regeneratorRuntime_default()().wrap(function _callee7$(_context7) {
|
|
while (1) switch (_context7.prev = _context7.next) {
|
|
case 0:
|
|
_context7.next = 2;
|
|
return (0,task/* getJupyterData */.dU)({
|
|
identifier: params.identifier,
|
|
homework_id: searchParams.get("homework_common_id")
|
|
});
|
|
case 2:
|
|
res = _context7.sent;
|
|
if (res) {
|
|
setJupyterData(res);
|
|
saveJupyterData.current = objectSpread2_default()({}, res);
|
|
setGamesData(objectSpread2_default()(objectSpread2_default()({}, gamesData), {}, {
|
|
test_sets: (res === null || res === void 0 ? void 0 : res.test_sets) || []
|
|
}));
|
|
redcuerDispatch({
|
|
type: 'SET_DRAGMODULE',
|
|
payload: res.jupyter_show_description
|
|
});
|
|
}
|
|
case 4:
|
|
case "end":
|
|
return _context7.stop();
|
|
}
|
|
}, _callee7);
|
|
}));
|
|
return function handleGetJupyterData() {
|
|
return _ref8.apply(this, arguments);
|
|
};
|
|
}();
|
|
var handleGetJupyterTPIUrl = /*#__PURE__*/function () {
|
|
var _ref9 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee8() {
|
|
var _res$data;
|
|
var res, _res$data2, _res$data3, _parseUrl, _res$data4, _res$data5, _res$data6, _res$data10, _res$data11, _res$data12, _res$data7, _res$data8, _res$data9;
|
|
return regeneratorRuntime_default()().wrap(function _callee8$(_context8) {
|
|
while (1) switch (_context8.prev = _context8.next) {
|
|
case 0:
|
|
_context8.next = 2;
|
|
return (0,task/* getInfoWithTPI */.rV)({
|
|
identifier: params.identifier,
|
|
homework_common_id: searchParams.get("homework_common_id") || ''
|
|
});
|
|
case 2:
|
|
res = _context8.sent;
|
|
setSpinning(false);
|
|
if (!(res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && (_res$data = _res$data.data_list) !== null && _res$data !== void 0 && _res$data.length)) {
|
|
_context8.next = 7;
|
|
break;
|
|
}
|
|
mediator/* default */.Z.publish('pod-restrict-data', {
|
|
identifier: res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.identifier,
|
|
data_list: res === null || res === void 0 || (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.data_list
|
|
});
|
|
return _context8.abrupt("return");
|
|
case 7:
|
|
if (!(res !== null && res !== void 0 && res.data)) {
|
|
_context8.next = 21;
|
|
break;
|
|
}
|
|
setUrl(res.data);
|
|
urlRef.current = res.data;
|
|
token.current = (_parseUrl = (0,util/* parseUrl */.en)(res === null || res === void 0 || (_res$data4 = res.data) === null || _res$data4 === void 0 || (_res$data4 = _res$data4[0]) === null || _res$data4 === void 0 ? void 0 : _res$data4["link_url"])) === null || _parseUrl === void 0 ? void 0 : _parseUrl.token;
|
|
port.current = res === null || res === void 0 || (_res$data5 = res.data) === null || _res$data5 === void 0 || (_res$data5 = _res$data5[0]) === null || _res$data5 === void 0 ? void 0 : _res$data5["port"];
|
|
if (!(((_res$data6 = res.data) === null || _res$data6 === void 0 ? void 0 : _res$data6.length) > 1)) {
|
|
_context8.next = 16;
|
|
break;
|
|
}
|
|
setTime(Date.now() + (res === null || res === void 0 || (_res$data7 = res.data) === null || _res$data7 === void 0 || (_res$data7 = _res$data7[0]) === null || _res$data7 === void 0 ? void 0 : _res$data7.remaining_time));
|
|
setEndTime((res === null || res === void 0 || (_res$data8 = res.data) === null || _res$data8 === void 0 || (_res$data8 = _res$data8[0]) === null || _res$data8 === void 0 ? void 0 : _res$data8.remaining_time) - 300 * 1000 <= 0 ? Date.now() + 1000 : Date.now() + ((res === null || res === void 0 || (_res$data9 = res.data) === null || _res$data9 === void 0 || (_res$data9 = _res$data9[0]) === null || _res$data9 === void 0 ? void 0 : _res$data9.remaining_time) - 300 * 1000));
|
|
return _context8.abrupt("return");
|
|
case 16:
|
|
setUrlSign(false);
|
|
setStatus(Status.Success);
|
|
setTime(Date.now() + (res === null || res === void 0 || (_res$data10 = res.data) === null || _res$data10 === void 0 || (_res$data10 = _res$data10[0]) === null || _res$data10 === void 0 ? void 0 : _res$data10.remaining_time));
|
|
// setTime(Date.now() + 3000);
|
|
|
|
setEndTime((res === null || res === void 0 || (_res$data11 = res.data) === null || _res$data11 === void 0 || (_res$data11 = _res$data11[0]) === null || _res$data11 === void 0 ? void 0 : _res$data11.remaining_time) - 300 * 1000 <= 0 ? Date.now() + 1000 : Date.now() + ((res === null || res === void 0 || (_res$data12 = res.data) === null || _res$data12 === void 0 || (_res$data12 = _res$data12[0]) === null || _res$data12 === void 0 ? void 0 : _res$data12.remaining_time) - 300 * 1000));
|
|
return _context8.abrupt("return");
|
|
case 21:
|
|
if (res.status === -1) {
|
|
setStatus(Status.LoadFail);
|
|
setUrlSign(false);
|
|
} else {
|
|
setStatus(Status.ReLoad);
|
|
}
|
|
case 22:
|
|
case "end":
|
|
return _context8.stop();
|
|
}
|
|
}, _callee8);
|
|
}));
|
|
return function handleGetJupyterTPIUrl() {
|
|
return _ref9.apply(this, arguments);
|
|
};
|
|
}();
|
|
var handleUrlClick = function handleUrlClick(num) {
|
|
setUrlSign(false);
|
|
setActive(num);
|
|
handleGetJupyterTPIUrl();
|
|
setStatus(Status.Success);
|
|
};
|
|
var handleGetTPITimeInfo = /*#__PURE__*/function () {
|
|
var _ref10 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee9() {
|
|
var res;
|
|
return regeneratorRuntime_default()().wrap(function _callee9$(_context9) {
|
|
while (1) switch (_context9.prev = _context9.next) {
|
|
case 0:
|
|
_context9.next = 2;
|
|
return (0,task/* getTimeInfoWithTPI */.x4)({
|
|
identifier: params.identifier
|
|
});
|
|
case 2:
|
|
res = _context9.sent;
|
|
if (!((res === null || res === void 0 ? void 0 : res.status) !== 0)) {
|
|
_context9.next = 5;
|
|
break;
|
|
}
|
|
return _context9.abrupt("return");
|
|
case 5:
|
|
if (res !== null && res !== void 0 && res.useSeconds) {
|
|
_context9.next = 8;
|
|
break;
|
|
}
|
|
handleResetEnvModal();
|
|
return _context9.abrupt("return");
|
|
case 8:
|
|
if (res !== null && res !== void 0 && res.remainingSeconds) {
|
|
setTime(Date.now() + res.remainingSeconds * 1000);
|
|
setEndTime(res.remainingSeconds - 300 <= 0 ? Date.now() + 1000 : Date.now() + (res.remainingSeconds - 300) * 1000);
|
|
}
|
|
case 9:
|
|
case "end":
|
|
return _context9.stop();
|
|
}
|
|
}, _callee9);
|
|
}));
|
|
return function handleGetTPITimeInfo() {
|
|
return _ref10.apply(this, arguments);
|
|
};
|
|
}();
|
|
var handleResetEnvModal = function handleResetEnvModal() {
|
|
postMessageToIframe(true);
|
|
setSpinning(true);
|
|
modal/* default */.Z.confirm({
|
|
centered: true,
|
|
title: '重置环境',
|
|
content: ' 是否确定重置环境?',
|
|
okText: '确定',
|
|
cancelText: '取消',
|
|
onOk: function onOk() {
|
|
handleResetEnv();
|
|
},
|
|
onCancel: function onCancel() {
|
|
postMessageToIframe(false);
|
|
setSpinning(false);
|
|
}
|
|
});
|
|
};
|
|
var handleResetEnv = /*#__PURE__*/function () {
|
|
var _ref11 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee10() {
|
|
var res;
|
|
return regeneratorRuntime_default()().wrap(function _callee10$(_context10) {
|
|
while (1) switch (_context10.prev = _context10.next) {
|
|
case 0:
|
|
_context10.next = 2;
|
|
return (0,task/* resetWithTPI */.m_)({
|
|
identifier: jupyterData === null || jupyterData === void 0 ? void 0 : jupyterData.myshixun_identifier
|
|
});
|
|
case 2:
|
|
res = _context10.sent;
|
|
if (!((res === null || res === void 0 ? void 0 : res.status) !== 0)) {
|
|
_context10.next = 5;
|
|
break;
|
|
}
|
|
return _context10.abrupt("return");
|
|
case 5:
|
|
message/* default */.ZP.success('重置成功!');
|
|
setSpinning(false);
|
|
setTimeout(function () {
|
|
return window.location.reload();
|
|
}, 300);
|
|
case 8:
|
|
case "end":
|
|
return _context10.stop();
|
|
}
|
|
}, _callee10);
|
|
}));
|
|
return function handleResetEnv() {
|
|
return _ref11.apply(this, arguments);
|
|
};
|
|
}();
|
|
var handleEndTimeFinish = function handleEndTimeFinish() {
|
|
modal/* default */.Z.destroyAll();
|
|
modal/* default */.Z.confirm({
|
|
centered: true,
|
|
title: '服务中断提醒',
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "tc font14",
|
|
children: ["jupyter\u5C06\u4E8E", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(Countdown, {
|
|
value: time,
|
|
format: "HH:mm:ss",
|
|
onFinish: handleTimeFinish
|
|
})
|
|
}), "\u65F6\u95F4\u540E\u670D\u52A1\u4E2D\u65AD\uFF0C\u662F\u5426\u9700\u8981\u5EF6\u957F\u4F7F\u7528\u65F6\u95F4\uFF1F"]
|
|
}),
|
|
okText: '立即延长',
|
|
cancelText: '不需要',
|
|
onOk: function () {
|
|
var _onOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee11() {
|
|
var res;
|
|
return regeneratorRuntime_default()().wrap(function _callee11$(_context11) {
|
|
while (1) switch (_context11.prev = _context11.next) {
|
|
case 0:
|
|
_context11.next = 2;
|
|
return (0,task/* activeWithTPI */.rB)(jupyterData === null || jupyterData === void 0 ? void 0 : jupyterData.myshixun_identifier);
|
|
case 2:
|
|
res = _context11.sent;
|
|
if (!(res.status === 0)) {
|
|
_context11.next = 7;
|
|
break;
|
|
}
|
|
_context11.next = 6;
|
|
return handleGetJupyterTPIUrl();
|
|
case 6:
|
|
message/* default */.ZP.success('延长成功!');
|
|
case 7:
|
|
case "end":
|
|
return _context11.stop();
|
|
}
|
|
}, _callee11);
|
|
}));
|
|
function onOk() {
|
|
return _onOk.apply(this, arguments);
|
|
}
|
|
return onOk;
|
|
}()
|
|
});
|
|
};
|
|
var handleTimeFinish = function handleTimeFinish() {
|
|
setistimeshow(true);
|
|
// Modal.destroyAll();
|
|
// Modal.confirm({
|
|
// centered: true,
|
|
// title: '倒计时截止',
|
|
// content: <p className="tc font14">服务已中断,是否确认重置实验环境?</p>,
|
|
// okText: '确定',
|
|
// cancelText: '取消',
|
|
// onOk: () => {
|
|
// handleResetEnv();
|
|
// },
|
|
// });
|
|
};
|
|
var saveNotebook = function saveNotebook() {
|
|
var saveEvent = new Event('beforeunload');
|
|
window.dispatchEvent(saveEvent);
|
|
};
|
|
var postMessageToIframe = function postMessageToIframe(stopParent) {
|
|
var iframe = document.getElementById('taskJupyterIframe');
|
|
if (!iframe) {
|
|
return;
|
|
}
|
|
if (stopParent) {
|
|
iframe.contentWindow.postMessage('stopParent', '*');
|
|
} else {
|
|
iframe.contentWindow.postMessage('clonsParent', '*');
|
|
}
|
|
};
|
|
var handleResetTPI = function handleResetTPI() {
|
|
setSpinning(true);
|
|
postMessageToIframe(true);
|
|
tipReset({
|
|
title: "恢复初始代码",
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "tc font14",
|
|
children: ["\u4F60\u5728\u672C\u6587\u4EF6\u4E2D\u4FEE\u6539\u7684\u5185\u5BB9\u5C06\u4E22\u5931,", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u662F\u5426\u786E\u5B9A\u91CD\u65B0\u52A0\u8F7D\u521D\u59CB\u4EE3\u7801\uFF1F"]
|
|
})
|
|
});
|
|
};
|
|
var evaluating = function evaluating() {
|
|
var iframe = document.getElementById('taskJupyterIframe');
|
|
if (!iframe) {
|
|
return;
|
|
}
|
|
//底下触发保存事件 Ctrl+S
|
|
// iframe.contentWindow.postMessage('saveCode', '*');
|
|
clickEvaluating.current = true;
|
|
setBtnLoading(true);
|
|
setCaseVisible(true);
|
|
handleSaveWithTPI();
|
|
};
|
|
var tipReset = function tipReset(obj) {
|
|
modal/* default */.Z.confirm({
|
|
centered: true,
|
|
title: obj.title,
|
|
content: obj.content,
|
|
okText: '确定',
|
|
cancelText: '取消',
|
|
onOk: function () {
|
|
var _onOk2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee12() {
|
|
var res;
|
|
return regeneratorRuntime_default()().wrap(function _callee12$(_context12) {
|
|
while (1) switch (_context12.prev = _context12.next) {
|
|
case 0:
|
|
_context12.next = 2;
|
|
return (0,task/* syncCode */.fi)({
|
|
identifier: params.identifier
|
|
});
|
|
case 2:
|
|
res = _context12.sent;
|
|
if (!(res.status !== 0)) {
|
|
_context12.next = 5;
|
|
break;
|
|
}
|
|
return _context12.abrupt("return");
|
|
case 5:
|
|
message/* default */.ZP.success('操作成功');
|
|
setSpinning(false);
|
|
setTimeout(function () {
|
|
return window.location.reload();
|
|
}, 300);
|
|
case 8:
|
|
case "end":
|
|
return _context12.stop();
|
|
}
|
|
}, _callee12);
|
|
}));
|
|
function onOk() {
|
|
return _onOk2.apply(this, arguments);
|
|
}
|
|
return onOk;
|
|
}(),
|
|
onCancel: function onCancel() {
|
|
postMessageToIframe(false);
|
|
setSpinning(false);
|
|
}
|
|
});
|
|
};
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
function onMove(e) {
|
|
redcuerDispatch({
|
|
type: 'MOVE_X',
|
|
payload: e.pageX
|
|
});
|
|
}
|
|
function onMouseUp() {
|
|
redcuerDispatch({
|
|
type: 'TRIGGER_RIGHT_PANEL_MASK',
|
|
payload: false
|
|
});
|
|
document.onselectstart = null;
|
|
}
|
|
if (state.showDragMask) {
|
|
document.addEventListener('mousemove', onMove);
|
|
document.addEventListener('mouseup', onMouseUp);
|
|
}
|
|
return function () {
|
|
document.removeEventListener('mousemove', onMove);
|
|
document.removeEventListener('mouseup', onMouseUp);
|
|
};
|
|
}, [state.showDragMask]);
|
|
var leftPanelWidth = typeof state.moveX === 'number' && state.moveX !== 0.01 ? "".concat(state.moveX, "px") : '40%';
|
|
var rightPanelWidth = "calc(100% - 4px - ".concat(leftPanelWidth, ")");
|
|
|
|
/**
|
|
*
|
|
*/
|
|
var onResizeStart = function onResizeStart(status) {
|
|
redcuerDispatch({
|
|
type: 'TRIGGER_RIGHT_PANEL_MASK',
|
|
payload: status
|
|
});
|
|
};
|
|
var _useState39 = (0,_react_17_0_2_react.useState)(),
|
|
_useState40 = slicedToArray_default()(_useState39, 2),
|
|
answerData = _useState40[0],
|
|
setAnswerData = _useState40[1];
|
|
var getAnswerData = /*#__PURE__*/function () {
|
|
var _ref12 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee13(identifier) {
|
|
var res;
|
|
return regeneratorRuntime_default()().wrap(function _callee13$(_context13) {
|
|
while (1) switch (_context13.prev = _context13.next) {
|
|
case 0:
|
|
_context13.next = 2;
|
|
return (0,fetch/* default */.ZP)("/api/shixuns/".concat(identifier, "/get_standard_answer.json"), {
|
|
method: 'get',
|
|
params: {
|
|
from: 'starting'
|
|
}
|
|
});
|
|
case 2:
|
|
res = _context13.sent;
|
|
if (res.status === 0) {
|
|
setAnswerData(res);
|
|
}
|
|
case 4:
|
|
case "end":
|
|
return _context13.stop();
|
|
}
|
|
}, _callee13);
|
|
}));
|
|
return function getAnswerData(_x2) {
|
|
return _ref12.apply(this, arguments);
|
|
};
|
|
}();
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
if (jupyterData.identifier) {
|
|
getAnswerData(jupyterData.identifier);
|
|
}
|
|
}, [jupyterData]);
|
|
function triggerToolBar() {
|
|
setIsToolBar(!isToolBar);
|
|
}
|
|
function onHideToolBar() {
|
|
setIsToolBar(false);
|
|
}
|
|
function onVncAction(name) {
|
|
onHideToolBar();
|
|
if (name === 'reset-task') {
|
|
handleResetEnvModal();
|
|
}
|
|
if (name === 'reset-git-code') {
|
|
openModalGit();
|
|
}
|
|
if (name === 'reset-code') {
|
|
handleResetTPI();
|
|
}
|
|
if (name === 'full-screen') {
|
|
if ((0,fullscreen/* IsFull */.vp)()) {
|
|
(0,fullscreen/* exitFull */.BU)();
|
|
} else {
|
|
var _document, _document$getElementB;
|
|
(0,fullscreen/* requestFullScreen */.Dj)((_document = document) === null || _document === void 0 || (_document$getElementB = _document.getElementById) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.call(_document, 'juptyer'));
|
|
}
|
|
}
|
|
}
|
|
var backExercise = function backExercise(type) {
|
|
if (document.activeElement.tagName !== "IFRAME") {
|
|
window.parent.postMessage('backExercise', '*');
|
|
// if (!lockExitFullRef.current) exitFull();
|
|
}
|
|
};
|
|
var fullChange = function fullChange(e) {
|
|
if ((0,fullscreen/* IsFull */.vp)()) {
|
|
setShowTool(false);
|
|
} else {
|
|
setShowTool(true);
|
|
}
|
|
};
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
document.addEventListener((0,fullscreen/* fullscreenChange */.gH)(), fullChange);
|
|
intervalRef.current = setInterval(function () {
|
|
saveNotebook();
|
|
}, 2000);
|
|
return function () {
|
|
clearInterval(intervalRef.current);
|
|
document.removeEventListener((0,fullscreen/* fullscreenChange */.gH)(), fullChange);
|
|
};
|
|
}, []);
|
|
function onResetGitCode() {
|
|
return _onResetGitCode.apply(this, arguments);
|
|
}
|
|
function _onResetGitCode() {
|
|
_onResetGitCode = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee15() {
|
|
var _window$location;
|
|
var response;
|
|
return regeneratorRuntime_default()().wrap(function _callee15$(_context15) {
|
|
while (1) switch (_context15.prev = _context15.next) {
|
|
case 0:
|
|
_context15.next = 2;
|
|
return (0,service/* resetGitCode */.Tf)(jupyterData === null || jupyterData === void 0 ? void 0 : jupyterData.myshixun_identifier, {});
|
|
case 2:
|
|
response = _context15.sent;
|
|
if (!((response === null || response === void 0 ? void 0 : response.status) === -5)) {
|
|
_context15.next = 6;
|
|
break;
|
|
}
|
|
modal/* default */.Z.info({
|
|
title: '提示',
|
|
maskClosable: true,
|
|
icon: null,
|
|
width: 700,
|
|
centered: true,
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
children: ["\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5DF2\u5728\u6559\u5B66\u8BFE\u5802\u8003\u8BD5\uFF08", /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
href: "/classrooms/".concat(response === null || response === void 0 ? void 0 : response.course_identifier, "/exercise/").concat(response === null || response === void 0 ? void 0 : response.exercise_id, "/detail"),
|
|
children: response === null || response === void 0 ? void 0 : response.exercise_name
|
|
}), "\uFF09\u4E2D\u88AB\u4F7F\u7528\uFF0C\u7528\u6237\u8BD5\u5377\u5DF2\u4EA4\u5377\uFF0C\u7981\u6B62\u518D\u4F5C\u7B54\uFF01"]
|
|
})
|
|
});
|
|
return _context15.abrupt("return");
|
|
case 6:
|
|
(_window$location = window.location) === null || _window$location === void 0 || _window$location.reload();
|
|
return _context15.abrupt("return", response);
|
|
case 8:
|
|
case "end":
|
|
return _context15.stop();
|
|
}
|
|
}, _callee15);
|
|
}));
|
|
return _onResetGitCode.apply(this, arguments);
|
|
}
|
|
var openModalGit = function openModalGit() {
|
|
modal/* default */.Z.confirm({
|
|
title: '重置代码仓库',
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)(ExclamationCircleOutlined/* default */.Z, {}),
|
|
content: '您的所有代码将被还原至初始状态,不影响通关状态与作业成绩。确认重置?',
|
|
centered: true,
|
|
okText: '确定',
|
|
cancelText: '取消',
|
|
onOk: onResetGitCode
|
|
});
|
|
};
|
|
var vncSettingOption = {
|
|
is_jupyter: true,
|
|
is_jupyter_notebook: (jupyterData === null || jupyterData === void 0 ? void 0 : jupyterData.is_jupyter) === true,
|
|
is_jupyter_lab: (jupyterData === null || jupyterData === void 0 ? void 0 : jupyterData.is_jupyter) === false,
|
|
jupyterData: jupyterData,
|
|
onVncAction: onVncAction,
|
|
onHideToolBar: onHideToolBar,
|
|
port: url === null || url === void 0 || (_url$ = url[0]) === null || _url$ === void 0 ? void 0 : _url$.port,
|
|
token: token.current
|
|
};
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(spin/* default */.Z, {
|
|
spinning: spinning,
|
|
tip: "\u52A0\u8F7D\u4E2D...",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
id: "juptyer",
|
|
className: Jupytermodules.bg,
|
|
style: {
|
|
userSelect: state.showDragMask ? 'none' : 'unset'
|
|
},
|
|
children: [state.showDragMask && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Jupytermodules.dragingMask
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("header", {
|
|
className: Jupytermodules.header,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Jupytermodules.user,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
src: "".concat(env/* default */.Z.IMG_SERVER, "/images/").concat(jupyterData === null || jupyterData === void 0 || (_jupyterData$user = jupyterData.user) === null || _jupyterData$user === void 0 ? void 0 : _jupyterData$user.image_url),
|
|
alt: "\u7528\u6237\u5934\u50CF"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: "ml10",
|
|
children: jupyterData === null || jupyterData === void 0 || (_jupyterData$user2 = jupyterData.user) === null || _jupyterData$user2 === void 0 ? void 0 : _jupyterData$user2.name
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Jupytermodules.titleWrap,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Jupytermodules.title,
|
|
children: jupyterData === null || jupyterData === void 0 ? void 0 : jupyterData.name
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(Countdown, {
|
|
value: time,
|
|
format: "HH:mm:ss",
|
|
onFinish: handleTimeFinish
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Jupytermodules.endTimeWrap,
|
|
children: endTime && /*#__PURE__*/(0,jsx_runtime.jsx)(Countdown, {
|
|
value: endTime,
|
|
format: "HH:mm:ss",
|
|
onFinish: handleEndTimeFinish
|
|
})
|
|
})]
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Jupytermodules.actionWrap,
|
|
children: [jupyterData.tpm_modified && showTool && /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
src: ImagesIcon/* noticeIcon */.GY,
|
|
onClick: updateCode,
|
|
style: {
|
|
position: 'relative',
|
|
top: -1,
|
|
marginRight: 8,
|
|
cursor: 'pointer'
|
|
}
|
|
}), showTool && /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
alt: "tool",
|
|
src: tool_namespaceObject,
|
|
width: 14,
|
|
style: {
|
|
opacity: "0.45",
|
|
margin: "0 -5px 2px 15px"
|
|
}
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
className: "".concat(Jupytermodules.colorGray, " font14"),
|
|
type: "link",
|
|
onClick: triggerToolBar,
|
|
children: "\u5DE5\u5177\u680F"
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)(PoweroffOutlined/* default */.Z, {}),
|
|
className: "".concat(Jupytermodules.colorGray, " font14"),
|
|
type: "link",
|
|
onClick: function onClick() {
|
|
modal/* default */.Z.confirm({
|
|
title: '退出实训',
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)(ExclamationCircleOutlined/* default */.Z, {}),
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
style: {
|
|
margin: '10px auto'
|
|
},
|
|
children: "\u60A8\u786E\u5B9A\u8981\u9000\u51FA\u5B9E\u8BAD\u5417\uFF1F"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
style: {
|
|
fontSize: '14px'
|
|
},
|
|
onChange: function onChange(e) {
|
|
setcheckboxData(e.target.checked);
|
|
},
|
|
children: "\u9000\u51FA\u5B9E\u8BAD\u65F6\uFF0C\u7ACB\u5373\u91CA\u653E\u5B9E\u9A8C\u8D44\u6E90"
|
|
})]
|
|
}),
|
|
centered: true,
|
|
okText: '确定',
|
|
cancelText: '取消',
|
|
onOk: function () {
|
|
var _onOk3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee14() {
|
|
var res;
|
|
return regeneratorRuntime_default()().wrap(function _callee14$(_context14) {
|
|
while (1) switch (_context14.prev = _context14.next) {
|
|
case 0:
|
|
if (!countRef.current) {
|
|
_context14.next = 5;
|
|
break;
|
|
}
|
|
_context14.next = 3;
|
|
return (0,exercise/* exitDeletePod */.eA)(jupyterData === null || jupyterData === void 0 ? void 0 : jupyterData.myshixun_identifier);
|
|
case 3:
|
|
res = _context14.sent;
|
|
if ((res === null || res === void 0 ? void 0 : res.status) == 0) {
|
|
message/* default */.ZP.success('释放资源成功');
|
|
}
|
|
case 5:
|
|
dispatch({
|
|
type: 'user/getUserInfo',
|
|
payload: {
|
|
objective_id: jupyterData.identifier,
|
|
objective_type: 'shixun'
|
|
}
|
|
});
|
|
if (searchParams.get("type") === 'exercises') {
|
|
backExercise('back');
|
|
}
|
|
_umi_production_exports.history.push("/shixuns/".concat(jupyterData.identifier, "/challenges"));
|
|
case 8:
|
|
case "end":
|
|
return _context14.stop();
|
|
}
|
|
}, _callee14);
|
|
}));
|
|
function onOk() {
|
|
return _onOk3.apply(this, arguments);
|
|
}
|
|
return onOk;
|
|
}(),
|
|
onCancel: function onCancel() {
|
|
setcheckboxData(false);
|
|
}
|
|
});
|
|
},
|
|
children: "\u9000\u51FA"
|
|
})]
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
className: Jupytermodules.content,
|
|
style: {
|
|
height: jupyterData !== null && jupyterData !== void 0 && jupyterData.open_evaluate ? 'calc(100vh - 130px)' : 'calc(100vh - 60px)'
|
|
},
|
|
children: [state.showDragModule && /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
className: Jupytermodules.leftContainer,
|
|
style: {
|
|
width: leftPanelWidth,
|
|
display: state.moveX === 0.01 ? 'none' : ''
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Jupytermodules.tabNav,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
children: "\u4EFB\u52A1\u8981\u6C42"
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Jupytermodules.mdContent,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
stylesPrev: {
|
|
position: "absolute"
|
|
},
|
|
value: jupyterData.description || ''
|
|
})
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
className: Jupytermodules.resizeBar,
|
|
onMouseDown: function onMouseDown() {
|
|
onResizeStart(true);
|
|
},
|
|
onMouseUp: function onMouseUp() {
|
|
return onResizeStart(false);
|
|
},
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(components_ResizeIcon, {
|
|
noDragging: false,
|
|
moveX: state.moveX
|
|
})
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
className: Jupytermodules.rightCotainer,
|
|
style: {
|
|
width: rightPanelWidth
|
|
},
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("main", {
|
|
className: Jupytermodules.main,
|
|
style: {
|
|
height: '100%'
|
|
},
|
|
children: urlSign ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Jupytermodules.start,
|
|
style: {
|
|
visibility: spinning ? 'hidden' : 'visible'
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Jupytermodules.title,
|
|
children: "\u8BF7\u70B9\u51FB\u4E00\u4E2A\u6587\u4EF6\u8FDB\u5165\u5B9E\u9A8C\u73AF\u5883\uFF0C\u5F00\u59CB\u5B9E\u9A8C\uFF01"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("b", {
|
|
className: "iconfont icon-dianji1"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Jupytermodules.liWarp,
|
|
children: url === null || url === void 0 ? void 0 : url.map(function (e, i) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
onClick: function onClick() {
|
|
return handleUrlClick(i);
|
|
},
|
|
className: Jupytermodules.li,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-wenjian6"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
title: e.name,
|
|
children: e.name
|
|
})]
|
|
});
|
|
})
|
|
})]
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
|
|
children: [showTool && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
style: {
|
|
right: isOpenDrawer === 1 && 330 || isOpenDrawer === 2 && 600
|
|
},
|
|
className: "".concat(Jupytermodules.dataSetButton, " ").concat(isOpenDrawer ? "".concat(Jupytermodules.dataSetOpen, " ").concat(isOpenDrawer === 1 ? Jupytermodules.ac : '') : ''),
|
|
onClick: function onClick(e) {
|
|
setIsOpenDrawer(1);
|
|
onHideToolBar();
|
|
e.nativeEvent.stopPropagation();
|
|
},
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Jupytermodules.dataSetText,
|
|
children: "\u6570\u636E\u96C6"
|
|
})
|
|
}), !(answerData !== null && answerData !== void 0 && answerData.hide_answer) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
style: {
|
|
top: '53%',
|
|
right: isOpenDrawer === 2 && 600
|
|
},
|
|
className: "".concat(Jupytermodules.dataSetButton, " ").concat(isOpenDrawer ? "".concat(Jupytermodules.dataSetOpen, " ").concat(isOpenDrawer === 2 ? Jupytermodules.ac : '') : ''),
|
|
onClick: function onClick(e) {
|
|
setIsOpenDrawer(2);
|
|
e.nativeEvent.stopPropagation();
|
|
},
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Jupytermodules.dataSetText,
|
|
children: "\u53C2\u8003\u7B54\u6848"
|
|
})
|
|
}), status === Status.LoadFail && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Jupytermodules.loadFail,
|
|
children: " "
|
|
}), status === Status.ReLoad && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Jupytermodules.reload,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Jupytermodules.failWrap,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-jiazaishibai1 ".concat(Jupytermodules.failIcon)
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
className: "font12",
|
|
children: ["\u52A0\u8F7D\u5B9E\u8BAD\u5931\u8D25\uFF0C", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Jupytermodules.failReload,
|
|
onClick: handleGetJupyterTPIUrl,
|
|
children: "\u91CD\u65B0\u52A0\u8F7D"
|
|
})]
|
|
})]
|
|
})
|
|
}), status === Status.Success && /*#__PURE__*/(0,jsx_runtime.jsx)("iframe", {
|
|
frameBorder: 0,
|
|
id: "taskJupyterIframe",
|
|
width: "100%",
|
|
height: "100%",
|
|
allow: "geolocation; microphone; camera; midi; encrypted-media;",
|
|
src: url === null || url === void 0 || (_url$active = url[active]) === null || _url$active === void 0 ? void 0 : _url$active.link_url
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(components_DataSet, {
|
|
visible: isOpenDrawer,
|
|
identifier: jupyterData.identifier,
|
|
cancel: function cancel() {
|
|
setIsOpenDrawer(false);
|
|
}
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Answer, {
|
|
visible: isOpenDrawer,
|
|
answerData: answerData,
|
|
cancel: function cancel() {
|
|
return setIsOpenDrawer(false);
|
|
}
|
|
})]
|
|
})
|
|
})
|
|
})]
|
|
}), jupyterData !== null && jupyterData !== void 0 && jupyterData.open_evaluate ? /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Jupytermodules.footer,
|
|
style: {
|
|
background: '#111c24'
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
children: [gamesData !== null && gamesData !== void 0 && gamesData.time_limit ? /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
children: "\u672C\u5173\u6700\u5927\u6267\u884C\u65F6\u95F4\uFF1A".concat(gamesData === null || gamesData === void 0 ? void 0 : gamesData.time_limit, "\u79D2")
|
|
}) : null, gamesData !== null && gamesData !== void 0 && gamesData.record_consume_time ? /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
className: "ml10",
|
|
children: ["\u672C\u6B21\u8BC4\u6D4B\u8017\u65F6(\u7F16\u8BD1\u3001\u8FD0\u884C\u603B\u65F6\u95F4)\uFF1A", gamesData === null || gamesData === void 0 ? void 0 : gamesData.record_consume_time, " \u79D2"]
|
|
}) : null]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
onClick: function onClick() {
|
|
return setCaseVisible(!caseVisible);
|
|
},
|
|
type: "primary",
|
|
ghost: true,
|
|
className: "mr20",
|
|
children: caseVisible ? '隐藏测试结果' : '查看测试结果'
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
className: Jupytermodules.disabled,
|
|
disabled: btnTime !== 0,
|
|
loading: btnLoading,
|
|
onClick: evaluating,
|
|
style: {
|
|
padding: '0 30px'
|
|
},
|
|
type: "primary",
|
|
children: btnTime !== 0 ? "".concat(btnTime, "s") : '评测'
|
|
})]
|
|
})
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
children: searchParams.get("homework_common_id") && !(jupyterData !== null && jupyterData !== void 0 && jupyterData.homework_is_end) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Jupytermodules.footer,
|
|
style: {
|
|
background: '#111c24'
|
|
},
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AsyncButton/* AsyncButton */.Z, {
|
|
onClick: function onClick() {
|
|
return submitWork();
|
|
},
|
|
type: "primary",
|
|
className: "mr20",
|
|
children: "\u63D0\u4EA4\u4F5C\u54C1"
|
|
})
|
|
})
|
|
}), caseVisible && /*#__PURE__*/(0,jsx_runtime.jsx)(Case, {
|
|
codeMessage: codeMessage,
|
|
loading: btnLoading,
|
|
gamesData: gamesData,
|
|
test_sets: (gamesData === null || gamesData === void 0 ? void 0 : gamesData.test_sets) || [],
|
|
jupyterData: jupyterData
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
title: [/*#__PURE__*/(0,jsx_runtime.jsx)(ExclamationCircleOutlined/* default */.Z, {
|
|
className: "modalIconYellow mr10"
|
|
}), '实验环境结束提醒'],
|
|
maskClosable: false,
|
|
closable: false,
|
|
centered: true,
|
|
open: istimeshow,
|
|
onOk: function onOk() {
|
|
(0,exercise/* exitDeletePod */.eA)(jupyterData === null || jupyterData === void 0 ? void 0 : jupyterData.myshixun_identifier).then(function (res) {});
|
|
_umi_production_exports.history.push("/shixuns/".concat(jupyterData.identifier, "/challenges"));
|
|
},
|
|
cancelButtonProps: {
|
|
style: {
|
|
// display: time !== 0 ? 'inline-block' : 'none'
|
|
background: '#009e9c',
|
|
color: '#fff'
|
|
}
|
|
},
|
|
confirmLoading: btnLoading,
|
|
onCancel: function onCancel() {
|
|
setistimeshow(false);
|
|
window.location.reload();
|
|
},
|
|
okText: '退出',
|
|
cancelText: '重新开启实验',
|
|
children: "\u5B9E\u9A8C\u73AF\u5883\u5012\u8BA1\u65F6\u7ED3\u675F\uFF0C\u8D44\u6E90\u5DF2\u7ECF\u88AB\u56DE\u6536\u3002"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(components_modal/* default */.Z, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(drawer/* default */.Z, {
|
|
width: 280,
|
|
rootClassName: "setting-drawer",
|
|
title: null,
|
|
placement: "right",
|
|
closable: false,
|
|
open: isToolBar,
|
|
onClose: onHideToolBar,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(vnc_setting/* default */.Z, objectSpread2_default()({}, vncSettingOption))
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Unlock/* default */.Z, {
|
|
successCb: handleSaveWithTPI
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(components_PassModal, {
|
|
showModal: showModal,
|
|
setShowModal: setShowModal
|
|
})]
|
|
});
|
|
};
|
|
/* harmony default export */ var Jupyter = ((0,_umi_production_exports.connect)(function (_ref13) {
|
|
var loading = _ref13.loading,
|
|
globalSetting = _ref13.globalSetting;
|
|
return {
|
|
globalSetting: globalSetting,
|
|
loading: loading
|
|
};
|
|
})(TaskJupyterPage));
|
|
|
|
/***/ }),
|
|
|
|
/***/ 80721:
|
|
/*!*****************************!*\
|
|
!*** ./src/service/task.ts ***!
|
|
\*****************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Jd: function() { return /* binding */ rebootEsc; },
|
|
/* harmony export */ a$: function() { return /* binding */ getDataSets; },
|
|
/* harmony export */ dU: function() { return /* binding */ getJupyterData; },
|
|
/* harmony export */ fi: function() { return /* binding */ syncCode; },
|
|
/* harmony export */ m_: function() { return /* binding */ resetWithTPI; },
|
|
/* harmony export */ rB: function() { return /* binding */ activeWithTPI; },
|
|
/* harmony export */ rV: function() { return /* binding */ getInfoWithTPI; },
|
|
/* harmony export */ x4: function() { return /* binding */ getTimeInfoWithTPI; },
|
|
/* harmony export */ zE: function() { return /* binding */ saveWithTPI; }
|
|
/* harmony export */ });
|
|
/* unused harmony export getLatexFileTree */
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js */ 82242);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_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_test4_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_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_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_test4_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_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
/* harmony import */ var _utils_fetch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/utils/fetch */ 1833);
|
|
|
|
|
|
|
|
|
|
function saveWithTPI(_x) {
|
|
return _saveWithTPI.apply(this, arguments);
|
|
}
|
|
function _saveWithTPI() {
|
|
_saveWithTPI = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee(params) {
|
|
return _root_workspace_ppte5yg23_local_v9_test4_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:
|
|
return _context.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/jupyters/save_with_tpi.json", {
|
|
method: 'Get',
|
|
params: params
|
|
}));
|
|
case 1:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
}));
|
|
return _saveWithTPI.apply(this, arguments);
|
|
}
|
|
function getJupyterData(_x2) {
|
|
return _getJupyterData.apply(this, arguments);
|
|
}
|
|
function _getJupyterData() {
|
|
_getJupyterData = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee2(params) {
|
|
return _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee2$(_context2) {
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
case 0:
|
|
return _context2.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/tasks/".concat(params.identifier, "/jupyter.json"), {
|
|
method: 'Get',
|
|
params: params
|
|
}));
|
|
case 1:
|
|
case "end":
|
|
return _context2.stop();
|
|
}
|
|
}, _callee2);
|
|
}));
|
|
return _getJupyterData.apply(this, arguments);
|
|
}
|
|
function getInfoWithTPI(_x3) {
|
|
return _getInfoWithTPI.apply(this, arguments);
|
|
}
|
|
function _getInfoWithTPI() {
|
|
_getInfoWithTPI = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee3(params) {
|
|
return _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee3$(_context3) {
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
case 0:
|
|
return _context3.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/myshixuns/".concat(params.identifier, "/start.json"), {
|
|
method: 'Get',
|
|
params: params
|
|
}));
|
|
case 1:
|
|
case "end":
|
|
return _context3.stop();
|
|
}
|
|
}, _callee3);
|
|
}));
|
|
return _getInfoWithTPI.apply(this, arguments);
|
|
}
|
|
function getTimeInfoWithTPI(_x4) {
|
|
return _getTimeInfoWithTPI.apply(this, arguments);
|
|
}
|
|
function _getTimeInfoWithTPI() {
|
|
_getTimeInfoWithTPI = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee4(params) {
|
|
return _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee4$(_context4) {
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
case 0:
|
|
return _context4.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/jupyters/timeinfo_with_tpi.json", {
|
|
method: 'Get',
|
|
params: params
|
|
}));
|
|
case 1:
|
|
case "end":
|
|
return _context4.stop();
|
|
}
|
|
}, _callee4);
|
|
}));
|
|
return _getTimeInfoWithTPI.apply(this, arguments);
|
|
}
|
|
function resetWithTPI(_x5) {
|
|
return _resetWithTPI.apply(this, arguments);
|
|
}
|
|
function _resetWithTPI() {
|
|
_resetWithTPI = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee5(params) {
|
|
return _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee5$(_context5) {
|
|
while (1) switch (_context5.prev = _context5.next) {
|
|
case 0:
|
|
return _context5.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/myshixuns/".concat(params.identifier, "/reset_pod.json"), {
|
|
method: 'Get'
|
|
// params
|
|
}));
|
|
case 1:
|
|
case "end":
|
|
return _context5.stop();
|
|
}
|
|
}, _callee5);
|
|
}));
|
|
return _resetWithTPI.apply(this, arguments);
|
|
}
|
|
function activeWithTPI(_x6, _x7) {
|
|
return _activeWithTPI.apply(this, arguments);
|
|
}
|
|
function _activeWithTPI() {
|
|
_activeWithTPI = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee6(id, params) {
|
|
return _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee6$(_context6) {
|
|
while (1) switch (_context6.prev = _context6.next) {
|
|
case 0:
|
|
return _context6.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/myshixuns/".concat(id, "/active_pod.json"), {
|
|
method: 'Get',
|
|
params: params
|
|
}));
|
|
case 1:
|
|
case "end":
|
|
return _context6.stop();
|
|
}
|
|
}, _callee6);
|
|
}));
|
|
return _activeWithTPI.apply(this, arguments);
|
|
}
|
|
function syncCode(_x8) {
|
|
return _syncCode.apply(this, arguments);
|
|
}
|
|
function _syncCode() {
|
|
_syncCode = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee7(params) {
|
|
var p;
|
|
return _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee7$(_context7) {
|
|
while (1) switch (_context7.prev = _context7.next) {
|
|
case 0:
|
|
p = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, params);
|
|
delete p.identifier;
|
|
return _context7.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/myshixuns/".concat(params.identifier, "/sync_code.json"), {
|
|
method: 'Post',
|
|
body: p
|
|
}));
|
|
case 3:
|
|
case "end":
|
|
return _context7.stop();
|
|
}
|
|
}, _callee7);
|
|
}));
|
|
return _syncCode.apply(this, arguments);
|
|
}
|
|
function getDataSets(_x9) {
|
|
return _getDataSets.apply(this, arguments);
|
|
}
|
|
|
|
// 重启window 云主机
|
|
function _getDataSets() {
|
|
_getDataSets = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee8(params) {
|
|
return _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee8$(_context8) {
|
|
while (1) switch (_context8.prev = _context8.next) {
|
|
case 0:
|
|
return _context8.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/shixuns/".concat(params.identifier, "/get_data_sets.json"), {
|
|
method: 'Get',
|
|
params: params
|
|
}));
|
|
case 1:
|
|
case "end":
|
|
return _context8.stop();
|
|
}
|
|
}, _callee8);
|
|
}));
|
|
return _getDataSets.apply(this, arguments);
|
|
}
|
|
function rebootEsc(_x10) {
|
|
return _rebootEsc.apply(this, arguments);
|
|
}
|
|
function _rebootEsc() {
|
|
_rebootEsc = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee9(params) {
|
|
return _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee9$(_context9) {
|
|
while (1) switch (_context9.prev = _context9.next) {
|
|
case 0:
|
|
return _context9.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)("/api/tasks/".concat(params.identifier, "/reboot_esc.json"), {
|
|
method: 'post',
|
|
body: params
|
|
}));
|
|
case 1:
|
|
case "end":
|
|
return _context9.stop();
|
|
}
|
|
}, _callee9);
|
|
}));
|
|
return _rebootEsc.apply(this, arguments);
|
|
}
|
|
function getLatexFileTree(_x11) {
|
|
return _getLatexFileTree.apply(this, arguments);
|
|
}
|
|
function _getLatexFileTree() {
|
|
_getLatexFileTree = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
|
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
while (1) switch (_context10.prev = _context10.next) {
|
|
case 0:
|
|
return _context10.abrupt("return", Fetch("/api/tasks/".concat(params.taskId, "/get_latex_file_tree.json"), {
|
|
method: 'Get',
|
|
params: params
|
|
}));
|
|
case 1:
|
|
case "end":
|
|
return _context10.stop();
|
|
}
|
|
}, _callee10);
|
|
}));
|
|
return _getLatexFileTree.apply(this, arguments);
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 72674:
|
|
/*!*********************************!*\
|
|
!*** ./src/utils/fullscreen.ts ***!
|
|
\*********************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* 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();
|
|
// }
|
|
// });
|
|
|
|
/***/ }),
|
|
|
|
/***/ 51581:
|
|
/*!****************************************************************************************************!*\
|
|
!*** ./node_modules/_react-infinite-scroller@1.2.4@react-infinite-scroller/dist/InfiniteScroll.js ***!
|
|
\****************************************************************************************************/
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
|
|
var _react = __webpack_require__(/*! react */ 59301);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _propTypes = __webpack_require__(/*! prop-types */ 12708);
|
|
|
|
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
|
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
|
|
var InfiniteScroll = function (_Component) {
|
|
_inherits(InfiniteScroll, _Component);
|
|
|
|
function InfiniteScroll(props) {
|
|
_classCallCheck(this, InfiniteScroll);
|
|
|
|
var _this = _possibleConstructorReturn(this, (InfiniteScroll.__proto__ || Object.getPrototypeOf(InfiniteScroll)).call(this, props));
|
|
|
|
_this.scrollListener = _this.scrollListener.bind(_this);
|
|
_this.eventListenerOptions = _this.eventListenerOptions.bind(_this);
|
|
_this.mousewheelListener = _this.mousewheelListener.bind(_this);
|
|
return _this;
|
|
}
|
|
|
|
_createClass(InfiniteScroll, [{
|
|
key: 'componentDidMount',
|
|
value: function componentDidMount() {
|
|
this.pageLoaded = this.props.pageStart;
|
|
this.options = this.eventListenerOptions();
|
|
this.attachScrollListener();
|
|
}
|
|
}, {
|
|
key: 'componentDidUpdate',
|
|
value: function componentDidUpdate() {
|
|
if (this.props.isReverse && this.loadMore) {
|
|
var parentElement = this.getParentElement(this.scrollComponent);
|
|
parentElement.scrollTop = parentElement.scrollHeight - this.beforeScrollHeight + this.beforeScrollTop;
|
|
this.loadMore = false;
|
|
}
|
|
this.attachScrollListener();
|
|
}
|
|
}, {
|
|
key: 'componentWillUnmount',
|
|
value: function componentWillUnmount() {
|
|
this.detachScrollListener();
|
|
this.detachMousewheelListener();
|
|
}
|
|
}, {
|
|
key: 'isPassiveSupported',
|
|
value: function isPassiveSupported() {
|
|
var passive = false;
|
|
|
|
var testOptions = {
|
|
get passive() {
|
|
passive = true;
|
|
}
|
|
};
|
|
|
|
try {
|
|
document.addEventListener('test', null, testOptions);
|
|
document.removeEventListener('test', null, testOptions);
|
|
} catch (e) {
|
|
// ignore
|
|
}
|
|
return passive;
|
|
}
|
|
}, {
|
|
key: 'eventListenerOptions',
|
|
value: function eventListenerOptions() {
|
|
var options = this.props.useCapture;
|
|
|
|
if (this.isPassiveSupported()) {
|
|
options = {
|
|
useCapture: this.props.useCapture,
|
|
passive: true
|
|
};
|
|
}
|
|
return options;
|
|
}
|
|
|
|
// Set a defaut loader for all your `InfiniteScroll` components
|
|
|
|
}, {
|
|
key: 'setDefaultLoader',
|
|
value: function setDefaultLoader(loader) {
|
|
this.defaultLoader = loader;
|
|
}
|
|
}, {
|
|
key: 'detachMousewheelListener',
|
|
value: function detachMousewheelListener() {
|
|
var scrollEl = window;
|
|
if (this.props.useWindow === false) {
|
|
scrollEl = this.scrollComponent.parentNode;
|
|
}
|
|
|
|
scrollEl.removeEventListener('mousewheel', this.mousewheelListener, this.options ? this.options : this.props.useCapture);
|
|
}
|
|
}, {
|
|
key: 'detachScrollListener',
|
|
value: function detachScrollListener() {
|
|
var scrollEl = window;
|
|
if (this.props.useWindow === false) {
|
|
scrollEl = this.getParentElement(this.scrollComponent);
|
|
}
|
|
|
|
scrollEl.removeEventListener('scroll', this.scrollListener, this.options ? this.options : this.props.useCapture);
|
|
scrollEl.removeEventListener('resize', this.scrollListener, this.options ? this.options : this.props.useCapture);
|
|
}
|
|
}, {
|
|
key: 'getParentElement',
|
|
value: function getParentElement(el) {
|
|
var scrollParent = this.props.getScrollParent && this.props.getScrollParent();
|
|
if (scrollParent != null) {
|
|
return scrollParent;
|
|
}
|
|
return el && el.parentNode;
|
|
}
|
|
}, {
|
|
key: 'filterProps',
|
|
value: function filterProps(props) {
|
|
return props;
|
|
}
|
|
}, {
|
|
key: 'attachScrollListener',
|
|
value: function attachScrollListener() {
|
|
var parentElement = this.getParentElement(this.scrollComponent);
|
|
|
|
if (!this.props.hasMore || !parentElement) {
|
|
return;
|
|
}
|
|
|
|
var scrollEl = window;
|
|
if (this.props.useWindow === false) {
|
|
scrollEl = parentElement;
|
|
}
|
|
|
|
scrollEl.addEventListener('mousewheel', this.mousewheelListener, this.options ? this.options : this.props.useCapture);
|
|
scrollEl.addEventListener('scroll', this.scrollListener, this.options ? this.options : this.props.useCapture);
|
|
scrollEl.addEventListener('resize', this.scrollListener, this.options ? this.options : this.props.useCapture);
|
|
|
|
if (this.props.initialLoad) {
|
|
this.scrollListener();
|
|
}
|
|
}
|
|
}, {
|
|
key: 'mousewheelListener',
|
|
value: function mousewheelListener(e) {
|
|
// Prevents Chrome hangups
|
|
// See: https://stackoverflow.com/questions/47524205/random-high-content-download-time-in-chrome/47684257#47684257
|
|
if (e.deltaY === 1 && !this.isPassiveSupported()) {
|
|
e.preventDefault();
|
|
}
|
|
}
|
|
}, {
|
|
key: 'scrollListener',
|
|
value: function scrollListener() {
|
|
var el = this.scrollComponent;
|
|
var scrollEl = window;
|
|
var parentNode = this.getParentElement(el);
|
|
|
|
var offset = void 0;
|
|
if (this.props.useWindow) {
|
|
var doc = document.documentElement || document.body.parentNode || document.body;
|
|
var scrollTop = scrollEl.pageYOffset !== undefined ? scrollEl.pageYOffset : doc.scrollTop;
|
|
if (this.props.isReverse) {
|
|
offset = scrollTop;
|
|
} else {
|
|
offset = this.calculateOffset(el, scrollTop);
|
|
}
|
|
} else if (this.props.isReverse) {
|
|
offset = parentNode.scrollTop;
|
|
} else {
|
|
offset = el.scrollHeight - parentNode.scrollTop - parentNode.clientHeight;
|
|
}
|
|
|
|
// Here we make sure the element is visible as well as checking the offset
|
|
if (offset < Number(this.props.threshold) && el && el.offsetParent !== null) {
|
|
this.detachScrollListener();
|
|
this.beforeScrollHeight = parentNode.scrollHeight;
|
|
this.beforeScrollTop = parentNode.scrollTop;
|
|
// Call loadMore after detachScrollListener to allow for non-async loadMore functions
|
|
if (typeof this.props.loadMore === 'function') {
|
|
this.props.loadMore(this.pageLoaded += 1);
|
|
this.loadMore = true;
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: 'calculateOffset',
|
|
value: function calculateOffset(el, scrollTop) {
|
|
if (!el) {
|
|
return 0;
|
|
}
|
|
|
|
return this.calculateTopPosition(el) + (el.offsetHeight - scrollTop - window.innerHeight);
|
|
}
|
|
}, {
|
|
key: 'calculateTopPosition',
|
|
value: function calculateTopPosition(el) {
|
|
if (!el) {
|
|
return 0;
|
|
}
|
|
return el.offsetTop + this.calculateTopPosition(el.offsetParent);
|
|
}
|
|
}, {
|
|
key: 'render',
|
|
value: function render() {
|
|
var _this2 = this;
|
|
|
|
var renderProps = this.filterProps(this.props);
|
|
|
|
var children = renderProps.children,
|
|
element = renderProps.element,
|
|
hasMore = renderProps.hasMore,
|
|
initialLoad = renderProps.initialLoad,
|
|
isReverse = renderProps.isReverse,
|
|
loader = renderProps.loader,
|
|
loadMore = renderProps.loadMore,
|
|
pageStart = renderProps.pageStart,
|
|
ref = renderProps.ref,
|
|
threshold = renderProps.threshold,
|
|
useCapture = renderProps.useCapture,
|
|
useWindow = renderProps.useWindow,
|
|
getScrollParent = renderProps.getScrollParent,
|
|
props = _objectWithoutProperties(renderProps, ['children', 'element', 'hasMore', 'initialLoad', 'isReverse', 'loader', 'loadMore', 'pageStart', 'ref', 'threshold', 'useCapture', 'useWindow', 'getScrollParent']);
|
|
|
|
props.ref = function (node) {
|
|
_this2.scrollComponent = node;
|
|
if (ref) {
|
|
ref(node);
|
|
}
|
|
};
|
|
|
|
var childrenArray = [children];
|
|
if (hasMore) {
|
|
if (loader) {
|
|
isReverse ? childrenArray.unshift(loader) : childrenArray.push(loader);
|
|
} else if (this.defaultLoader) {
|
|
isReverse ? childrenArray.unshift(this.defaultLoader) : childrenArray.push(this.defaultLoader);
|
|
}
|
|
}
|
|
return _react2.default.createElement(element, props, childrenArray);
|
|
}
|
|
}]);
|
|
|
|
return InfiniteScroll;
|
|
}(_react.Component);
|
|
|
|
InfiniteScroll.propTypes = {
|
|
children: _propTypes2.default.node.isRequired,
|
|
element: _propTypes2.default.node,
|
|
hasMore: _propTypes2.default.bool,
|
|
initialLoad: _propTypes2.default.bool,
|
|
isReverse: _propTypes2.default.bool,
|
|
loader: _propTypes2.default.node,
|
|
loadMore: _propTypes2.default.func.isRequired,
|
|
pageStart: _propTypes2.default.number,
|
|
ref: _propTypes2.default.func,
|
|
getScrollParent: _propTypes2.default.func,
|
|
threshold: _propTypes2.default.number,
|
|
useCapture: _propTypes2.default.bool,
|
|
useWindow: _propTypes2.default.bool
|
|
};
|
|
InfiniteScroll.defaultProps = {
|
|
element: 'div',
|
|
hasMore: false,
|
|
initialLoad: true,
|
|
pageStart: 0,
|
|
ref: null,
|
|
threshold: 250,
|
|
useWindow: true,
|
|
isReverse: false,
|
|
useCapture: false,
|
|
loader: null,
|
|
getScrollParent: null
|
|
};
|
|
exports["default"] = InfiniteScroll;
|
|
module.exports = exports['default'];
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 26724:
|
|
/*!**************************************************************************************!*\
|
|
!*** ./node_modules/_react-infinite-scroller@1.2.4@react-infinite-scroller/index.js ***!
|
|
\**************************************************************************************/
|
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
|
|
module.exports = __webpack_require__(/*! ./dist/InfiniteScroll */ 51581)
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |