|
|
"use strict";
|
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[14105],{
|
|
|
|
|
|
/***/ 80330:
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/pages/tasks/util.js ***!
|
|
|
\*********************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ Ax: function() { return /* binding */ processTreeData; },
|
|
|
/* harmony export */ Ds: function() { return /* binding */ debounce; },
|
|
|
/* harmony export */ KI: function() { return /* binding */ apiPref; },
|
|
|
/* harmony export */ SI: function() { return /* binding */ getTreeData; },
|
|
|
/* harmony export */ f1: function() { return /* binding */ isCompileOk; }
|
|
|
/* harmony export */ });
|
|
|
/* unused harmony export isProd */
|
|
|
/* harmony import */ var _utils_env__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/utils/env */ 78130);
|
|
|
|
|
|
function isCompileOk(rs) {
|
|
|
var flag = true;
|
|
|
if (rs.length > 0) {
|
|
|
for (var i = 0; i < rs.length; i++) {
|
|
|
if (rs[i].compile_success == 0 || !rs[i].compile_success) {
|
|
|
flag = false;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
flag = false;
|
|
|
}
|
|
|
return flag;
|
|
|
}
|
|
|
function getTreeData(data) {
|
|
|
var parentKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
|
var result = [];
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
var item = data[i];
|
|
|
var key = parentKey ? "".concat(parentKey, "/").concat(item.name) : "".concat(item.name);
|
|
|
result.push({
|
|
|
title: item.name,
|
|
|
isLeaf: item.type === 'tree' ? false : true,
|
|
|
key: key
|
|
|
});
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
function processTreeData(repos, key, newData) {
|
|
|
for (var i = 0; i < repos.length; i++) {
|
|
|
var item = repos[i];
|
|
|
if (item.key === key) {
|
|
|
item.children = newData;
|
|
|
break;
|
|
|
}
|
|
|
if (item.children) {
|
|
|
processTreeData(item.children, key, newData);
|
|
|
}
|
|
|
}
|
|
|
return repos;
|
|
|
}
|
|
|
function debounce(func, wait, immediate) {
|
|
|
var timeout;
|
|
|
return function () {
|
|
|
var context = this,
|
|
|
args = arguments;
|
|
|
var later = function later() {
|
|
|
timeout = null;
|
|
|
if (!immediate) func.apply(context, args);
|
|
|
};
|
|
|
var callNow = immediate && !timeout;
|
|
|
clearTimeout(timeout);
|
|
|
timeout = setTimeout(later, wait);
|
|
|
if (callNow) func.apply(context, args);
|
|
|
};
|
|
|
}
|
|
|
var isProd = true;
|
|
|
var apiPref = _utils_env__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.API_SERVER;
|
|
|
// export const isProd =
|
|
|
// window.location.href.indexOf('test-') > 0 ||
|
|
|
// window.location.href.indexOf('localhost') > 0
|
|
|
// ? false
|
|
|
// : true;
|
|
|
|
|
|
// export const apiPref = isProd
|
|
|
// ? 'https://www.educoder.net'
|
|
|
// : 'https://test-newweb.educoder.net';
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 75816:
|
|
|
/*!**********************************************!*\
|
|
|
!*** ./src/components/AsyncButton/index.tsx ***!
|
|
|
\**********************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ Z: function() { return /* binding */ AsyncButton; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js */ 10574);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js */ 39343);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js */ 11006);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectWithoutProperties.js */ 27161);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_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_test1_node_modules_babel_runtime_7_23_2_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_test1_node_modules_babel_runtime_7_23_2_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_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, props), {}, {
|
|
|
loading: btnLoading,
|
|
|
onClick: /*#__PURE__*/function () {
|
|
|
var _ref2 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee(e) {
|
|
|
return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_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
|
|
|
}));
|
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 75964:
|
|
|
/*!****************************************!*\
|
|
|
!*** ./src/components/Hooks/index.tsx ***!
|
|
|
\****************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ y: function() { return /* binding */ useDisableAction; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
|
|
|
|
|
|
var useDisableAction = function useDisableAction(disable) {
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
|
if (disable) {
|
|
|
var handleKeyDown = function handleKeyDown(event) {
|
|
|
if (event.key === "F12") {
|
|
|
event.preventDefault();
|
|
|
// 执行你的自定义行为
|
|
|
console.log('F12被禁用');
|
|
|
}
|
|
|
};
|
|
|
var handleContextmenu = function handleContextmenu(event) {
|
|
|
event.preventDefault();
|
|
|
};
|
|
|
document.addEventListener("keydown", handleKeyDown);
|
|
|
document.addEventListener("contextmenu", handleContextmenu);
|
|
|
return function () {
|
|
|
document.removeEventListener("keydown", handleKeyDown);
|
|
|
document.removeEventListener("contextmenu", handleContextmenu);
|
|
|
};
|
|
|
}
|
|
|
}, [disable]);
|
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 19480:
|
|
|
/*!*********************************************************!*\
|
|
|
!*** ./src/components/PreviewAll/index.tsx + 1 modules ***!
|
|
|
\*********************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
Z: function() { return /* binding */ PreviewAll; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(26801);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js
|
|
|
var regeneratorRuntime = __webpack_require__(10574);
|
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js
|
|
|
var asyncToGenerator = __webpack_require__(39343);
|
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(11006);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
;// CONCATENATED MODULE: ./src/components/PreviewAll/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var PreviewAllmodules = ({"wrp":"wrp___dq7YK","bgBlack":"bgBlack___ARIUV","monaco":"monaco___VnZC3","darkBlue":"darkBlue___UprA9","close":"close___LKoWu","embed":"embed___hvpEJ"});
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(3113);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/ArrowDownOutlined.js + 1 modules
|
|
|
var ArrowDownOutlined = __webpack_require__(98915);
|
|
|
// EXTERNAL MODULE: ./src/components/monaco-editor/index.jsx + 3 modules
|
|
|
var monaco_editor = __webpack_require__(76329);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tooltip/index.js + 3 modules
|
|
|
var tooltip = __webpack_require__(6848);
|
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
|
var util = __webpack_require__(22739);
|
|
|
// EXTERNAL MODULE: ./src/service/exercise.ts
|
|
|
var exercise = __webpack_require__(35367);
|
|
|
// EXTERNAL MODULE: ./src/components/NoData/index.tsx
|
|
|
var NoData = __webpack_require__(73208);
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
|
var env = __webpack_require__(78130);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/components/PreviewAll/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* harmony default export */ var PreviewAll = (function (_ref) {
|
|
|
var _data, _data2, _data3, _data4, _data5, _data6, _data7;
|
|
|
var _ref$editOffice = _ref.editOffice,
|
|
|
editOffice = _ref$editOffice === void 0 ? 'view' : _ref$editOffice,
|
|
|
data = _ref.data,
|
|
|
theme = _ref.theme,
|
|
|
type = _ref.type,
|
|
|
filename = _ref.filename,
|
|
|
monacoEditor = _ref.monacoEditor,
|
|
|
className = _ref.className,
|
|
|
style = _ref.style,
|
|
|
close = _ref.close,
|
|
|
onClose = _ref.onClose,
|
|
|
hasMask = _ref.hasMask,
|
|
|
disabledDownload = _ref.disabledDownload,
|
|
|
onImgDimensions = _ref.onImgDimensions,
|
|
|
showNodata = _ref.showNodata;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)('https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt'),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
src = _useState2[0],
|
|
|
setSrc = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(""),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
token = _useState4[0],
|
|
|
setToken = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
officeData = _useState6[0],
|
|
|
setOfficeData = _useState6[1];
|
|
|
var officePath = window.ENV === "build" ? "/react/build" : "";
|
|
|
var apiServer = location.host.startsWith("localhost") ? env/* default */.Z.PROXY_SERVER : env/* default */.Z.API_SERVER;
|
|
|
// let size;
|
|
|
console.log("disabledDownload---", disabledDownload);
|
|
|
var unit = 1024 * 1024;
|
|
|
var maxSize = 10 * unit;
|
|
|
var closeRef = (0,_react_17_0_2_react.useRef)();
|
|
|
if ((_data = data) !== null && _data !== void 0 && _data.startsWith("/api") && type !== "txt") {
|
|
|
data = env/* default */.Z.API_SERVER + data;
|
|
|
}
|
|
|
// if (type === "office") {
|
|
|
// size = parseUrl(data).filesize
|
|
|
// if (size > maxSize) {
|
|
|
// type = "other"
|
|
|
// }
|
|
|
// }
|
|
|
if (filename) monacoEditor.filename = filename;
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var _document$cookie;
|
|
|
var cookies = (_document$cookie = document.cookie) === null || _document$cookie === void 0 || (_document$cookie = _document$cookie.replace(/\s/g, "")) === null || _document$cookie === void 0 ? void 0 : _document$cookie.split(";");
|
|
|
cookies === null || cookies === void 0 || cookies.map(function (item) {
|
|
|
var i = item.split("=");
|
|
|
if (i[0] === '_educoder_session') {
|
|
|
setToken(i[1]);
|
|
|
}
|
|
|
});
|
|
|
}, []);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (type === "office") getData();
|
|
|
}, [type, data]);
|
|
|
var getData = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var _url, _id, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
console.log("data:", data);
|
|
|
_url = data;
|
|
|
if (!data.startsWith("http")) {
|
|
|
_url = location.origin + _url;
|
|
|
}
|
|
|
_id = new URL(_url).pathname.split("/").pop();
|
|
|
_context.next = 6;
|
|
|
return (0,exercise/* setEcsAttachment */.gJ)({
|
|
|
attachment_id: _id
|
|
|
});
|
|
|
case 6:
|
|
|
res = _context.sent;
|
|
|
setOfficeData(res);
|
|
|
case 8:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function getData() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleClick = function handleClick() {
|
|
|
if (data.startsWith("http") || data.startsWith('blob:')) {
|
|
|
handleDown();
|
|
|
return;
|
|
|
}
|
|
|
(0,util/* downloadFile */.Sv)(filename || 'educoder', data, filename);
|
|
|
};
|
|
|
var handleDown = function handleDown() {
|
|
|
(0,util/* downLoadLink */.Nd)(filename || 'educoder', decodeURIComponent(data));
|
|
|
};
|
|
|
console.log(data, 'data');
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: objectSpread2_default()({}, style || {}),
|
|
|
className: "".concat(hasMask && PreviewAllmodules.bgBlack, " ").concat(!!type ? PreviewAllmodules.wrp : "hide"),
|
|
|
children: [close && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: PreviewAllmodules.close,
|
|
|
ref: closeRef,
|
|
|
children: [!!onImgDimensions && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",
|
|
|
getPopupContainer: function getPopupContainer() {
|
|
|
return closeRef.current;
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onClick: function onClick() {
|
|
|
onClose();
|
|
|
onImgDimensions();
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "icon-yulanpizhu"
|
|
|
})
|
|
|
})
|
|
|
}), !disabledDownload && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",
|
|
|
getPopupContainer: function getPopupContainer() {
|
|
|
return closeRef.current;
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onClick: handleDown,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "icon-quxiaozhiding"
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u5173\u95ED",
|
|
|
getPopupContainer: function getPopupContainer() {
|
|
|
return closeRef.current;
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "",
|
|
|
onClick: onClose,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "icon-guanbi1"
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "".concat(PreviewAllmodules[className], " ").concat(className, " ").concat(PreviewAllmodules.monaco, " ").concat(type === "txt" ? "show" : "hide"),
|
|
|
children: type === "txt" && /*#__PURE__*/(0,jsx_runtime.jsx)(monaco_editor/* default */.ZP, objectSpread2_default()({}, monacoEditor))
|
|
|
}), type === "audio" && /*#__PURE__*/(0,jsx_runtime.jsx)("audio", {
|
|
|
src: ((_data2 = data) === null || _data2 === void 0 ? void 0 : _data2.indexOf("http")) > -1 || (_data3 = data) !== null && _data3 !== void 0 && _data3.startsWith("/api") ? data : "data:image/png;base64,".concat(data),
|
|
|
autoPlay: true
|
|
|
}), type === "video" && /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: ((_data4 = data) === null || _data4 === void 0 ? void 0 : _data4.indexOf("http")) > -1 || (_data5 = data) !== null && _data5 !== void 0 && _data5.startsWith("/api") ? /*#__PURE__*/(0,jsx_runtime.jsx)("video", {
|
|
|
controls: true,
|
|
|
src: "".concat(data),
|
|
|
autoPlay: true
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("video", {
|
|
|
controls: true,
|
|
|
src: "data:video/mp4;base64,".concat(data),
|
|
|
autoPlay: true
|
|
|
})
|
|
|
}), type === 'office' && officeData && /*#__PURE__*/(0,jsx_runtime.jsx)("iframe", {
|
|
|
src: "".concat(officePath, "/office.html?key=").concat(officeData.key, "&url=").concat(apiServer + officeData.url, "&callbackUrl=").concat(apiServer + officeData.callbackUrl, "&fileType=").concat(officeData.fileType, "&title=").concat(officeData.title, "&model=").concat(editOffice, "&officeServer=").concat(env/* default */.Z.ONLYOFFICE, "&disabledDownload=").concat(!!disabledDownload)
|
|
|
}), type === 'html' && /*#__PURE__*/(0,jsx_runtime.jsx)("iframe", {
|
|
|
src: data + '&disposition=inline'
|
|
|
}), type === 'pdf' && /*#__PURE__*/(0,jsx_runtime.jsx)("iframe", {
|
|
|
src: "".concat(officePath, "/js/pdfview/index.html?url=").concat(data, "&disabledDownload=").concat(!!disabledDownload)
|
|
|
}) //<embed className={styles.embed + "#toolbar=0"} src={data} />
|
|
|
, type === "image" && /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: ((_data6 = data) === null || _data6 === void 0 ? void 0 : _data6.indexOf("http")) > -1 || (_data7 = data) !== null && _data7 !== void 0 && _data7.startsWith("/api") ? data : "data:image/png;base64,".concat(data)
|
|
|
}), (type === "other" || type === "download") && /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: showNodata ? /*#__PURE__*/(0,jsx_runtime.jsx)(NoData/* default */.Z, {
|
|
|
customText: "\u5F53\u524D\u6587\u4EF6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u53EF\u70B9\u51FB\u4E0B\u8F7D\u67E5\u770B",
|
|
|
ButtonTwo: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-xiazai4 font14"
|
|
|
}),
|
|
|
type: "primary",
|
|
|
size: 'middle',
|
|
|
onClick: handleClick,
|
|
|
children: "\u4E0B\u8F7D"
|
|
|
})
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.ZP, {
|
|
|
type: "primary",
|
|
|
size: 'middle',
|
|
|
onClick: handleDown,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ArrowDownOutlined/* default */.Z, {}), "\u70B9\u51FB\u4E0B\u8F7D"]
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 81525:
|
|
|
/*!*********************************************************!*\
|
|
|
!*** ./src/components/QuestionEditor/Buttonloading.tsx ***!
|
|
|
\*********************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js */ 10574);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js */ 39343);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js */ 11006);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! umi */ 45295);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react */ 59301);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! antd */ 8591);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! antd */ 3113);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! antd */ 43418);
|
|
|
/* harmony import */ var js_base64__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! js-base64 */ 24334);
|
|
|
/* harmony import */ var js_base64__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(js_base64__WEBPACK_IMPORTED_MODULE_6__);
|
|
|
/* harmony import */ var _utils_fetch__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/utils/fetch */ 91506);
|
|
|
/* harmony import */ var _pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/pages/MyProblem/service */ 43887);
|
|
|
/* harmony import */ var _pages_MyProblem_TestCasePanel__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/pages/MyProblem/TestCasePanel */ 90678);
|
|
|
/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! moment */ 9498);
|
|
|
/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_10__);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* @description: 自测运行
|
|
|
* @param {*}
|
|
|
* ButtonProps:按钮部分样式等参数
|
|
|
* ButtonText 按钮文字
|
|
|
* form 表单内容
|
|
|
* answerKey 填空字段
|
|
|
* items 为运行调试字段
|
|
|
* @return {*}
|
|
|
*/
|
|
|
var ButtonLoading = function ButtonLoading(_ref) {
|
|
|
var ButtonProps = _ref.ButtonProps,
|
|
|
ButtonText = _ref.ButtonText,
|
|
|
form = _ref.form,
|
|
|
answerKey = _ref.answerKey,
|
|
|
_ref$hackidentifier = _ref.hackidentifier,
|
|
|
hackidentifier = _ref$hackidentifier === void 0 ? "" : _ref$hackidentifier,
|
|
|
_ref$items = _ref.items,
|
|
|
items = _ref$items === void 0 ? {} : _ref$items;
|
|
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(false),
|
|
|
_useState2 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState, 2),
|
|
|
isloading = _useState2[0],
|
|
|
setisloading = _useState2[1];
|
|
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(''),
|
|
|
_useState4 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState3, 2),
|
|
|
identifier = _useState4[0],
|
|
|
setidentifier = _useState4[1];
|
|
|
var param = (0,umi__WEBPACK_IMPORTED_MODULE_4__.useParams)();
|
|
|
var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)({}),
|
|
|
_useState6 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState5, 2),
|
|
|
modalshow = _useState6[0],
|
|
|
setmodalshow = _useState6[1];
|
|
|
var isEdit = param.type === 'edit';
|
|
|
var type = window.location.href.includes('problemset') ? 1 : 2;
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_5__.useEffect)(function () {
|
|
|
if (isEdit || hackidentifier) {
|
|
|
setidentifier(hackidentifier || param.id);
|
|
|
}
|
|
|
}, [param]);
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_5__.useEffect)(function () {
|
|
|
return function () {
|
|
|
sessionStorage.removeItem("projectFill");
|
|
|
};
|
|
|
}, []);
|
|
|
function onUpdateCode(_x, _x2) {
|
|
|
return _onUpdateCode.apply(this, arguments);
|
|
|
}
|
|
|
function _onUpdateCode() {
|
|
|
_onUpdateCode = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee4(re, id) {
|
|
|
var _stats$filter;
|
|
|
var code, stats, codes, response;
|
|
|
return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee4$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
code = form.getFieldValue("hack_codes");
|
|
|
stats = form.getFieldValue(answerKey);
|
|
|
if (code.code) {
|
|
|
_context4.next = 5;
|
|
|
break;
|
|
|
}
|
|
|
antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.info('程序代码不能为空!');
|
|
|
return _context4.abrupt("return");
|
|
|
case 5:
|
|
|
if (code.language) {
|
|
|
_context4.next = 8;
|
|
|
break;
|
|
|
}
|
|
|
antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.info('编程语言不能为空!');
|
|
|
return _context4.abrupt("return");
|
|
|
case 8:
|
|
|
if (!(stats.length > 0 && ((_stats$filter = stats.filter(function (item) {
|
|
|
return !item.answer_text;
|
|
|
})) === null || _stats$filter === void 0 ? void 0 : _stats$filter.length) > 0)) {
|
|
|
_context4.next = 11;
|
|
|
break;
|
|
|
}
|
|
|
antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.info('填空项不能为空!');
|
|
|
return _context4.abrupt("return");
|
|
|
case 11:
|
|
|
codes = code.code;
|
|
|
if (stats.length > 0) {
|
|
|
stats === null || stats === void 0 || stats.map(function (item) {
|
|
|
if (item.multi_line) {
|
|
|
codes = codes.substring(0, codes.indexOf('@▁▁@')) + item.answer_text + codes.substring(codes.indexOf('@▁▁@') + 4);
|
|
|
} else {
|
|
|
codes = codes.substring(0, codes.indexOf('@▁@')) + item.answer_text + codes.substring(codes.indexOf('@▁@') + 3);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
_context4.next = 15;
|
|
|
return (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__/* .updateCode */ .n4)(id, re ? re : {
|
|
|
code: js_base64__WEBPACK_IMPORTED_MODULE_6__.Base64.encode(codes),
|
|
|
language: code.language
|
|
|
});
|
|
|
case 15:
|
|
|
response = _context4.sent;
|
|
|
return _context4.abrupt("return", response);
|
|
|
case 17:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
return _onUpdateCode.apply(this, arguments);
|
|
|
}
|
|
|
function onUpdateCodes(_x3, _x4) {
|
|
|
return _onUpdateCodes.apply(this, arguments);
|
|
|
}
|
|
|
function _onUpdateCodes() {
|
|
|
_onUpdateCodes = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee5(re, id) {
|
|
|
var _stats$filter2;
|
|
|
var stats, codes, response;
|
|
|
return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee5$(_context5) {
|
|
|
while (1) switch (_context5.prev = _context5.next) {
|
|
|
case 0:
|
|
|
stats = items.userAnswer;
|
|
|
codes = js_base64__WEBPACK_IMPORTED_MODULE_6__.Base64.decode(items.code);
|
|
|
debugger;
|
|
|
if (!(stats.length > 0 && ((_stats$filter2 = stats.filter(function (item) {
|
|
|
return !item.value;
|
|
|
})) === null || _stats$filter2 === void 0 ? void 0 : _stats$filter2.length) > 0)) {
|
|
|
_context5.next = 6;
|
|
|
break;
|
|
|
}
|
|
|
antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.info('填空项不能为空!');
|
|
|
return _context5.abrupt("return");
|
|
|
case 6:
|
|
|
if (stats.length > 0) {
|
|
|
stats === null || stats === void 0 || stats.map(function (item) {
|
|
|
if (item.multi_line) {
|
|
|
codes = codes.substring(0, codes.indexOf('@▁▁@')) + item.value + codes.substring(codes.indexOf('@▁▁@') + 4);
|
|
|
} else {
|
|
|
codes = codes.substring(0, codes.indexOf('@▁@')) + item.value + codes.substring(codes.indexOf('@▁@') + 3);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
_context5.next = 9;
|
|
|
return (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__/* .updateCode */ .n4)(id, re ? re : {
|
|
|
code: js_base64__WEBPACK_IMPORTED_MODULE_6__.Base64.encode(codes),
|
|
|
language: items.language
|
|
|
});
|
|
|
case 9:
|
|
|
response = _context5.sent;
|
|
|
return _context5.abrupt("return", response);
|
|
|
case 11:
|
|
|
case "end":
|
|
|
return _context5.stop();
|
|
|
}
|
|
|
}, _callee5);
|
|
|
}));
|
|
|
return _onUpdateCodes.apply(this, arguments);
|
|
|
}
|
|
|
function getTimeStamp() {
|
|
|
return new Date().getTime();
|
|
|
}
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .ZP, _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({
|
|
|
loading: isloading
|
|
|
}, ButtonProps), {}, {
|
|
|
onClick: /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee3() {
|
|
|
var _res, _response, executeCode, startTime, aa, res, formValues, _formValues$hack, _res2, _formValues$hack2, res1, response, _executeCode, _startTime;
|
|
|
return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
if (!(ButtonText === '运行调试')) {
|
|
|
_context3.next = 20;
|
|
|
break;
|
|
|
}
|
|
|
setisloading(true);
|
|
|
if (!isloading) {
|
|
|
_context3.next = 4;
|
|
|
break;
|
|
|
}
|
|
|
return _context3.abrupt("return");
|
|
|
case 4:
|
|
|
_context3.next = 6;
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP)("/api/problems/".concat(identifier, "/start.json"), {
|
|
|
method: 'get'
|
|
|
});
|
|
|
case 6:
|
|
|
_res = _context3.sent;
|
|
|
_context3.next = 9;
|
|
|
return onUpdateCodes(null, _res === null || _res === void 0 ? void 0 : _res.identifier);
|
|
|
case 9:
|
|
|
_response = _context3.sent;
|
|
|
if (!((_response === null || _response === void 0 ? void 0 : _response.status) === 0)) {
|
|
|
_context3.next = 18;
|
|
|
break;
|
|
|
}
|
|
|
executeCode = /*#__PURE__*/function () {
|
|
|
var _ref3 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee() {
|
|
|
var _yield$getOperationRe, status, message, data, executeTime, isTimeOut;
|
|
|
return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__/* .getOperationResult */ .rX)(_res === null || _res === void 0 ? void 0 : _res.identifier, 'submit');
|
|
|
case 2:
|
|
|
_yield$getOperationRe = _context.sent;
|
|
|
status = _yield$getOperationRe.status;
|
|
|
message = _yield$getOperationRe.message;
|
|
|
data = _yield$getOperationRe.data;
|
|
|
executeTime = getTimeStamp();
|
|
|
isTimeOut = executeTime - startTime > 6 * 1000;
|
|
|
if (status !== 0 && !isTimeOut) {
|
|
|
setTimeout(executeCode, 1000);
|
|
|
}
|
|
|
if (!isTimeOut) {
|
|
|
_context.next = 13;
|
|
|
break;
|
|
|
}
|
|
|
antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z.error({
|
|
|
centered: true,
|
|
|
okText: '知道啦',
|
|
|
title: '调试代码超时'
|
|
|
});
|
|
|
setisloading(false);
|
|
|
return _context.abrupt("return");
|
|
|
case 13:
|
|
|
if (status === 0) {
|
|
|
setisloading(false);
|
|
|
// let datas = await Fetch(`/api/myproblems/record_detail.json`, {
|
|
|
// method: 'GET',
|
|
|
// params: {
|
|
|
// id: data?.id
|
|
|
// }
|
|
|
// })
|
|
|
|
|
|
setmodalshow(data);
|
|
|
if (data.status === 2) {
|
|
|
setisloading(false);
|
|
|
antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z.error({
|
|
|
centered: true,
|
|
|
okText: '知道啦',
|
|
|
title: '调试代码超时'
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
case 14:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function executeCode() {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
startTime = getTimeStamp();
|
|
|
_context3.next = 15;
|
|
|
return (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__/* .sumbitCode */ .bM)(_res === null || _res === void 0 ? void 0 : _res.identifier, {});
|
|
|
case 15:
|
|
|
executeCode();
|
|
|
_context3.next = 19;
|
|
|
break;
|
|
|
case 18:
|
|
|
setisloading(false);
|
|
|
case 19:
|
|
|
return _context3.abrupt("return");
|
|
|
case 20:
|
|
|
aa = true;
|
|
|
_context3.next = 23;
|
|
|
return form.validateFields().then(function () {
|
|
|
aa = false;
|
|
|
}, function (errInfo) {
|
|
|
var _errInfo$errorFields, _errInfo$errorFields2;
|
|
|
if (errInfo.errorFields[0].name.includes("standard_answers")) {
|
|
|
antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.error("填空项答案不能为空");
|
|
|
} else {
|
|
|
antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.error(errInfo.errorFields[0].errors[0]);
|
|
|
}
|
|
|
if (((_errInfo$errorFields = errInfo.errorFields) === null || _errInfo$errorFields === void 0 ? void 0 : _errInfo$errorFields.length) === 0) {
|
|
|
aa = false;
|
|
|
}
|
|
|
form.scrollToField(errInfo === null || errInfo === void 0 || (_errInfo$errorFields2 = errInfo.errorFields) === null || _errInfo$errorFields2 === void 0 || (_errInfo$errorFields2 = _errInfo$errorFields2[0]) === null || _errInfo$errorFields2 === void 0 ? void 0 : _errInfo$errorFields2.name, {
|
|
|
behavior: 'smooth',
|
|
|
block: 'center'
|
|
|
});
|
|
|
aa = true;
|
|
|
});
|
|
|
case 23:
|
|
|
if (!aa) {
|
|
|
_context3.next = 25;
|
|
|
break;
|
|
|
}
|
|
|
return _context3.abrupt("return");
|
|
|
case 25:
|
|
|
setisloading(true);
|
|
|
if (!isloading) {
|
|
|
_context3.next = 28;
|
|
|
break;
|
|
|
}
|
|
|
return _context3.abrupt("return");
|
|
|
case 28:
|
|
|
res = '';
|
|
|
formValues = form.getFieldsValue();
|
|
|
if (identifier) {
|
|
|
_context3.next = 39;
|
|
|
break;
|
|
|
}
|
|
|
_context3.next = 33;
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP)("/api/problems.json", {
|
|
|
method: 'post',
|
|
|
body: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues), {}, {
|
|
|
hack: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues === null || formValues === void 0 ? void 0 : formValues.hack), {}, {
|
|
|
sub_discipline_id: formValues === null || formValues === void 0 || (_formValues$hack = formValues.hack) === null || _formValues$hack === void 0 || (_formValues$hack = _formValues$hack.sub_discipline_id) === null || _formValues$hack === void 0 ? void 0 : _formValues$hack[1],
|
|
|
difficult: formValues.difficulty,
|
|
|
item_banks_group_id: formValues.item_banks_group_id
|
|
|
}),
|
|
|
hack_codes: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues.hack_codes), {}, {
|
|
|
code: js_base64__WEBPACK_IMPORTED_MODULE_6__.Base64.encode(formValues.hack_codes.code)
|
|
|
}),
|
|
|
hack_sets: [_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues.hack_sets)],
|
|
|
is_blank: true
|
|
|
})
|
|
|
});
|
|
|
case 33:
|
|
|
res = _context3.sent;
|
|
|
identifier = (_res2 = res) === null || _res2 === void 0 ? void 0 : _res2.identifier;
|
|
|
sessionStorage.projectFill = identifier;
|
|
|
setidentifier(identifier);
|
|
|
_context3.next = 42;
|
|
|
break;
|
|
|
case 39:
|
|
|
_context3.next = 41;
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP)("/api/problems/".concat(identifier, ".json"), {
|
|
|
method: 'put',
|
|
|
body: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues), {}, {
|
|
|
hack: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues === null || formValues === void 0 ? void 0 : formValues.hack), {}, {
|
|
|
sub_discipline_id: formValues === null || formValues === void 0 || (_formValues$hack2 = formValues.hack) === null || _formValues$hack2 === void 0 || (_formValues$hack2 = _formValues$hack2.sub_discipline_id) === null || _formValues$hack2 === void 0 ? void 0 : _formValues$hack2[1],
|
|
|
difficult: formValues.difficulty,
|
|
|
item_banks_group_id: formValues.item_banks_group_id
|
|
|
}),
|
|
|
hack_codes: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues.hack_codes), {}, {
|
|
|
code: js_base64__WEBPACK_IMPORTED_MODULE_6__.Base64.encode(formValues.hack_codes.code)
|
|
|
}),
|
|
|
update_hack_sets: [_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues.hack_sets)],
|
|
|
is_blank: true
|
|
|
})
|
|
|
});
|
|
|
case 41:
|
|
|
res = _context3.sent;
|
|
|
case 42:
|
|
|
_context3.next = 44;
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP)("/api/problems/".concat(identifier, "/start.json"), {
|
|
|
method: 'get'
|
|
|
});
|
|
|
case 44:
|
|
|
res1 = _context3.sent;
|
|
|
_context3.next = 47;
|
|
|
return onUpdateCode(null, res1 === null || res1 === void 0 ? void 0 : res1.identifier);
|
|
|
case 47:
|
|
|
response = _context3.sent;
|
|
|
if (!((response === null || response === void 0 ? void 0 : response.status) === 0)) {
|
|
|
_context3.next = 56;
|
|
|
break;
|
|
|
}
|
|
|
_executeCode = /*#__PURE__*/function () {
|
|
|
var _ref4 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee2() {
|
|
|
var _yield$getOperationRe2, status, message, data, executeTime, isTimeOut;
|
|
|
return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.next = 2;
|
|
|
return (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__/* .getOperationResult */ .rX)(res1 === null || res1 === void 0 ? void 0 : res1.identifier, 'submit');
|
|
|
case 2:
|
|
|
_yield$getOperationRe2 = _context2.sent;
|
|
|
status = _yield$getOperationRe2.status;
|
|
|
message = _yield$getOperationRe2.message;
|
|
|
data = _yield$getOperationRe2.data;
|
|
|
executeTime = getTimeStamp();
|
|
|
isTimeOut = executeTime - _startTime > (formValues.hack.time_limit + 3) * 1000;
|
|
|
if (status !== 0 && !isTimeOut) {
|
|
|
setTimeout(_executeCode, 1000);
|
|
|
}
|
|
|
if (!isTimeOut) {
|
|
|
_context2.next = 13;
|
|
|
break;
|
|
|
}
|
|
|
antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z.error({
|
|
|
centered: true,
|
|
|
okText: '知道啦',
|
|
|
title: '调试代码超时'
|
|
|
});
|
|
|
setisloading(false);
|
|
|
return _context2.abrupt("return");
|
|
|
case 13:
|
|
|
if (status === 0) {
|
|
|
setisloading(false);
|
|
|
setmodalshow(data);
|
|
|
if (data.status === 2) {
|
|
|
setisloading(false);
|
|
|
antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z.error({
|
|
|
centered: true,
|
|
|
okText: '知道啦',
|
|
|
title: '调试代码超时'
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
case 14:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function _executeCode() {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
_startTime = getTimeStamp();
|
|
|
_context3.next = 53;
|
|
|
return (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__/* .sumbitCode */ .bM)(res1 === null || res1 === void 0 ? void 0 : res1.identifier, {});
|
|
|
case 53:
|
|
|
_executeCode();
|
|
|
_context3.next = 57;
|
|
|
break;
|
|
|
case 56:
|
|
|
setisloading(false);
|
|
|
case 57:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
})),
|
|
|
children: ButtonText
|
|
|
})), (modalshow === null || modalshow === void 0 ? void 0 : modalshow.id) && modalshow.status !== 2 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, {
|
|
|
open: (modalshow === null || modalshow === void 0 ? void 0 : modalshow.id) && modalshow.status !== 2,
|
|
|
title: "\u8FD0\u884C\u7ED3\u679C",
|
|
|
width: 1100,
|
|
|
footer: false,
|
|
|
onOk: function onOk() {
|
|
|
setmodalshow({});
|
|
|
},
|
|
|
onCancel: function onCancel() {
|
|
|
setmodalshow({});
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
|
|
|
style: {
|
|
|
maxHeight: 600,
|
|
|
overflow: 'auto',
|
|
|
marginBottom: 15
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
|
|
|
style: {
|
|
|
marginBottom: 20,
|
|
|
display: 'flex',
|
|
|
justifyContent: 'space-between',
|
|
|
fontSize: 14
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#666666'
|
|
|
},
|
|
|
children: "\u72B6\u6001"
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
|
|
|
style: {
|
|
|
marginLeft: 12,
|
|
|
color: modalshow.status !== 0 && '#E30000'
|
|
|
},
|
|
|
children: _pages_MyProblem_TestCasePanel__WEBPACK_IMPORTED_MODULE_9__/* .ExecuteDict */ .Im[modalshow.status]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#666666'
|
|
|
},
|
|
|
children: "\u63D0\u4EA4\u65F6\u95F4"
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
|
|
|
style: {
|
|
|
marginLeft: 12
|
|
|
},
|
|
|
children: moment__WEBPACK_IMPORTED_MODULE_10___default()(modalshow.created_at).format('YYYY-MM-DD HH:mm:ss')
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#666666'
|
|
|
},
|
|
|
children: "\u8BED\u8A00"
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
|
|
|
style: {
|
|
|
marginLeft: 12
|
|
|
},
|
|
|
children: modalshow.language
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#666666'
|
|
|
},
|
|
|
children: "\u6267\u884C\u7528\u65F6"
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("span", {
|
|
|
style: {
|
|
|
marginLeft: 12
|
|
|
},
|
|
|
children: [modalshow.execute_time, "ms"]
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_pages_MyProblem_TestCasePanel__WEBPACK_IMPORTED_MODULE_9__/* .DetailCommitOut */ .Y4, _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, modalshow))]
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ __webpack_exports__.Z = (ButtonLoading);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 11436:
|
|
|
/*!*********************************************************!*\
|
|
|
!*** ./src/components/RenderHtml/index.tsx + 1 modules ***!
|
|
|
\*********************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
Z: function() { return /* binding */ RenderHtml; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(26801);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/toConsumableArray.js
|
|
|
var toConsumableArray = __webpack_require__(93923);
|
|
|
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/createForOfIteratorHelper.js
|
|
|
var createForOfIteratorHelper = __webpack_require__(98190);
|
|
|
var createForOfIteratorHelper_default = /*#__PURE__*/__webpack_require__.n(createForOfIteratorHelper);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(11006);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
// EXTERNAL MODULE: ./node_modules/_katex@0.11.1@katex/dist/katex.min.css
|
|
|
var katex_min = __webpack_require__(16622);
|
|
|
// EXTERNAL MODULE: ./node_modules/_marked@2.0.7@marked/lib/marked.js
|
|
|
var marked = __webpack_require__(32834);
|
|
|
var marked_default = /*#__PURE__*/__webpack_require__.n(marked);
|
|
|
// EXTERNAL MODULE: ./node_modules/_marked@2.0.7@marked/src/helpers.js
|
|
|
var helpers = __webpack_require__(11690);
|
|
|
;// CONCATENATED MODULE: ./src/utils/marked.ts
|
|
|
|
|
|
|
|
|
|
|
|
function indentCodeCompensation(raw, text) {
|
|
|
var matchIndentToCode = raw.match(/^(\s+)(?:```)/);
|
|
|
if (matchIndentToCode === null) {
|
|
|
return text;
|
|
|
}
|
|
|
var indentToCode = matchIndentToCode[1];
|
|
|
return text.split('\n').map(function (node) {
|
|
|
var matchIndentInNode = node.match(/^\s+/);
|
|
|
if (matchIndentInNode === null) {
|
|
|
return node;
|
|
|
}
|
|
|
var _matchIndentInNode = slicedToArray_default()(matchIndentInNode, 1),
|
|
|
indentInNode = _matchIndentInNode[0];
|
|
|
if (indentInNode.length >= indentToCode.length) {
|
|
|
return node.slice(indentToCode.length);
|
|
|
}
|
|
|
return node;
|
|
|
}).join('\n');
|
|
|
}
|
|
|
//兼容之前的 ##标题式写法
|
|
|
var toc = [];
|
|
|
var ctx = ["<ul>"];
|
|
|
var renderer = new (marked_default()).Renderer();
|
|
|
var headingRegex = /^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;
|
|
|
function cleanToc() {
|
|
|
toc.length = 0;
|
|
|
ctx = ["<ul>"];
|
|
|
}
|
|
|
var lines = {
|
|
|
overflow: "hidden",
|
|
|
WebkitBoxOrient: "vertical",
|
|
|
display: "-webkit-box",
|
|
|
WebkitLineClamp: 2
|
|
|
};
|
|
|
function buildToc(coll, k, level, ctx) {
|
|
|
if (k >= coll.length || coll[k].level <= level) {
|
|
|
return k;
|
|
|
}
|
|
|
var node = coll[k];
|
|
|
ctx.push("<li><a href='#" + node.anchor + "'>" + node.text + "</a>");
|
|
|
k++;
|
|
|
var childCtx = [];
|
|
|
k = buildToc(coll, k, node.level, childCtx);
|
|
|
if (childCtx.length > 0) {
|
|
|
ctx.push("<ul>");
|
|
|
childCtx.forEach(function (idm) {
|
|
|
ctx.push(idm);
|
|
|
});
|
|
|
ctx.push("</ul>");
|
|
|
}
|
|
|
ctx.push("</li>");
|
|
|
k = buildToc(coll, k, level, ctx);
|
|
|
return k;
|
|
|
}
|
|
|
function getTocContent() {
|
|
|
buildToc(toc, 0, 0, ctx);
|
|
|
ctx.push("</ul>");
|
|
|
return ctx.join("");
|
|
|
}
|
|
|
var tokenizer = {
|
|
|
heading: function heading(src) {
|
|
|
var cap = headingRegex.exec(src);
|
|
|
if (cap) {
|
|
|
return {
|
|
|
type: 'heading',
|
|
|
raw: cap[0],
|
|
|
depth: cap[1].length,
|
|
|
text: cap[2]
|
|
|
};
|
|
|
}
|
|
|
},
|
|
|
fences: function fences(src) {
|
|
|
var cap = this.rules.block.fences.exec(src);
|
|
|
if (cap) {
|
|
|
var raw = cap[0];
|
|
|
var text = indentCodeCompensation(raw, cap[3] || '');
|
|
|
var lang = cap[2] ? cap[2].trim() : cap[2];
|
|
|
if (['latex', 'katex', 'math'].indexOf(lang) >= 0) {
|
|
|
var id = next_id();
|
|
|
var expression = text;
|
|
|
text = id;
|
|
|
math_expressions[id] = {
|
|
|
type: 'block',
|
|
|
expression: expression
|
|
|
};
|
|
|
}
|
|
|
return {
|
|
|
type: 'code',
|
|
|
raw: raw,
|
|
|
lang: lang,
|
|
|
text: text
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
var latexRegex = /(?:\${2})([^\n`]+?)(?:\${2})/gi;
|
|
|
var katex_count = 0;
|
|
|
var next_id = function next_id() {
|
|
|
return "__special_katext_id_".concat(katex_count++, "__");
|
|
|
};
|
|
|
var math_expressions = {};
|
|
|
function getMathExpressions() {
|
|
|
return math_expressions;
|
|
|
}
|
|
|
function resetMathExpressions() {
|
|
|
katex_count = 0;
|
|
|
math_expressions = {};
|
|
|
}
|
|
|
function replace_math_with_ids(text) {
|
|
|
text = text.replace(latexRegex, function (_match, expression) {
|
|
|
var id = next_id();
|
|
|
math_expressions[id] = {
|
|
|
type: 'inline',
|
|
|
expression: expression
|
|
|
};
|
|
|
return id;
|
|
|
});
|
|
|
return text;
|
|
|
}
|
|
|
var original_listitem = renderer.listitem;
|
|
|
renderer.listitem = function (text) {
|
|
|
return original_listitem(replace_math_with_ids(text));
|
|
|
};
|
|
|
var original_paragraph = renderer.paragraph;
|
|
|
renderer.paragraph = function (text) {
|
|
|
return original_paragraph(replace_math_with_ids(text));
|
|
|
};
|
|
|
var original_tablecell = renderer.tablecell;
|
|
|
renderer.tablecell = function (content, flags) {
|
|
|
return original_tablecell(replace_math_with_ids(content), flags);
|
|
|
};
|
|
|
renderer.code = function (code, infostring, escaped) {
|
|
|
var lang = (infostring || '').match(/\S*/)[0];
|
|
|
if (!lang) {
|
|
|
return '<pre class="prettyprint linenums"><code>' + (escaped ? code : (0,helpers.escape)(code, true)) + '</code></pre>';
|
|
|
}
|
|
|
if (['latex', 'katex', 'math'].indexOf(lang) >= 0) {
|
|
|
return "<p class='editormd-tex'>".concat(code, "</p>");
|
|
|
} else {
|
|
|
return "<pre class=\"prettyprint linenums\"><code class=\"language-".concat(infostring, "\">").concat(escaped ? code : (0,helpers.escape)(code, true), "</code></pre>\n");
|
|
|
}
|
|
|
};
|
|
|
renderer.heading = function (text, level, raw) {
|
|
|
var anchor = this.options.headerPrefix + raw.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g, '-');
|
|
|
toc.push({
|
|
|
anchor: anchor,
|
|
|
level: level,
|
|
|
text: text
|
|
|
});
|
|
|
return '<h' + level + ' id="' + anchor + '">' + text + '</h' + level + '>';
|
|
|
};
|
|
|
marked_default().setOptions({
|
|
|
silent: true,
|
|
|
gfm: true,
|
|
|
pedantic: false
|
|
|
});
|
|
|
marked_default().use({
|
|
|
tokenizer: tokenizer,
|
|
|
renderer: renderer
|
|
|
});
|
|
|
/* harmony default export */ var utils_marked = ((marked_default()));
|
|
|
// EXTERNAL MODULE: ./node_modules/_code-prettify@0.1.0@code-prettify/src/prettify.js
|
|
|
var prettify = __webpack_require__(64018);
|
|
|
// EXTERNAL MODULE: ./node_modules/_hls.js@1.4.13@hls.js/dist/hls.mjs
|
|
|
var dist_hls = __webpack_require__(9029);
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
|
var env = __webpack_require__(78130);
|
|
|
// EXTERNAL MODULE: ./node_modules/_katex@0.11.1@katex/dist/katex.js
|
|
|
var katex = __webpack_require__(15342);
|
|
|
// EXTERNAL MODULE: ./node_modules/_uuid@8.3.0@uuid/dist/esm-browser/v4.js + 4 modules
|
|
|
var v4 = __webpack_require__(1012);
|
|
|
// EXTERNAL MODULE: ./src/components/PreviewAll/index.tsx + 1 modules
|
|
|
var PreviewAll = __webpack_require__(19480);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/components/RenderHtml/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ADD_MULTI = '@▁▁@';
|
|
|
var ADD_SINGLE = '@▁@';
|
|
|
var preRegex = /<pre[^>]*>/g;
|
|
|
function _unescape(str) {
|
|
|
var div = document.createElement('div');
|
|
|
div.innerHTML = str;
|
|
|
return div.childNodes.length === 0 ? '' : div.childNodes[0].nodeValue;
|
|
|
}
|
|
|
/* harmony default export */ var RenderHtml = (function (_ref) {
|
|
|
var _ref$value = _ref.value,
|
|
|
value = _ref$value === void 0 ? '' : _ref$value,
|
|
|
className = _ref.className,
|
|
|
showTextOnly = _ref.showTextOnly,
|
|
|
showLines = _ref.showLines,
|
|
|
_ref$style = _ref.style,
|
|
|
style = _ref$style === void 0 ? {} : _ref$style,
|
|
|
_ref$stylesPrev = _ref.stylesPrev,
|
|
|
stylesPrev = _ref$stylesPrev === void 0 ? {} : _ref$stylesPrev,
|
|
|
highlightKeywords = _ref.highlightKeywords,
|
|
|
showProgramFill = _ref.showProgramFill,
|
|
|
isProgramFill = _ref.isProgramFill,
|
|
|
_ref$disabledFill = _ref.disabledFill,
|
|
|
disabledFill = _ref$disabledFill === void 0 ? false : _ref$disabledFill,
|
|
|
programFillValue = _ref.programFillValue,
|
|
|
_ref$onFillChange = _ref.onFillChange,
|
|
|
onFillChange = _ref$onFillChange === void 0 ? function (value) {} : _ref$onFillChange,
|
|
|
_ref$onFillBlur = _ref.onFillBlur,
|
|
|
onFillBlur = _ref$onFillBlur === void 0 ? function () {} : _ref$onFillBlur;
|
|
|
var str = String(value);
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(""),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
data = _useState2[0],
|
|
|
setData = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)("office"),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
type = _useState4[0],
|
|
|
setType = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
projectValue = _useState6[0],
|
|
|
setProjectValue = _useState6[1];
|
|
|
var classNamesRef = (0,_react_17_0_2_react.useRef)("a" + (0,v4/* default */.Z)());
|
|
|
var formObj = {};
|
|
|
var createInput = function createInput(a, num) {
|
|
|
// const wrap = document.createElement("span")
|
|
|
// wrap.className =
|
|
|
var input = document.createElement(a === ADD_SINGLE ? "input" : "textarea");
|
|
|
input.style.width = "100%";
|
|
|
input.style.height = a === ADD_SINGLE ? "40px" : "151px";
|
|
|
input.rows = 5;
|
|
|
input.spellcheck = false;
|
|
|
input.name = "edu-program-fill";
|
|
|
input.placeholder = "请输入";
|
|
|
input.dataset.id = num;
|
|
|
var key = Object.keys(formObj).length;
|
|
|
formObj[key] = input;
|
|
|
return "<span class=\"edu-program-fill-wrap ".concat(a === ADD_SINGLE ? "" : "show", "\" style=\"width:").concat(a === ADD_SINGLE ? "200px" : "100%", "\"><span>").concat(input.outerHTML, "<span class=\"edu-program-fill-score\"></span></span></span>");
|
|
|
};
|
|
|
var formatMD = function formatMD(rs) {
|
|
|
return rs.replace(/<style.*?>([\s\S]+?)<\/style>/gim, function (_, css) {
|
|
|
var _css = css.replace(/(\n|\r)/g, "").split("}");
|
|
|
var arr = [];
|
|
|
_css.map(function (item) {
|
|
|
if (item != '') {
|
|
|
arr.push(".".concat(classNamesRef.current, " ").concat(item));
|
|
|
}
|
|
|
});
|
|
|
return "<style>".concat(arr.join("}"), "</style>");
|
|
|
});
|
|
|
};
|
|
|
var html = (0,_react_17_0_2_react.useMemo)(function () {
|
|
|
try {
|
|
|
var reg = /\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g;
|
|
|
var reg2 = /\"\/api\/attachments\/|\"\/attachments\/download\//g;
|
|
|
var reg3 = /\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;
|
|
|
str = str.replace(reg, "(" + env/* default */.Z.API_SERVER + "/api/attachments/").replace(reg2, '"' + env/* default */.Z.API_SERVER + "/api/attachments/").replace(reg3, '"' + env/* default */.Z.API_SERVER + "/files/uploads/").replaceAll("http://video.educoder", "https://video.educoder").replaceAll("http://www.educoder.net/api", "https://data.educoder.net/api").replaceAll("https://www.educoder.net/api", "https://data.educoder.net/api").replace(/\r\n/g, "\n");
|
|
|
// str = str.replace(new RegExp("(?<!\\n)\\n(?!\\n)", "g"), " \n")
|
|
|
} catch (e) {}
|
|
|
;
|
|
|
if (showProgramFill) {
|
|
|
var num = -1;
|
|
|
str = str.replaceAll("<", "<").replaceAll(">", ">").replace(/(@▁▁@|@▁@)/g, function (a, b, c) {
|
|
|
++num;
|
|
|
return createInput(a, num);
|
|
|
});
|
|
|
return "<pre style=\"background:#fff;padding:4px\">".concat(formatMD(str || ""), "</pre>");
|
|
|
}
|
|
|
var rs = utils_marked(str);
|
|
|
rs = formatMD(rs);
|
|
|
var math_expressions = getMathExpressions();
|
|
|
if (str.match(/\[TOC\]/)) {
|
|
|
rs = rs.replace('<p>[TOC]</p>', getTocContent());
|
|
|
cleanToc();
|
|
|
}
|
|
|
rs = rs.replace(/(__special_katext_id_\d+__)/g, function (_match, capture) {
|
|
|
var _math_expressions$cap = math_expressions[capture],
|
|
|
type = _math_expressions$cap.type,
|
|
|
expression = _math_expressions$cap.expression;
|
|
|
return (0,katex.renderToString)(_unescape(expression) || '', {
|
|
|
displayMode: type === 'block',
|
|
|
throwOnError: false,
|
|
|
output: 'html'
|
|
|
});
|
|
|
});
|
|
|
rs = rs.replace(/▁/g, '▁▁▁');
|
|
|
resetMathExpressions();
|
|
|
// return dompurify.sanitize(rs)
|
|
|
var dom = document.createElement('div');
|
|
|
dom.innerHTML = rs;
|
|
|
if (highlightKeywords) {
|
|
|
var escapedKeywords = highlightKeywords.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
|
findKeyword(dom, escapedKeywords);
|
|
|
return dom.innerHTML;
|
|
|
}
|
|
|
if (showTextOnly) {
|
|
|
return dom.innerText;
|
|
|
}
|
|
|
setTimeout(function () {
|
|
|
return onLoad();
|
|
|
}, 500);
|
|
|
console.log("dom.innerHTML:", dom.innerHTML);
|
|
|
return dom.innerHTML;
|
|
|
}, [str, highlightKeywords]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (el.current) {
|
|
|
var inputs = el.current.querySelectorAll(["input", "textarea"]);
|
|
|
inputs.forEach(function (input) {
|
|
|
input.oninput = onInput;
|
|
|
input.onblur = onBlur;
|
|
|
});
|
|
|
}
|
|
|
}, [projectValue]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (!!(programFillValue !== null && programFillValue !== void 0 && programFillValue.length)) {
|
|
|
var scoreDom = el.current.querySelectorAll(".edu-program-fill-score");
|
|
|
var dom = el.current.querySelectorAll('[name="edu-program-fill"]');
|
|
|
var _iterator = createForOfIteratorHelper_default()(dom.entries()),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var _programFillValue$k;
|
|
|
var _step$value = slicedToArray_default()(_step.value, 2),
|
|
|
k = _step$value[0],
|
|
|
i = _step$value[1];
|
|
|
i.value = (_programFillValue$k = programFillValue[k]) === null || _programFillValue$k === void 0 ? void 0 : _programFillValue$k.value;
|
|
|
if (programFillValue[k].type === "warning") {
|
|
|
i.className = "program-fill-warning";
|
|
|
} else if (programFillValue[k].type === "success") {
|
|
|
i.className = "program-fill-success";
|
|
|
} else {
|
|
|
i.className = "";
|
|
|
}
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
var _iterator2 = createForOfIteratorHelper_default()(scoreDom.entries()),
|
|
|
_step2;
|
|
|
try {
|
|
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
|
var _programFillValue$_k, _programFillValue$_k2;
|
|
|
var _step2$value = slicedToArray_default()(_step2.value, 2),
|
|
|
_k = _step2$value[0],
|
|
|
_i = _step2$value[1];
|
|
|
_i.innerHTML = (_programFillValue$_k = programFillValue[_k]) !== null && _programFillValue$_k !== void 0 && _programFillValue$_k.score ? "".concat((_programFillValue$_k2 = programFillValue[_k]) === null || _programFillValue$_k2 === void 0 ? void 0 : _programFillValue$_k2.score, "\u5206") : "";
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator2.e(err);
|
|
|
} finally {
|
|
|
_iterator2.f();
|
|
|
}
|
|
|
setProjectValue(programFillValue);
|
|
|
}
|
|
|
}, [programFillValue]);
|
|
|
var onInput = function onInput(e) {
|
|
|
projectValue[e.target.dataset.id] = projectValue[e.target.dataset.id] || {};
|
|
|
projectValue[e.target.dataset.id]["value"] = e.target.value;
|
|
|
setProjectValue(toConsumableArray_default()(projectValue));
|
|
|
onFillChange(projectValue, e.target.dataset.id);
|
|
|
};
|
|
|
var onBlur = function onBlur(e) {
|
|
|
projectValue[e.target.dataset.id] = projectValue[e.target.dataset.id] || {};
|
|
|
projectValue[e.target.dataset.id]["value"] = e.target.value;
|
|
|
setProjectValue(toConsumableArray_default()(projectValue));
|
|
|
onFillBlur(projectValue, e.target.dataset.id);
|
|
|
};
|
|
|
function findKeyword(node, keyword) {
|
|
|
return node.childNodes.forEach(function (childNode) {
|
|
|
if (childNode.childNodes.length > 0) {
|
|
|
findKeyword(childNode, keyword);
|
|
|
} else if (childNode.nodeName !== "IMG") {
|
|
|
if (childNode.innerHTML) {
|
|
|
var _childNode$innerHTML;
|
|
|
childNode.innerHTML = (_childNode$innerHTML = childNode.innerHTML) === null || _childNode$innerHTML === void 0 ? void 0 : _childNode$innerHTML.replace(new RegExp(keyword, "gi"), '<span style="color:#0152d9;background-color:#1890ff33">$&</span>');
|
|
|
} else {
|
|
|
var dom = document.createElement("span");
|
|
|
dom.innerHTML = childNode.textContent.replace(new RegExp(keyword, "gi"), '<span style="color:#0152d9;background-color:#1890ff33">$&</span>');
|
|
|
childNode.replaceWith(dom);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// return dom.childNodes.forEach((node:any) => {
|
|
|
// console.log("nodeLen:",node.childNodes.length)
|
|
|
// if(node.childNodes.length > 0){
|
|
|
// debugger
|
|
|
// // findKeyword(dom.childNodes,keyword)
|
|
|
// }else{
|
|
|
// if(node.nodeName !== "#text"){
|
|
|
// node.innerHTML = node.innerHTML.replaceAll(keyword,`<span class="c-blue">${keyword}</span>`)
|
|
|
// console.log("node:",node,dom,node.nodeName,node.innerHTML,node.childNodes.length)
|
|
|
// debugger
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
// return node
|
|
|
// });
|
|
|
}
|
|
|
|
|
|
var el = (0,_react_17_0_2_react.useRef)();
|
|
|
lines['WebkitLineClamp'] = showLines;
|
|
|
if (showLines) {
|
|
|
style = objectSpread2_default()(objectSpread2_default()({}, style), lines);
|
|
|
}
|
|
|
function onAncherHandler(e) {
|
|
|
var target = e.target;
|
|
|
if (target.tagName.toUpperCase() === 'A') {
|
|
|
var ancher = target.getAttribute('href');
|
|
|
if (ancher.indexOf("office") > -1) {
|
|
|
e.preventDefault();
|
|
|
setData(ancher);
|
|
|
setType("office");
|
|
|
} else if (ancher.indexOf("application/pdf") > -1) {
|
|
|
e.preventDefault();
|
|
|
setData(ancher);
|
|
|
setType("pdf");
|
|
|
} else if (ancher.indexOf("text/html") > -1) {
|
|
|
e.preventDefault();
|
|
|
setData(ancher);
|
|
|
setType("html");
|
|
|
} else if (ancher.startsWith('#')) {
|
|
|
e.preventDefault();
|
|
|
var viewEl = document.getElementById(ancher.replace('#', ''));
|
|
|
if (viewEl) {
|
|
|
viewEl.scrollIntoView(true);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
var onLoad = function onLoad() {
|
|
|
var _el$current;
|
|
|
var videoElement = (_el$current = el.current) === null || _el$current === void 0 ? void 0 : _el$current.querySelectorAll('video');
|
|
|
videoElement === null || videoElement === void 0 || videoElement.forEach(function (item) {
|
|
|
item.oncontextmenu = function () {
|
|
|
return false;
|
|
|
};
|
|
|
if (item.src.indexOf('.m3u8') > -1) {
|
|
|
if (item.canPlayType('application/vnd.apple.mpegurl')) {} else if (dist_hls/* default */.Z.isSupported()) {
|
|
|
var hls = new dist_hls/* default */.Z();
|
|
|
hls.loadSource(item.src);
|
|
|
hls.attachMedia(item);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (el.current && html) {
|
|
|
if (html.match(preRegex)) {
|
|
|
window.PR.prettyPrint();
|
|
|
}
|
|
|
}
|
|
|
if (el.current) {
|
|
|
el.current.addEventListener('click', onAncherHandler);
|
|
|
return function () {
|
|
|
var _el$current2;
|
|
|
(_el$current2 = el.current) === null || _el$current2 === void 0 || _el$current2.removeEventListener('click', onAncherHandler);
|
|
|
resetMathExpressions();
|
|
|
cleanToc();
|
|
|
};
|
|
|
}
|
|
|
}, [html, el.current, onAncherHandler]);
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [showTextOnly && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
ref: el,
|
|
|
children: html
|
|
|
}), !showTextOnly && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
ref: el,
|
|
|
style: objectSpread2_default()({}, style),
|
|
|
className: "".concat(className ? className : '', " ").concat(disabledFill ? "disabled-fill" : "", " markdown-body ").concat(classNamesRef.current),
|
|
|
dangerouslySetInnerHTML: {
|
|
|
__html: html
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(PreviewAll/* default */.Z, {
|
|
|
close: true,
|
|
|
data: data,
|
|
|
type: !!(data !== null && data !== void 0 && data.length) ? type : "",
|
|
|
style: objectSpread2_default()({}, stylesPrev),
|
|
|
onClose: function onClose() {
|
|
|
return setData("");
|
|
|
}
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 79669:
|
|
|
/*!*************************************************************!*\
|
|
|
!*** ./src/components/markdown-editor/code-block/index.tsx ***!
|
|
|
\*************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ h: function() { return /* binding */ MyCodeMirror; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js */ 11006);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ 59301);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd */ 57809);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! antd */ 78241);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! antd */ 3113);
|
|
|
/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! codemirror */ 89780);
|
|
|
/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(codemirror__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var codemirror_lib_codemirror_css__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! codemirror/lib/codemirror.css */ 7042);
|
|
|
/* harmony import */ var codemirror_theme_blackboard_css__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! codemirror/theme/blackboard.css */ 93202);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Option = antd__WEBPACK_IMPORTED_MODULE_7__["default"].Option;
|
|
|
|
|
|
//https://github.com/codemirror/CodeMirror/issues/4838
|
|
|
var formItemLayout = {
|
|
|
labelCol: {
|
|
|
span: 4
|
|
|
},
|
|
|
wrapperCol: {
|
|
|
span: 20
|
|
|
}
|
|
|
};
|
|
|
var LanguageDesc = {
|
|
|
asp: ['ASP', 'vbscript'],
|
|
|
actionscript: ['ActionScript(3.0)/Flash/Flex', 'clike'],
|
|
|
bash: ['Bash/Bat', 'shell'],
|
|
|
css: ['CSS', 'css'],
|
|
|
c: ['C', 'clike'],
|
|
|
cpp: ['C++', 'clike'],
|
|
|
csharp: ['C#', 'clike'],
|
|
|
coffeescript: ['CoffeeScript', 'coffeescript'],
|
|
|
d: ['D', 'd'],
|
|
|
dart: ['Dart', 'dart'],
|
|
|
delphi: ['Delphi/Pascal', 'pascal'],
|
|
|
erlang: ['Erlang', 'erlang'],
|
|
|
go: ['Golang', 'go'],
|
|
|
groovy: ['Groovy', 'groovy'],
|
|
|
html: ['HTML', 'text/html'],
|
|
|
java: ['Java', 'clike'],
|
|
|
json: ['JSON', 'text/json'],
|
|
|
javascript: ['Javascript', 'javascript'],
|
|
|
lua: ['Lua', 'lua'],
|
|
|
less: ['LESS', 'css'],
|
|
|
markdown: ['Markdown', 'gfm'],
|
|
|
'objective-c': ['Objective-C', 'clike'],
|
|
|
php: ['PHP', 'php'],
|
|
|
perl: ['Perl', 'perl'],
|
|
|
python: ['Python', 'python'],
|
|
|
r: ['R', 'r'],
|
|
|
rst: ['reStructedText', 'rst'],
|
|
|
ruby: ['Ruby', 'ruby'],
|
|
|
sql: ['SQL', 'sql'],
|
|
|
sass: ['SASS/SCSS', 'sass'],
|
|
|
shell: ['Shell', 'shell'],
|
|
|
scala: ['Scala', 'clike'],
|
|
|
swift: ['Swift', 'clike'],
|
|
|
vb: ['VB/VBScript', 'vb'],
|
|
|
xml: ['XML', 'text/xml'],
|
|
|
yaml: ['YAML', 'yaml']
|
|
|
};
|
|
|
/* harmony default export */ __webpack_exports__.Z = (function (_ref) {
|
|
|
var callback = _ref.callback,
|
|
|
onCancel = _ref.onCancel;
|
|
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)('python'),
|
|
|
_useState2 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState, 2),
|
|
|
mode = _useState2[0],
|
|
|
setMode = _useState2[1];
|
|
|
function onSetMode(value) {
|
|
|
setMode(LanguageDesc[value][1]);
|
|
|
}
|
|
|
function onSubmit(values) {
|
|
|
callback(values);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formItemLayout), {}, {
|
|
|
className: "code-block-panel",
|
|
|
initialValues: {
|
|
|
language: 'python',
|
|
|
content: ''
|
|
|
},
|
|
|
onFinish: onSubmit,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u4EE3\u7801\u8BED\u8A00",
|
|
|
name: "language",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_7__["default"], {
|
|
|
getPopupContainer: function getPopupContainer(trigger) {
|
|
|
return trigger.parentNode;
|
|
|
},
|
|
|
onChange: onSetMode,
|
|
|
children: Object.keys(LanguageDesc).map(function (item) {
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(Option, {
|
|
|
value: item,
|
|
|
children: LanguageDesc[item][0]
|
|
|
}, item);
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u4EE3\u7801\u5185\u5BB9",
|
|
|
name: "content",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入代码内容'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(MyCodeMirror, {
|
|
|
mode: mode
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", {
|
|
|
className: "flex-container flex-end",
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .ZP, {
|
|
|
type: "primary",
|
|
|
htmlType: "submit",
|
|
|
style: {
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: "\u786E\u5B9A"
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .ZP, {
|
|
|
type: "ghost",
|
|
|
onClick: onCancel,
|
|
|
children: "\u53D6\u6D88"
|
|
|
})]
|
|
|
})]
|
|
|
}));
|
|
|
});
|
|
|
function MyCodeMirror(_ref2) {
|
|
|
var value = _ref2.value,
|
|
|
onChange = _ref2.onChange,
|
|
|
mode = _ref2.mode,
|
|
|
_ref2$options = _ref2.options,
|
|
|
options = _ref2$options === void 0 ? {} : _ref2$options;
|
|
|
var el = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)();
|
|
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(),
|
|
|
_useState4 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState3, 2),
|
|
|
cm = _useState4[0],
|
|
|
setCm = _useState4[1];
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
var onChangeHandler = function onChangeHandler(cm) {
|
|
|
var content = cm.getValue();
|
|
|
onChange && onChange(content);
|
|
|
};
|
|
|
cm.on('change', onChangeHandler);
|
|
|
return function () {
|
|
|
cm.off('change', onChangeHandler);
|
|
|
};
|
|
|
}
|
|
|
}, [cm, onChange]);
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
cm.setOption('mode', mode);
|
|
|
}
|
|
|
}, [cm, mode]);
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
if (value !== cm.getValue() || value === '') {
|
|
|
setTimeout(function () {
|
|
|
cm.setValue(value || '');
|
|
|
}, 300);
|
|
|
}
|
|
|
}
|
|
|
}, [cm, value]);
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
|
|
|
if (el.current && !cm) {
|
|
|
var instance = codemirror__WEBPACK_IMPORTED_MODULE_3___default().fromTextArea(el.current, _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({
|
|
|
mode: mode,
|
|
|
lineNumbers: true,
|
|
|
lineWrapping: true,
|
|
|
autoCloseBrackets: true,
|
|
|
tabSize: 4,
|
|
|
autofocus: true,
|
|
|
autoCloseTags: true,
|
|
|
matchBrackets: true,
|
|
|
styleActiveLine: true
|
|
|
}, options));
|
|
|
setCm(instance);
|
|
|
}
|
|
|
}, [el.current, cm]);
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", {
|
|
|
className: "my-codemirror-container",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("textarea", {
|
|
|
ref: el
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 83954:
|
|
|
/*!***************************************************************!*\
|
|
|
!*** ./src/components/markdown-editor/index.tsx + 10 modules ***!
|
|
|
\***************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
Z: function() { return /* binding */ markdown_editor; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/createForOfIteratorHelper.js
|
|
|
var createForOfIteratorHelper = __webpack_require__(98190);
|
|
|
var createForOfIteratorHelper_default = /*#__PURE__*/__webpack_require__.n(createForOfIteratorHelper);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js
|
|
|
var regeneratorRuntime = __webpack_require__(10574);
|
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js
|
|
|
var asyncToGenerator = __webpack_require__(39343);
|
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(11006);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/defineProperty.js
|
|
|
var defineProperty = __webpack_require__(22060);
|
|
|
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/lib/codemirror.js
|
|
|
var codemirror = __webpack_require__(89780);
|
|
|
var codemirror_default = /*#__PURE__*/__webpack_require__.n(codemirror);
|
|
|
// EXTERNAL MODULE: ./node_modules/_resize-observer-polyfill@1.5.1@resize-observer-polyfill/dist/ResizeObserver.es.js
|
|
|
var ResizeObserver_es = __webpack_require__(76374);
|
|
|
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/lib/codemirror.css
|
|
|
var lib_codemirror = __webpack_require__(7042);
|
|
|
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/addon/edit/closetag.js
|
|
|
var closetag = __webpack_require__(6313);
|
|
|
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/addon/edit/closebrackets.js
|
|
|
var closebrackets = __webpack_require__(25717);
|
|
|
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/addon/display/placeholder.js
|
|
|
var placeholder = __webpack_require__(99498);
|
|
|
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/mode/markdown/markdown.js
|
|
|
var markdown = __webpack_require__(25419);
|
|
|
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/mode/stex/stex.js
|
|
|
var stex = __webpack_require__(67549);
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/index.less
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules
|
|
|
var RenderHtml = __webpack_require__(11436);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/components/RenderHtml/stex.tsx
|
|
|
|
|
|
// const latexjs = require('latex-l.js/dist/latex.js');
|
|
|
// import "latex-l.js/dist/css/base.css"
|
|
|
|
|
|
|
|
|
/* harmony default export */ var RenderHtml_stex = (function (_ref) {
|
|
|
var _ref$value = _ref.value,
|
|
|
value = _ref$value === void 0 ? '' : _ref$value,
|
|
|
className = _ref.className,
|
|
|
showTextOnly = _ref.showTextOnly,
|
|
|
showLines = _ref.showLines,
|
|
|
_ref$style = _ref.style,
|
|
|
style = _ref$style === void 0 ? {} : _ref$style;
|
|
|
var html = (0,_react_17_0_2_react.useMemo)(function () {
|
|
|
// try {
|
|
|
// const latex = value || 'This is some text';
|
|
|
// let generator = new latexjs.default.HtmlGenerator({ hyphenate: true })
|
|
|
// let doc = latexjs.default.parse(latex, { generator: generator }).htmlDocument()
|
|
|
// return doc.body.innerHTML
|
|
|
// }catch(e){
|
|
|
// console.log("e:",e)
|
|
|
// return "错误的latex语法,请检查"
|
|
|
// }
|
|
|
return "";
|
|
|
}, [value]);
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
dangerouslySetInnerHTML: {
|
|
|
__html: html
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
});
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(26801);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/toolbar/index.less
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/css/iconfont.css
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/toolbar/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var DEFAULTICONS = [{
|
|
|
title: '粗体',
|
|
|
icon: 'icon-bold',
|
|
|
actionName: 'bold'
|
|
|
}, {
|
|
|
title: '斜体',
|
|
|
icon: 'icon-italic',
|
|
|
actionName: 'italic'
|
|
|
}, '|', {
|
|
|
title: '无序列表',
|
|
|
icon: 'icon-unorder-list',
|
|
|
actionName: 'list-ul'
|
|
|
}, {
|
|
|
title: '有序列表',
|
|
|
icon: 'icon-order-list',
|
|
|
actionName: 'list-ol'
|
|
|
}, '|', {
|
|
|
title: '行内代码',
|
|
|
icon: 'icon-code',
|
|
|
actionName: 'code'
|
|
|
}, {
|
|
|
title: '代码块(多语言风格)',
|
|
|
icon: 'icon-file-code',
|
|
|
actionName: 'code-block'
|
|
|
}, {
|
|
|
title: '链接',
|
|
|
icon: 'icon-link',
|
|
|
actionName: 'link'
|
|
|
}, '|', {
|
|
|
title: '行内公式',
|
|
|
icon: 'icon-sum',
|
|
|
actionName: 'inline-latex'
|
|
|
}, {
|
|
|
title: '多行公式',
|
|
|
icon: 'icon-formula',
|
|
|
actionName: 'latex'
|
|
|
}, '|', {
|
|
|
title: '添加图片',
|
|
|
icon: 'icon-picture',
|
|
|
actionName: 'upload-image'
|
|
|
}, {
|
|
|
title: '表格',
|
|
|
icon: 'icon-table',
|
|
|
actionName: 'add-table'
|
|
|
}, '|', {
|
|
|
title: '换行',
|
|
|
icon: 'icon-minus',
|
|
|
actionName: 'line-break'
|
|
|
}, {
|
|
|
title: '清空',
|
|
|
icon: 'icon-eraser',
|
|
|
actionName: 'eraser'
|
|
|
}];
|
|
|
function AButton(_ref) {
|
|
|
var onActionCallback = _ref.onActionCallback,
|
|
|
title = _ref.title,
|
|
|
icon = _ref.icon,
|
|
|
actionName = _ref.actionName,
|
|
|
_ref$className = _ref.className,
|
|
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
|
children = _ref.children;
|
|
|
function onAction() {
|
|
|
onActionCallback(actionName);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
|
|
|
title: title,
|
|
|
className: className,
|
|
|
onClick: onAction,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "md-iconfont ".concat(icon)
|
|
|
}), children]
|
|
|
});
|
|
|
}
|
|
|
/* harmony default export */ var toolbar = (function (_ref2) {
|
|
|
var watch = _ref2.watch,
|
|
|
showNullButton = _ref2.showNullButton,
|
|
|
showNullProgramButton = _ref2.showNullProgramButton,
|
|
|
onActionCallback = _ref2.onActionCallback,
|
|
|
fullScreen = _ref2.fullScreen,
|
|
|
insertTemp = _ref2.insertTemp,
|
|
|
hidetoolBar = _ref2.hidetoolBar;
|
|
|
var icons = [].concat(DEFAULTICONS, [{
|
|
|
title: "".concat(watch ? '关闭实时预览' : '开启实时预览'),
|
|
|
icon: "".concat(watch ? 'icon-eye-slash' : 'icon-eye'),
|
|
|
actionName: 'trigger-watch'
|
|
|
}]);
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
|
className: "markdown-toolbar-container",
|
|
|
children: [!hidetoolBar && icons.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: item.actionName ? /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, objectSpread2_default()(objectSpread2_default()({}, item), {}, {
|
|
|
onActionCallback: onActionCallback
|
|
|
})) : /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "v-line"
|
|
|
})
|
|
|
}, index);
|
|
|
}), showNullButton ? /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
|
|
|
icon: "icon-edit insert-blank",
|
|
|
className: "btn-null",
|
|
|
title: "\u589E\u52A0\u586B\u7A7A",
|
|
|
actionName: "add-null-ch",
|
|
|
onActionCallback: onActionCallback,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "fill-tip",
|
|
|
children: "\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"
|
|
|
})
|
|
|
})
|
|
|
}) : null, showNullProgramButton ? /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
|
|
|
icon: "icon-edit insert-blank",
|
|
|
className: "btn-null",
|
|
|
title: "\u589E\u52A0\u586B\u7A7A",
|
|
|
actionName: "add-signal",
|
|
|
onActionCallback: onActionCallback,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "fill-tip",
|
|
|
children: "\u6DFB\u52A0\u5355\u884C\u586B\u7A7A\u9879"
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
|
|
|
icon: "icon-uniE900 insert-blank",
|
|
|
className: "btn-null",
|
|
|
title: "\u589E\u52A0\u586B\u7A7A",
|
|
|
actionName: "add-multiple",
|
|
|
onActionCallback: onActionCallback,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "fill-tip",
|
|
|
children: "\u6DFB\u52A0\u591A\u884C\u586B\u7A7A\u9879"
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
}) : null, insertTemp && /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
|
|
|
icon: "icon-edit",
|
|
|
className: "btn-null",
|
|
|
title: "\u63D2\u5165\u6A21\u677F",
|
|
|
actionName: "inster-template-".concat(insertTemp),
|
|
|
onActionCallback: onActionCallback,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "fill-tip",
|
|
|
children: "\u63D2\u5165\u6A21\u677F"
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
className: "btn-full-screen",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
|
|
|
icon: "".concat(fullScreen ? 'icon-shrink' : 'icon-enlarge'),
|
|
|
title: fullScreen ? '关闭全屏' : '开启全屏',
|
|
|
actionName: "trigger-full-screen",
|
|
|
onActionCallback: onActionCallback
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
// EXTERNAL MODULE: ./src/components/modal.tsx
|
|
|
var modal = __webpack_require__(83016);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/form/index.js + 19 modules
|
|
|
var es_form = __webpack_require__(78241);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
|
|
|
var input = __webpack_require__(1056);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(3113);
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/link/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var formItemLayout = {
|
|
|
labelCol: {
|
|
|
span: 4
|
|
|
},
|
|
|
wrapperCol: {
|
|
|
span: 20
|
|
|
}
|
|
|
};
|
|
|
/* harmony default export */ var markdown_editor_link = (function (_ref) {
|
|
|
var callback = _ref.callback,
|
|
|
onCancel = _ref.onCancel;
|
|
|
function onSubmit(values) {
|
|
|
callback(values);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, objectSpread2_default()(objectSpread2_default()({}, formItemLayout), {}, {
|
|
|
initialValues: {
|
|
|
link: 'http://',
|
|
|
title: ''
|
|
|
},
|
|
|
className: "link-panel",
|
|
|
onFinish: onSubmit,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
label: "\u94FE\u63A5\u5730\u5740",
|
|
|
name: "link",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入链接地址'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
label: "\u94FE\u63A5\u6807\u9898",
|
|
|
name: "title",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入链接标题'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "flex-container flex-end",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "primary",
|
|
|
htmlType: "submit",
|
|
|
style: {
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: "\u786E\u5B9A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "ghost",
|
|
|
onClick: onCancel,
|
|
|
children: "\u53D6\u6D88"
|
|
|
})]
|
|
|
})]
|
|
|
}));
|
|
|
});
|
|
|
// EXTERNAL MODULE: ./src/components/markdown-editor/code-block/index.tsx
|
|
|
var code_block = __webpack_require__(79669);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
|
|
|
var message = __webpack_require__(8591);
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/upload-image/index.less
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
// EXTERNAL MODULE: ./src/pages/tasks/util.js
|
|
|
var util = __webpack_require__(80330);
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/upload-image/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var useForm = es_form/* default */.Z.useForm;
|
|
|
var style = {
|
|
|
width: 280,
|
|
|
marginRight: 10
|
|
|
};
|
|
|
var upload_image_formItemLayout = {
|
|
|
labelCol: {
|
|
|
span: 5
|
|
|
},
|
|
|
wrapperCol: {
|
|
|
span: 19
|
|
|
}
|
|
|
};
|
|
|
/* harmony default export */ var upload_image = (function (_ref) {
|
|
|
var callback = _ref.callback,
|
|
|
onCancel = _ref.onCancel;
|
|
|
var _useForm = useForm(),
|
|
|
_useForm2 = slicedToArray_default()(_useForm, 1),
|
|
|
form = _useForm2[0];
|
|
|
var nameRef = (0,_react_17_0_2_react.useRef)();
|
|
|
function onSubmit(values) {
|
|
|
callback(objectSpread2_default()(objectSpread2_default()({}, values), {}, {
|
|
|
name: nameRef.current
|
|
|
}));
|
|
|
}
|
|
|
function onAddUrl(data, file) {
|
|
|
if (data.status === -1) {
|
|
|
message/* default */.ZP.error(data.message);
|
|
|
return;
|
|
|
}
|
|
|
form.setFieldsValue({
|
|
|
src: "/api/attachments/".concat(data.id),
|
|
|
type: file.type
|
|
|
});
|
|
|
}
|
|
|
function onFileChange(e) {
|
|
|
var file = e.target.files[0];
|
|
|
nameRef.current = file.name;
|
|
|
uploadImage(file, onAddUrl);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, objectSpread2_default()(objectSpread2_default()({
|
|
|
form: form
|
|
|
}, upload_image_formItemLayout), {}, {
|
|
|
className: "upload-image-panel",
|
|
|
onFinish: onSubmit,
|
|
|
style: {
|
|
|
width: 470,
|
|
|
overflow: "hidden"
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
label: "\u56FE\u7247\u5730\u5740",
|
|
|
required: true,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "flex-container",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: "src",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入文件地址'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
style: style
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(UploadButton, {
|
|
|
onFileChange: onFileChange
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
label: "\u56FE\u7247\u63CF\u8FF0",
|
|
|
name: "alt"
|
|
|
// rules={[{ required: true, message: '请输入图片描述' }]}
|
|
|
,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
style: {
|
|
|
width: 264
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z.Item, {
|
|
|
style: {
|
|
|
textAlign: "right"
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "primary",
|
|
|
htmlType: "submit",
|
|
|
style: {
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: "\u786E\u5B9A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "default",
|
|
|
onClick: onCancel,
|
|
|
children: "\u53D6\u6D88"
|
|
|
})]
|
|
|
})]
|
|
|
}));
|
|
|
});
|
|
|
function UploadButton(_ref2) {
|
|
|
var onFileChange = _ref2.onFileChange;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("label", {
|
|
|
className: "upload-button",
|
|
|
style: {
|
|
|
cursor: "pointer"
|
|
|
},
|
|
|
children: ["\u672C\u5730\u4E0A\u4F20", /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
type: "file",
|
|
|
onChange: onFileChange
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
function uploadImage(file, callback) {
|
|
|
if (!file) {
|
|
|
throw new String('没有文件');
|
|
|
return;
|
|
|
}
|
|
|
var formData = new FormData();
|
|
|
formData.append('editormd-image-file', file);
|
|
|
formData.append('file_param_name', 'editormd-image-file');
|
|
|
formData.append('byxhr', 'true');
|
|
|
var xhr = new window.XMLHttpRequest();
|
|
|
xhr.withCredentials = true;
|
|
|
xhr.addEventListener('load', function (response) {
|
|
|
callback(JSON.parse(response.target.responseText), file);
|
|
|
}, false);
|
|
|
xhr.addEventListener('error', function (error) {
|
|
|
console.error(error);
|
|
|
}, false);
|
|
|
xhr.open('POST', "".concat(util/* apiPref */.KI, "/api/attachments.json"));
|
|
|
xhr.send(formData);
|
|
|
}
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/radio/index.js + 5 modules
|
|
|
var es_radio = __webpack_require__(5112);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input-number/index.js + 14 modules
|
|
|
var input_number = __webpack_require__(85731);
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/add-table-panel/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var RadioGroup = es_radio/* default.Group */.ZP.Group;
|
|
|
var add_table_panel_style = {
|
|
|
margin: '0 8px'
|
|
|
};
|
|
|
/* harmony default export */ var add_table_panel = (function (_ref) {
|
|
|
var callback = _ref.callback,
|
|
|
onCancel = _ref.onCancel;
|
|
|
function onSubmit(values) {
|
|
|
callback(values);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
|
|
|
className: "add-table-panel",
|
|
|
initialValues: {
|
|
|
row: 3,
|
|
|
col: 2,
|
|
|
align: 'default'
|
|
|
},
|
|
|
onFinish: onSubmit,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "flex-container",
|
|
|
style: {
|
|
|
alignItems: "baseline"
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: add_table_panel_style,
|
|
|
children: "\u5355\u5143\u683C\u6570\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: add_table_panel_style,
|
|
|
children: "\u884C\u6570"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "row",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入行数'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: add_table_panel_style,
|
|
|
children: "\u5217\u6570"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "col",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入列数'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "flex-container",
|
|
|
style: {
|
|
|
marginTop: 12,
|
|
|
alignItems: "baseline"
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: add_table_panel_style,
|
|
|
children: "\u5BF9\u9F50\u65B9\u5F0F\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "align",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(RadioGroup, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
|
|
|
value: "default",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "fa fa-align-justify"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
|
|
|
value: "left",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "fa fa-align-left"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
|
|
|
value: "center",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "fa fa-align-center"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
|
|
|
value: "right",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "fa fa-align-right"
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "flex-container flex-end",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "primary",
|
|
|
htmlType: "submit",
|
|
|
style: {
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: "\u786E\u5B9A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "ghost",
|
|
|
onClick: onCancel,
|
|
|
children: "\u53D6\u6D88"
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
|
var env = __webpack_require__(78130);
|
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
|
var fetch = __webpack_require__(91506);
|
|
|
// EXTERNAL MODULE: ./node_modules/_uuid@8.3.0@uuid/dist/esm-browser/v4.js + 4 modules
|
|
|
var v4 = __webpack_require__(1012);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
|
|
|
var es_modal = __webpack_require__(43418);
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/constant.ts
|
|
|
var LINK = 'link';
|
|
|
var UPLOAD_IMAGE = 'upload-image';
|
|
|
var CODE_BLOCK = 'code-block';
|
|
|
var ADD_TABLE = 'add-table';
|
|
|
var HRLINE = '------------';
|
|
|
var ALIGNSIGN = {
|
|
|
"default": HRLINE,
|
|
|
left: ":".concat(HRLINE),
|
|
|
center: ":".concat(HRLINE, ":"),
|
|
|
right: "".concat(HRLINE, ":")
|
|
|
};
|
|
|
// EXTERNAL MODULE: ./src/components/useInterval.tsx
|
|
|
var useInterval = __webpack_require__(47169);
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _DEFAULTKEYMAP, _TitleDesc;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function noop() {}
|
|
|
var pending = 0;
|
|
|
var StorageTimeTicket = 10000;
|
|
|
var NULL_CH = '▁';
|
|
|
var ADD_MULTI = '@▁▁@';
|
|
|
var ADD_SINGLE = '@▁@';
|
|
|
var TEMP1 = '\n**模板标题**\n模板正文内容,可输入文本内容和粘贴图片等操作'; //课程须知模板
|
|
|
function processSize(size) {
|
|
|
return !/^\d+$/.test(size) ? size : "".concat(size, "px");
|
|
|
}
|
|
|
var isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|
|
|
var key = isMac ? 'Cmd' : 'Ctrl';
|
|
|
var officeSix = ["pptm", "pptx", "ppt", "pot", "pps", "ppa", "potx", "ppsx", "ppam", "pptm", "potm", "ppsm", "doc", "docx", "dot", "dotx", "docm", "dotm", "xls", "xlsx", "csv", "xlt", "xla", "xltx", "xlsm", "xltm", "xlam", "xlsb"];
|
|
|
var DEFAULTKEYMAP = (_DEFAULTKEYMAP = {}, defineProperty_default()(_DEFAULTKEYMAP, key + '-B', 'bold'), defineProperty_default()(_DEFAULTKEYMAP, key + '-I', 'italic'), _DEFAULTKEYMAP);
|
|
|
var TitleDesc = (_TitleDesc = {}, defineProperty_default()(_TitleDesc, LINK, '添加链接'), defineProperty_default()(_TitleDesc, CODE_BLOCK, '添加代码块'), defineProperty_default()(_TitleDesc, UPLOAD_IMAGE, '添加文件'), defineProperty_default()(_TitleDesc, ADD_TABLE, '添加表格'), _TitleDesc);
|
|
|
|
|
|
//https://codemirror.net/demo
|
|
|
//The height can be set through CSS (by giving the .CodeMirror class a height property), or by calling the cm's setSize method.
|
|
|
/* harmony default export */ var markdown_editor = (function (_ref) {
|
|
|
var _ref$defaultValue = _ref.defaultValue,
|
|
|
defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
|
|
|
onChange = _ref.onChange,
|
|
|
_ref$width = _ref.width,
|
|
|
width = _ref$width === void 0 ? '100%' : _ref$width,
|
|
|
_ref$height = _ref.height,
|
|
|
height = _ref$height === void 0 ? 400 : _ref$height,
|
|
|
_ref$miniToolbar = _ref.miniToolbar,
|
|
|
miniToolbar = _ref$miniToolbar === void 0 ? false : _ref$miniToolbar,
|
|
|
_ref$isFocus = _ref.isFocus,
|
|
|
isFocus = _ref$isFocus === void 0 ? false : _ref$isFocus,
|
|
|
watch = _ref.watch,
|
|
|
insertTemp = _ref.insertTemp,
|
|
|
_ref$mode = _ref.mode,
|
|
|
mode = _ref$mode === void 0 ? "markdown" : _ref$mode,
|
|
|
_ref$id = _ref.id,
|
|
|
id = _ref$id === void 0 ? 'markdown-editor-id' : _ref$id,
|
|
|
_ref$showResizeBar = _ref.showResizeBar,
|
|
|
showResizeBar = _ref$showResizeBar === void 0 ? false : _ref$showResizeBar,
|
|
|
_ref$noStorage = _ref.noStorage,
|
|
|
noStorage = _ref$noStorage === void 0 ? false : _ref$noStorage,
|
|
|
_ref$showNullButton = _ref.showNullButton,
|
|
|
showNullButton = _ref$showNullButton === void 0 ? false : _ref$showNullButton,
|
|
|
_ref$showNullProgramB = _ref.showNullProgramButton,
|
|
|
showNullProgramButton = _ref$showNullProgramB === void 0 ? false : _ref$showNullProgramB,
|
|
|
_ref$hidetoolBar = _ref.hidetoolBar,
|
|
|
hidetoolBar = _ref$hidetoolBar === void 0 ? false : _ref$hidetoolBar,
|
|
|
_ref$fullScreen = _ref.fullScreen,
|
|
|
fullScreen = _ref$fullScreen === void 0 ? false : _ref$fullScreen,
|
|
|
onBlur = _ref.onBlur,
|
|
|
onCMBeforeChange = _ref.onCMBeforeChange,
|
|
|
onFullScreen = _ref.onFullScreen,
|
|
|
_ref$className = _ref.className,
|
|
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
|
_ref$disablePaste = _ref.disablePaste,
|
|
|
disablePaste = _ref$disablePaste === void 0 ? false : _ref$disablePaste,
|
|
|
_ref$disabled = _ref.disabled,
|
|
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
|
_ref$disabledFill = _ref.disabledFill,
|
|
|
disabledFill = _ref$disabledFill === void 0 ? false : _ref$disabledFill,
|
|
|
_ref$placeholder = _ref.placeholder,
|
|
|
placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
|
|
|
_ref$values = _ref.values,
|
|
|
values = _ref$values === void 0 ? '' : _ref$values;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(null),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
cm = _useState2[0],
|
|
|
setCm = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(defaultValue),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
value = _useState4[0],
|
|
|
setValue = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(watch),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
preview = _useState6[0],
|
|
|
setPreview = _useState6[1];
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)(fullScreen),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
isFull = _useState8[0],
|
|
|
setIsFull = _useState8[1];
|
|
|
var _useState9 = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
action = _useState10[0],
|
|
|
setAction = _useState10[1];
|
|
|
var _useState11 = (0,_react_17_0_2_react.useState)(0),
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
lastedUpdateTime = _useState12[0],
|
|
|
setLastedUpdateTime = _useState12[1];
|
|
|
var _useState13 = (0,_react_17_0_2_react.useState)(height),
|
|
|
_useState14 = slicedToArray_default()(_useState13, 2),
|
|
|
h = _useState14[0],
|
|
|
setH = _useState14[1];
|
|
|
var _useState15 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState16 = slicedToArray_default()(_useState15, 2),
|
|
|
tip = _useState16[0],
|
|
|
setTip = _useState16[1];
|
|
|
var uuidRef = (0,_react_17_0_2_react.useRef)((0,v4/* default */.Z)());
|
|
|
var openPhoneRef = (0,_react_17_0_2_react.useRef)(false);
|
|
|
var timer = (0,_react_17_0_2_react.useRef)();
|
|
|
var cmEl = (0,_react_17_0_2_react.useRef)();
|
|
|
var containerEl = (0,_react_17_0_2_react.useRef)();
|
|
|
var resizeBarEl = (0,_react_17_0_2_react.useRef)();
|
|
|
var previewEl = (0,_react_17_0_2_react.useRef)();
|
|
|
var checkFiles = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var _res$attachments;
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return (0,fetch/* default */.ZP)("/api/attachments/distinct_hash_val.json", {
|
|
|
method: "post",
|
|
|
body: {
|
|
|
hash_val: uuidRef.current
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context.sent;
|
|
|
if (!!(res !== null && res !== void 0 && (_res$attachments = res.attachments) !== null && _res$attachments !== void 0 && _res$attachments.length)) {
|
|
|
console.log("cm:", cm, cmEl);
|
|
|
res.attachments.map(function (item) {
|
|
|
if (item.content_type.indexOf("image") > -1) {
|
|
|
cm.replaceSelection(".concat(item.content_type, ")"));
|
|
|
} else if (item.content_type.indexOf("video") > -1) {
|
|
|
cm.replaceSelection("<video width=\"100%\" controls src=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "\"></video>"));
|
|
|
} else if (item.content_type.indexOf("pdf") > -1) {
|
|
|
cm.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(item.id, "?type=").concat(item.content_type, "&disposition=inline\" target=\"_blank\">").concat(item.name, "</a>"));
|
|
|
} else {
|
|
|
cm.replaceSelection("[".concat(item.name, "](").concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(item.id, "?type=").concat(item.content_type, ")"));
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function checkFiles() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
|
|
|
// useEffect(() => {
|
|
|
// setValue(defaultValue)
|
|
|
// cm?.setValue(defaultValue)
|
|
|
// },[])
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var scrollTop = window.scrollY || window.pageYOffset;
|
|
|
setValue(values);
|
|
|
cm === null || cm === void 0 || cm.setValue(values);
|
|
|
window.scrollTo(0, scrollTop);
|
|
|
}, [values]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
onFullScreen === null || onFullScreen === void 0 || onFullScreen(isFull);
|
|
|
}, [isFull]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (cmEl.current) {
|
|
|
var onPaste = function onPaste(_, e) {
|
|
|
if (disablePaste) {
|
|
|
e.preventDefault();
|
|
|
return;
|
|
|
}
|
|
|
var clipboardData = e.clipboardData;
|
|
|
if (clipboardData) {
|
|
|
var types = clipboardData.types.toString();
|
|
|
var items = clipboardData.items;
|
|
|
if (types === 'Files' || clipboardData.types.indexOf("Files") > -1) {
|
|
|
e.preventDefault();
|
|
|
if (mode == "stex") return;
|
|
|
try {
|
|
|
var _items$;
|
|
|
var item = items[1];
|
|
|
if (((_items$ = items[0]) === null || _items$ === void 0 ? void 0 : _items$.kind) === 'file') {
|
|
|
item = items[0];
|
|
|
}
|
|
|
var file = item.getAsFile();
|
|
|
var fileSix = file.name.split(".").pop();
|
|
|
// console.log("item:", item, file, item?.type?.match(/^video\//i))
|
|
|
uploadImage(file, function (data) {
|
|
|
if (data.id) {
|
|
|
var _file$type, _file$type2, _file$type3;
|
|
|
if ((file === null || file === void 0 || (_file$type = file.type) === null || _file$type === void 0 ? void 0 : _file$type.indexOf("image")) > -1) {
|
|
|
instance.replaceSelection(".concat(data.content_type, ")"));
|
|
|
} else if ((file === null || file === void 0 || (_file$type2 = file.type) === null || _file$type2 === void 0 ? void 0 : _file$type2.indexOf("video")) > -1) {
|
|
|
instance.replaceSelection("<video width=\"100%\" controls src=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "\"></video>"));
|
|
|
} else if ((file === null || file === void 0 || (_file$type3 = file.type) === null || _file$type3 === void 0 ? void 0 : _file$type3.indexOf("pdf")) > -1) {
|
|
|
instance.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=").concat(file.type, "&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
|
|
|
} else if (officeSix.includes(fileSix)) {
|
|
|
instance.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=office&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
|
|
|
} else {
|
|
|
instance.replaceSelection("[".concat(file.name, "](").concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=").concat(data.content_type, ")"));
|
|
|
}
|
|
|
} else {
|
|
|
if ((data === null || data === void 0 ? void 0 : data.status) === 401) document.location.href = '/user/login';
|
|
|
}
|
|
|
});
|
|
|
} catch (e) {
|
|
|
message/* default */.ZP.warning("请使用chrome浏览器粘贴");
|
|
|
}
|
|
|
return true;
|
|
|
} else {
|
|
|
//toMarkdown ?
|
|
|
// let html = clipboardData.getData('text/html')
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
};
|
|
|
var instance = codemirror_default().fromTextArea(cmEl.current, {
|
|
|
mode: mode,
|
|
|
// inputStyle: 'contenteditable',
|
|
|
lineNumbers: miniToolbar ? false : true,
|
|
|
lineWrapping: true,
|
|
|
value: defaultValue,
|
|
|
autoCloseTags: true,
|
|
|
autoCloseBrackets: true
|
|
|
});
|
|
|
instance.on("keyup", function (cm, event) {
|
|
|
if (event.keyCode === 8) {
|
|
|
if (cm.getValue() == "") {
|
|
|
instance.setOption("placeholder", placeholder);
|
|
|
} else {
|
|
|
instance.setOption("placeholder", null);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
instance.on("keydown", function (cm, event) {
|
|
|
if (event.keyCode === 8) {
|
|
|
var pos = deleteAtSymbol(cm);
|
|
|
if (pos) {
|
|
|
event.preventDefault();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
isFocus && instance.focus();
|
|
|
instance.on('paste', onPaste);
|
|
|
instance.on('dragleave', function (data, e) {
|
|
|
containerEl.current.classList.remove("mouse-hover-md");
|
|
|
});
|
|
|
instance.on('dragover', function (data, e) {
|
|
|
containerEl.current.classList.add("mouse-hover-md");
|
|
|
});
|
|
|
instance.on('drop', function (data, e) {
|
|
|
containerEl.current.classList.add("mouse-hover-md");
|
|
|
// var file;
|
|
|
var files;
|
|
|
// Check if files were dropped
|
|
|
files = e.dataTransfer.files;
|
|
|
if (files.length > 0) {
|
|
|
e.preventDefault();
|
|
|
e.stopPropagation();
|
|
|
// file = files[0];
|
|
|
// alert('File: ' + file.name);
|
|
|
// return false;
|
|
|
var _loop = function _loop() {
|
|
|
var file = files[i];
|
|
|
var fileSix = file.name.split(".").pop();
|
|
|
uploadImage(file, function (data) {
|
|
|
if (data.id) {
|
|
|
var _file$type4, _file$type5, _file$type6;
|
|
|
if ((file === null || file === void 0 || (_file$type4 = file.type) === null || _file$type4 === void 0 ? void 0 : _file$type4.indexOf("image")) > -1) {
|
|
|
instance.replaceSelection(".concat(data.content_type, ")"));
|
|
|
} else if ((file === null || file === void 0 || (_file$type5 = file.type) === null || _file$type5 === void 0 ? void 0 : _file$type5.indexOf("video")) > -1) {
|
|
|
instance.replaceSelection("<video width=\"100%\" controls src=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "\"></video>"));
|
|
|
} else if ((file === null || file === void 0 || (_file$type6 = file.type) === null || _file$type6 === void 0 ? void 0 : _file$type6.indexOf("pdf")) > -1) {
|
|
|
instance.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=").concat(file.type, "&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
|
|
|
} else if (officeSix.includes(fileSix)) {
|
|
|
instance.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=office&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
|
|
|
} else {
|
|
|
instance.replaceSelection("[".concat(file.name, "](").concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=").concat(data.content_type, ")"));
|
|
|
}
|
|
|
} else {
|
|
|
if ((data === null || data === void 0 ? void 0 : data.status) === 401) document.location.href = '/user/login';
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
for (var i = 0; i < files.length; i++) {
|
|
|
_loop();
|
|
|
}
|
|
|
// files.map((file:any) => {
|
|
|
|
|
|
// })
|
|
|
}
|
|
|
});
|
|
|
|
|
|
if (disabled) {
|
|
|
instance.on("beforeChange", function (instances, change) {
|
|
|
if (change.origin === "paste" || change.origin === "+input") {
|
|
|
change.cancel();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
setCm(instance);
|
|
|
return function () {
|
|
|
instance.off('paste', onPaste);
|
|
|
};
|
|
|
}
|
|
|
}, []);
|
|
|
var resizeEditorBodyHeight = (0,_react_17_0_2_react.useCallback)(function () {
|
|
|
if (containerEl.current) {
|
|
|
try {
|
|
|
// let toolH = containerEl.current.getElementsByClassName('markdown-toolbar-container')[0].offsetHeight
|
|
|
// let mdBody = containerEl.current.getElementsByClassName('markdown-editor-body')[0]
|
|
|
// if (!isFull) {
|
|
|
// mdBody.style.height = `${h - toolH}px`
|
|
|
// } else {
|
|
|
// mdBody.style.height = `calc(100vh - ${toolH}px)`
|
|
|
// }
|
|
|
} catch (error) {
|
|
|
console.log(error, '---- to set md editor body height');
|
|
|
}
|
|
|
}
|
|
|
}, [h, containerEl, isFull]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
function onLayout() {
|
|
|
var ro = new ResizeObserver_es/* default */.Z(function (entries) {
|
|
|
var _iterator = createForOfIteratorHelper_default()(entries),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var entry = _step.value;
|
|
|
if (entry.target.offsetHeight > 0 || entry.target.offsetWidth > 0) {
|
|
|
resizeEditorBodyHeight();
|
|
|
cm.setSize('100%', '100%');
|
|
|
cm.refresh();
|
|
|
}
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
});
|
|
|
ro.observe(cmEl.current.parentElement);
|
|
|
return ro;
|
|
|
}
|
|
|
if (cm) {
|
|
|
var ro = onLayout();
|
|
|
return function () {
|
|
|
var _cmEl$current, _cmEl$current2;
|
|
|
if ((_cmEl$current = cmEl.current) !== null && _cmEl$current !== void 0 && _cmEl$current.parentElement) ro.unobserve((_cmEl$current2 = cmEl.current) === null || _cmEl$current2 === void 0 ? void 0 : _cmEl$current2.parentElement);
|
|
|
};
|
|
|
}
|
|
|
}, [cm, resizeEditorBodyHeight]);
|
|
|
|
|
|
//keymap
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
var keymap = [];
|
|
|
var _loop2 = function _loop2() {
|
|
|
var _Object$entries$_i = slicedToArray_default()(_Object$entries[_i], 2),
|
|
|
k = _Object$entries$_i[0],
|
|
|
value = _Object$entries$_i[1];
|
|
|
var map = defineProperty_default()({}, k, function () {
|
|
|
onActionCallback(value);
|
|
|
});
|
|
|
keymap.push(map);
|
|
|
cm.addKeyMap(map);
|
|
|
};
|
|
|
for (var _i = 0, _Object$entries = Object.entries(DEFAULTKEYMAP); _i < _Object$entries.length; _i++) {
|
|
|
_loop2();
|
|
|
}
|
|
|
timer.current = setInterval(function () {
|
|
|
if (openPhoneRef.current) {
|
|
|
checkFiles();
|
|
|
}
|
|
|
}, 4000);
|
|
|
return function () {
|
|
|
clearInterval(timer.current);
|
|
|
for (var _i2 = 0, _keymap = keymap; _i2 < _keymap.length; _i2++) {
|
|
|
var m = _keymap[_i2];
|
|
|
cm.removeKeyMap(m);
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
}, [cm]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (fullScreen !== isFull) {
|
|
|
setIsFull(fullScreen);
|
|
|
}
|
|
|
}, [fullScreen]);
|
|
|
(0,useInterval/* default */.Z)(function () {
|
|
|
if (!noStorage && lastedUpdateTime > 0) {
|
|
|
var currentTime = new Date().getTime();
|
|
|
var lastedValue = window.sessionStorage.getItem(id);
|
|
|
if (currentTime >= lastedUpdateTime + StorageTimeTicket && (!lastedValue || lastedValue !== value)) {
|
|
|
window.sessionStorage.setItem(id, value);
|
|
|
setTip(true);
|
|
|
}
|
|
|
}
|
|
|
}, StorageTimeTicket);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
setPreview(watch);
|
|
|
}, [cm, watch]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
isFocus && cm.focus();
|
|
|
}
|
|
|
}, [cm, isFocus]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (preview && cm) {
|
|
|
var syncScroll = function syncScroll(e) {
|
|
|
var target = e.target;
|
|
|
if (previewEl.current) {
|
|
|
var ratio = target.scrollTop / target.scrollHeight;
|
|
|
previewEl.current.scrollTop = previewEl.current.scrollHeight * ratio;
|
|
|
}
|
|
|
};
|
|
|
var scrollEl = cm.getScrollerElement();
|
|
|
scrollEl.addEventListener('scroll', syncScroll);
|
|
|
return function () {
|
|
|
scrollEl.removeEventListener('scroll', syncScroll);
|
|
|
};
|
|
|
}
|
|
|
}, [cm, preview]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (cm && onCMBeforeChange) {
|
|
|
var onChangeHandler = function onChangeHandler(cm, change) {
|
|
|
onCMBeforeChange(cm, change);
|
|
|
};
|
|
|
cm.on('beforeChange', onChangeHandler);
|
|
|
return function () {
|
|
|
cm.off('beforeChange', onChangeHandler);
|
|
|
};
|
|
|
}
|
|
|
}, [cm, onCMBeforeChange]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (cm && onBlur) {
|
|
|
var onBlurHandler = function onBlurHandler() {
|
|
|
onBlur(cm.getValue());
|
|
|
};
|
|
|
cm.on('blur', onBlurHandler);
|
|
|
return function () {
|
|
|
cm.off('blur', onBlurHandler);
|
|
|
};
|
|
|
}
|
|
|
}, [cm, onBlur]);
|
|
|
function deleteAtSymbol(cm, change) {
|
|
|
var doc = cm.getDoc();
|
|
|
var cursor = doc.getCursor();
|
|
|
var line = doc.getLine(cursor.line);
|
|
|
var ch = line.charAt(cursor.ch - 1);
|
|
|
var p1 = line.lastIndexOf("@▁@", cursor.ch);
|
|
|
var p2 = line.lastIndexOf("@▁▁@", cursor.ch);
|
|
|
var posStart = p1 > p2 ? p1 : p2;
|
|
|
var n = p1 > p2 ? 3 : 4;
|
|
|
if (ADD_MULTI.indexOf(ch) === -1) return null;
|
|
|
console.log("change1:", change, cm, line, cursor, posStart, p1, p2, ch);
|
|
|
if (posStart >= 0 && cursor.ch - posStart < 5) {
|
|
|
var posEnd = posStart + n;
|
|
|
doc.replaceRange("", {
|
|
|
line: cursor.line,
|
|
|
ch: posStart
|
|
|
}, {
|
|
|
line: cursor.line,
|
|
|
ch: posEnd
|
|
|
});
|
|
|
return {
|
|
|
line: cursor.line,
|
|
|
ch: posEnd
|
|
|
};
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
var onChangeHandler = function onChangeHandler(cm, change) {
|
|
|
var content = cm.getValue();
|
|
|
setValue(content);
|
|
|
setLastedUpdateTime(new Date().getTime());
|
|
|
cm.getScrollerElement().dispatchEvent(new CustomEvent('scroll'));
|
|
|
if (onChange) {
|
|
|
if (showNullProgramButton) {
|
|
|
onChange(content, formatProgramFill(content));
|
|
|
} else {
|
|
|
onChange(content);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
cm.on('change', onChangeHandler);
|
|
|
return function () {
|
|
|
cm.off('change', onChangeHandler);
|
|
|
};
|
|
|
}
|
|
|
}, [cm, onChange]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
// isFocus && cm.focus()
|
|
|
if (defaultValue === null || defaultValue === undefined) {
|
|
|
cm.setValue('');
|
|
|
setValue('');
|
|
|
} else {
|
|
|
var scrollTop = window.scrollY || window.pageYOffset;
|
|
|
if (defaultValue !== cm.getValue()) {
|
|
|
cm.setValue(defaultValue);
|
|
|
setValue(defaultValue);
|
|
|
cm.setCursor(disabled ? 1 : cm.lineCount(), 0);
|
|
|
window.scrollTo(0, scrollTop);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, [cm, defaultValue]);
|
|
|
var onActionCallback = (0,_react_17_0_2_react.useCallback)(function (actionName) {
|
|
|
var cursor = cm.getCursor();
|
|
|
var selection = cm.getSelection();
|
|
|
var selectionText = selection.split('\n');
|
|
|
switch (actionName) {
|
|
|
case 'bold':
|
|
|
cm.replaceSelection('**' + selection + '**');
|
|
|
if (selection === '') {
|
|
|
cm.setCursor(cursor.line, cursor.ch + 2);
|
|
|
}
|
|
|
return cm.focus();
|
|
|
case 'italic':
|
|
|
cm.replaceSelection('*' + selection + '*');
|
|
|
if (selection === '') {
|
|
|
cm.setCursor(cursor.line, cursor.ch + 1);
|
|
|
}
|
|
|
return cm.focus();
|
|
|
case 'code':
|
|
|
cm.replaceSelection('`' + selection + '`');
|
|
|
if (selection === '') {
|
|
|
cm.setCursor(cursor.line, cursor.ch + 1);
|
|
|
}
|
|
|
return cm.focus();
|
|
|
case 'inline-latex':
|
|
|
cm.replaceSelection('`$$' + selection + '$$`');
|
|
|
if (selection === '') {
|
|
|
cm.setCursor(cursor.line, cursor.ch + 3);
|
|
|
}
|
|
|
return cm.focus();
|
|
|
case 'latex':
|
|
|
cm.replaceSelection("```latex\n" + selection + "\n```");
|
|
|
cm.setCursor(cursor.line + 1, selection.length + 1);
|
|
|
return cm.focus();
|
|
|
case 'line-break':
|
|
|
cm.replaceSelection('<br/>\n');
|
|
|
return cm.focus();
|
|
|
case 'list-ul':
|
|
|
if (selection === '') {
|
|
|
cm.replaceSelection('- ' + selection);
|
|
|
} else {
|
|
|
cm.replaceSelection(selectionText.map(function (item) {
|
|
|
return item === '' ? '' : "- ".concat(item);
|
|
|
}).join('\n'));
|
|
|
}
|
|
|
return cm.focus();
|
|
|
case 'list-ol':
|
|
|
if (selection === '') {
|
|
|
cm.replaceSelection('1. ' + selection);
|
|
|
} else {
|
|
|
cm.replaceSelection(selectionText.map(function (item, index) {
|
|
|
return item === '' ? '' : "".concat(index + 1, ". ").concat(item);
|
|
|
}).join('\n'));
|
|
|
}
|
|
|
return cm.focus();
|
|
|
case 'add-null-ch':
|
|
|
if (selection === '') {
|
|
|
cm.setCursor(cursor.line, cursor.ch);
|
|
|
}
|
|
|
cm.replaceSelection(NULL_CH);
|
|
|
return cm.focus();
|
|
|
case 'add-signal':
|
|
|
if (selection === '') {
|
|
|
cm.setCursor(cursor.line, cursor.ch);
|
|
|
}
|
|
|
cm.replaceSelection(ADD_SINGLE);
|
|
|
return cm.focus();
|
|
|
case 'add-multiple':
|
|
|
if (selection === '') {
|
|
|
cm.setCursor(cursor.line, cursor.ch);
|
|
|
}
|
|
|
cm.replaceSelection(ADD_MULTI);
|
|
|
return cm.focus();
|
|
|
case 'inster-template-1':
|
|
|
if (selection === '') {
|
|
|
cm.setCursor(cursor.line, cursor.ch);
|
|
|
}
|
|
|
cm.replaceSelection(TEMP1);
|
|
|
return cm.focus();
|
|
|
case 'eraser':
|
|
|
cm.setValue('');
|
|
|
return cm.focus();
|
|
|
case 'trigger-watch':
|
|
|
setPreview(!preview);
|
|
|
return cm.focus();
|
|
|
case 'trigger-full-screen':
|
|
|
setIsFull(!isFull);
|
|
|
return cm.focus();
|
|
|
case LINK:
|
|
|
setAction(LINK);
|
|
|
return;
|
|
|
case CODE_BLOCK:
|
|
|
setAction(CODE_BLOCK);
|
|
|
return;
|
|
|
case UPLOAD_IMAGE:
|
|
|
setAction(UPLOAD_IMAGE);
|
|
|
return;
|
|
|
case ADD_TABLE:
|
|
|
setAction(ADD_TABLE);
|
|
|
return;
|
|
|
default:
|
|
|
throw new Error();
|
|
|
}
|
|
|
}, [cm, preview, isFull]);
|
|
|
var ExecutePluginAction = (0,_react_17_0_2_react.useCallback)(function (values) {
|
|
|
setAction('');
|
|
|
switch (action) {
|
|
|
case LINK:
|
|
|
var title = values.title,
|
|
|
link = values.link;
|
|
|
cm.replaceSelection("[".concat(title, "](").concat(link, ")"));
|
|
|
return cm.focus();
|
|
|
case CODE_BLOCK:
|
|
|
var language = values.language,
|
|
|
content = values.content;
|
|
|
cm.replaceSelection(['```' + language, content, '```'].join('\n'));
|
|
|
return cm.focus();
|
|
|
case UPLOAD_IMAGE:
|
|
|
var src = values.src,
|
|
|
alt = values.alt;
|
|
|
if (alt) {
|
|
|
cm.replaceSelection(".concat(src, " \"").concat(alt, "\" )"));
|
|
|
} else {
|
|
|
cm.replaceSelection(""));
|
|
|
}
|
|
|
return cm.focus();
|
|
|
case ADD_TABLE:
|
|
|
var row = values.row,
|
|
|
col = values.col,
|
|
|
align = values.align;
|
|
|
var table = '\n';
|
|
|
for (var r = 0; r < row; r++) {
|
|
|
var rows = [];
|
|
|
var heads = [];
|
|
|
for (var c = 0; c < col; c++) {
|
|
|
if (r === 1) {
|
|
|
heads.push(ALIGNSIGN[align]);
|
|
|
}
|
|
|
rows.push(' ');
|
|
|
}
|
|
|
if (r === 1) {
|
|
|
table += "| ".concat(heads.join(' | '), " |\n");
|
|
|
}
|
|
|
table += "| ".concat(rows.join(col === 1 ? '' : ' | '), " |\n");
|
|
|
}
|
|
|
cm.replaceSelection(table + '\n');
|
|
|
return cm.focus();
|
|
|
default:
|
|
|
throw new Error();
|
|
|
}
|
|
|
}, [cm, action]);
|
|
|
var PluginEl = (0,_react_17_0_2_react.useMemo)(function () {
|
|
|
switch (action) {
|
|
|
case LINK:
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor_link, {
|
|
|
callback: ExecutePluginAction,
|
|
|
onCancel: onCancel
|
|
|
});
|
|
|
case CODE_BLOCK:
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(code_block/* default */.Z, {
|
|
|
callback: ExecutePluginAction,
|
|
|
onCancel: onCancel
|
|
|
});
|
|
|
case UPLOAD_IMAGE:
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(upload_image, {
|
|
|
callback: ExecutePluginAction,
|
|
|
onCancel: onCancel
|
|
|
});
|
|
|
case ADD_TABLE:
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(add_table_panel, {
|
|
|
callback: ExecutePluginAction,
|
|
|
onCancel: onCancel
|
|
|
});
|
|
|
default:
|
|
|
return null;
|
|
|
}
|
|
|
}, [action]);
|
|
|
function onCancel() {
|
|
|
setAction('');
|
|
|
}
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (resizeBarEl.current) {
|
|
|
var onMouseDown = function onMouseDown(e) {
|
|
|
dragging = true;
|
|
|
startY = e.pageY;
|
|
|
};
|
|
|
var onMouseUp = function onMouseUp() {
|
|
|
dragging = false;
|
|
|
};
|
|
|
var onMouseMove = function onMouseMove(e) {
|
|
|
if (dragging) {
|
|
|
var delta = e.pageY - startY;
|
|
|
if (delta < 0) {
|
|
|
delta = 0;
|
|
|
}
|
|
|
if (delta > 300) {
|
|
|
delta = 300;
|
|
|
}
|
|
|
var resizeH = height + delta + 'px';
|
|
|
setH(resizeH);
|
|
|
}
|
|
|
};
|
|
|
var resizeBar = resizeBarEl.current;
|
|
|
var dragging = false;
|
|
|
var startY = 0;
|
|
|
resizeBar.addEventListener('mousedown', onMouseDown);
|
|
|
document.addEventListener('mousemove', onMouseMove);
|
|
|
document.addEventListener('mouseup', onMouseUp);
|
|
|
return function () {
|
|
|
resizeBar.removeEventListener('mousedown', onMouseDown);
|
|
|
document.removeEventListener('mousemove', onMouseMove);
|
|
|
document.removeEventListener('mouseup', onMouseUp);
|
|
|
};
|
|
|
}
|
|
|
}, [cm, resizeBarEl]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
setH(height);
|
|
|
}, [height]);
|
|
|
var fixedWidth = processSize(width);
|
|
|
var fixedHeight = processSize(h);
|
|
|
var style = {
|
|
|
width: fixedWidth,
|
|
|
height: fixedHeight
|
|
|
};
|
|
|
var saveTime = (0,_react_17_0_2_react.useMemo)(function () {
|
|
|
if (lastedUpdateTime) {
|
|
|
var d = new Date(lastedUpdateTime);
|
|
|
var _h = d.getHours();
|
|
|
var m = d.getMinutes();
|
|
|
var s = d.getSeconds();
|
|
|
_h = _h < 10 ? '0' + _h : _h;
|
|
|
m = m < 10 ? '0' + m : m;
|
|
|
s = s < 10 ? '0' + s : s;
|
|
|
return "".concat(_h, ":").concat(m, ":").concat(s);
|
|
|
}
|
|
|
return 0;
|
|
|
}, [lastedUpdateTime]);
|
|
|
var formatProgramFill = function formatProgramFill(str) {
|
|
|
var arr = [];
|
|
|
if (showNullProgramButton) {
|
|
|
var num = -1;
|
|
|
str = str.replace(/(@▁▁@|@▁@)/g, function (a, b, c) {
|
|
|
arr.push({
|
|
|
multiLine: !(a === ADD_SINGLE)
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
return arr;
|
|
|
};
|
|
|
function onCancelStorage() {
|
|
|
window.sessionStorage.removeItem(id);
|
|
|
setTip(false);
|
|
|
setLastedUpdateTime(0);
|
|
|
}
|
|
|
function onReset() {
|
|
|
setTip(false);
|
|
|
setLastedUpdateTime(0);
|
|
|
cm.setValue(window.sessionStorage.getItem(id));
|
|
|
}
|
|
|
function setValues(a, b) {
|
|
|
var content = cm.getValue();
|
|
|
content = content.replace(a, b);
|
|
|
setValue(content);
|
|
|
cm === null || cm === void 0 || cm.setValue(content);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "markdown-editor-wrapper",
|
|
|
ref: containerEl,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "markdown-editor-container ".concat(className, " ").concat(preview ? 'on-preview' : '', " ").concat(miniToolbar ? 'mini' : '', " ").concat(isFull ? 'full-screen' : ''),
|
|
|
style: style,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(toolbar, {
|
|
|
insertTemp: insertTemp,
|
|
|
watch: preview,
|
|
|
fullScreen: isFull,
|
|
|
showNullButton: showNullButton,
|
|
|
showNullProgramButton: showNullProgramButton,
|
|
|
onActionCallback: onActionCallback,
|
|
|
hidetoolBar: hidetoolBar,
|
|
|
uuid: uuidRef.current,
|
|
|
setOpenPhones: function setOpenPhones() {
|
|
|
openPhoneRef.current = true;
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "markdown-editor-body",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "codemirror-container",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("textarea", {
|
|
|
ref: cmEl,
|
|
|
placeholder: placeholder
|
|
|
})
|
|
|
}), preview ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
ref: previewEl,
|
|
|
className: "preview-container",
|
|
|
children: [mode === "stex" && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml_stex, {
|
|
|
value: value
|
|
|
}), mode !== "stex" && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
disabledFill: disabledFill,
|
|
|
showProgramFill: showNullProgramButton,
|
|
|
value: value
|
|
|
})]
|
|
|
}) : null]
|
|
|
})]
|
|
|
})
|
|
|
}), showResizeBar ? /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
ref: resizeBarEl,
|
|
|
className: "editor-resize"
|
|
|
}) : null, /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
children: TitleDesc[action] ? /*#__PURE__*/(0,jsx_runtime.jsx)(es_modal/* default */.Z, {
|
|
|
centered: true,
|
|
|
title: TitleDesc[action],
|
|
|
open: true,
|
|
|
onCancel: onCancel,
|
|
|
footer: null,
|
|
|
className: "markdown-popup-form",
|
|
|
children: PluginEl
|
|
|
}) : null
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 99662:
|
|
|
/*!***************************************************************************!*\
|
|
|
!*** ./src/pages/Classrooms/Lists/Exercise/Answer/index.tsx + 16 modules ***!
|
|
|
\***************************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// ESM COMPAT FLAG
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"default": function() { return /* binding */ Exercise_Answer; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/toConsumableArray.js
|
|
|
var toConsumableArray = __webpack_require__(93923);
|
|
|
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(26801);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js
|
|
|
var regeneratorRuntime = __webpack_require__(10574);
|
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js
|
|
|
var asyncToGenerator = __webpack_require__(39343);
|
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(11006);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectWithoutProperties.js
|
|
|
var objectWithoutProperties = __webpack_require__(27161);
|
|
|
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__(45295);
|
|
|
// EXTERNAL MODULE: ./node_modules/_qrcode.react@1.0.0@qrcode.react/lib/index.js
|
|
|
var lib = __webpack_require__(15845);
|
|
|
var lib_default = /*#__PURE__*/__webpack_require__.n(lib);
|
|
|
// 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/form/index.js + 19 modules
|
|
|
var es_form = __webpack_require__(78241);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
|
|
|
var es_modal = __webpack_require__(43418);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
|
|
|
var input = __webpack_require__(1056);
|
|
|
// 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/progress/index.js + 13 modules
|
|
|
var es_progress = __webpack_require__(93948);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/row/index.js
|
|
|
var row = __webpack_require__(95237);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/col/index.js
|
|
|
var col = __webpack_require__(43604);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/radio/index.js + 5 modules
|
|
|
var es_radio = __webpack_require__(5112);
|
|
|
// 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/tooltip/index.js + 3 modules
|
|
|
var tooltip = __webpack_require__(6848);
|
|
|
// 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/alert/index.js + 3 modules
|
|
|
var es_alert = __webpack_require__(46400);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(3113);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/MinusSquareOutlined.js + 1 modules
|
|
|
var MinusSquareOutlined = __webpack_require__(31307);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/PlusSquareOutlined.js + 1 modules
|
|
|
var PlusSquareOutlined = __webpack_require__(56159);
|
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
|
var fetch = __webpack_require__(91506);
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
|
var env = __webpack_require__(78130);
|
|
|
;// CONCATENATED MODULE: ./src/components/CaptureVideo/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var CaptureVideomodules = ({"flex_box_center":"flex_box_center___kVqBh","flex_space_between":"flex_space_between___FMnNq","flex_box_vertical_center":"flex_box_vertical_center___meESe","flex_box_center_end":"flex_box_center_end___KFpOb","flex_box_column":"flex_box_column___GHIK9","video":"video___nn_cD"});
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/components/CaptureVideo/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* base64 to file
|
|
|
* @param dataurl base64 content
|
|
|
* @param filename set up a meaningful suffix, or you can set mime type in options
|
|
|
* @returns {File|*}
|
|
|
*/
|
|
|
var dataURLtoFile = function dataURLtoFile(dataurl, filename) {
|
|
|
var arr = dataurl.split(',');
|
|
|
var mime = arr[0].match(/:(.*?);/)[1];
|
|
|
var bstr = atob(arr[1]);
|
|
|
var n = bstr.length;
|
|
|
var u8arr = new Uint8Array(n);
|
|
|
while (n--) {
|
|
|
u8arr[n] = bstr.charCodeAt(n);
|
|
|
}
|
|
|
return new Blob([u8arr], {
|
|
|
type: mime
|
|
|
}); // if env support File, also can use this: return new File([u8arr], filename, { type: mime });
|
|
|
};
|
|
|
|
|
|
var CaptureVideo = /*#__PURE__*/(0,_react_17_0_2_react.forwardRef)(function (_ref, ref) {
|
|
|
var time = _ref.time,
|
|
|
number = _ref.number,
|
|
|
supportCamera = _ref.supportCamera,
|
|
|
take_photo = _ref.take_photo,
|
|
|
update = _ref.update,
|
|
|
id = _ref.id;
|
|
|
var video = (0,_react_17_0_2_react.useRef)();
|
|
|
var canvas = (0,_react_17_0_2_react.useRef)();
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
phoneStep = _useState2[0],
|
|
|
setPhoneStep = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(0),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
status = _useState4[0],
|
|
|
setStatus = _useState4[1]; // 0准备中,1开启失败,2开启成功,3考试结束
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
src = _useState6[0],
|
|
|
setSrc = _useState6[1];
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)(),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
interval = _useState8[0],
|
|
|
setInter = _useState8[1];
|
|
|
var _useState9 = (0,_react_17_0_2_react.useState)(0),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
isPause = _useState10[0],
|
|
|
setIsPause = _useState10[1]; //0未开始,1开始计时,2停止计时
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
checkMediaDevices();
|
|
|
return function () {
|
|
|
handleStop();
|
|
|
clearTimer();
|
|
|
};
|
|
|
}, []);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
// clearTimer()
|
|
|
if (status === 2 && time && number > 0) {
|
|
|
calcPhoto();
|
|
|
setIsPause(1);
|
|
|
// photograph();
|
|
|
}
|
|
|
}, [time]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (isPause === 0) return;
|
|
|
if (isPause === 2) {
|
|
|
clearInterval(interval);
|
|
|
} else {
|
|
|
var n = 0;
|
|
|
var _id = setInterval(function () {
|
|
|
if (phoneStep.includes(n)) {
|
|
|
handlePhoto();
|
|
|
}
|
|
|
n++;
|
|
|
}, 1000);
|
|
|
setInter(_id);
|
|
|
}
|
|
|
return function () {
|
|
|
return clearInterval(interval);
|
|
|
};
|
|
|
}, [isPause]);
|
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, function () {
|
|
|
return {
|
|
|
handlePhoto: handlePhoto
|
|
|
};
|
|
|
});
|
|
|
var clearTimer = function clearTimer() {
|
|
|
setIsPause(2);
|
|
|
};
|
|
|
var calcPhoto = function calcPhoto() {
|
|
|
var step = time / number;
|
|
|
var arr = [];
|
|
|
function getRndInteger(min, max) {
|
|
|
return parseInt(Math.floor(Math.random() * (max - min + 1)) + min);
|
|
|
}
|
|
|
new Array(number).fill(0).map(function (item, key) {
|
|
|
if (take_photo) {
|
|
|
arr.push(getRndInteger(step * key, step * (key + 1)));
|
|
|
} else {
|
|
|
if (key == 0) {
|
|
|
arr.push(0);
|
|
|
} else {
|
|
|
arr.push(getRndInteger(step * key, step * (key + 1)));
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
phoneStep = arr;
|
|
|
setPhoneStep([].concat(arr));
|
|
|
console.log(arr);
|
|
|
};
|
|
|
var checkMediaDevices = function checkMediaDevices() {
|
|
|
if (navigator.mediaDevices === undefined) {
|
|
|
navigator.mediaDevices = {};
|
|
|
}
|
|
|
if (navigator.mediaDevices.getUserMedia === undefined) {
|
|
|
navigator.mediaDevices.getUserMedia = function (constraints) {
|
|
|
var getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
|
|
|
if (!getUserMedia) {
|
|
|
return Promise.reject(new Error('getUserMedia is not implemented in this browser'));
|
|
|
}
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
getUserMedia.call(navigator, constraints, resolve, reject);
|
|
|
});
|
|
|
};
|
|
|
}
|
|
|
navigator.mediaDevices.getUserMedia({
|
|
|
video: {
|
|
|
width: 200,
|
|
|
height: 113
|
|
|
}
|
|
|
}).then(function (stream) {
|
|
|
supportCamera && supportCamera(2);
|
|
|
setStatus(2);
|
|
|
if ("srcObject" in video.current) {
|
|
|
video.current.srcObject = stream;
|
|
|
} else {
|
|
|
video.current.src = window.URL.createObjectURL(stream);
|
|
|
}
|
|
|
video.current.onloadedmetadata = function (e) {
|
|
|
video.current.play();
|
|
|
};
|
|
|
video.current.addEventListener('ended', function () {
|
|
|
//结束
|
|
|
console.log("播放结束");
|
|
|
clearTimer();
|
|
|
message/* default */.ZP.error({
|
|
|
content: "您已经关闭了摄像头,请在10秒钟内恢复摄像头,否则将推出考试",
|
|
|
duration: 10,
|
|
|
key: 9998
|
|
|
});
|
|
|
}, false);
|
|
|
})["catch"](function (err) {
|
|
|
setStatus(1);
|
|
|
supportCamera && supportCamera(1);
|
|
|
// 错误信息,以及用户未授权
|
|
|
if (err.message === "Permission denied" || err.name === 'NotAllowedError') {
|
|
|
message/* default */.ZP.error('您已拒绝了获取摄像头');
|
|
|
} else {
|
|
|
message/* default */.ZP.error('摄像头获取失败,或您已拒绝了获取摄像头');
|
|
|
}
|
|
|
console.log("errname: " + err.name);
|
|
|
console.log("err: " + err.message);
|
|
|
});
|
|
|
};
|
|
|
var handlePhoto = function handlePhoto() {
|
|
|
try {
|
|
|
canvas.current.width = video.current.videoWidth;
|
|
|
canvas.current.height = video.current.videoHeight;
|
|
|
var context = canvas.current.getContext('2d');
|
|
|
context.drawImage(video.current, 0, 0, canvas.current.width, canvas.current.height);
|
|
|
setSrc(canvas.current.toDataURL('image/png'));
|
|
|
uploadFile(canvas.current.toDataURL('image/png'));
|
|
|
} catch (e) {}
|
|
|
};
|
|
|
var handleStop = function handleStop() {
|
|
|
try {
|
|
|
var stream = video.current.srcObject;
|
|
|
var tracks = stream.getTracks();
|
|
|
tracks.forEach(function (track) {
|
|
|
track.stop();
|
|
|
});
|
|
|
video.current.srcObject = null;
|
|
|
} catch (e) {}
|
|
|
};
|
|
|
var uploadFile = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(file) {
|
|
|
var formData, xhr;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
formData = new FormData();
|
|
|
formData.append('file', dataURLtoFile(file, '1'));
|
|
|
formData.append('1', '123');
|
|
|
xhr = new window.XMLHttpRequest();
|
|
|
xhr.withCredentials = true;
|
|
|
xhr.addEventListener('load', function (response) {
|
|
|
// console.log('response',);
|
|
|
var res = JSON.parse(response.target.responseText);
|
|
|
(0,fetch/* default */.ZP)("/api/exercises/".concat(id, "/upload_photo.json"), {
|
|
|
method: "post",
|
|
|
body: {
|
|
|
attachment_id: res.id
|
|
|
}
|
|
|
});
|
|
|
}, false);
|
|
|
xhr.addEventListener('error', function (error) {
|
|
|
console.error(error);
|
|
|
}, false);
|
|
|
xhr.open('POST', "".concat(env/* default */.Z.API_SERVER, "/api/attachments.json"));
|
|
|
xhr.send(formData);
|
|
|
// const res = await Fetch('/api/buckets/get_upload_token.json', { method: "get" })
|
|
|
// res.data = JSON.parse(decrypt(res.data))
|
|
|
|
|
|
// const name = uuidv4()
|
|
|
// const client = new OSS({
|
|
|
// endpoint: res?.data?.end_point,
|
|
|
// region: res?.data?.region,
|
|
|
// accessKeyId: res?.data?.access_key_id,
|
|
|
// accessKeySecret: res?.data?.access_key_secret,
|
|
|
// bucket: res?.data?.bucket,
|
|
|
// stsToken: res?.data?.security_token
|
|
|
// });
|
|
|
// const imgfile = dataURLtoFile(file, name);
|
|
|
// client.multipartUpload(`${name}.png`, imgfile, {
|
|
|
// timeout: 10 * 1000,
|
|
|
// partSize: 10485760,
|
|
|
// callback: {
|
|
|
// url: res?.data?.callback_url,
|
|
|
// host: res?.data.bucket_host,
|
|
|
// body: 'bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&my_var=${x:my_var}&login=' + params.login + '&container_id=' + params.categoryId + '&container_type=Exercise',
|
|
|
// }
|
|
|
// }).then(function (result: any) {
|
|
|
// console.log("result:", result)
|
|
|
// }).catch(function (err: any) {
|
|
|
// console.log("err:", err)
|
|
|
// });
|
|
|
case 9:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function uploadFile(_x) {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: status !== 3 && /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
className: CaptureVideomodules.video,
|
|
|
id: "screenshot",
|
|
|
children: [status === 0 && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u6B63\u5728\u5F00\u542F\u6444\u50CF\u5934..."
|
|
|
}), status === 1 && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u6444\u50CF\u5934\u5F00\u542F\u5931\u8D25"
|
|
|
}), status === 2 && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("video", {
|
|
|
width: "200",
|
|
|
ref: video,
|
|
|
autoPlay: true
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("canvas", {
|
|
|
style: {
|
|
|
display: "none"
|
|
|
},
|
|
|
ref: canvas
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
});
|
|
|
});
|
|
|
/* harmony default export */ var components_CaptureVideo = (CaptureVideo);
|
|
|
// EXTERNAL MODULE: ./src/components/Exercise/recordScreen.tsx + 3 modules
|
|
|
var recordScreen = __webpack_require__(88668);
|
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
|
var util = __webpack_require__(22739);
|
|
|
;// CONCATENATED MODULE: ./src/components/ReactCaptureScreens/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ReactCaptureScreens = function ReactCaptureScreens(_ref) {
|
|
|
var id = _ref.id,
|
|
|
startRecording = _ref.startRecording,
|
|
|
startScreenshot = _ref.startScreenshot,
|
|
|
onBack = _ref.onBack,
|
|
|
onSuccuss = _ref.onSuccuss,
|
|
|
_ref$timeInSeconds = _ref.timeInSeconds,
|
|
|
timeInSeconds = _ref$timeInSeconds === void 0 ? [1, 6, 11, 16, 21, 26, 31, 41, 51, 61, 71, 81, 91, 101, 111, 121, 151, 181, 211, 241, 271, 361, 421, 481, 541, 601, 661] : _ref$timeInSeconds;
|
|
|
var stream = (0,_react_17_0_2_react.useRef)(null);
|
|
|
var video = (0,_react_17_0_2_react.useRef)(null);
|
|
|
var canvas = (0,_react_17_0_2_react.useRef)(null);
|
|
|
var timer = (0,_react_17_0_2_react.useRef)(null);
|
|
|
var openActionRecord = (0,_react_17_0_2_react.useRef)(true);
|
|
|
var exerciseAbnormityId = (0,_react_17_0_2_react.useRef)('');
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(null),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
time = _useState2[0],
|
|
|
setTime = _useState2[1];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (startRecording) {
|
|
|
startLp();
|
|
|
} else {
|
|
|
stopLp();
|
|
|
}
|
|
|
}, [startRecording]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (startScreenshot) {
|
|
|
setTime(0);
|
|
|
} else {
|
|
|
clearTimeout(timer.current);
|
|
|
setTime(null);
|
|
|
exerciseAbnormityId.current = '';
|
|
|
}
|
|
|
}, [startScreenshot]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (typeof time === 'number') {
|
|
|
if (timeInSeconds !== null && timeInSeconds !== void 0 && timeInSeconds.includes(time)) {
|
|
|
captureScreenshot();
|
|
|
}
|
|
|
if (time <= 720) {
|
|
|
timer.current = setTimeout(function () {
|
|
|
setTime(time + 1);
|
|
|
}, 1000);
|
|
|
}
|
|
|
}
|
|
|
return function () {
|
|
|
clearTimeout(timer.current);
|
|
|
};
|
|
|
}, [time]);
|
|
|
var handleGoBack = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var str,
|
|
|
_args = arguments;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
str = _args.length > 0 && _args[0] !== undefined ? _args[0] : '未共享整个屏幕,禁止作答!';
|
|
|
message/* default */.ZP.warning(str);
|
|
|
setTimeout(function () {
|
|
|
onBack();
|
|
|
}, 1000);
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function handleGoBack() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var startLp = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
var _stream$current, _stream$current2, mediaStream, displaySurface;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
if ((0,util/* isChrome */.i7)()) {
|
|
|
_context2.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
handleGoBack('请使用谷歌浏览器答题');
|
|
|
return _context2.abrupt("return");
|
|
|
case 3:
|
|
|
if (!stream.current) {
|
|
|
_context2.next = 6;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.warning('正在录制中');
|
|
|
return _context2.abrupt("return");
|
|
|
case 6:
|
|
|
openActionRecord.current = true;
|
|
|
_context2.prev = 7;
|
|
|
_context2.next = 10;
|
|
|
return navigator.mediaDevices.getDisplayMedia({
|
|
|
video: {
|
|
|
displaySurface: 'monitor'
|
|
|
}
|
|
|
});
|
|
|
case 10:
|
|
|
mediaStream = _context2.sent;
|
|
|
stream.current = mediaStream;
|
|
|
displaySurface = (_stream$current = stream.current) === null || _stream$current === void 0 || (_stream$current = _stream$current.getVideoTracks()) === null || _stream$current === void 0 || (_stream$current = _stream$current[0]) === null || _stream$current === void 0 || (_stream$current = _stream$current.getSettings()) === null || _stream$current === void 0 ? void 0 : _stream$current.displaySurface; //火狐判断是否是选中的屏幕
|
|
|
// const label = stream.current?.getVideoTracks()?.[0]?.label
|
|
|
// if (isFirefox() && !!label) {
|
|
|
// stopLp()
|
|
|
// onBack()
|
|
|
// return
|
|
|
// }
|
|
|
if (!(displaySurface !== 'monitor')) {
|
|
|
_context2.next = 17;
|
|
|
break;
|
|
|
}
|
|
|
stopLp();
|
|
|
handleGoBack();
|
|
|
return _context2.abrupt("return");
|
|
|
case 17:
|
|
|
if ("srcObject" in video.current) {
|
|
|
video.current.srcObject = stream.current;
|
|
|
} else {
|
|
|
video.current.src = URL.createObjectURL(stream.current);
|
|
|
}
|
|
|
// 等待视频加载完成
|
|
|
_context2.next = 20;
|
|
|
return new Promise(function (resolve) {
|
|
|
video.current.addEventListener('loadedmetadata', function () {
|
|
|
resolve();
|
|
|
});
|
|
|
});
|
|
|
case 20:
|
|
|
(_stream$current2 = stream.current) === null || _stream$current2 === void 0 || (_stream$current2 = _stream$current2.getVideoTracks()) === null || _stream$current2 === void 0 || (_stream$current2 = _stream$current2[0]) === null || _stream$current2 === void 0 || _stream$current2.addEventListener('ended', function () {
|
|
|
if (openActionRecord.current) {
|
|
|
handleGoBack();
|
|
|
}
|
|
|
});
|
|
|
video.current.play();
|
|
|
onSuccuss();
|
|
|
_context2.next = 28;
|
|
|
break;
|
|
|
case 25:
|
|
|
_context2.prev = 25;
|
|
|
_context2.t0 = _context2["catch"](7);
|
|
|
handleGoBack('屏幕录制功能错误,请检查后再共享整个屏幕,否则无法作答');
|
|
|
case 28:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2, null, [[7, 25]]);
|
|
|
}));
|
|
|
return function startLp() {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var stopLp = function stopLp() {
|
|
|
var _stream$current3;
|
|
|
openActionRecord.current = false;
|
|
|
var tracks = (_stream$current3 = stream.current) === null || _stream$current3 === void 0 ? void 0 : _stream$current3.getTracks();
|
|
|
tracks === null || tracks === void 0 || tracks.forEach(function (track) {
|
|
|
track.stop();
|
|
|
});
|
|
|
stream.current = null;
|
|
|
};
|
|
|
var dataURLToBlob = function dataURLToBlob(dataURL) {
|
|
|
var base64String = dataURL.split(',')[1];
|
|
|
var mimeString = dataURL.split(',')[0].split(':')[1].split(';')[0];
|
|
|
var byteCharacters = toConsumableArray_default()(atob(base64String));
|
|
|
var byteArray = new Uint8Array(byteCharacters.map(function (_char) {
|
|
|
return _char.charCodeAt(0);
|
|
|
}));
|
|
|
return new Blob([byteArray], {
|
|
|
type: mimeString
|
|
|
});
|
|
|
};
|
|
|
var getDataId = /*#__PURE__*/function () {
|
|
|
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
_context3.next = 2;
|
|
|
return (0,fetch/* default */.ZP)("/api/exercises/".concat(id, "/exercise_user_screens.json"), {
|
|
|
method: 'post'
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context3.sent;
|
|
|
if (res.status === 0) {
|
|
|
exerciseAbnormityId.current = res.exercise_abnormity_id;
|
|
|
setTime(0);
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return function getDataId() {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var captureScreenshot = /*#__PURE__*/function () {
|
|
|
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
|
|
|
var ctx, dataURL, blob, file, formData, res, fileItem, save;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
ctx = canvas.current.getContext('2d');
|
|
|
canvas.current.width = video.current.videoWidth;
|
|
|
canvas.current.height = video.current.videoHeight;
|
|
|
ctx.drawImage(video.current, 0, 0, canvas.current.width, canvas.current.height);
|
|
|
dataURL = canvas.current.toDataURL('image/jpeg'); // 可以选择其他图像格式
|
|
|
// 将DataURL转换为Blob对象
|
|
|
blob = dataURLToBlob(dataURL); // 创建一个File对象
|
|
|
file = new File([blob], 'canvas_image.jpg', {
|
|
|
type: 'image/jpeg'
|
|
|
});
|
|
|
formData = new FormData();
|
|
|
formData.append('file', file);
|
|
|
_context4.next = 11;
|
|
|
return (0,fetch/* default */.ZP)("/api/exercises/".concat(id, "/exercise_user_screens/check.json"), {
|
|
|
method: 'get'
|
|
|
});
|
|
|
case 11:
|
|
|
res = _context4.sent;
|
|
|
if (!((res === null || res === void 0 ? void 0 : res.status) === 0)) {
|
|
|
_context4.next = 21;
|
|
|
break;
|
|
|
}
|
|
|
_context4.next = 15;
|
|
|
return (0,fetch/* default */.ZP)("/api/attachments.json", {
|
|
|
method: 'post',
|
|
|
body: formData
|
|
|
}, true);
|
|
|
case 15:
|
|
|
fileItem = _context4.sent;
|
|
|
if (!(fileItem !== null && fileItem !== void 0 && fileItem.id)) {
|
|
|
_context4.next = 21;
|
|
|
break;
|
|
|
}
|
|
|
_context4.next = 19;
|
|
|
return (0,fetch/* default */.ZP)("/api/exercises/".concat(id, "/exercise_user_screens.json"), {
|
|
|
method: 'post',
|
|
|
body: {
|
|
|
attachment_id: fileItem === null || fileItem === void 0 ? void 0 : fileItem.id,
|
|
|
exercise_abnormity_id: exerciseAbnormityId.current
|
|
|
}
|
|
|
});
|
|
|
case 19:
|
|
|
save = _context4.sent;
|
|
|
if (save.status === 0) {
|
|
|
exerciseAbnormityId.current = save.exercise_abnormity_id;
|
|
|
}
|
|
|
case 21:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
return function captureScreenshot() {
|
|
|
return _ref5.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("video", {
|
|
|
ref: video,
|
|
|
muted: true,
|
|
|
className: "hide"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("canvas", {
|
|
|
id: "canvas",
|
|
|
ref: canvas,
|
|
|
className: "hide"
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_ReactCaptureScreens = (ReactCaptureScreens);
|
|
|
// EXTERNAL MODULE: ./node_modules/_dayjs@1.11.10@dayjs/dayjs.min.js
|
|
|
var dayjs_min = __webpack_require__(9498);
|
|
|
var dayjs_min_default = /*#__PURE__*/__webpack_require__.n(dayjs_min);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Answer/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var Answermodules = ({"flex_box_center":"flex_box_center___ariLt","flex_space_between":"flex_space_between___MC6sH","flex_box_vertical_center":"flex_box_vertical_center___tJHfy","flex_box_center_end":"flex_box_center_end___AfB_t","flex_box_column":"flex_box_column___xX4Fj","bg":"bg___nHBEZ","wrapper":"wrapper___TZKl8","exerciseAlert":"exerciseAlert___QUMwm","title":"title___rj6Q0","content":"content___Te7Wz","baseMargin":"baseMargin___BRmsh","noWrap":"noWrap___X6AS3","singleItem":"singleItem___GkaDR","questionIcons":"questionIcons___XoGYC","green":"green___iIYnV","orange":"orange___EIhiL","greenTip":"greenTip___WwiUh","redTip":"redTip___aWSt4","orangeTip":"orangeTip___j5g_H","pollDesc":"pollDesc___yDT2Q","answered":"answered___d2hE7","unanswer":"unanswer___AdOhE","anchor":"anchor___z3CaP","answerFlag":"answerFlag___wwTKa","flagActive":"flagActive___piG3D","flagHalf":"flagHalf___E29dd","answerStudentFlag":"answerStudentFlag___HRVt8","answerStudentActive":"answerStudentActive___kM6r4","questionItem":"questionItem___q6Hgu","questionScore":"questionScore___RW5tm","itemType":"itemType___pPqzT","itemFlag":"itemFlag___j5TSr","answerWrap":"answerWrap___G9dnn","answerSubjective":"answerSubjective___LRVKJ","otherInput":"otherInput___SxNAw","submitButton":"submitButton___zPo7H","randomFlag":"randomFlag___TOZ2H","answerTrue":"answerTrue___fgIW0","answerFalse":"answerFalse___gAQD8","answerHalf":"answerHalf___h40sX","renderHtml":"renderHtml___UerV1","simpleText":"simpleText___ZKx7o","answerYes":"answerYes___AA0oM","answerNo":"answerNo___gMGLy","answerInfo":"answerInfo___tB4Wz","answerProgress":"answerProgress___CbmXy","answerSheetWrap":"answerSheetWrap___aPipx","answerSheetQuestionTitle":"answerSheetQuestionTitle___P18Ss","answerSheet":"answerSheet___yhxK1","answerSheetItem":"answerSheetItem___DIH2V","qindex":"qindex___XuKA8","markIcon":"markIcon___ZTkqb","active":"active___WSsrt","partialActive":"partialActive___K6lsa","selected":"selected___grFyM","countDown":"countDown___OzcWL","cnText":"cnText___TvFjV","red":"red___Mge1h","refreshBtn":"refreshBtn___lK1MX","fold":"fold___id0EJ","cardList":"cardList___xKhMX","withQrcode":"withQrcode___qphZK","iframe":"iframe___pMMQx","eduTip":"eduTip___hXWhK","eduQrcode":"eduQrcode____qxcx","eduVideo":"eduVideo___mufWJ","eduUsername":"eduUsername___tiufh","startAnswer":"startAnswer___AA7n5","eduSubmit":"eduSubmit___UPIsJ","eduTitle":"eduTitle___jCJrO","wrpAnswer":"wrpAnswer___AVK1Y","simpleMd":"simpleMd___ZGbXj","videomodal":"videomodal___bYarH","mainPart":"mainPart___Fqvw7","userInfoText":"userInfoText___nqL8p","answerSheetBottom":"answerSheetBottom___yXf5u","tooltipWrap":"tooltipWrap___AxG9B","leftPart":"leftPart___P4Ook","rightPart":"rightPart___De4P3","questionPart":"questionPart___GTq66","questionTypeTitle":"questionTypeTitle___r6Fo9","questionTypeInfo":"questionTypeInfo___JfpWv","toIframeBtn":"toIframeBtn___gRKtn","bottom":"bottom___coSlv","markBtn":"markBtn___ZCLGF","changeButton":"changeButton___sBTjl","prevBtn":"prevBtn___lgCPG","analysisWrap":"analysisWrap___JoCnb","greyBg":"greyBg___vgesc","fixHeader":"fixHeader___RoNxE","exerciseTitle":"exerciseTitle___Dtp56","commitModal":"commitModal___zqvNA","commitItem":"commitItem___mjYF6","commitInfoLabel":"commitInfoLabel___KtIjW","commitInfoValue":"commitInfoValue___DCyRn","cameraHeader":"cameraHeader___Pqhwb","dottedLineWrapper":"dottedLineWrapper___ONO9c","leftHalfCircle":"leftHalfCircle___RNJN7","dottedLine":"dottedLine___qWy4W","rightHalfCircle":"rightHalfCircle___s3_hr","orangeNum":"orangeNum___IYnup","teachAnalysis":"teachAnalysis___FH6fk","teachAnalysisModal":"teachAnalysisModal___RcKVp"});
|
|
|
// EXTERNAL MODULE: ./src/components/Exercise/ip.tsx
|
|
|
var Exercise_ip = __webpack_require__(56780);
|
|
|
// EXTERNAL MODULE: ./src/utils/authority.ts
|
|
|
var authority = __webpack_require__(13186);
|
|
|
// EXTERNAL MODULE: ./src/utils/fullscreen.ts
|
|
|
var fullscreen = __webpack_require__(69888);
|
|
|
// EXTERNAL MODULE: ./src/service/exercise.ts
|
|
|
var service_exercise = __webpack_require__(35367);
|
|
|
// EXTERNAL MODULE: ./src/service/shixuns.ts
|
|
|
var shixuns = __webpack_require__(25248);
|
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules
|
|
|
var RenderHtml = __webpack_require__(11436);
|
|
|
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 10 modules
|
|
|
var markdown_editor = __webpack_require__(83954);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Answer/components/Simple.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var scoreStatusMapping = {
|
|
|
0: 'c-red-ee4',
|
|
|
1: 'c-green'
|
|
|
};
|
|
|
var Simple = function Simple(_ref) {
|
|
|
var _answerData$exercise, _answerData$exercise2, _answerData$exercise3, _item$user_answer, _item$user_answer2, _item$standard_answer;
|
|
|
var item = _ref.item,
|
|
|
answerData = _ref.answerData,
|
|
|
isEducation = _ref.isEducation,
|
|
|
sign = _ref.sign,
|
|
|
_ref$onBlur = _ref.onBlur,
|
|
|
_onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur;
|
|
|
var value = (0,_react_17_0_2_react.useRef)("");
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
isShow = _useState2[0],
|
|
|
setIsShow = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
isFocus = _useState4[0],
|
|
|
setIsFocus = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(isEducation || false),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
showEditor = _useState6[0],
|
|
|
setShowEditor = _useState6[1];
|
|
|
var timeRef = (0,_react_17_0_2_react.useRef)();
|
|
|
var countDown = function countDown() {
|
|
|
clearInterval(timeRef.current);
|
|
|
timeRef.current = setInterval(function () {
|
|
|
if (isFocus) _onBlur(value.current, true);
|
|
|
}, 10 * 1000);
|
|
|
};
|
|
|
var onBeforeunload = function onBeforeunload(e) {
|
|
|
_onBlur(value.current);
|
|
|
var confirmationMessage = "确定离开此页面吗?此页数据可能会丢失";
|
|
|
(e || window.event).returnValue = confirmationMessage;
|
|
|
return confirmationMessage;
|
|
|
};
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
console.log("isFocus:", isFocus);
|
|
|
if (isFocus) {
|
|
|
// window.addEventListener('beforeunload', onBeforeunload)
|
|
|
countDown();
|
|
|
} else {
|
|
|
// window.removeEventListener('beforeunload', onBeforeunload)
|
|
|
}
|
|
|
}, [isFocus]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
setIsShow(item === null || item === void 0 ? void 0 : item.a_flag);
|
|
|
}, [item === null || item === void 0 ? void 0 : item.a_flag]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
return function () {
|
|
|
clearInterval(timeRef.current);
|
|
|
};
|
|
|
}, []);
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [(answerData === null || answerData === void 0 || (_answerData$exercise = answerData.exercise) === null || _answerData$exercise === void 0 ? void 0 : _answerData$exercise.user_exercise_status) === 1 ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "mb20",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-between",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: "\u6211\u7684\u7B54\u6848"
|
|
|
}), ((0,authority/* isAdmin */.GJ)() || (0,authority/* isStudent */.dE)() && (answerData === null || answerData === void 0 || (_answerData$exercise2 = answerData.exercise) === null || _answerData$exercise2 === void 0 ? void 0 : _answerData$exercise2.user_exercise_status) > 0 && (answerData === null || answerData === void 0 || (_answerData$exercise3 = answerData.exercise) === null || _answerData$exercise3 === void 0 ? void 0 : _answerData$exercise3.open_score)) && /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "end",
|
|
|
className: "mb20",
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font14",
|
|
|
style: {
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u5F97\u5206"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font14 ml10",
|
|
|
children: [(item === null || item === void 0 ? void 0 : item.user_score) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: scoreStatusMapping[Number(item === null || item === void 0 ? void 0 : item.answer_status)] || 'c-orange-ff9',
|
|
|
children: item === null || item === void 0 ? void 0 : item.user_score
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
marginLeft: 5,
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u5206"
|
|
|
})]
|
|
|
}), !(item !== null && item !== void 0 && item.user_score) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-red",
|
|
|
children: "\u672A\u8BC4"
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Answermodules.simpleText,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item === null || item === void 0 || (_item$user_answer = item.user_answer) === null || _item$user_answer === void 0 ? void 0 : _item$user_answer[0]
|
|
|
})
|
|
|
})]
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: item.user_score && (item.user_score === item.question_score ? "c-green" : "c-red"),
|
|
|
children: showEditor ? /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z
|
|
|
// hidetoolBar={true}
|
|
|
// hidetoolBar={document.domain === "kepukehuan.educoder.net"}
|
|
|
// height={isEducation ? "60vh" : 150}
|
|
|
, {
|
|
|
watch: true,
|
|
|
isFocus: true,
|
|
|
defaultValue: item === null || item === void 0 || (_item$user_answer2 = item.user_answer) === null || _item$user_answer2 === void 0 ? void 0 : _item$user_answer2[0],
|
|
|
id: item === null || item === void 0 ? void 0 : item.question_id,
|
|
|
className: "mt20",
|
|
|
onChange: function onChange(v) {
|
|
|
value.current = v;
|
|
|
setIsFocus(true);
|
|
|
},
|
|
|
onBlur: function onBlur() {
|
|
|
setTimeout(function () {
|
|
|
_onBlur(value.current);
|
|
|
}, 200);
|
|
|
clearInterval(timeRef.current);
|
|
|
setIsFocus(false);
|
|
|
}
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
onClick: function onClick() {
|
|
|
var _item$user_answer3;
|
|
|
if (!item.repeat_answer && (item === null || item === void 0 || (_item$user_answer3 = item.user_answer) === null || _item$user_answer3 === void 0 ? void 0 : _item$user_answer3.length) > 0 && item.ques_status !== 0) {
|
|
|
message/* default */.ZP.warning('该题不允许再修改答案');
|
|
|
return;
|
|
|
}
|
|
|
sign.current = true;
|
|
|
setShowEditor(true);
|
|
|
},
|
|
|
className: Answermodules.startAnswer,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "c-blue",
|
|
|
children: "\u70B9\u51FB\u5F00\u59CB\u4F5C\u7B54"
|
|
|
})
|
|
|
})
|
|
|
}), (0,authority/* isStudent */.dE)() && (item === null || item === void 0 ? void 0 : item.standard_answer) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Answermodules.analysisWrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Answermodules.greyBg,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: "mb20",
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
className: "font14 mr10",
|
|
|
style: {
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u3010\u7B54\u6848\u3011"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item === null || item === void 0 || (_item$standard_answer = item.standard_answer) === null || _item$standard_answer === void 0 ? void 0 : _item$standard_answer[0]
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font14 mr10",
|
|
|
style: {
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u3010\u89E3\u6790\u3011"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
className: Answermodules.renderHtml,
|
|
|
value: item === null || item === void 0 ? void 0 : item.analysis
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_Simple = (Simple);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/select/index.js
|
|
|
var es_select = __webpack_require__(57809);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Answer/components/Simple2.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Simple2_Simple = function Simple(_ref) {
|
|
|
var _answerData$exercise, _item$user_answer, _item$user_answer2, _item$standard_answer;
|
|
|
var item = _ref.item,
|
|
|
answerData = _ref.answerData,
|
|
|
isEducation = _ref.isEducation,
|
|
|
_ref$onBlur = _ref.onBlur,
|
|
|
_onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur;
|
|
|
var value = (0,_react_17_0_2_react.useRef)("");
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
isShow = _useState2[0],
|
|
|
setIsShow = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
isFull = _useState4[0],
|
|
|
setIsFull = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
isFocus = _useState6[0],
|
|
|
setIsFocus = _useState6[1];
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)(isEducation || false),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
showEditor = _useState8[0],
|
|
|
setShowEditor = _useState8[1];
|
|
|
var _useState9 = (0,_react_17_0_2_react.useState)(0),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
update = _useState10[0],
|
|
|
setUpdate = _useState10[1];
|
|
|
var title = (0,_react_17_0_2_react.useRef)(item.kp_content || "");
|
|
|
var type = (0,_react_17_0_2_react.useRef)(item.kp_clazz);
|
|
|
var timeRef = (0,_react_17_0_2_react.useRef)();
|
|
|
var totalNum = (0,_react_17_0_2_react.useMemo)(function () {
|
|
|
var _value$current;
|
|
|
return (_value$current = value.current) === null || _value$current === void 0 || (_value$current = _value$current.replace(/[\n|\r|\t]/g, "")) === null || _value$current === void 0 ? void 0 : _value$current.length;
|
|
|
}, [value.current]);
|
|
|
var countDown = function countDown() {
|
|
|
clearInterval(timeRef.current);
|
|
|
timeRef.current = setInterval(function () {
|
|
|
if (isFocus) _onBlur(value.current, title.current, type.current);
|
|
|
}, 30 * 1000);
|
|
|
};
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
console.log("isFocus:", isFocus);
|
|
|
countDown();
|
|
|
}, [isFocus]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
setIsShow(item === null || item === void 0 ? void 0 : item.a_flag);
|
|
|
}, [item === null || item === void 0 ? void 0 : item.a_flag]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
return function () {
|
|
|
clearInterval(timeRef.current);
|
|
|
};
|
|
|
}, []);
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [(answerData === null || answerData === void 0 || (_answerData$exercise = answerData.exercise) === null || _answerData$exercise === void 0 ? void 0 : _answerData$exercise.user_exercise_status) === 1 ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "mt30",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("strong", {
|
|
|
children: "\u4F5C\u6587\u9898\u76EE\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
disabled: true,
|
|
|
className: "mt10",
|
|
|
value: title.current,
|
|
|
onChange: function onChange(e) {
|
|
|
title.current = e.target.value;
|
|
|
setUpdate(update + 1);
|
|
|
},
|
|
|
onBlur: function onBlur() {
|
|
|
_onBlur(value.current, title.current, type.current);
|
|
|
setIsFocus(false);
|
|
|
}
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "mt30",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("strong", {
|
|
|
children: "\u4F5C\u54C1\u7C7B\u578B\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_select["default"], {
|
|
|
disabled: true,
|
|
|
className: "mt10 w100",
|
|
|
placeholder: "\u8BF7\u9009\u62E9\u4F5C\u54C1\u7C7B\u578B",
|
|
|
value: type.current,
|
|
|
onChange: function onChange(value) {
|
|
|
type.current = value;
|
|
|
setUpdate(update + 1);
|
|
|
},
|
|
|
onBlur: function onBlur() {
|
|
|
_onBlur(value.current, title.current, type.current);
|
|
|
setIsFocus(false);
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
|
|
|
value: "科普",
|
|
|
children: "\u79D1\u666E"
|
|
|
}, 1), /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
|
|
|
value: "科幻",
|
|
|
children: "\u79D1\u5E7B"
|
|
|
}, 2)]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "mt10 mb0",
|
|
|
children: "\u4F5C\u54C1\u5185\u5BB9\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Answermodules.simpleText,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item === null || item === void 0 || (_item$user_answer = item.user_answer) === null || _item$user_answer === void 0 ? void 0 : _item$user_answer[0]
|
|
|
})
|
|
|
})]
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "mt30",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("strong", {
|
|
|
children: "\u4F5C\u6587\u9898\u76EE\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
className: "mt10",
|
|
|
maxLength: 60,
|
|
|
onBlur: function onBlur() {
|
|
|
return _onBlur(value.current, title.current, type.current);
|
|
|
},
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u4F5C\u6587\u9898\u76EE(\u6700\u591A60\u4E2A\u5B57)",
|
|
|
value: title.current,
|
|
|
onChange: function onChange(e) {
|
|
|
title.current = e.target.value;
|
|
|
setUpdate(update + 1);
|
|
|
}
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "mt30",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("strong", {
|
|
|
children: "\u4F5C\u6587\u7C7B\u578B\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_select["default"], {
|
|
|
className: "mt10 w100",
|
|
|
placeholder: "\u8BF7\u9009\u62E9\u4F5C\u54C1\u7C7B\u578B",
|
|
|
value: type.current,
|
|
|
onChange: function onChange(value) {
|
|
|
type.current = value;
|
|
|
_onBlur(value.current, title.current, type.current);
|
|
|
setUpdate(update + 1);
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
|
|
|
value: "科普",
|
|
|
children: "\u79D1\u666E"
|
|
|
}, 1), /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
|
|
|
value: "科幻",
|
|
|
children: "\u79D1\u5E7B"
|
|
|
}, 2)]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt30 mb20",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: item.user_score && (item.user_score === item.question_score ? "c-green" : "c-red"),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("strong", {
|
|
|
children: "\u4F5C\u6587\u5185\u5BB9\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "mt10 relative",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "c-blue",
|
|
|
style: {
|
|
|
position: isFull ? "fixed" : "absolute",
|
|
|
top: isFull ? 61 : 4,
|
|
|
left: 10,
|
|
|
zIndex: 106
|
|
|
},
|
|
|
children: ["\u5DF2\u8F93\u5165", totalNum, "\u5B57"]
|
|
|
}), showEditor ? /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
className: Answermodules.simpleMd,
|
|
|
disablePaste: true,
|
|
|
hidetoolBar: isEducation,
|
|
|
height: isEducation ? "60vh" : 150,
|
|
|
isFocus: true,
|
|
|
defaultValue: item === null || item === void 0 || (_item$user_answer2 = item.user_answer) === null || _item$user_answer2 === void 0 ? void 0 : _item$user_answer2[0],
|
|
|
id: item === null || item === void 0 ? void 0 : item.question_id,
|
|
|
onFullScreen: function onFullScreen(status) {
|
|
|
return setIsFull(status);
|
|
|
},
|
|
|
onChange: function onChange(v) {
|
|
|
value.current = v;
|
|
|
setIsFocus(true);
|
|
|
setUpdate(update + 1);
|
|
|
},
|
|
|
onBlur: function onBlur() {
|
|
|
_onBlur(value.current, title.current, type.current);
|
|
|
setIsFocus(false);
|
|
|
}
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
onClick: function onClick() {
|
|
|
return setShowEditor(true);
|
|
|
},
|
|
|
className: Answermodules.startAnswer,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "c-blue",
|
|
|
children: "\u70B9\u51FB\u5F00\u59CB\u4F5C\u7B54"
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
}), (0,authority/* isStudent */.dE)() && (item === null || item === void 0 ? void 0 : item.standard_answer) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "mt10 mb0",
|
|
|
children: "\u53C2\u8003\u7B54\u6848\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
border: "1px solid #eee",
|
|
|
background: "#f5f5f5",
|
|
|
borderRadius: 4,
|
|
|
padding: 5
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item === null || item === void 0 || (_item$standard_answer = item.standard_answer) === null || _item$standard_answer === void 0 ? void 0 : _item$standard_answer[0]
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var Simple2 = (Simple2_Simple);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/anchor/index.js + 4 modules
|
|
|
var es_anchor = __webpack_require__(79817);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/table/index.js + 85 modules
|
|
|
var table = __webpack_require__(72315);
|
|
|
// EXTERNAL MODULE: ./src/components/monaco-editor/index.jsx + 3 modules
|
|
|
var monaco_editor = __webpack_require__(76329);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Answer/components/UserScore/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var UserScoremodules = ({"score":"score___mcGn7","wrap":"wrap___h11sQ"});
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Answer/components/UserScore/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var UserScore = function UserScore(_ref) {
|
|
|
var score = _ref.score;
|
|
|
return score ? /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: UserScoremodules.wrap,
|
|
|
children: ["\u5F97\u5206", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "".concat(UserScoremodules.score, " ml10 mr5"),
|
|
|
children: score
|
|
|
}), "\u5206"]
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-red",
|
|
|
children: "\u672A\u8BC4"
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_UserScore = (UserScore);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Answer/components/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var componentsmodules = ({"flex_box_center":"flex_box_center___xK64P","flex_space_between":"flex_space_between___BNBCA","flex_box_vertical_center":"flex_box_vertical_center___ConJK","flex_box_center_end":"flex_box_center_end___L08sz","flex_box_column":"flex_box_column___hvk0E","shixunWrp":"shixunWrp___FTFC6","fill":"fill___H_Qd6","index":"index___PaSVJ","success":"success___fz_F7","fail":"fail___ftXSv","fillInput":"fillInput___q_sSb","shixunWrapper":"shixunWrapper___toGqF","score":"score___AsYGZ","name":"name___hawfX","programWrapper":"programWrapper___zVQPT","desc":"desc___MFIu5","content":"content___QuE41","analysisWrap":"analysisWrap___qGPzJ","greyBg":"greyBg___FIDIB"});
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Answer/components/Shixun.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Shixun_scoreStatusMapping = {
|
|
|
0: 'c-red-ee4',
|
|
|
1: 'c-green'
|
|
|
};
|
|
|
var Shixun = function Shixun(_ref) {
|
|
|
var _item$shixun, _item$shixun2, _answerData$exercise, _answerData$exercise2, _item$shixun3;
|
|
|
var item = _ref.item,
|
|
|
answerData = _ref.answerData,
|
|
|
exerciseId = _ref.exerciseId,
|
|
|
coursesId = _ref.coursesId;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
data = _useState2[0],
|
|
|
setData = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
challengeData = _useState4[0],
|
|
|
setChallengeData = _useState4[1];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var _item$shixun_details;
|
|
|
if (!(item !== null && item !== void 0 && (_item$shixun_details = item.shixun_details) !== null && _item$shixun_details !== void 0 && _item$shixun_details.length)) {
|
|
|
return;
|
|
|
}
|
|
|
var shixun = [];
|
|
|
var challenge = [];
|
|
|
var _loop = function _loop() {
|
|
|
var _item$shixun_details4;
|
|
|
for (var j = 0; j < (item === null || item === void 0 ? void 0 : item.shixun_details[i].stage_list.length); j++) {
|
|
|
var _item$shixun_details3;
|
|
|
var shixunItem = item === null || item === void 0 ? void 0 : item.shixun_details[i].stage_list[j];
|
|
|
shixun.push(objectSpread2_default()(objectSpread2_default()({}, shixunItem), {
|
|
|
operation: item === null || item === void 0 || (_item$shixun_details3 = item.shixun_details) === null || _item$shixun_details3 === void 0 || (_item$shixun_details3 = _item$shixun_details3[i]) === null || _item$shixun_details3 === void 0 || (_item$shixun_details3 = _item$shixun_details3.shixun_detail) === null || _item$shixun_details3 === void 0 || (_item$shixun_details3 = _item$shixun_details3[0]) === null || _item$shixun_details3 === void 0 ? void 0 : _item$shixun_details3.game_identifier,
|
|
|
is_jupyter: item === null || item === void 0 ? void 0 : item.is_jupyter,
|
|
|
is_jupyter_lab: item === null || item === void 0 ? void 0 : item.is_jupyter_lab
|
|
|
}));
|
|
|
}
|
|
|
if (item !== null && item !== void 0 && (_item$shixun_details4 = item.shixun_details) !== null && _item$shixun_details4 !== void 0 && (_item$shixun_details4 = _item$shixun_details4[i]) !== null && _item$shixun_details4 !== void 0 && _item$shixun_details4.shixun_detail) {
|
|
|
var _item$shixun_details5, _item$shixun_details$;
|
|
|
var finishedChallenge = item === null || item === void 0 || (_item$shixun_details5 = item.shixun_details) === null || _item$shixun_details5 === void 0 || (_item$shixun_details5 = _item$shixun_details5[i]) === null || _item$shixun_details5 === void 0 || (_item$shixun_details5 = _item$shixun_details5.shixun_detail) === null || _item$shixun_details5 === void 0 ? void 0 : _item$shixun_details5[0];
|
|
|
var userScore = item === null || item === void 0 || (_item$shixun_details$ = item.shixun_details[i].stage_list) === null || _item$shixun_details$ === void 0 || (_item$shixun_details$ = _item$shixun_details$.find(function (stageListItem) {
|
|
|
return (stageListItem === null || stageListItem === void 0 ? void 0 : stageListItem.game_identifier) === (finishedChallenge === null || finishedChallenge === void 0 ? void 0 : finishedChallenge.game_identifier);
|
|
|
})) === null || _item$shixun_details$ === void 0 ? void 0 : _item$shixun_details$.user_score;
|
|
|
challenge.push(objectSpread2_default()(objectSpread2_default()({}, finishedChallenge), {}, {
|
|
|
user_score: userScore
|
|
|
}));
|
|
|
}
|
|
|
};
|
|
|
for (var i = 0; i < (item === null || item === void 0 || (_item$shixun_details2 = item.shixun_details) === null || _item$shixun_details2 === void 0 ? void 0 : _item$shixun_details2.length); i++) {
|
|
|
var _item$shixun_details2;
|
|
|
_loop();
|
|
|
}
|
|
|
setChallengeData(challenge);
|
|
|
setData(shixun);
|
|
|
}, [item === null || item === void 0 ? void 0 : item.shixun_details]);
|
|
|
var columns = [{
|
|
|
title: "关卡",
|
|
|
dataIndex: "position",
|
|
|
key: "position",
|
|
|
align: 'center'
|
|
|
}, {
|
|
|
title: "任务名称",
|
|
|
dataIndex: "name",
|
|
|
key: "name",
|
|
|
align: 'center',
|
|
|
render: function render(name) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "overflowHidden1",
|
|
|
style: {
|
|
|
maxWidth: "400px"
|
|
|
},
|
|
|
title: name && name.length > 25 ? name : "",
|
|
|
children: name
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: "评测次数",
|
|
|
dataIndex: "evaluate_count",
|
|
|
key: "evaluate_count",
|
|
|
align: 'center',
|
|
|
render: function render(testCount, item) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: item.evaluate_count ? item.evaluate_count : /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "color-grey-9",
|
|
|
children: "--"
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: "完成时间",
|
|
|
key: "endTime",
|
|
|
dataIndex: "endTime",
|
|
|
align: 'center',
|
|
|
render: function render(endTime, item) {
|
|
|
var timeOver = false;
|
|
|
if (item.finished_time && answerData !== null && answerData !== void 0 && answerData.exercise && answerData !== null && answerData !== void 0 && answerData.exercise_answer_user) {
|
|
|
// issue#29511 exercise.time -1没有设置答题的时间限制,则比较完成时间和试卷截至时间
|
|
|
if ((answerData === null || answerData === void 0 ? void 0 : answerData.exercise.time) === -1) {
|
|
|
timeOver = dayjs_min_default()(answerData === null || answerData === void 0 ? void 0 : answerData.exercise.end_time).isBefore(item.finished_time);
|
|
|
} else {
|
|
|
timeOver = dayjs_min_default()(answerData === null || answerData === void 0 ? void 0 : answerData.exercise_answer_user.start_at).add(answerData === null || answerData === void 0 ? void 0 : answerData.exercise.time, "m").isBefore(item.finished_time);
|
|
|
}
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [item.finished_time || /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-grey-999",
|
|
|
children: "--"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-orange-ff9 ",
|
|
|
children: timeOver ? "(已超时)" : ""
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: "耗时",
|
|
|
dataIndex: "time_consuming",
|
|
|
key: "time_consuming",
|
|
|
align: 'center',
|
|
|
render: function render(time, item) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: item.time_consuming || /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "color-grey-9",
|
|
|
children: "--"
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: "查看答案",
|
|
|
dataIndex: "view_answer",
|
|
|
key: "view_answer",
|
|
|
align: 'center',
|
|
|
render: function render(exp, item) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: item.view_answer ? "已查看" : "未查看"
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: '得分',
|
|
|
dataIndex: 'user_score',
|
|
|
key: 'user_score',
|
|
|
align: 'center',
|
|
|
render: function render(score) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
style: {
|
|
|
color: '#FA6400'
|
|
|
},
|
|
|
children: [score, "\u5206"]
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: "操作",
|
|
|
dataIndex: "operation",
|
|
|
key: "operation",
|
|
|
align: 'center',
|
|
|
render: function render(value, data, index) {
|
|
|
return value && !data.is_jupyter && !data.is_jupyter_lab ? /*#__PURE__*/(0,jsx_runtime.jsx)(es_anchor/* default */.Z, {
|
|
|
affix: false,
|
|
|
className: "mt10",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_anchor/* default */.Z.Link, {
|
|
|
href: "#challenge_".concat(item === null || item === void 0 ? void 0 : item.question_id).concat(index),
|
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#0152d9',
|
|
|
fontSize: 14
|
|
|
},
|
|
|
children: "\u67E5\u770B"
|
|
|
})
|
|
|
})
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-grey-999",
|
|
|
children: "--"
|
|
|
});
|
|
|
}
|
|
|
}];
|
|
|
console.log(challengeData);
|
|
|
var options = {
|
|
|
selectOnLineNumbers: true,
|
|
|
readOnly: true,
|
|
|
minimap: {
|
|
|
enabled: false
|
|
|
},
|
|
|
scrollBeyondLastLine: false
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [(item === null || item === void 0 || (_item$shixun = item.shixun) === null || _item$shixun === void 0 ? void 0 : _item$shixun.length) > 0 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: componentsmodules.shixunWrapper,
|
|
|
children: item === null || item === void 0 || (_item$shixun2 = item.shixun) === null || _item$shixun2 === void 0 ? void 0 : _item$shixun2.map(function (val, key) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: "mb20",
|
|
|
justify: "space-between",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: componentsmodules.score,
|
|
|
children: ["(", val.challenge_score, "\u5206)"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: componentsmodules.name,
|
|
|
children: [val.challenge_name, " "]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: [!val.answer_status && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font14",
|
|
|
style: {
|
|
|
color: '#FA6400'
|
|
|
},
|
|
|
children: "\u672A\u5B8C\u6210"
|
|
|
}), !!val.answer_status && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font14",
|
|
|
style: {
|
|
|
color: '#37AD83'
|
|
|
},
|
|
|
children: "\u5DF2\u5B8C\u6210"
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
})
|
|
|
}), (answerData === null || answerData === void 0 || (_answerData$exercise = answerData.exercise) === null || _answerData$exercise === void 0 ? void 0 : _answerData$exercise.student_commit_status) !== 0 || (answerData === null || answerData === void 0 || (_answerData$exercise2 = answerData.exercise) === null || _answerData$exercise2 === void 0 ? void 0 : _answerData$exercise2.user_exercise_status) !== 0 ? /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [!!(data !== null && data !== void 0 && data.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-between",
|
|
|
className: "mb10",
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
className: "font14 c-grey-666",
|
|
|
children: "\u9636\u6BB5\u6210\u7EE9"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(components_UserScore, {
|
|
|
score: item === null || item === void 0 ? void 0 : item.user_score
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
|
|
|
columns: columns,
|
|
|
dataSource: data,
|
|
|
pagination: false
|
|
|
})]
|
|
|
}), !!(challengeData !== null && challengeData !== void 0 && challengeData.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "font16 c-grey-666 mt10",
|
|
|
children: "\u5B9E\u8BAD\u8BE6\u60C5"
|
|
|
}), challengeData === null || challengeData === void 0 ? void 0 : challengeData.map(function (chanllenge, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
id: "challenge_".concat(item === null || item === void 0 ? void 0 : item.question_id).concat(index),
|
|
|
className: "mt5",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font14 mr15",
|
|
|
children: [" \u7B2C", chanllenge.position, "\u5173"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
|
className: "current c-black font14",
|
|
|
target: "_blank",
|
|
|
to: "/tasks/".concat(coursesId, "/").concat(exerciseId, "/").concat(chanllenge.game_identifier, "/exercise"),
|
|
|
children: chanllenge.name
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
style: {
|
|
|
marginLeft: 'auto'
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(components_UserScore, {
|
|
|
score: chanllenge.user_score
|
|
|
})
|
|
|
})]
|
|
|
}), (chanllenge === null || chanllenge === void 0 ? void 0 : chanllenge.st) === 0 && chanllenge.passed_code && /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
className: componentsmodules.shixunWrp,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("h2", {
|
|
|
children: ["\u7B2C\u4E00\u6B21\u901A\u5173\u7684\u4EE3\u7801\uFF08\u672A\u901A\u5173\u5219\u4E3A\u6700\u540E\u4E00\u6B21\u63D0\u4EA4\u8BC4\u6D4B\u7684\u4EE3\u7801\uFF09", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-light-black",
|
|
|
children: chanllenge.path
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(monaco_editor/* default */.ZP, {
|
|
|
height: 300,
|
|
|
language: "python",
|
|
|
theme: "default",
|
|
|
value: chanllenge.passed_code,
|
|
|
options: options
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
})]
|
|
|
})]
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [(0,authority/* isStudent */.dE)() && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
className: "c-grey-999 mt20 mb20",
|
|
|
value: item === null || item === void 0 ? void 0 : item.question_title
|
|
|
}), item === null || item === void 0 || (_item$shixun3 = item.shixun) === null || _item$shixun3 === void 0 ? void 0 : _item$shixun3.map(function (shixun, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
className: "font16 c-grey-666 mb5",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "mr20",
|
|
|
children: ["\u7B2C", shixun === null || shixun === void 0 ? void 0 : shixun.challenge_position, "\u5173 ", shixun === null || shixun === void 0 ? void 0 : shixun.challenge_name]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [shixun === null || shixun === void 0 ? void 0 : shixun.challenge_score, "\u5206"]
|
|
|
})]
|
|
|
}, index);
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_Shixun = (Shixun);
|
|
|
// EXTERNAL MODULE: ./node_modules/_js-base64@2.6.4@js-base64/base64.js
|
|
|
var base64 = __webpack_require__(24334);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Answer/components/Program.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Program_scoreStatusMapping = {
|
|
|
0: 'c-red-ee4',
|
|
|
1: 'c-green'
|
|
|
};
|
|
|
var Program = function Program(_ref) {
|
|
|
var _answerData$exercise, _answerData$exercise2, _answerData$exercise3;
|
|
|
var item = _ref.item,
|
|
|
answerData = _ref.answerData;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
data = _useState2[0],
|
|
|
setData = _useState2[1];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var _item$evaluate_codes;
|
|
|
if ((item === null || item === void 0 || (_item$evaluate_codes = item.evaluate_codes) === null || _item$evaluate_codes === void 0 ? void 0 : _item$evaluate_codes.length) > 0) {
|
|
|
var _item$evaluate_codes2;
|
|
|
setData(item === null || item === void 0 || (_item$evaluate_codes2 = item.evaluate_codes) === null || _item$evaluate_codes2 === void 0 ? void 0 : _item$evaluate_codes2.map(function (code, index) {
|
|
|
return {
|
|
|
key: index + 1,
|
|
|
error_msg: code !== null && code !== void 0 && code.error_msg ? base64.Base64.decode(code === null || code === void 0 ? void 0 : code.error_msg) : ''
|
|
|
};
|
|
|
}));
|
|
|
} else {
|
|
|
setData([{
|
|
|
key: "--",
|
|
|
error_msg: "--"
|
|
|
}]);
|
|
|
}
|
|
|
}, [item === null || item === void 0 ? void 0 : item.evaluate_codes]);
|
|
|
var columns = [{
|
|
|
title: '评测次数',
|
|
|
dataIndex: 'key',
|
|
|
width: "127px",
|
|
|
key: 'key',
|
|
|
align: 'center',
|
|
|
render: function render(text, record) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: record.key
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: '详细信息',
|
|
|
dataIndex: 'error_msg',
|
|
|
key: 'error_msg',
|
|
|
align: 'center',
|
|
|
render: function render(text, record) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: record.error_msg ? record.error_msg : "--"
|
|
|
});
|
|
|
}
|
|
|
}];
|
|
|
var options = {
|
|
|
selectOnLineNumbers: true,
|
|
|
readOnly: true,
|
|
|
minimap: {
|
|
|
enabled: false
|
|
|
},
|
|
|
scrollBeyondLastLine: false
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "".concat(componentsmodules.programWrapper),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: componentsmodules.desc,
|
|
|
children: "\u9898\u76EE\u63CF\u8FF0"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: componentsmodules.content,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item === null || item === void 0 ? void 0 : item.description
|
|
|
})
|
|
|
}), (answerData === null || answerData === void 0 || (_answerData$exercise = answerData.exercise) === null || _answerData$exercise === void 0 ? void 0 : _answerData$exercise.user_exercise_status) === 1 && /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-between",
|
|
|
className: "mt40",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
style: {
|
|
|
fontSize: 14,
|
|
|
color: '#666666'
|
|
|
},
|
|
|
children: "\u6211\u7684\u7B54\u6848"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(components_UserScore, {
|
|
|
score: item === null || item === void 0 ? void 0 : item.user_score
|
|
|
})
|
|
|
})]
|
|
|
}), (item === null || item === void 0 ? void 0 : item.passed_code) && /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
className: componentsmodules.shixunWrp,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("h3", {
|
|
|
children: "\u7B2C\u4E00\u6B21\u8BC4\u6D4B\u901A\u8FC7\u7684\u4EE3\u7801\uFF08\u672A\u901A\u5173\u5219\u4E3A\u6700\u540E\u4E00\u6B21\u63D0\u4EA4\u8BC4\u6D4B\u7684\u4EE3\u7801\uFF09"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(monaco_editor/* default */.ZP, {
|
|
|
style: {
|
|
|
border: '1px solid #ccc'
|
|
|
},
|
|
|
height: 300,
|
|
|
language: "python",
|
|
|
theme: "vs-light",
|
|
|
value: item !== null && item !== void 0 && item.passed_code ? base64.Base64.decode(item === null || item === void 0 ? void 0 : item.passed_code) : "",
|
|
|
options: options
|
|
|
})]
|
|
|
}), (answerData === null || answerData === void 0 || (_answerData$exercise2 = answerData.exercise) === null || _answerData$exercise2 === void 0 ? void 0 : _answerData$exercise2.user_exercise_status) === 1 && (answerData === null || answerData === void 0 || (_answerData$exercise3 = answerData.exercise) === null || _answerData$exercise3 === void 0 ? void 0 : _answerData$exercise3.answer_open) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
background: "#F6F7F9"
|
|
|
},
|
|
|
className: "mt30",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
padding: "20px",
|
|
|
fontSize: "16px",
|
|
|
display: "flex"
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
whiteSpace: "nowrap"
|
|
|
},
|
|
|
children: "\u3010\u89E3\u6790\u3011"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: (item === null || item === void 0 ? void 0 : item.analysis) || '暂无解析'
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_Program = (Program);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Answer/components/Fill.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TextArea = input/* default */.Z.TextArea;
|
|
|
var Fill_scoreStatusMapping = {
|
|
|
0: 'c-red-ee4',
|
|
|
1: 'c-green'
|
|
|
};
|
|
|
var Fill = function Fill(_ref) {
|
|
|
var _answerData$exercise, _answerData$exercise2, _item$standard_answer, _item$standard_answer2;
|
|
|
var sign = _ref.sign,
|
|
|
item = _ref.item,
|
|
|
answerData = _ref.answerData,
|
|
|
_ref$onBlur = _ref.onBlur,
|
|
|
_onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
userAnswer = _useState2[0],
|
|
|
setUserAnswer = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
saveStatusArr = _useState4[0],
|
|
|
setSaveStatusArr = _useState4[1];
|
|
|
var currentData = (0,_react_17_0_2_react.useRef)();
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var data = [];
|
|
|
var _loop = function _loop(i) {
|
|
|
var _item$user_answer;
|
|
|
var param = (item === null || item === void 0 || (_item$user_answer = item.user_answer) === null || _item$user_answer === void 0 ? void 0 : _item$user_answer.find(function (e) {
|
|
|
return e.choice_id === i + 1;
|
|
|
})) || {
|
|
|
choice_id: i + 1,
|
|
|
answer_text: ''
|
|
|
};
|
|
|
data.push(objectSpread2_default()({}, param));
|
|
|
};
|
|
|
for (var i = 0; i < (item === null || item === void 0 ? void 0 : item.multi_count); i++) {
|
|
|
_loop(i);
|
|
|
}
|
|
|
currentData.current = data;
|
|
|
setUserAnswer(data);
|
|
|
}, [item === null || item === void 0 ? void 0 : item.user_answer]);
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [userAnswer === null || userAnswer === void 0 ? void 0 : userAnswer.map(function (answer, index) {
|
|
|
var _item$user_answer2, _saveStatusArr$index, _saveStatusArr$index2, _saveStatusArr$index3;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: "".concat(componentsmodules.baseMargin, " ").concat(componentsmodules.fill),
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: componentsmodules.index,
|
|
|
children: ["\u586B\u7A7A\u9879", index + 1]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: '430px',
|
|
|
className: "ml20 mr20",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u7B54\u6848",
|
|
|
disabled: !item.repeat_answer && (item === null || item === void 0 || (_item$user_answer2 = item.user_answer) === null || _item$user_answer2 === void 0 ? void 0 : _item$user_answer2.length) > 0 && item.ques_status !== 0 || !!(answerData !== null && answerData !== void 0 && answerData.exercise.commit_status),
|
|
|
value: answer === null || answer === void 0 ? void 0 : answer.answer_text,
|
|
|
onChange: function onChange(e) {
|
|
|
userAnswer[index].answer_text = e.target.value;
|
|
|
setUserAnswer(toConsumableArray_default()(userAnswer));
|
|
|
},
|
|
|
onFocus: function onFocus() {
|
|
|
sign.current = true;
|
|
|
},
|
|
|
onBlur: function onBlur(e) {
|
|
|
setTimeout( /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var res, newArr, _newArr;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return _onBlur(answer === null || answer === void 0 ? void 0 : answer.answer_text, index + 1, userAnswer);
|
|
|
case 2:
|
|
|
res = _context.sent;
|
|
|
if (!res.status) {
|
|
|
newArr = saveStatusArr.slice();
|
|
|
newArr[index] = {
|
|
|
status: 'success',
|
|
|
errorText: ''
|
|
|
};
|
|
|
setSaveStatusArr(newArr);
|
|
|
} else {
|
|
|
_newArr = saveStatusArr.slice();
|
|
|
_newArr[index] = {
|
|
|
status: 'fail',
|
|
|
errorText: res.message
|
|
|
};
|
|
|
setSaveStatusArr(_newArr);
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
})), 200);
|
|
|
},
|
|
|
className: "".concat(item.user_score && (item.user_score === item.question_score ? "c-green" : "c-red"), " ").concat(componentsmodules.fillInput)
|
|
|
})
|
|
|
}), ((_saveStatusArr$index = saveStatusArr[index]) === null || _saveStatusArr$index === void 0 ? void 0 : _saveStatusArr$index.status) === "success" && /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
style: {
|
|
|
marginRight: 8
|
|
|
},
|
|
|
className: "iconfont icon-chenggong1 ".concat(componentsmodules.success)
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: componentsmodules.success,
|
|
|
children: "\u4FDD\u5B58\u6210\u529F"
|
|
|
})]
|
|
|
})
|
|
|
}), ((_saveStatusArr$index2 = saveStatusArr[index]) === null || _saveStatusArr$index2 === void 0 ? void 0 : _saveStatusArr$index2.status) === "fail" && /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
style: {
|
|
|
marginRight: 8
|
|
|
},
|
|
|
className: "iconfont icon-tishi7 ".concat(componentsmodules.fail)
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: componentsmodules.fail,
|
|
|
children: (_saveStatusArr$index3 = saveStatusArr[index]) === null || _saveStatusArr$index3 === void 0 ? void 0 : _saveStatusArr$index3.errorText
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
}, index);
|
|
|
}), ((0,authority/* isAdmin */.GJ)() || (0,authority/* isStudent */.dE)() && (answerData === null || answerData === void 0 || (_answerData$exercise = answerData.exercise) === null || _answerData$exercise === void 0 ? void 0 : _answerData$exercise.user_exercise_status) > 0 && (answerData === null || answerData === void 0 || (_answerData$exercise2 = answerData.exercise) === null || _answerData$exercise2 === void 0 ? void 0 : _answerData$exercise2.open_score)) && /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "end",
|
|
|
className: "mb20",
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font14",
|
|
|
style: {
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u5F97\u5206"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font14 ml10",
|
|
|
children: [(item === null || item === void 0 ? void 0 : item.user_score) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Fill_scoreStatusMapping[Number(item === null || item === void 0 ? void 0 : item.answer_status)] || 'c-orange-ff9',
|
|
|
children: item === null || item === void 0 ? void 0 : item.user_score
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
marginLeft: 5,
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u5206"
|
|
|
})]
|
|
|
}), !(item !== null && item !== void 0 && item.user_score) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-red",
|
|
|
children: "\u672A\u8BC4"
|
|
|
})]
|
|
|
})]
|
|
|
}), !!(item !== null && item !== void 0 && (_item$standard_answer = item.standard_answer) !== null && _item$standard_answer !== void 0 && _item$standard_answer.length) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: componentsmodules.analysisWrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: componentsmodules.greyBg,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: "mb20",
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
className: "font14 mr10",
|
|
|
style: {
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u3010\u7B54\u6848\u3011"
|
|
|
}), item === null || item === void 0 || (_item$standard_answer2 = item.standard_answer) === null || _item$standard_answer2 === void 0 ? void 0 : _item$standard_answer2.map(function (answer, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: "mr40",
|
|
|
children: ["\u586B\u7A7A\u9879", index + 1, ":", answer === null || answer === void 0 ? void 0 : answer.answer_text[0]]
|
|
|
}, index);
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font14 mr10",
|
|
|
style: {
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u3010\u89E3\u6790\u3011"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
className: componentsmodules.renderHtml,
|
|
|
value: item === null || item === void 0 ? void 0 : item.analysis
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_Fill = (Fill);
|
|
|
// EXTERNAL MODULE: ./src/components/QuestionEditor/Buttonloading.tsx
|
|
|
var Buttonloading = __webpack_require__(81525);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Answer/components/BFill.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var BFill_TextArea = input/* default */.Z.TextArea;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var BFill = function BFill(_ref) {
|
|
|
var _item$user_answer4, _item$standard_answer3, _item$standard_answer4;
|
|
|
var item = _ref.item,
|
|
|
answerData = _ref.answerData,
|
|
|
_ref$onBlur = _ref.onBlur,
|
|
|
onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur,
|
|
|
_ref$onDebug = _ref.onDebug,
|
|
|
onDebug = _ref$onDebug === void 0 ? function () {} : _ref$onDebug;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
userAnswer = _useState2[0],
|
|
|
setUserAnswer = _useState2[1];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var _item$standard_answer;
|
|
|
var data = item === null || item === void 0 || (_item$standard_answer = item.standard_answer_with_score) === null || _item$standard_answer === void 0 ? void 0 : _item$standard_answer.map(function (val, index) {
|
|
|
var _item$user_answer;
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, val), {}, {
|
|
|
value: (item === null || item === void 0 || (_item$user_answer = item.user_answer) === null || _item$user_answer === void 0 || (_item$user_answer = _item$user_answer[index]) === null || _item$user_answer === void 0 ? void 0 : _item$user_answer.answer_text) || ''
|
|
|
});
|
|
|
});
|
|
|
setUserAnswer(data);
|
|
|
}, [item === null || item === void 0 ? void 0 : item.standard_answer_with_score]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var _item$user_answer2;
|
|
|
if ((item === null || item === void 0 || (_item$user_answer2 = item.user_answer) === null || _item$user_answer2 === void 0 ? void 0 : _item$user_answer2.length) > 0) {
|
|
|
var _Array$fill;
|
|
|
var data = (_Array$fill = new Array(item.multi_count).fill({
|
|
|
value: ''
|
|
|
})) === null || _Array$fill === void 0 ? void 0 : _Array$fill.map(function (val, index) {
|
|
|
var _item$standard_answer2, _item$user_answer3;
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, val), {}, {
|
|
|
score: item === null || item === void 0 || (_item$standard_answer2 = item.standard_answer_with_score) === null || _item$standard_answer2 === void 0 || (_item$standard_answer2 = _item$standard_answer2[index]) === null || _item$standard_answer2 === void 0 ? void 0 : _item$standard_answer2.score,
|
|
|
value: (item === null || item === void 0 || (_item$user_answer3 = item.user_answer) === null || _item$user_answer3 === void 0 || (_item$user_answer3 = _item$user_answer3[index]) === null || _item$user_answer3 === void 0 ? void 0 : _item$user_answer3.answer_text) || ''
|
|
|
});
|
|
|
});
|
|
|
setUserAnswer(data);
|
|
|
}
|
|
|
}, [item === null || item === void 0 ? void 0 : item.user_answer]);
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [(item === null || item === void 0 ? void 0 : item.code) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
border: '1px solid #CCCCCC',
|
|
|
padding: '10px',
|
|
|
marginBottom: 20
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
disabledFill: !item.repeat_answer && (item === null || item === void 0 || (_item$user_answer4 = item.user_answer) === null || _item$user_answer4 === void 0 ? void 0 : _item$user_answer4.length) > 0 && item.ques_status !== 0 || !!(answerData !== null && answerData !== void 0 && answerData.exercise.commit_status),
|
|
|
onFillBlur: /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(e, index) {
|
|
|
var _e$parseInt;
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return onBlur(e === null || e === void 0 || (_e$parseInt = e[parseInt(index)]) === null || _e$parseInt === void 0 ? void 0 : _e$parseInt.value, parseInt(index) + 1, userAnswer);
|
|
|
case 2:
|
|
|
res = _context.sent;
|
|
|
if (res.status === 0) {
|
|
|
userAnswer[parseInt(index)].type = "success";
|
|
|
setUserAnswer(userAnswer);
|
|
|
} else {
|
|
|
userAnswer[parseInt(index)].type = "warning";
|
|
|
setUserAnswer(userAnswer);
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function (_x, _x2) {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}(),
|
|
|
className: componentsmodules.content,
|
|
|
programFillValue: userAnswer,
|
|
|
showProgramFill: true,
|
|
|
value: base64.Base64.decode((item === null || item === void 0 ? void 0 : item.code) || '')
|
|
|
})
|
|
|
}), !!(item !== null && item !== void 0 && (_item$standard_answer3 = item.standard_answer) !== null && _item$standard_answer3 !== void 0 && _item$standard_answer3.length) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: componentsmodules.analysisWrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: componentsmodules.greyBg,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: "mb20",
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
className: "font14 mr10",
|
|
|
style: {
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u3010\u7B54\u6848\u3011"
|
|
|
}), item === null || item === void 0 || (_item$standard_answer4 = item.standard_answer) === null || _item$standard_answer4 === void 0 ? void 0 : _item$standard_answer4.map(function (answer, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: "mr40",
|
|
|
children: ["\u586B\u7A7A\u9879", index + 1, ":", answer === null || answer === void 0 ? void 0 : answer.answer_text]
|
|
|
}, index);
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font14 mr10",
|
|
|
style: {
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u3010\u89E3\u6790\u3011"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
className: componentsmodules.renderHtml,
|
|
|
value: item === null || item === void 0 ? void 0 : item.analysis
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
}), (item === null || item === void 0 ? void 0 : item.allow_student_debug) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
textAlign: 'end',
|
|
|
marginTop: 10
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(Buttonloading/* default */.Z, {
|
|
|
ButtonProps: {
|
|
|
type: 'primary'
|
|
|
},
|
|
|
ButtonText: "\u8FD0\u884C\u8C03\u8BD5",
|
|
|
items: objectSpread2_default()(objectSpread2_default()({}, item), {}, {
|
|
|
userAnswer: userAnswer
|
|
|
}),
|
|
|
hackidentifier: item === null || item === void 0 ? void 0 : item.hack_identifier
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_BFill = (BFill);
|
|
|
// EXTERNAL MODULE: ./src/components/ImagesIcon/index.ts + 32 modules
|
|
|
var ImagesIcon = __webpack_require__(12416);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Answer/components/ErrCheckIpTip.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ErrCheckIpTip_TextArea = input/* default */.Z.TextArea;
|
|
|
var ErrCheckIpTip_Fill = function Fill(_ref) {
|
|
|
var data = _ref.data;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "tc mt80 pb30",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
width: "486",
|
|
|
src: ImagesIcon/* errIcon */.BV
|
|
|
}), " ", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), data.status === -1 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "c-grey-999 mt60",
|
|
|
children: "\u60A8\u7684IP\u4E0D\u5728\u8003\u8BD5\u5141\u8BB8\u7684\u8303\u56F4\u5185\uFF01"
|
|
|
}), data.status === -2 && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: " c-grey-999 mt60",
|
|
|
children: ["\u60A8\u5DF2\u7ED1\u5B9A\u5F53\u524D\u8003\u8BD5IP\u5730\u5740\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-red",
|
|
|
children: data.ip
|
|
|
}), "\u8BF7\u4F7F\u7528\u8BE5IP\u5730\u5740\u8FDB\u5165\u8003\u8BD5\u3002"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
className: "mt40 pl20 pr20",
|
|
|
type: "primary",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
href: "/",
|
|
|
children: "\u56DE\u5230\u9996\u9875"
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var ErrCheckIpTip = (ErrCheckIpTip_Fill);
|
|
|
// EXTERNAL MODULE: ./node_modules/_lodash@4.17.21@lodash/lodash.js
|
|
|
var lodash = __webpack_require__(89392);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Answer/components/NewAnswerComments/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var NewAnswerCommentsmodules = ({"comments":"comments___ZkLeS","greyText":"greyText___ow9J6","commentText":"commentText___Uklcs","wrapper":"wrapper___XTdhL","header":"header___pq5DQ","updateTime":"updateTime___WYYjt","text":"text___FmQY7","date":"date___DiXg4"});
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Answer/components/NewAnswerComments/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var NewAnswerComments = function NewAnswerComments(_ref) {
|
|
|
var list = _ref.list,
|
|
|
_ref$hideScore = _ref.hideScore,
|
|
|
hideScore = _ref$hideScore === void 0 ? false : _ref$hideScore;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: list === null || list === void 0 ? void 0 : list.map(function (v) {
|
|
|
var _v$user, _v$user2, _v$user3, _v$comments, _v$comments2;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "mt20 ".concat(NewAnswerCommentsmodules.wrapper),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
className: NewAnswerCommentsmodules.header,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: env/* default */.Z.API_SERVER + '/images/' + ((_v$user2 = v.user) === null || _v$user2 === void 0 ? void 0 : _v$user2.image_url)
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "ml10 font16",
|
|
|
children: (_v$user3 = v.user) === null || _v$user3 === void 0 ? void 0 : _v$user3.name
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: NewAnswerCommentsmodules.updateTime,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: NewAnswerCommentsmodules.text,
|
|
|
children: "\u8BC4\u9605\u65F6\u95F4"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: NewAnswerCommentsmodules.date,
|
|
|
children: dayjs_min_default()((_v$comments = v.comments) === null || _v$comments === void 0 || (_v$comments = _v$comments[0]) === null || _v$comments === void 0 ? void 0 : _v$comments.updated_at).format('YYYY-MM-DD HH:mm')
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: NewAnswerCommentsmodules.comments,
|
|
|
children: v === null || v === void 0 || (_v$comments2 = v.comments) === null || _v$comments2 === void 0 ? void 0 : _v$comments2.map(function (e, i) {
|
|
|
var _v$user4;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
justify: "space-between",
|
|
|
children: [!!e.shixun_chanllge_position && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
flexShrink: 0,
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: ["\u7B2C", e.shixun_chanllge_position, "\u5173"]
|
|
|
}), !hideScore && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
flex: 1
|
|
|
},
|
|
|
children: ["\u539F\u59CB\u5F97\u5206", e === null || e === void 0 ? void 0 : e.origin_score, "\u5206\uFF0C\u4FEE\u6B63\u4E3A", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-light-primary",
|
|
|
children: e === null || e === void 0 ? void 0 : e.score
|
|
|
}), "\u5206"]
|
|
|
})]
|
|
|
}), !!e.comment && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [" ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "".concat(NewAnswerCommentsmodules.greyText, " mr10"),
|
|
|
children: "\u8BC4\u8BED"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: NewAnswerCommentsmodules.commentText,
|
|
|
children: e.comment
|
|
|
})]
|
|
|
})]
|
|
|
}, (v === null || v === void 0 || (_v$user4 = v.user) === null || _v$user4 === void 0 ? void 0 : _v$user4.user_id) + '-' + i);
|
|
|
})
|
|
|
})]
|
|
|
}, v === null || v === void 0 || (_v$user = v.user) === null || _v$user === void 0 ? void 0 : _v$user.user_id);
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_NewAnswerComments = (NewAnswerComments);
|
|
|
// EXTERNAL MODULE: ./src/pages/Classrooms/Lists/Exercise/components/Unlock.tsx
|
|
|
var Unlock = __webpack_require__(14303);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react-draggable@4.4.6@react-draggable/build/cjs/cjs.js
|
|
|
var cjs = __webpack_require__(12911);
|
|
|
var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/MinusOutlined.js + 1 modules
|
|
|
var MinusOutlined = __webpack_require__(17599);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/PlusOutlined.js + 1 modules
|
|
|
var PlusOutlined = __webpack_require__(378);
|
|
|
// EXTERNAL MODULE: ./src/components/AsyncButton/index.tsx
|
|
|
var AsyncButton = __webpack_require__(75816);
|
|
|
// EXTERNAL MODULE: ./src/components/Hooks/index.tsx
|
|
|
var Hooks = __webpack_require__(75964);
|
|
|
// EXTERNAL MODULE: ./src/utils/hooks/useRemindModal.tsx
|
|
|
var useRemindModal = __webpack_require__(64066);
|
|
|
// EXTERNAL MODULE: ./src/utils/constant.ts
|
|
|
var constant = __webpack_require__(33346);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Answer/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["globalSetting", "loading", "user", "exercise", "dispatch"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Countdown = statistic/* default */.Z.Countdown;
|
|
|
var tagList = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
|
|
|
var Answer_scoreStatusMapping = {
|
|
|
0: 'c-red-ee4',
|
|
|
1: 'c-green'
|
|
|
};
|
|
|
var Answer = function Answer(_ref) {
|
|
|
var _user$userInfo, _user$userInfo2, _answerData$exercise4, _answerData$exercise24, _answerData$exercise25, _answerData$exercise26, _answerData$exercise27, _answerData$exercise28, _answerData$exercise29, _answerData$exercise30, _answerData$exercise31, _answerData$exercise32, _answerData$exercise33, _answerData$exercise_14, _answerData$exercise34, _answerData$exercise35, _answerData$exercise36, _answerData$exercise37, _answerData$exercise38, _answerData$exercise39, _answerData$question_5, _answerData$exercise_15, _answerData$question_6, _answerData$exercise_16, _answerData$exercise_17, _answerData$exercise_18, _answerData$exercise_19, _answerData$exercise_20, _answerData$exercise40, _answerData$exercise_21, _answerData$exercise_22, _answerData$exercise_24, _answerData$exercise_25, _answerData$exercise_26, _answerData$exercise41, _answerData$exercise42, _answerData$exercise43, _answerData$exercise44, _answerData$exercise_27;
|
|
|
var globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
user = _ref.user,
|
|
|
exercise = _ref.exercise,
|
|
|
dispatch = _ref.dispatch,
|
|
|
props = objectWithoutProperties_default()(_ref, _excluded);
|
|
|
var location = (0,_umi_production_exports.useLocation)();
|
|
|
var _useSearchParams = (0,_umi_production_exports.useSearchParams)(),
|
|
|
_useSearchParams2 = slicedToArray_default()(_useSearchParams, 1),
|
|
|
searchParams = _useSearchParams2[0];
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var _useState = (0,_react_17_0_2_react.useState)({}),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
answerData = _useState2[0],
|
|
|
setAnswerData = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)({}),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
answerCheckData = _useState4[0],
|
|
|
setAnswerCheckData = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)({}),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
hideAnswerCard = _useState6[0],
|
|
|
setHideAnswerCard = _useState6[1];
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
isSpin = _useState8[0],
|
|
|
setIsSpin = _useState8[1];
|
|
|
var _useState9 = (0,_react_17_0_2_react.useState)(true),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
showAnswerCard = _useState10[0],
|
|
|
setShowAnswerCard = _useState10[1];
|
|
|
var _useState11 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
showCamera = _useState12[0],
|
|
|
setShowCamera = _useState12[1];
|
|
|
var _useState13 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState14 = slicedToArray_default()(_useState13, 2),
|
|
|
openFullScreen = _useState14[0],
|
|
|
setOpenFullScreen = _useState14[1];
|
|
|
var _useState15 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState16 = slicedToArray_default()(_useState15, 2),
|
|
|
startRecording = _useState16[0],
|
|
|
setStartRecording = _useState16[1]; //获取权限开启录制通道
|
|
|
var _useState17 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState18 = slicedToArray_default()(_useState17, 2),
|
|
|
startScreenshot = _useState18[0],
|
|
|
setStartScreenshot = _useState18[1]; //开始截图
|
|
|
var _useState19 = (0,_react_17_0_2_react.useState)(),
|
|
|
_useState20 = slicedToArray_default()(_useState19, 2),
|
|
|
time = _useState20[0],
|
|
|
setTime = _useState20[1];
|
|
|
var _useState21 = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState22 = slicedToArray_default()(_useState21, 2),
|
|
|
iframeUrl = _useState22[0],
|
|
|
setIframeUrl = _useState22[1];
|
|
|
var _useState23 = (0,_react_17_0_2_react.useState)('none'),
|
|
|
_useState24 = slicedToArray_default()(_useState23, 2),
|
|
|
iframeBlock = _useState24[0],
|
|
|
setIframeBlock = _useState24[1];
|
|
|
var _useState25 = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState26 = slicedToArray_default()(_useState25, 2),
|
|
|
countDownColor = _useState26[0],
|
|
|
setCountDownColor = _useState26[1];
|
|
|
var _useState27 = (0,_react_17_0_2_react.useState)({
|
|
|
status: 0
|
|
|
}),
|
|
|
_useState28 = slicedToArray_default()(_useState27, 2),
|
|
|
checkStatus = _useState28[0],
|
|
|
setCheckStatus = _useState28[1]; //0ip合法,-1ip不在范围,-2已绑定其他ip
|
|
|
var _useState29 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState30 = slicedToArray_default()(_useState29, 2),
|
|
|
openCameraSuccess = _useState30[0],
|
|
|
setOpenCameraSuccess = _useState30[1];
|
|
|
var _useState31 = (0,_react_17_0_2_react.useState)(window.document.domain === "kepukehuan.educoder.net" ? true : false),
|
|
|
_useState32 = slicedToArray_default()(_useState31, 2),
|
|
|
isEducation = _useState32[0],
|
|
|
setIsEducation = _useState32[1];
|
|
|
var _useState33 = (0,_react_17_0_2_react.useState)(true),
|
|
|
_useState34 = slicedToArray_default()(_useState33, 2),
|
|
|
normalClose = _useState34[0],
|
|
|
setNormalClose = _useState34[1]; //可以通过控制台操纵DOM的方式隐藏开考密码弹窗,当用户通过正常方式关闭开考密码弹窗时为true
|
|
|
var iframe = (0,_react_17_0_2_react.useRef)();
|
|
|
var captureRef = (0,_react_17_0_2_react.useRef)();
|
|
|
var localIpRef = (0,_react_17_0_2_react.useRef)();
|
|
|
var lockRef = (0,_react_17_0_2_react.useRef)();
|
|
|
var iframeUrlSuffix = (0,_react_17_0_2_react.useRef)();
|
|
|
var answerCheckDataRef = (0,_react_17_0_2_react.useRef)();
|
|
|
var _Form$useForm = es_form/* default */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
var socket = (0,_react_17_0_2_react.useMemo)(function () {
|
|
|
return new WebSocket("ws://localhost:8082");
|
|
|
}, []);
|
|
|
var _useState35 = (0,_react_17_0_2_react.useState)(0),
|
|
|
_useState36 = slicedToArray_default()(_useState35, 2),
|
|
|
oneindex = _useState36[0],
|
|
|
setoneindex = _useState36[1]; //大题下标
|
|
|
var _useState37 = (0,_react_17_0_2_react.useState)(0),
|
|
|
_useState38 = slicedToArray_default()(_useState37, 2),
|
|
|
twoindex = _useState38[0],
|
|
|
settwoindex = _useState38[1]; //小题下标
|
|
|
var _useState39 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState40 = slicedToArray_default()(_useState39, 2),
|
|
|
isShowmodal = _useState40[0],
|
|
|
setisshowmodal = _useState40[1];
|
|
|
var _useState41 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState42 = slicedToArray_default()(_useState41, 2),
|
|
|
ischecked = _useState42[0],
|
|
|
setischecked = _useState42[1];
|
|
|
var allowRouter = ["/classrooms/".concat(params.coursesId, "/exercise/").concat(params.categoryId, "/detail"), "/classrooms/".concat(params.coursesId, "/exercise"), "/classrooms/".concat(params.coursesId, "/exercise/"), "/classrooms/".concat(params.coursesId, "/exercise/").concat(params.categoryId, "/users/").concat((_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.login, "/check"), "/classrooms/".concat(params.coursesId, "/exercisenotice/").concat(params.categoryId, "/users/").concat((_user$userInfo2 = user.userInfo) === null || _user$userInfo2 === void 0 ? void 0 : _user$userInfo2.login)];
|
|
|
var _useState43 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState44 = slicedToArray_default()(_useState43, 2),
|
|
|
disabled = _useState44[0],
|
|
|
setDisabled = _useState44[1];
|
|
|
var _useState45 = (0,_react_17_0_2_react.useState)({
|
|
|
left: 0,
|
|
|
top: 0,
|
|
|
bottom: 0,
|
|
|
right: 0
|
|
|
}),
|
|
|
_useState46 = slicedToArray_default()(_useState45, 2),
|
|
|
bounds = _useState46[0],
|
|
|
setBounds = _useState46[1];
|
|
|
var draggleRef = (0,_react_17_0_2_react.useRef)(null);
|
|
|
var _useState47 = (0,_react_17_0_2_react.useState)(true),
|
|
|
_useState48 = slicedToArray_default()(_useState47, 2),
|
|
|
isopen = _useState48[0],
|
|
|
setisopen = _useState48[1];
|
|
|
var questionPartRef = (0,_react_17_0_2_react.useRef)();
|
|
|
var _useState49 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState50 = slicedToArray_default()(_useState49, 2),
|
|
|
teachAnalysisModal = _useState50[0],
|
|
|
setTeachAnalysisModal = _useState50[1];
|
|
|
(0,Hooks/* useDisableAction */.y)((0,authority/* isStudent */.dE)());
|
|
|
var _onStart = function onStart(_event, uiData) {
|
|
|
var _draggleRef$current;
|
|
|
var _window$document$docu = window.document.documentElement,
|
|
|
clientWidth = _window$document$docu.clientWidth,
|
|
|
clientHeight = _window$document$docu.clientHeight;
|
|
|
var targetRect = (_draggleRef$current = draggleRef.current) === null || _draggleRef$current === void 0 ? void 0 : _draggleRef$current.getBoundingClientRect();
|
|
|
setBounds({
|
|
|
left: -targetRect.left + uiData.x,
|
|
|
right: clientWidth - (targetRect.right - uiData.x),
|
|
|
top: -targetRect.top + uiData.y,
|
|
|
bottom: clientHeight - (targetRect.bottom - uiData.y) - 70
|
|
|
});
|
|
|
};
|
|
|
var clearCountdownTimeout = (0,useRemindModal/* useRemindModal */._)(answerData);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
document.body.setAttribute('data-custom', 'auto');
|
|
|
return function () {
|
|
|
document.body.removeAttribute('data-custom');
|
|
|
};
|
|
|
}, []);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var _user$userInfo3, _user$userInfo4;
|
|
|
document.body.scrollIntoView();
|
|
|
if (((_user$userInfo3 = user.userInfo) === null || _user$userInfo3 === void 0 ? void 0 : _user$userInfo3.real_name) === "游客") {
|
|
|
window.location.href = "/classrooms/".concat(params.coursesId, "/exercise");
|
|
|
return;
|
|
|
}
|
|
|
if ((_user$userInfo4 = user.userInfo) !== null && _user$userInfo4 !== void 0 && _user$userInfo4.user_id) {
|
|
|
if ((0,authority/* isAdmin */.GJ)()) {
|
|
|
initData();
|
|
|
// window.addEventListener("beforeunload", onBeforeunload);
|
|
|
} else if (user.userInfo.login) {
|
|
|
// 检测进入考试流程是否合法
|
|
|
checkCanStart();
|
|
|
}
|
|
|
}
|
|
|
window.addEventListener('message', handleMessage);
|
|
|
return function () {
|
|
|
window.removeEventListener('message', handleMessage);
|
|
|
// window.removeEventListener("beforeunload", onBeforeunload);
|
|
|
if (location.pathname.indexOf("/detail") > -1) (0,fullscreen/* exitFull */.BU)();
|
|
|
};
|
|
|
}, [params.categoryId, user.userInfo.login]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
window.addEventListener('beforeunload', sendBeacon);
|
|
|
return function () {
|
|
|
clearCountdownTimeout();
|
|
|
window.removeEventListener('beforeunload', sendBeacon);
|
|
|
};
|
|
|
}, []);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
dispatch({
|
|
|
type: "globalSetting/headerFooterToggle",
|
|
|
payload: false
|
|
|
});
|
|
|
return function () {
|
|
|
dispatch({
|
|
|
type: "globalSetting/headerFooterToggle",
|
|
|
payload: true
|
|
|
});
|
|
|
};
|
|
|
}, []);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var _answerData$question_;
|
|
|
if (answerData !== null && answerData !== void 0 && (_answerData$question_ = answerData.question_status) !== null && _answerData$question_ !== void 0 && _answerData$question_.every(function (item) {
|
|
|
return !!item.ques_status && openCameraSuccess && (answerCheckData === null || answerCheckData === void 0 ? void 0 : answerCheckData.used_screen_num) < (answerCheckData === null || answerCheckData === void 0 ? void 0 : answerCheckData.screen_num);
|
|
|
})) {
|
|
|
setTimeout(function () {
|
|
|
var _captureRef$current;
|
|
|
(_captureRef$current = captureRef.current) === null || _captureRef$current === void 0 || _captureRef$current.handlePhoto();
|
|
|
}, 1300);
|
|
|
}
|
|
|
}, [answerData]);
|
|
|
var sendBeacon = function sendBeacon() {
|
|
|
var _exercise$exerciseUse;
|
|
|
if (!(answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.is_commit) && (0,authority/* isStudent */.dE)()) {
|
|
|
(0,util/* copyTextFuc */.RG)(" ", true);
|
|
|
}
|
|
|
if ((_exercise$exerciseUse = exercise.exerciseUserInfo) !== null && _exercise$exerciseUse !== void 0 && _exercise$exerciseUse.screen_open) window.navigator.sendBeacon("".concat(env/* default */.Z.API_SERVER, "/api/exercises/").concat(params.categoryId, "/commit_screen_at.json"), {});
|
|
|
};
|
|
|
var handleMessage = function handleMessage(data) {
|
|
|
if (data.data === 'backExercise') {
|
|
|
(0,util/* copyTextFuc */.RG)(" ", true);
|
|
|
resetIframe();
|
|
|
}
|
|
|
};
|
|
|
var resetIframe = function resetIframe() {
|
|
|
setIframeBlock("none");
|
|
|
setIframeUrl("");
|
|
|
initData();
|
|
|
};
|
|
|
var checkCanStart = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
// 检测是否开启摄像头
|
|
|
getExerciseUserInfo();
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function checkCanStart() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var startLocke = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
setNormalClose(false);
|
|
|
es_modal/* default */.Z.info({
|
|
|
title: "开考密码",
|
|
|
width: 500,
|
|
|
centered: true,
|
|
|
closable: false,
|
|
|
keyboard: false,
|
|
|
maskClosable: false,
|
|
|
maskStyle: {
|
|
|
background: "#000"
|
|
|
},
|
|
|
okText: "进入考试",
|
|
|
onOk: function onOk() {
|
|
|
return new Promise( /*#__PURE__*/function () {
|
|
|
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(resolve, reject) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.prev = 0;
|
|
|
_context2.next = 3;
|
|
|
return form.validateFields();
|
|
|
case 3:
|
|
|
_context2.next = 8;
|
|
|
break;
|
|
|
case 5:
|
|
|
_context2.prev = 5;
|
|
|
_context2.t0 = _context2["catch"](0);
|
|
|
reject();
|
|
|
case 8:
|
|
|
_context2.t1 = service_exercise/* exerciseStartUnLock */.pL;
|
|
|
_context2.t2 = (objectSpread2_default());
|
|
|
_context2.t3 = {
|
|
|
exercise_user_id: answerCheckData === null || answerCheckData === void 0 ? void 0 : answerCheckData.exercise_user_id,
|
|
|
categoryId: params.categoryId
|
|
|
};
|
|
|
_context2.next = 13;
|
|
|
return form.validateFields();
|
|
|
case 13:
|
|
|
_context2.t4 = _context2.sent;
|
|
|
_context2.t5 = (0, _context2.t2)(_context2.t3, _context2.t4);
|
|
|
_context2.next = 17;
|
|
|
return (0, _context2.t1)(_context2.t5);
|
|
|
case 17:
|
|
|
res = _context2.sent;
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
setNormalClose(true);
|
|
|
checkCamera();
|
|
|
resolve(res);
|
|
|
} else {
|
|
|
form.setFields([{
|
|
|
name: 'start_password',
|
|
|
errors: [res === null || res === void 0 ? void 0 : res.message]
|
|
|
}]);
|
|
|
reject();
|
|
|
}
|
|
|
case 19:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2, null, [[0, 5]]);
|
|
|
}));
|
|
|
return function (_x, _x2) {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}());
|
|
|
},
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "",
|
|
|
children: "\u8BF7\u8F93\u5165\u76D1\u8003\u8001\u5E08\u5BA3\u5E03\u672C\u573A\u8003\u8BD5\u7684\u5F00\u8003\u5BC6\u7801\u540E\u8FDB\u5165\u8003\u8BD5"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z, {
|
|
|
form: form,
|
|
|
autoComplete: "off",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "start_password",
|
|
|
label: "\u5F00\u8003\u5BC6\u7801",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入开考密码'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z.Password, {
|
|
|
autoComplete: "off"
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
});
|
|
|
case 2:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return function startLocke() {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var getExerciseUserInfo = /*#__PURE__*/function () {
|
|
|
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
_context4.next = 2;
|
|
|
return dispatch({
|
|
|
type: "exercise/getExerciseUserInfo",
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context4.sent;
|
|
|
answerCheckDataRef.current = objectSpread2_default()(objectSpread2_default()({}, res.data), {}, {
|
|
|
status: res === null || res === void 0 ? void 0 : res.status
|
|
|
});
|
|
|
setAnswerCheckData(objectSpread2_default()(objectSpread2_default()({}, res.data), {}, {
|
|
|
status: res === null || res === void 0 ? void 0 : res.status
|
|
|
}));
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
return function getExerciseUserInfo() {
|
|
|
return _ref5.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.exercise_user_id) {
|
|
|
if (!(answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.is_commit)) {
|
|
|
(0,util/* copyTextFuc */.RG)(" ", true);
|
|
|
}
|
|
|
;
|
|
|
if (!(answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.is_commit) && ((answerCheckData === null || answerCheckData === void 0 ? void 0 : answerCheckData.ip_limit) === "inner" || answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.ip_bind)) {
|
|
|
iframeUrlSuffix.current = "&ip_limit=".concat(answerCheckData === null || answerCheckData === void 0 ? void 0 : answerCheckData.ip_limit, "&ip_bind=").concat(answerCheckData === null || answerCheckData === void 0 ? void 0 : answerCheckData.ip_bind);
|
|
|
}
|
|
|
;
|
|
|
if (!(answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.is_commit)) {
|
|
|
(0,util/* copyTextFuc */.RG)(" ", true);
|
|
|
// 开启人脸识别,未通过识别
|
|
|
if (!(answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.can_start)) {
|
|
|
window.location.href = "/classrooms/".concat(params.coursesId, "/exercise/").concat(params.categoryId, "/users/").concat(params.login, "/check");
|
|
|
return;
|
|
|
}
|
|
|
// ip合法检测
|
|
|
if (answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.is_locked && answerCheckData.ip_error) {
|
|
|
dispatch({
|
|
|
type: 'exercise/setActionTabs',
|
|
|
payload: {
|
|
|
key: 'student-unlock',
|
|
|
exerciseParams: objectSpread2_default()(objectSpread2_default()({}, answerCheckData), {}, {
|
|
|
id: params.categoryId
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
} else if (!(answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.is_locked) && answerCheckData.ip_error) {}
|
|
|
// performance.navigation.type 0首页进入 1刷新 2返回
|
|
|
if (document.referrer === "" || performance.navigation.type === 2 || !allowRouter.includes(new URL(document.referrer).pathname)) {
|
|
|
sessionStorage.setItem("illegalEntry", "illegalEntry");
|
|
|
_umi_production_exports.history.push("/classrooms/".concat(params.coursesId, "/exercise/"));
|
|
|
return;
|
|
|
}
|
|
|
// 是否开启开考密码
|
|
|
if (answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.start_locked && !(answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.user_is_enter)) {
|
|
|
startLocke();
|
|
|
return;
|
|
|
}
|
|
|
// 开启解锁码,未成功进入答题
|
|
|
if (answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.is_locked && performance.navigation.type === 1 && !sessionStorage.getItem("studentunlock")) {
|
|
|
dispatch({
|
|
|
type: 'exercise/setActionTabs',
|
|
|
payload: {
|
|
|
key: 'student-unlock',
|
|
|
exerciseParams: objectSpread2_default()(objectSpread2_default()({}, answerCheckData), {}, {
|
|
|
id: params.categoryId
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
// 直接复制网址进入答题页
|
|
|
if (answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.is_locked && performance.navigation.type === 0 && answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.user_is_enter && !(answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.is_commit)) {
|
|
|
dispatch({
|
|
|
type: 'exercise/setActionTabs',
|
|
|
payload: {
|
|
|
key: 'student-unlock',
|
|
|
exerciseParams: objectSpread2_default()(objectSpread2_default()({}, answerCheckData), {}, {
|
|
|
id: params.categoryId
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
} else if (!answerCheckData.answered_open) {
|
|
|
// 交卷后,检测是否有权限查看
|
|
|
es_modal/* default */.Z.info({
|
|
|
width: 500,
|
|
|
centered: true,
|
|
|
icon: null,
|
|
|
title: "提示",
|
|
|
content: "老师已设置本试卷在交卷后不可查看",
|
|
|
onOk: function onOk() {
|
|
|
window.location.href = "/classrooms/".concat(params.coursesId, "/exercise/").concat(params.categoryId, "/detail");
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
checkCamera();
|
|
|
}
|
|
|
return function () {
|
|
|
if (!(answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.is_commit) && (0,authority/* isStudent */.dE)()) {
|
|
|
(0,util/* copyTextFuc */.RG)(" ", true);
|
|
|
}
|
|
|
};
|
|
|
}, [answerCheckData]);
|
|
|
var checkCamera = /*#__PURE__*/function () {
|
|
|
var _ref6 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5() {
|
|
|
var _res$data, _res$data2, _res$data3, _res$data4, _res$data5, _res$data6;
|
|
|
var res, _res$data7, _res$data8, _res$data9, checkData, _res$data10, _res$data11, _res$data12, _res$data13;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
|
|
|
while (1) switch (_context5.prev = _context5.next) {
|
|
|
case 0:
|
|
|
// 进入考试后,删除学生解锁码
|
|
|
sessionStorage.setItem("studentunlock", "studentunlock");
|
|
|
res = {
|
|
|
data: answerCheckData,
|
|
|
status: answerCheckData.status
|
|
|
};
|
|
|
if (!((res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.ip_limit) !== 'no' || res !== null && res !== void 0 && (_res$data2 = res.data) !== null && _res$data2 !== void 0 && _res$data2.ip_bind)) {
|
|
|
_context5.next = 6;
|
|
|
break;
|
|
|
}
|
|
|
_context5.next = 5;
|
|
|
return (0,Exercise_ip/* findLocalIp */.y)({
|
|
|
ip_limit: res === null || res === void 0 || (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.ip_limit,
|
|
|
ip_bind: res === null || res === void 0 || (_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : _res$data4.ip_bind
|
|
|
});
|
|
|
case 5:
|
|
|
localIpRef.current = _context5.sent;
|
|
|
case 6:
|
|
|
if (!((res === null || res === void 0 || (_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : _res$data5.ip_limit) !== 'no' || res !== null && res !== void 0 && (_res$data6 = res.data) !== null && _res$data6 !== void 0 && _res$data6.ip_bind)) {
|
|
|
_context5.next = 14;
|
|
|
break;
|
|
|
}
|
|
|
if (!((res === null || res === void 0 || (_res$data7 = res.data) === null || _res$data7 === void 0 ? void 0 : _res$data7.ip_limit) === 'inner' || res !== null && res !== void 0 && (_res$data8 = res.data) !== null && _res$data8 !== void 0 && _res$data8.ip_bind)) {
|
|
|
_context5.next = 14;
|
|
|
break;
|
|
|
}
|
|
|
_context5.next = 10;
|
|
|
return (0,util/* checkLocalOrPublicIp */.oi)({
|
|
|
exerciseId: params.categoryId,
|
|
|
ip: localIpRef.current,
|
|
|
errmsgHide: true,
|
|
|
ip_limit: (res === null || res === void 0 || (_res$data9 = res.data) === null || _res$data9 === void 0 ? void 0 : _res$data9.ip_limit) || 'no'
|
|
|
});
|
|
|
case 10:
|
|
|
checkData = _context5.sent;
|
|
|
if (!((checkData === null || checkData === void 0 ? void 0 : checkData.status) !== 0)) {
|
|
|
_context5.next = 14;
|
|
|
break;
|
|
|
}
|
|
|
setCheckStatus(checkData);
|
|
|
return _context5.abrupt("return");
|
|
|
case 14:
|
|
|
if (!((res === null || res === void 0 ? void 0 : res.status) == 0)) {
|
|
|
_context5.next = 25;
|
|
|
break;
|
|
|
}
|
|
|
if (!((res === null || res === void 0 || (_res$data10 = res.data) === null || _res$data10 === void 0 ? void 0 : _res$data10.used_screen_num) > (res === null || res === void 0 || (_res$data11 = res.data) === null || _res$data11 === void 0 ? void 0 : _res$data11.screen_num) && res !== null && res !== void 0 && (_res$data12 = res.data) !== null && _res$data12 !== void 0 && _res$data12.screen_open)) {
|
|
|
_context5.next = 18;
|
|
|
break;
|
|
|
}
|
|
|
handleSubmitAnswer();
|
|
|
return _context5.abrupt("return", false);
|
|
|
case 18:
|
|
|
setShowCamera(res === null || res === void 0 ? void 0 : res.data.check_camera);
|
|
|
if (res !== null && res !== void 0 && res.data.check_camera) {
|
|
|
_context5.next = 25;
|
|
|
break;
|
|
|
}
|
|
|
if (!(res !== null && res !== void 0 && res.data.screen_shot_open)) {
|
|
|
_context5.next = 23;
|
|
|
break;
|
|
|
}
|
|
|
setStartRecording(answerCheckData === null || answerCheckData === void 0 ? void 0 : answerCheckData.screen_shot_open);
|
|
|
return _context5.abrupt("return");
|
|
|
case 23:
|
|
|
setOpenFullScreen(res === null || res === void 0 || (_res$data13 = res.data) === null || _res$data13 === void 0 ? void 0 : _res$data13.screen_open);
|
|
|
initData();
|
|
|
case 25:
|
|
|
case "end":
|
|
|
return _context5.stop();
|
|
|
}
|
|
|
}, _callee5);
|
|
|
}));
|
|
|
return function checkCamera() {
|
|
|
return _ref6.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleCheckInitModal = /*#__PURE__*/function () {
|
|
|
var _ref7 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6(res) {
|
|
|
var toSkipUrl;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee6$(_context6) {
|
|
|
while (1) switch (_context6.prev = _context6.next) {
|
|
|
case 0:
|
|
|
if (!((res === null || res === void 0 ? void 0 : res.type) === 1)) {
|
|
|
_context6.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
es_modal/* default */.Z.info({
|
|
|
centered: true,
|
|
|
width: 470,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
title: '提示',
|
|
|
icon: null,
|
|
|
keyboard: false,
|
|
|
onOk: function onOk() {
|
|
|
_umi_production_exports.history.replace("/classrooms/".concat(params.coursesId, "/exercise/").concat(params.categoryId, "/detail"));
|
|
|
},
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: (res === null || res === void 0 ? void 0 : res.message) || ''
|
|
|
})
|
|
|
});
|
|
|
return _context6.abrupt("return", Promise.reject());
|
|
|
case 3:
|
|
|
if (!((res === null || res === void 0 ? void 0 : res.type) === 2)) {
|
|
|
_context6.next = 7;
|
|
|
break;
|
|
|
}
|
|
|
toSkipUrl = function toSkipUrl() {
|
|
|
_umi_production_exports.history.replace("/classrooms/".concat(params.coursesId, "/exercise/").concat(params.categoryId, "/centralizeReview/").concat(res === null || res === void 0 ? void 0 : res.login));
|
|
|
};
|
|
|
es_modal/* default */.Z.confirm({
|
|
|
centered: true,
|
|
|
width: 470,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
title: '提示',
|
|
|
icon: null,
|
|
|
keyboard: false,
|
|
|
onOk: toSkipUrl,
|
|
|
onCancel: function onCancel() {
|
|
|
_umi_production_exports.history.replace("/classrooms/".concat(params.coursesId, "/exercise/").concat(params.categoryId, "/detail"));
|
|
|
},
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u60A8\u5DF2\u6210\u4E3A\u6307\u5B9A\u9605\u5377\u6559\u5E08\uFF0C\u662F\u5426\u73B0\u5728\u524D\u5F80", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onClick: toSkipUrl,
|
|
|
className: "ml5 mr5 c-light-primary current",
|
|
|
children: "\u96C6\u4E2D\u9605\u5377"
|
|
|
}), "\u7EE7\u7EED\u8BC4\u9605\uFF1F"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "c-grey-999",
|
|
|
children: "\uFF08\u9605\u5377\u7ED3\u675F\u540E\u6062\u590D\u5B66\u751F\u4E2A\u4EBA\u8BC4\u9605\u529F\u80FD\uFF0C\u5E76\u5C55\u793A\u5B66\u751F\u6210\u7EE9\uFF09"
|
|
|
})]
|
|
|
})
|
|
|
});
|
|
|
return _context6.abrupt("return", Promise.reject());
|
|
|
case 7:
|
|
|
case "end":
|
|
|
return _context6.stop();
|
|
|
}
|
|
|
}, _callee6);
|
|
|
}));
|
|
|
return function handleCheckInitModal(_x3) {
|
|
|
return _ref7.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var initData = /*#__PURE__*/function () {
|
|
|
var _ref8 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee7() {
|
|
|
var _user$userInfo5;
|
|
|
var res, random_id, _res, _res2, _res9, _res10, _res$exercise, _res11, _res14, _res15, _res3, _answerCheckDataRef$c, _answerCheckDataRef$c2, _answerCheckDataRef$c3, _answerCheckDataRef$c4, _res4, _res6, _res7, _res8, _res5, _res12, _res13, _res16, _res17, _res21, _res22, _res23, _res18, _key;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee7$(_context7) {
|
|
|
while (1) switch (_context7.prev = _context7.next) {
|
|
|
case 0:
|
|
|
document.body.scrollIntoView();
|
|
|
setIsSpin(true);
|
|
|
random_id = (_user$userInfo5 = user.userInfo) === null || _user$userInfo5 === void 0 ? void 0 : _user$userInfo5.user_id;
|
|
|
if (!(0,authority/* isAdmin */.GJ)()) {
|
|
|
_context7.next = 11;
|
|
|
break;
|
|
|
}
|
|
|
_context7.next = 6;
|
|
|
return (0,service_exercise/* getReviewExercise */.BJ)({
|
|
|
exerciseId: params.categoryId,
|
|
|
login: params.login
|
|
|
})["catch"](function () {
|
|
|
return setIsSpin(false);
|
|
|
});
|
|
|
case 6:
|
|
|
res = _context7.sent;
|
|
|
((_res = res) === null || _res === void 0 ? void 0 : _res.exercise) && (res.exercise.user_exercise_status = 1);
|
|
|
random_id = (_res2 = res) === null || _res2 === void 0 || (_res2 = _res2.exercise_answer_user) === null || _res2 === void 0 ? void 0 : _res2.user_id;
|
|
|
_context7.next = 38;
|
|
|
break;
|
|
|
case 11:
|
|
|
if (!searchParams.get("check")) {
|
|
|
_context7.next = 18;
|
|
|
break;
|
|
|
}
|
|
|
_context7.next = 14;
|
|
|
return (0,service_exercise/* getReviewExercise */.BJ)(objectSpread2_default()(objectSpread2_default()({}, params), {}, {
|
|
|
exerciseId: params.categoryId,
|
|
|
login: params.login
|
|
|
}))["catch"](function () {
|
|
|
return setIsSpin(false);
|
|
|
});
|
|
|
case 14:
|
|
|
res = _context7.sent;
|
|
|
random_id = (_res3 = res) === null || _res3 === void 0 || (_res3 = _res3.exercise) === null || _res3 === void 0 ? void 0 : _res3.user_id;
|
|
|
_context7.next = 32;
|
|
|
break;
|
|
|
case 18:
|
|
|
if (!(((_answerCheckDataRef$c = answerCheckDataRef.current) === null || _answerCheckDataRef$c === void 0 ? void 0 : _answerCheckDataRef$c.ip_limit) !== 'no' || (_answerCheckDataRef$c2 = answerCheckDataRef.current) !== null && _answerCheckDataRef$c2 !== void 0 && _answerCheckDataRef$c2.ip_bind)) {
|
|
|
_context7.next = 22;
|
|
|
break;
|
|
|
}
|
|
|
_context7.next = 21;
|
|
|
return (0,Exercise_ip/* findLocalIp */.y)({
|
|
|
ip_limit: (_answerCheckDataRef$c3 = answerCheckDataRef.current) === null || _answerCheckDataRef$c3 === void 0 ? void 0 : _answerCheckDataRef$c3.ip_limit,
|
|
|
ip_bind: (_answerCheckDataRef$c4 = answerCheckDataRef.current) === null || _answerCheckDataRef$c4 === void 0 ? void 0 : _answerCheckDataRef$c4.ip_bind
|
|
|
});
|
|
|
case 21:
|
|
|
localIpRef.current = _context7.sent;
|
|
|
case 22:
|
|
|
_context7.next = 24;
|
|
|
return (0,service_exercise/* getExerciseStart */.CD)(objectSpread2_default()(objectSpread2_default()({}, params), {}, {
|
|
|
ip: localIpRef.current
|
|
|
}))["catch"](function () {
|
|
|
return setIsSpin(false);
|
|
|
});
|
|
|
case 24:
|
|
|
res = _context7.sent;
|
|
|
if (res.status === -1) {
|
|
|
handleToDetail();
|
|
|
}
|
|
|
if (!(((_res4 = res) === null || _res4 === void 0 ? void 0 : _res4.status) === -5)) {
|
|
|
_context7.next = 29;
|
|
|
break;
|
|
|
}
|
|
|
dispatch({
|
|
|
type: 'exercise/setActionTabs',
|
|
|
payload: {
|
|
|
key: 'student-unlock',
|
|
|
exerciseParams: objectSpread2_default()(objectSpread2_default()({}, answerCheckDataRef.current), {}, {
|
|
|
id: params.categoryId,
|
|
|
errorMessage: (_res5 = res) === null || _res5 === void 0 ? void 0 : _res5.message
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
return _context7.abrupt("return");
|
|
|
case 29:
|
|
|
((_res6 = res) === null || _res6 === void 0 ? void 0 : _res6.exercise) && (res.exercise.user_exercise_status = 0);
|
|
|
((_res7 = res) === null || _res7 === void 0 ? void 0 : _res7.exercise) && (res.exercise.exercise_status = 2);
|
|
|
(_res8 = res) === null || _res8 === void 0 || (_res8 = _res8.exercise_question_types) === null || _res8 === void 0 || _res8.map(function (item) {
|
|
|
if ((item === null || item === void 0 ? void 0 : item.question_type) < 3) {
|
|
|
var _item$items;
|
|
|
item === null || item === void 0 || (_item$items = item.items) === null || _item$items === void 0 || _item$items.map(function (ite) {
|
|
|
ite.user_answer = ite.question_choices.filter(function (j) {
|
|
|
return j.user_answer_boolean;
|
|
|
}).map(function (k) {
|
|
|
return k.choice_id;
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
case 32:
|
|
|
if (!(!((_res9 = res) !== null && _res9 !== void 0 && (_res9 = _res9.exercise) !== null && _res9 !== void 0 && _res9.can_start) && (_res10 = res) !== null && _res10 !== void 0 && _res10.exercise)) {
|
|
|
_context7.next = 35;
|
|
|
break;
|
|
|
}
|
|
|
window.location.href = "/classrooms/".concat(params.coursesId, "/exercise/").concat(params.categoryId, "/users/").concat(params.login, "/check");
|
|
|
return _context7.abrupt("return");
|
|
|
case 35:
|
|
|
if (((_res$exercise = res.exercise) === null || _res$exercise === void 0 ? void 0 : _res$exercise.commit_status) === 0 && !lockRef.current) {
|
|
|
try {
|
|
|
lockRef.current = true;
|
|
|
socket.send(JSON.stringify({
|
|
|
type: "toggleLockExit",
|
|
|
data: true
|
|
|
}));
|
|
|
socket.send(JSON.stringify({
|
|
|
type: "network-close",
|
|
|
data: ''
|
|
|
}));
|
|
|
} catch (_unused) {}
|
|
|
;
|
|
|
// window.removeEventListener("beforeunload", onBeforeunload)
|
|
|
}
|
|
|
|
|
|
if ((_res11 = res) !== null && _res11 !== void 0 && (_res11 = _res11.exercise) !== null && _res11 !== void 0 && _res11.left_time) {
|
|
|
setTimeout(function () {
|
|
|
setCountDownColor(Answermodules.red);
|
|
|
}, (((_res12 = res) === null || _res12 === void 0 || (_res12 = _res12.exercise) === null || _res12 === void 0 ? void 0 : _res12.left_time) - 300 > 0 ? ((_res13 = res) === null || _res13 === void 0 || (_res13 = _res13.exercise) === null || _res13 === void 0 ? void 0 : _res13.left_time) - 300 : 0) * 1000);
|
|
|
}
|
|
|
if (((_res14 = res) === null || _res14 === void 0 || (_res14 = _res14.exercise) === null || _res14 === void 0 ? void 0 : _res14.take_photo) >= ((_res15 = res) === null || _res15 === void 0 || (_res15 = _res15.exercise) === null || _res15 === void 0 ? void 0 : _res15.photo_count)) {}
|
|
|
case 38:
|
|
|
setIsSpin(false);
|
|
|
_context7.next = 41;
|
|
|
return handleCheckInitModal(res);
|
|
|
case 41:
|
|
|
if (res) {
|
|
|
if ((_res16 = res) !== null && _res16 !== void 0 && (_res16 = _res16.exercise) !== null && _res16 !== void 0 && _res16.question_random || (_res17 = res) !== null && _res17 !== void 0 && (_res17 = _res17.exercise) !== null && _res17 !== void 0 && _res17.choice_random) {
|
|
|
_key = 1;
|
|
|
res.exercise.question_random = (_res18 = res) === null || _res18 === void 0 || (_res18 = _res18.exercise_question_types) === null || _res18 === void 0 ? void 0 : _res18.map(function (item) {
|
|
|
var _res19, _res20;
|
|
|
if ((_res19 = res) !== null && _res19 !== void 0 && (_res19 = _res19.exercise) !== null && _res19 !== void 0 && _res19.choice_random) {
|
|
|
if (item.question_type === 0 || item.question_type === 1) {
|
|
|
item.items.map(function (i) {
|
|
|
i.question_choices = (0,util/* randomArray */.M2)(i.question_choices, random_id);
|
|
|
return i;
|
|
|
});
|
|
|
}
|
|
|
if (item.question_type === 7) {
|
|
|
item.items.forEach(function (i) {
|
|
|
i.sub_exercise_questions.forEach(function (k) {
|
|
|
k.question_choices = (0,util/* randomArray */.M2)(k.question_choices, random_id);
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
if ((_res20 = res) !== null && _res20 !== void 0 && (_res20 = _res20.exercise) !== null && _res20 !== void 0 && _res20.question_random) {
|
|
|
item.items = (0,util/* randomArray */.M2)(item.items, random_id);
|
|
|
}
|
|
|
item.items.map(function (i) {
|
|
|
i.question_num = _key;
|
|
|
_key++;
|
|
|
return i;
|
|
|
});
|
|
|
return item;
|
|
|
});
|
|
|
}
|
|
|
res.exercise_types = ((_res21 = res) === null || _res21 === void 0 ? void 0 : _res21.exercise_types) || ((_res22 = res) === null || _res22 === void 0 || (_res22 = _res22.exercise_scores) === null || _res22 === void 0 ? void 0 : _res22.exercise_types);
|
|
|
res.question_status = res.question_status || createItems(((_res23 = res) === null || _res23 === void 0 ? void 0 : _res23.exercise_question_types) || []);
|
|
|
setAnswerData(res);
|
|
|
}
|
|
|
return _context7.abrupt("return", res);
|
|
|
case 43:
|
|
|
case "end":
|
|
|
return _context7.stop();
|
|
|
}
|
|
|
}, _callee7);
|
|
|
}));
|
|
|
return function initData() {
|
|
|
return _ref8.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var createItems = function createItems(item) {
|
|
|
var items = [];
|
|
|
item.forEach(function (e) {
|
|
|
items = items.concat(e.items);
|
|
|
});
|
|
|
items = items.map(function (e) {
|
|
|
return {
|
|
|
ques_status: e === null || e === void 0 ? void 0 : e.ques_status,
|
|
|
question_num: e === null || e === void 0 ? void 0 : e.question_num,
|
|
|
ques_id: e === null || e === void 0 ? void 0 : e.question_id
|
|
|
};
|
|
|
});
|
|
|
return items;
|
|
|
};
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var _answerData$exercise, _answerData$exercise2, _answerData$exercise3;
|
|
|
if (((_answerData$exercise = answerData.exercise) === null || _answerData$exercise === void 0 ? void 0 : _answerData$exercise.left_time) === 0) {
|
|
|
handleSubmitAnswer();
|
|
|
} //自动任务失败,进入后时间为0自动提交试卷
|
|
|
((_answerData$exercise2 = answerData.exercise) === null || _answerData$exercise2 === void 0 ? void 0 : _answerData$exercise2.left_time) && setTime(Date.now() + (answerData === null || answerData === void 0 || (_answerData$exercise3 = answerData.exercise) === null || _answerData$exercise3 === void 0 ? void 0 : _answerData$exercise3.left_time) * 1000);
|
|
|
}, [(_answerData$exercise4 = answerData.exercise) === null || _answerData$exercise4 === void 0 ? void 0 : _answerData$exercise4.left_time]);
|
|
|
var handleBackToRedo = function handleBackToRedo() {
|
|
|
var _answerData$exercise5;
|
|
|
if ((answerData === null || answerData === void 0 || (_answerData$exercise5 = answerData.exercise) === null || _answerData$exercise5 === void 0 ? void 0 : _answerData$exercise5.exercise_status) === 3) {
|
|
|
es_modal/* default */.Z.confirm({
|
|
|
width: 530,
|
|
|
title: '提示',
|
|
|
icon: null,
|
|
|
centered: true,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u622A\u6B62\u65F6\u95F4\u5DF2\u5230\uFF0C\u65E0\u6CD5\u6253\u56DE\u8BD5\u5377", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u8BF7\u5728\u4FEE\u6539\u622A\u6B62\u65F6\u95F4\u540E\u518D\u64CD\u4F5C"]
|
|
|
})
|
|
|
});
|
|
|
} else {
|
|
|
es_modal/* default */.Z.confirm({
|
|
|
width: 530,
|
|
|
title: '提示',
|
|
|
icon: null,
|
|
|
centered: true,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u5B66\u751F\u5C06\u5F97\u5230\u4E00\u6B21\u91CD\u65B0\u7B54\u9898\u7684\u673A\u4F1A\uFF0C\u73B0\u6709\u7684\u7B54\u9898\u60C5\u51B5\u5C06\u88AB\u6E05\u7A7A", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u662F\u5426\u786E\u8BA4\u56DE\u9000TA\u7684\u8BD5\u5377\u7B54\u9898"]
|
|
|
}),
|
|
|
onOk: function () {
|
|
|
var _onOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee8() {
|
|
|
var _answerData$exercise_;
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee8$(_context8) {
|
|
|
while (1) switch (_context8.prev = _context8.next) {
|
|
|
case 0:
|
|
|
_context8.next = 2;
|
|
|
return (0,service_exercise/* redoExercise */.q6)({
|
|
|
categoryId: params.categoryId,
|
|
|
user_ids: [answerData === null || answerData === void 0 || (_answerData$exercise_ = answerData.exercise_answer_user) === null || _answerData$exercise_ === void 0 ? void 0 : _answerData$exercise_.user_id]
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context8.sent;
|
|
|
if (res) {
|
|
|
message/* default */.ZP.info(res === null || res === void 0 ? void 0 : res.message);
|
|
|
handleToDetail();
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context8.stop();
|
|
|
}
|
|
|
}, _callee8);
|
|
|
}));
|
|
|
function onOk() {
|
|
|
return _onOk.apply(this, arguments);
|
|
|
}
|
|
|
return onOk;
|
|
|
}()
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
var handleToDetail = function handleToDetail() {
|
|
|
window.location.href = (0,util/* checkIsClientExam */.Ll)() ? "/" : "/classrooms/".concat(params.coursesId, "/exercise/").concat(params.categoryId, "/detail");
|
|
|
};
|
|
|
var handleLeftTime = /*#__PURE__*/function () {
|
|
|
var _ref9 = 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,service_exercise/* exerciseLeftTime */.PT)(objectSpread2_default()({}, params));
|
|
|
case 2:
|
|
|
res = _context9.sent;
|
|
|
if (!(res !== null && res !== void 0 && res.has_time)) {
|
|
|
_context9.next = 9;
|
|
|
break;
|
|
|
}
|
|
|
setTime(Date.now() + (res === null || res === void 0 ? void 0 : res.left_time) * 1000);
|
|
|
setAnswerData(function (prevData) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, prevData), {}, {
|
|
|
exercise: objectSpread2_default()(objectSpread2_default()({}, prevData.exercise), {}, {
|
|
|
left_time: res === null || res === void 0 ? void 0 : res.left_time
|
|
|
})
|
|
|
});
|
|
|
});
|
|
|
return _context9.abrupt("return", true);
|
|
|
case 9:
|
|
|
handleFinishTime();
|
|
|
return _context9.abrupt("return", false);
|
|
|
case 11:
|
|
|
case "end":
|
|
|
return _context9.stop();
|
|
|
}
|
|
|
}, _callee9);
|
|
|
}));
|
|
|
return function handleLeftTime() {
|
|
|
return _ref9.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
// 自动交卷
|
|
|
var handleFinishTime = /*#__PURE__*/function () {
|
|
|
var _ref10 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee11() {
|
|
|
var res, _time;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee11$(_context11) {
|
|
|
while (1) switch (_context11.prev = _context11.next) {
|
|
|
case 0:
|
|
|
_context11.next = 2;
|
|
|
return (0,service_exercise/* submitExerciseAnswer */.VL)({
|
|
|
categoryId: params.categoryId,
|
|
|
commit_method: 2
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context11.sent;
|
|
|
setOpenFullScreen(false); //交卷之后不再记录切屏
|
|
|
setStartRecording(false);
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
es_modal/* default */.Z.info({
|
|
|
width: 530,
|
|
|
title: '提示',
|
|
|
centered: true,
|
|
|
okText: '确定',
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u7B54\u9898\u7ED3\u675F\u4E86\uFF0C\u7CFB\u7EDF\u5DF2\u81EA\u52A8\u63D0\u4EA4\u8BD5\u5377", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u4E0D\u80FD\u518D\u4FEE\u6539\u7B54\u9898"]
|
|
|
}),
|
|
|
onOk: function () {
|
|
|
var _onOk2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee10() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee10$(_context10) {
|
|
|
while (1) switch (_context10.prev = _context10.next) {
|
|
|
case 0:
|
|
|
handleToDetail();
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context10.stop();
|
|
|
}
|
|
|
}, _callee10);
|
|
|
}));
|
|
|
function onOk() {
|
|
|
return _onOk2.apply(this, arguments);
|
|
|
}
|
|
|
return onOk;
|
|
|
}()
|
|
|
});
|
|
|
message/* default */.ZP.info(res === null || res === void 0 ? void 0 : res.message);
|
|
|
}
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === -3) {
|
|
|
_time = parseInt(res === null || res === void 0 ? void 0 : res.message);
|
|
|
answerData.exercise.left_time = _time;
|
|
|
setAnswerData(objectSpread2_default()({}, answerData));
|
|
|
}
|
|
|
case 7:
|
|
|
case "end":
|
|
|
return _context11.stop();
|
|
|
}
|
|
|
}, _callee11);
|
|
|
}));
|
|
|
return function handleFinishTime() {
|
|
|
return _ref10.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var goShixun = /*#__PURE__*/function () {
|
|
|
var _ref11 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee12(item) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee12$(_context12) {
|
|
|
while (1) switch (_context12.prev = _context12.next) {
|
|
|
case 0:
|
|
|
_context12.next = 2;
|
|
|
return (item.is_jupyter || item.is_jupyter_lab ? shixuns/* execJupyter */.BK : shixuns/* execShixun */.Ir)({
|
|
|
id: item.shixun_identifier
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context12.sent;
|
|
|
if (res !== null && res !== void 0 && res.game_identifier || res !== null && res !== void 0 && res.identifier) {
|
|
|
if (item.is_jupyter_lab || item.is_jupyter) {
|
|
|
setIframeUrl("/tasks/".concat(res.identifier, "/jupyter?type=exercises&exercisesId=").concat(params.categoryId, "&coursesId=").concat(params.coursesId, "&login=").concat(params.login, "&questionId=").concat(item.question_id, "&isFullScreen=").concat((0,fullscreen/* IsFull */.vp)()).concat(iframeUrlSuffix.current || ""));
|
|
|
} else {
|
|
|
setIframeUrl("/tasks/".concat(res.game_identifier, "?type=exercises&exercisesId=").concat(params.categoryId, "&coursesId=").concat(params.coursesId, "&login=").concat(params.login, "&questionId=").concat(item.question_id, "&isFullScreen=").concat((0,fullscreen/* IsFull */.vp)()).concat(iframeUrlSuffix.current || ""));
|
|
|
}
|
|
|
setIframeBlock("block");
|
|
|
}
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === -3) {
|
|
|
(0,util/* bindPhone */.eF)();
|
|
|
} else if ((res === null || res === void 0 ? void 0 : res.status) === 2) {
|
|
|
handleResetGame(res === null || res === void 0 ? void 0 : res.message, item.question_id, item.is_jupyter_lab, item.is_jupyter);
|
|
|
} else if ((res === null || res === void 0 ? void 0 : res.status) === 3) {
|
|
|
handleInBeta(res === null || res === void 0 ? void 0 : res.message);
|
|
|
}
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context12.stop();
|
|
|
}
|
|
|
}, _callee12);
|
|
|
}));
|
|
|
return function goShixun(_x4) {
|
|
|
return _ref11.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleResetGame = function handleResetGame(url, question_id, is_jupyter_lab, is_jupyter) {
|
|
|
var _url;
|
|
|
url = (_url = url) !== null && _url !== void 0 && _url.includes('.json') ? url : "".concat(url, ".json");
|
|
|
es_modal/* default */.Z.confirm({
|
|
|
centered: true,
|
|
|
title: '提示',
|
|
|
icon: null,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u5B9E\u8BAD\u5DF2\u7ECF\u66F4\u65B0\u4E86\uFF0C\u6B63\u5728\u4E3A\u60A8\u91CD\u7F6E!"
|
|
|
}),
|
|
|
onOk: function () {
|
|
|
var _onOk3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee13() {
|
|
|
var res, execRes;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee13$(_context13) {
|
|
|
while (1) switch (_context13.prev = _context13.next) {
|
|
|
case 0:
|
|
|
_context13.next = 2;
|
|
|
return (0,service_exercise/* resetMyGame */.$Q)({
|
|
|
url: url
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context13.sent;
|
|
|
if (res) {
|
|
|
_context13.next = 5;
|
|
|
break;
|
|
|
}
|
|
|
return _context13.abrupt("return");
|
|
|
case 5:
|
|
|
message/* default */.ZP.success("重置成功,正在进入实践项目!");
|
|
|
_context13.next = 8;
|
|
|
return (0,shixuns/* execShixun */.Ir)({
|
|
|
id: res.shixun_identifier
|
|
|
});
|
|
|
case 8:
|
|
|
execRes = _context13.sent;
|
|
|
if (!(execRes !== null && execRes !== void 0 && execRes.game_identifier)) {
|
|
|
_context13.next = 12;
|
|
|
break;
|
|
|
}
|
|
|
goShixun({
|
|
|
shixun_identifier: execRes === null || execRes === void 0 ? void 0 : execRes.game_identifier,
|
|
|
question_id: question_id,
|
|
|
is_jupyter_lab: is_jupyter_lab,
|
|
|
is_jupyter: is_jupyter
|
|
|
});
|
|
|
// openNewWindow(`/tasks/${execRes.game_identifier}`);
|
|
|
return _context13.abrupt("return");
|
|
|
case 12:
|
|
|
if ((execRes === null || execRes === void 0 ? void 0 : execRes.status) === 2) {
|
|
|
handleResetGame(execRes === null || execRes === void 0 ? void 0 : execRes.message, question_id, is_jupyter_lab, is_jupyter);
|
|
|
} else if ((execRes === null || execRes === void 0 ? void 0 : execRes.status) === 3) {
|
|
|
handleInBeta(execRes === null || execRes === void 0 ? void 0 : execRes.message);
|
|
|
}
|
|
|
case 13:
|
|
|
case "end":
|
|
|
return _context13.stop();
|
|
|
}
|
|
|
}, _callee13);
|
|
|
}));
|
|
|
function onOk() {
|
|
|
return _onOk3.apply(this, arguments);
|
|
|
}
|
|
|
return onOk;
|
|
|
}()
|
|
|
});
|
|
|
};
|
|
|
var handleInBeta = function handleInBeta(message) {
|
|
|
es_modal/* default */.Z.confirm({
|
|
|
centered: true,
|
|
|
title: '提示',
|
|
|
icon: null,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u76EE\u524D\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5C1A\u5728\u5185\u6D4B\u4E2D\uFF0C\u5C06\u4E8E", message, "\u4E4B\u540E\u5F00\u653E\uFF0C\u8C22\u8C22\uFF01"]
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
var handleJoinShixun = /*#__PURE__*/function () {
|
|
|
var _ref12 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee15(item) {
|
|
|
var _exercise$exerciseUse2;
|
|
|
var checkRes;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee15$(_context15) {
|
|
|
while (1) switch (_context15.prev = _context15.next) {
|
|
|
case 0:
|
|
|
_context15.next = 2;
|
|
|
return (0,service_exercise/* checkRedoStatus */.o3)({
|
|
|
exercise_user_id: (_exercise$exerciseUse2 = exercise.exerciseUserInfo) === null || _exercise$exerciseUse2 === void 0 ? void 0 : _exercise$exerciseUse2.exercise_user_id,
|
|
|
shixun_id: item.shixun_id
|
|
|
});
|
|
|
case 2:
|
|
|
checkRes = _context15.sent;
|
|
|
if (checkRes !== null && checkRes !== void 0 && checkRes.redo) {
|
|
|
es_modal/* default */.Z.info({
|
|
|
width: 530,
|
|
|
title: '提示',
|
|
|
icon: null,
|
|
|
centered: true,
|
|
|
okText: '确定',
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u60A8\u4E4B\u524D\u5DF2\u7ECF\u6311\u6218\u8FC7\u8BE5\u5B9E\u8BAD\uFF0C\u8003\u8BD5\u8FC7\u7A0B\u4E2D\u9700\u8981\u91CD\u65B0\u6311\u6218"
|
|
|
}),
|
|
|
onOk: function () {
|
|
|
var _onOk4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee14() {
|
|
|
var res, newQuestions, index, newItem;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee14$(_context14) {
|
|
|
while (1) switch (_context14.prev = _context14.next) {
|
|
|
case 0:
|
|
|
_context14.next = 2;
|
|
|
return (0,service_exercise/* resetMyGame */.$Q)({
|
|
|
id: checkRes === null || checkRes === void 0 ? void 0 : checkRes.myshixun_identifier,
|
|
|
url: checkRes === null || checkRes === void 0 ? void 0 : checkRes.url
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context14.sent;
|
|
|
if (res) {
|
|
|
clearCountdownTimeout();
|
|
|
newQuestions = (0,lodash.cloneDeep)(answerData === null || answerData === void 0 ? void 0 : answerData.exercise_question_types);
|
|
|
index = newQuestions === null || newQuestions === void 0 ? void 0 : newQuestions.findIndex(function (e) {
|
|
|
return e.question_type === 5;
|
|
|
});
|
|
|
newQuestions[index].items.find(function (er) {
|
|
|
return er.question_id === item.question_id;
|
|
|
}).redo = false;
|
|
|
newQuestions[index].items.find(function (er) {
|
|
|
return er.question_id === item.question_id;
|
|
|
}).shixun_identifier = res.shixun_identifier;
|
|
|
answerData.exercise_question_types = newQuestions;
|
|
|
setAnswerData(answerData);
|
|
|
newItem = objectSpread2_default()(objectSpread2_default()({}, item), {}, {
|
|
|
shixun_identifier: res.shixun_identifier
|
|
|
});
|
|
|
goShixun(newItem);
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context14.stop();
|
|
|
}
|
|
|
}, _callee14);
|
|
|
}));
|
|
|
function onOk() {
|
|
|
return _onOk4.apply(this, arguments);
|
|
|
}
|
|
|
return onOk;
|
|
|
}()
|
|
|
});
|
|
|
} else {
|
|
|
clearCountdownTimeout();
|
|
|
goShixun(item);
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context15.stop();
|
|
|
}
|
|
|
}, _callee15);
|
|
|
}));
|
|
|
return function handleJoinShixun(_x5) {
|
|
|
return _ref12.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleJoinProgram = /*#__PURE__*/function () {
|
|
|
var _ref13 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee16(item) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee16$(_context16) {
|
|
|
while (1) switch (_context16.prev = _context16.next) {
|
|
|
case 0:
|
|
|
if (!item.hack_identifier) {
|
|
|
_context16.next = 5;
|
|
|
break;
|
|
|
}
|
|
|
_context16.next = 3;
|
|
|
return (0,service_exercise/* startProgram */.nF)({
|
|
|
id: item.hack_identifier
|
|
|
});
|
|
|
case 3:
|
|
|
res = _context16.sent;
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
clearCountdownTimeout();
|
|
|
setIframeUrl("/myproblems/".concat(res.identifier, "?type=exercises&exercisesId=").concat(params.categoryId, "&coursesId=").concat(params.coursesId, "&login=").concat(params.login, "&questionId=").concat(item.question_id).concat(iframeUrlSuffix.current || ""));
|
|
|
setIframeBlock("block");
|
|
|
}
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context16.stop();
|
|
|
}
|
|
|
}, _callee16);
|
|
|
}));
|
|
|
return function handleJoinProgram(_x6) {
|
|
|
return _ref13.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleSave = /*#__PURE__*/function () {
|
|
|
var _ref14 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee17(questionId, exercise_choice_id, answer_text, callBack, kp_content, kp_clazz, hideLoading) {
|
|
|
var _res$alert;
|
|
|
var ip, saveParams, res, _res$alert2;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee17$(_context17) {
|
|
|
while (1) switch (_context17.prev = _context17.next) {
|
|
|
case 0:
|
|
|
if (!hideLoading) setIsSpin(true);
|
|
|
saveParams = {
|
|
|
questionId: questionId,
|
|
|
exercise_choice_id: exercise_choice_id,
|
|
|
answer_text: answer_text
|
|
|
};
|
|
|
if (!((answerCheckData === null || answerCheckData === void 0 ? void 0 : answerCheckData.ip_limit) === 'inner' || answerCheckData.ip_bind)) {
|
|
|
_context17.next = 6;
|
|
|
break;
|
|
|
}
|
|
|
_context17.next = 5;
|
|
|
return (0,Exercise_ip/* findLocalIp */.y)({
|
|
|
ip_limit: answerCheckData === null || answerCheckData === void 0 ? void 0 : answerCheckData.ip_limit
|
|
|
});
|
|
|
case 5:
|
|
|
ip = _context17.sent;
|
|
|
case 6:
|
|
|
// await checkLocalOrPublicIp({ exerciseId: params.categoryId, ip: ip, errmsgHide: true, ip_limit: answerCheckData?.ip_limit, ip_bind: answerCheckData?.ip_bind }).catch(e => {
|
|
|
// setCheckStatus(e);
|
|
|
// })
|
|
|
|
|
|
if (kp_content) {
|
|
|
saveParams["kp_content"] = kp_content;
|
|
|
}
|
|
|
if (kp_content) {
|
|
|
saveParams["kp_clazz"] = kp_clazz;
|
|
|
}
|
|
|
if (questionId) {
|
|
|
_context17.next = 11;
|
|
|
break;
|
|
|
}
|
|
|
console.error("handleSave no questionId params");
|
|
|
return _context17.abrupt("return");
|
|
|
case 11:
|
|
|
saveParams.ip = ip;
|
|
|
_context17.next = 14;
|
|
|
return (0,service_exercise/* updateExerciseAnswers */.oX)(saveParams);
|
|
|
case 14:
|
|
|
res = _context17.sent;
|
|
|
if (res !== null && res !== void 0 && (_res$alert = res.alert) !== null && _res$alert !== void 0 && _res$alert.length) {
|
|
|
res === null || res === void 0 || (_res$alert2 = res.alert) === null || _res$alert2 === void 0 || _res$alert2.map(function (item) {
|
|
|
es_modal/* default */.Z.warn({
|
|
|
title: "提示",
|
|
|
autoFocusButton: null,
|
|
|
content: item
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
callBack && callBack();
|
|
|
signConfigFuc();
|
|
|
} else if ((res === null || res === void 0 ? void 0 : res.status) === -1) {
|
|
|
// message.warning("试卷已截止,已自动交卷")
|
|
|
setTimeout(function () {
|
|
|
handleToDetail();
|
|
|
}, 1000);
|
|
|
} else if ((res === null || res === void 0 ? void 0 : res.status) === -2) {
|
|
|
setCheckStatus(res);
|
|
|
} else if ((res === null || res === void 0 ? void 0 : res.status) === -3) {
|
|
|
res.status = -1;
|
|
|
setCheckStatus(res);
|
|
|
} else if ((res === null || res === void 0 ? void 0 : res.status) === -4) {
|
|
|
//提交的答案为空时为-4
|
|
|
signConfigFuc();
|
|
|
} else if ((res === null || res === void 0 ? void 0 : res.status) === -5) {
|
|
|
dispatch({
|
|
|
type: 'exercise/setActionTabs',
|
|
|
payload: {
|
|
|
key: 'student-unlock',
|
|
|
exerciseParams: objectSpread2_default()(objectSpread2_default()({}, answerCheckData), {}, {
|
|
|
id: params.categoryId,
|
|
|
errorMessage: res === null || res === void 0 ? void 0 : res.message
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
message/* default */.ZP.warning(res.message || "试卷已截止,已自动交卷");
|
|
|
}
|
|
|
setIsSpin(false);
|
|
|
return _context17.abrupt("return", res);
|
|
|
case 19:
|
|
|
case "end":
|
|
|
return _context17.stop();
|
|
|
}
|
|
|
}, _callee17);
|
|
|
}));
|
|
|
return function handleSave(_x7, _x8, _x9, _x10, _x11, _x12, _x13) {
|
|
|
return _ref14.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleVerifySave = /*#__PURE__*/function () {
|
|
|
var _ref15 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee20(isSave) {
|
|
|
var timeRes, time, res, tip, total, _answerData$exercise_2, _answerData$exercise_3, renderArr, filteredArr;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee20$(_context20) {
|
|
|
while (1) switch (_context20.prev = _context20.next) {
|
|
|
case 0:
|
|
|
_context20.next = 2;
|
|
|
return (0,service_exercise/* exerciseLeftTime */.PT)(objectSpread2_default()({}, params));
|
|
|
case 2:
|
|
|
timeRes = _context20.sent;
|
|
|
time = timeRes !== null && timeRes !== void 0 && timeRes.left_time ? Date.now() + (timeRes === null || timeRes === void 0 ? void 0 : timeRes.left_time) * 1000 : null;
|
|
|
_context20.next = 6;
|
|
|
return (0,service_exercise/* beginCommit */.Vj)({
|
|
|
id: params.categoryId
|
|
|
});
|
|
|
case 6:
|
|
|
res = _context20.sent;
|
|
|
if (res) {
|
|
|
_context20.next = 9;
|
|
|
break;
|
|
|
}
|
|
|
return _context20.abrupt("return");
|
|
|
case 9:
|
|
|
console.log("res===", res);
|
|
|
if (res.question_undo !== 0 || res.oj_undo !== 0) {
|
|
|
if (res.question_undo > 0) {
|
|
|
total = /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: ["\u6709", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Answermodules.orangeNum,
|
|
|
children: res.question_undo
|
|
|
}), "\u9898\u672A\u5B8C\u6210"]
|
|
|
});
|
|
|
if (res.oj_undo > 0 || res.shixun_undo > 0) {
|
|
|
renderArr = [{
|
|
|
type: (answerData === null || answerData === void 0 || (_answerData$exercise_2 = answerData.exercise_question_types) === null || _answerData$exercise_2 === void 0 || (_answerData$exercise_2 = _answerData$exercise_2.find(function (item) {
|
|
|
return item.question_type == 6;
|
|
|
})) === null || _answerData$exercise_2 === void 0 ? void 0 : _answerData$exercise_2.name) || '编程题',
|
|
|
num: res.oj_undo
|
|
|
}, {
|
|
|
type: (answerData === null || answerData === void 0 || (_answerData$exercise_3 = answerData.exercise_question_types) === null || _answerData$exercise_3 === void 0 || (_answerData$exercise_3 = _answerData$exercise_3.find(function (item) {
|
|
|
return item.question_type == 5;
|
|
|
})) === null || _answerData$exercise_3 === void 0 ? void 0 : _answerData$exercise_3.name) || '实训题',
|
|
|
num: res.shixun_undo
|
|
|
}];
|
|
|
filteredArr = renderArr.filter(function (item) {
|
|
|
return item.num > 0;
|
|
|
});
|
|
|
tip = /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [total, "\uFF08\u5176\u4E2D\u6709", filteredArr.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Answermodules.orangeNum,
|
|
|
children: item === null || item === void 0 ? void 0 : item.num
|
|
|
}), "\u4E2A", item === null || item === void 0 ? void 0 : item.type, index !== (filteredArr === null || filteredArr === void 0 ? void 0 : filteredArr.length) - 1 ? '、' : '']
|
|
|
});
|
|
|
}), "\uFF09"]
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
es_modal/* default */.Z.confirm({
|
|
|
width: 530,
|
|
|
title: '提示',
|
|
|
icon: null,
|
|
|
closable: true,
|
|
|
centered: true,
|
|
|
okText: isSave ? '知道了' : '确认交卷',
|
|
|
cancelText: '取消',
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [tip, isSave ? "\u5728".concat(dayjs_min_default()(res.end_time).format("YYYY-MM-DD HH:mm"), "\u4E4B\u524D\uFF0C\u5141\u8BB8\u4FEE\u6539\u7B54\u9898") : time ? "\u4F60\u672C\u573A\u8003\u8BD5\u5269\u4F59\u65F6\u95F4\u8FD8\u6709".concat((0,util/* toTimeFormat */.li)((time - new Date().getTime()) / 1000), " \uFF0C\u786E\u8BA4\u63D0\u524D\u4EA4\u5377\u5417\uFF1F") : "提交后无法再修改答题,是否确认提交?"]
|
|
|
}),
|
|
|
onOk: function () {
|
|
|
var _onOk5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee18() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee18$(_context18) {
|
|
|
while (1) switch (_context18.prev = _context18.next) {
|
|
|
case 0:
|
|
|
setOpenFullScreen(false);
|
|
|
setStartRecording(false);
|
|
|
if (!isSave) {
|
|
|
_context18.next = 6;
|
|
|
break;
|
|
|
}
|
|
|
if (!(answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.screen_open)) handleToDetail();else message/* default */.ZP.success("保存成功");
|
|
|
_context18.next = 8;
|
|
|
break;
|
|
|
case 6:
|
|
|
_context18.next = 8;
|
|
|
return handleSubmitAnswer();
|
|
|
case 8:
|
|
|
case "end":
|
|
|
return _context18.stop();
|
|
|
}
|
|
|
}, _callee18);
|
|
|
}));
|
|
|
function onOk() {
|
|
|
return _onOk5.apply(this, arguments);
|
|
|
}
|
|
|
return onOk;
|
|
|
}()
|
|
|
});
|
|
|
} else {
|
|
|
es_modal/* default */.Z.confirm({
|
|
|
width: 530,
|
|
|
title: '提示',
|
|
|
icon: null,
|
|
|
centered: true,
|
|
|
okText: isSave ? '知道了' : '确认交卷',
|
|
|
cancelText: '取消',
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: isSave ? "\u5728".concat(dayjs_min_default()(res.end_time).format("YYYY-MM-DD HH:mm"), "\u4E4B\u524D\uFF0C\u5141\u8BB8\u4FEE\u6539\u7B54\u9898") : time ? "\u4F60\u672C\u573A\u8003\u8BD5\u5269\u4F59\u65F6\u95F4\u8FD8\u6709".concat((0,util/* toTimeFormat */.li)((time - new Date().getTime()) / 1000), " \uFF0C\u786E\u8BA4\u63D0\u524D\u4EA4\u5377\u5417\uFF1F") : "提交后无法再修改答题,是否确认提交?"
|
|
|
}),
|
|
|
onOk: function () {
|
|
|
var _onOk6 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee19() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee19$(_context19) {
|
|
|
while (1) switch (_context19.prev = _context19.next) {
|
|
|
case 0:
|
|
|
setOpenFullScreen(false);
|
|
|
setStartRecording(false);
|
|
|
if (!isSave) {
|
|
|
_context19.next = 6;
|
|
|
break;
|
|
|
}
|
|
|
if (!(answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.screen_open)) handleToDetail();else message/* default */.ZP.success("保存成功");
|
|
|
_context19.next = 8;
|
|
|
break;
|
|
|
case 6:
|
|
|
_context19.next = 8;
|
|
|
return handleSubmitAnswer();
|
|
|
case 8:
|
|
|
case "end":
|
|
|
return _context19.stop();
|
|
|
}
|
|
|
}, _callee19);
|
|
|
}));
|
|
|
function onOk() {
|
|
|
return _onOk6.apply(this, arguments);
|
|
|
}
|
|
|
return onOk;
|
|
|
}()
|
|
|
});
|
|
|
}
|
|
|
case 11:
|
|
|
case "end":
|
|
|
return _context20.stop();
|
|
|
}
|
|
|
}, _callee20);
|
|
|
}));
|
|
|
return function handleVerifySave(_x14) {
|
|
|
return _ref15.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var submitProgressContent = function submitProgressContent(progress) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_progress/* default */.Z, {
|
|
|
strokeColor: {
|
|
|
from: '#3061D0',
|
|
|
to: '#63E0FB'
|
|
|
},
|
|
|
status: "active",
|
|
|
percent: progress
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "c-grey-c tc mt10 mb20",
|
|
|
children: "\u6B63\u5728\u5224\u5206\u4E2D\u2026"
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var submitProgressLoading = function submitProgressLoading() {
|
|
|
var progress = 0;
|
|
|
var modal = es_modal/* default */.Z.info({
|
|
|
title: "交卷中",
|
|
|
icon: null,
|
|
|
className: "modal-footer-none",
|
|
|
content: submitProgressContent(progress)
|
|
|
});
|
|
|
var interval = setInterval(function () {
|
|
|
if (progress <= 100) {
|
|
|
progress += 2;
|
|
|
modal.update({
|
|
|
content: submitProgressContent(progress)
|
|
|
});
|
|
|
} else {
|
|
|
modal.destroy();
|
|
|
clearInterval(interval);
|
|
|
}
|
|
|
}, 50);
|
|
|
};
|
|
|
var handleSubmitAnswer = /*#__PURE__*/function () {
|
|
|
var _ref16 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee21() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee21$(_context21) {
|
|
|
while (1) switch (_context21.prev = _context21.next) {
|
|
|
case 0:
|
|
|
_context21.next = 2;
|
|
|
return (0,service_exercise/* submitExerciseAnswer */.VL)({
|
|
|
categoryId: params.categoryId,
|
|
|
commit_method: 1
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context21.sent;
|
|
|
_context21.next = 5;
|
|
|
return dispatch({
|
|
|
type: "exercise/setActionTabs",
|
|
|
payload: objectSpread2_default()({}, {
|
|
|
removeEventListenerExitScreen: true
|
|
|
})
|
|
|
});
|
|
|
case 5:
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
submitProgressLoading();
|
|
|
message/* default */.ZP.success(res === null || res === void 0 ? void 0 : res.message);
|
|
|
setShowCamera(false);
|
|
|
// initData();
|
|
|
try {
|
|
|
socket.send(JSON.stringify({
|
|
|
type: "toggleLockExit",
|
|
|
data: false
|
|
|
}));
|
|
|
socket.send(JSON.stringify({
|
|
|
type: "network-open",
|
|
|
data: ''
|
|
|
}));
|
|
|
} catch (_unused2) {}
|
|
|
setTimeout(function () {
|
|
|
var _answerData$exercise6, _answerData$exercise7, _res$data14, _answerData$exercise8, _res$data15;
|
|
|
es_modal/* default */.Z.info({
|
|
|
centered: true,
|
|
|
title: "交卷成功",
|
|
|
className: "".concat(Answermodules.commitModal),
|
|
|
width: 520,
|
|
|
icon: null,
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: "mb20",
|
|
|
gutter: 20,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
span: 12,
|
|
|
className: Answermodules.commitItem,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Answermodules.commitInfoLabel,
|
|
|
children: "\u59D3\u540D"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Answermodules.commitInfoValue,
|
|
|
title: answerData === null || answerData === void 0 || (_answerData$exercise6 = answerData.exercise) === null || _answerData$exercise6 === void 0 ? void 0 : _answerData$exercise6.user_name,
|
|
|
children: (answerData === null || answerData === void 0 || (_answerData$exercise7 = answerData.exercise) === null || _answerData$exercise7 === void 0 ? void 0 : _answerData$exercise7.user_name) || '- -'
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
span: 12,
|
|
|
className: Answermodules.commitItem,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Answermodules.commitInfoLabel,
|
|
|
children: "\u4F5C\u7B54\u65F6\u957F"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Answermodules.commitInfoValue,
|
|
|
children: res === null || res === void 0 || (_res$data14 = res.data) === null || _res$data14 === void 0 ? void 0 : _res$data14.user_exercise_time
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
gutter: 20,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
span: 12,
|
|
|
className: Answermodules.commitItem,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Answermodules.commitInfoLabel,
|
|
|
children: "\u5B66\u53F7"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Answermodules.commitInfoValue,
|
|
|
children: (answerData === null || answerData === void 0 || (_answerData$exercise8 = answerData.exercise) === null || _answerData$exercise8 === void 0 ? void 0 : _answerData$exercise8.student_id) || '- -'
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
span: 12,
|
|
|
className: Answermodules.commitItem,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Answermodules.commitInfoLabel,
|
|
|
children: "\u4EA4\u5377\u65F6\u95F4"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Answermodules.commitInfoValue,
|
|
|
children: res === null || res === void 0 || (_res$data15 = res.data) === null || _res$data15 === void 0 ? void 0 : _res$data15.commit_time
|
|
|
})]
|
|
|
})]
|
|
|
})]
|
|
|
}),
|
|
|
okText: "确定",
|
|
|
maskClosable: false,
|
|
|
keyboard: false,
|
|
|
onOk: function onOk() {
|
|
|
(0,fullscreen/* exitFull */.BU)();
|
|
|
handleToDetail();
|
|
|
}
|
|
|
});
|
|
|
}, 3000);
|
|
|
}
|
|
|
case 6:
|
|
|
case "end":
|
|
|
return _context21.stop();
|
|
|
}
|
|
|
}, _callee21);
|
|
|
}));
|
|
|
return function handleSubmitAnswer() {
|
|
|
return _ref16.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleChangeSingle = /*#__PURE__*/function () {
|
|
|
var _ref17 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee22(value, id, key, item) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee22$(_context22) {
|
|
|
while (1) switch (_context22.prev = _context22.next) {
|
|
|
case 0:
|
|
|
handleSave(id, value, null, function () {
|
|
|
//答题卡选中
|
|
|
answerData.question_status.find(function (item) {
|
|
|
return item.ques_id === id;
|
|
|
}).ques_status = value ? 1 : 0;
|
|
|
item.user_answer = [];
|
|
|
item.user_answer.push(value);
|
|
|
// if (!item.repeat_answer) {
|
|
|
// item.ques_status = 1 //手动将题目设为已作答的状态
|
|
|
// }
|
|
|
setAnswerData(objectSpread2_default()({}, answerData));
|
|
|
});
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context22.stop();
|
|
|
}
|
|
|
}, _callee22);
|
|
|
}));
|
|
|
return function handleChangeSingle(_x15, _x16, _x17, _x18) {
|
|
|
return _ref17.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleChangeSingles = /*#__PURE__*/function () {
|
|
|
var _ref18 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee23(value, id, key, item, items) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee23$(_context23) {
|
|
|
while (1) switch (_context23.prev = _context23.next) {
|
|
|
case 0:
|
|
|
handleSave(item.question_id, value, null, function () {
|
|
|
var _items$sub_exercise_q, _items$sub_exercise_q2, _items$sub_exercise_q3;
|
|
|
item.user_answer = [];
|
|
|
item.user_answer.push(value);
|
|
|
items.user_answer = toConsumableArray_default()(item.user_answer); //组合题的是否作答判断也要放在外层
|
|
|
var answer = items === null || items === void 0 || (_items$sub_exercise_q = items.sub_exercise_questions) === null || _items$sub_exercise_q === void 0 ? void 0 : _items$sub_exercise_q.filter(function (item) {
|
|
|
var _item$user_answer;
|
|
|
return ((_item$user_answer = item.user_answer) === null || _item$user_answer === void 0 ? void 0 : _item$user_answer.length) === 0;
|
|
|
});
|
|
|
answerData.question_status.find(function (item) {
|
|
|
return item.ques_id === id;
|
|
|
}).ques_status = (answer === null || answer === void 0 ? void 0 : answer.length) === (items === null || items === void 0 || (_items$sub_exercise_q2 = items.sub_exercise_questions) === null || _items$sub_exercise_q2 === void 0 ? void 0 : _items$sub_exercise_q2.length) ? 0 : (answer === null || answer === void 0 ? void 0 : answer.length) > 0 && (answer === null || answer === void 0 ? void 0 : answer.length) < (items === null || items === void 0 || (_items$sub_exercise_q3 = items.sub_exercise_questions) === null || _items$sub_exercise_q3 === void 0 ? void 0 : _items$sub_exercise_q3.length) ? 2 : 1;
|
|
|
setAnswerData(objectSpread2_default()({}, answerData));
|
|
|
});
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context23.stop();
|
|
|
}
|
|
|
}, _callee23);
|
|
|
}));
|
|
|
return function handleChangeSingles(_x19, _x20, _x21, _x22, _x23) {
|
|
|
return _ref18.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleChangeMultiple = function handleChangeMultiple(value, id, item) {
|
|
|
if (!(value !== null && value !== void 0 && value.length)) return;
|
|
|
handleSave(id, value, null, function () {
|
|
|
item.user_answer = value;
|
|
|
// if (!item.repeat_answer) {
|
|
|
// item.israp = true;
|
|
|
// }
|
|
|
answerData.question_status.find(function (item) {
|
|
|
return item.ques_id === id;
|
|
|
}).ques_status = value !== null && value !== void 0 && value.length ? 1 : 0;
|
|
|
setAnswerData(objectSpread2_default()({}, answerData));
|
|
|
});
|
|
|
};
|
|
|
var handleBlurFill = /*#__PURE__*/function () {
|
|
|
var _ref19 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee24(value, index, id, param, item) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee24$(_context24) {
|
|
|
while (1) switch (_context24.prev = _context24.next) {
|
|
|
case 0:
|
|
|
if (value.replaceAll(' ', '')) {
|
|
|
_context24.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
signConfigFuc();
|
|
|
return _context24.abrupt("return", {
|
|
|
status: -4,
|
|
|
message: '答案不能为空'
|
|
|
});
|
|
|
case 3:
|
|
|
_context24.next = 5;
|
|
|
return handleSave(id, index, value, function () {
|
|
|
answerData.question_status.find(function (item) {
|
|
|
return item.ques_id === id;
|
|
|
}).ques_status = param.every(function (k) {
|
|
|
return !!k.answer_text;
|
|
|
}) ? 1 : answerData.question_status.find(function (item) {
|
|
|
return item.ques_id === id;
|
|
|
}).ques_status = param.some(function (k) {
|
|
|
return !!k.answer_text;
|
|
|
}) ? 2 : 0;
|
|
|
var answers = {
|
|
|
choice_id: index,
|
|
|
answer_text: value
|
|
|
};
|
|
|
if (item.user_answer.filter(function (item) {
|
|
|
return item.choice_id != index;
|
|
|
})) {
|
|
|
item.user_answer.splice(index - 1, 1, answers);
|
|
|
} else {
|
|
|
item.user_answer.push(answers);
|
|
|
}
|
|
|
setAnswerData(objectSpread2_default()({}, answerData));
|
|
|
});
|
|
|
case 5:
|
|
|
res = _context24.sent;
|
|
|
return _context24.abrupt("return", res);
|
|
|
case 7:
|
|
|
case "end":
|
|
|
return _context24.stop();
|
|
|
}
|
|
|
}, _callee24);
|
|
|
}));
|
|
|
return function handleBlurFill(_x24, _x25, _x26, _x27, _x28) {
|
|
|
return _ref19.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleBlurBProgram = /*#__PURE__*/function () {
|
|
|
var _ref20 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee25(value, index, id, param, item) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee25$(_context25) {
|
|
|
while (1) switch (_context25.prev = _context25.next) {
|
|
|
case 0:
|
|
|
_context25.next = 2;
|
|
|
return handleSave(id, index, value, function () {
|
|
|
answerData.question_status.find(function (item) {
|
|
|
return item.ques_id === id;
|
|
|
}).ques_status = param.every(function (k) {
|
|
|
return !!k.value;
|
|
|
}) ? 1 : answerData.question_status.find(function (item) {
|
|
|
return item.ques_id === id;
|
|
|
}).ques_status = param.some(function (k) {
|
|
|
return !!k.value;
|
|
|
}) ? 2 : 0;
|
|
|
// item.user_answer=value;
|
|
|
var answers = {
|
|
|
choice_id: index,
|
|
|
answer_text: value
|
|
|
};
|
|
|
if (item.user_answer.filter(function (item) {
|
|
|
return item.choice_id != index;
|
|
|
})) {
|
|
|
item.user_answer.splice(index - 1, 1, answers);
|
|
|
} else {
|
|
|
item.user_answer.push(answers);
|
|
|
}
|
|
|
if (!item.repeat_answer) {
|
|
|
item.israp = true;
|
|
|
}
|
|
|
setAnswerData(objectSpread2_default()({}, answerData));
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context25.sent;
|
|
|
return _context25.abrupt("return", res);
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context25.stop();
|
|
|
}
|
|
|
}, _callee25);
|
|
|
}));
|
|
|
return function handleBlurBProgram(_x29, _x30, _x31, _x32, _x33) {
|
|
|
return _ref20.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleBlurSimple = function handleBlurSimple(value, id, item, hideLoading) {
|
|
|
if (!value.replaceAll(' ', '')) {
|
|
|
signConfigFuc();
|
|
|
return;
|
|
|
}
|
|
|
handleSave(id, null, value, function () {
|
|
|
answerData.question_status.find(function (item) {
|
|
|
return item.ques_id === id;
|
|
|
}).ques_status = value ? 1 : 0;
|
|
|
item.user_answer = [];
|
|
|
item.user_answer.push(value);
|
|
|
setAnswerData(objectSpread2_default()({}, answerData));
|
|
|
}, undefined, undefined, hideLoading);
|
|
|
};
|
|
|
var renderSingle = function renderSingle(item, key) {
|
|
|
var _answerData$exercise9, _item$user_answer2, _item$user_answer3, _item$question_choice2, _answerData$exercise10, _answerData$exercise11;
|
|
|
var answerText = '';
|
|
|
var answerBool = (item === null || item === void 0 ? void 0 : item.question_type) === 0 || (item === null || item === void 0 ? void 0 : item.question_type) === 1;
|
|
|
if (answerBool) {
|
|
|
var _item$question_choice;
|
|
|
item === null || item === void 0 || (_item$question_choice = item.question_choices) === null || _item$question_choice === void 0 || _item$question_choice.forEach(function (k, i) {
|
|
|
if (k.standard_boolean) {
|
|
|
answerText = answerText + tagList[i];
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
var disabled = (answerData === null || answerData === void 0 || (_answerData$exercise9 = answerData.exercise) === null || _answerData$exercise9 === void 0 ? void 0 : _answerData$exercise9.user_exercise_status) === 1 || !item.repeat_answer && (item === null || item === void 0 || (_item$user_answer2 = item.user_answer) === null || _item$user_answer2 === void 0 ? void 0 : _item$user_answer2.length) > 0 && item.ques_status !== 0;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Answermodules.baseMargin,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Group */.ZP.Group, {
|
|
|
disabled: disabled,
|
|
|
defaultValue: item === null || item === void 0 || (_item$user_answer3 = item.user_answer) === null || _item$user_answer3 === void 0 ? void 0 : _item$user_answer3[0],
|
|
|
onChange: function onChange(e) {
|
|
|
return handleChangeSingle(e.target.value, item === null || item === void 0 ? void 0 : item.question_id, key, item);
|
|
|
},
|
|
|
className: item.user_score && "edu-radio-".concat(item.user_score === item.question_score ? "green" : "red"),
|
|
|
children: item === null || item === void 0 || (_item$question_choice2 = item.question_choices) === null || _item$question_choice2 === void 0 ? void 0 : _item$question_choice2.map(function (answer, index) {
|
|
|
var isJudge = item.question_type == 2;
|
|
|
var prefix = isJudge ? '' : "".concat(tagList[index], ".");
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Answermodules.answerWrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default */.ZP, {
|
|
|
className: Answermodules.noWrap,
|
|
|
value: answer === null || answer === void 0 ? void 0 : answer.choice_id,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#333333'
|
|
|
},
|
|
|
className: "font16 mr3",
|
|
|
children: prefix
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
style: {
|
|
|
width: 740
|
|
|
},
|
|
|
className: Answermodules.renderHtml,
|
|
|
value: answer === null || answer === void 0 ? void 0 : answer.choice_text
|
|
|
})]
|
|
|
})
|
|
|
}, index);
|
|
|
})
|
|
|
})
|
|
|
}), ((0,authority/* isAdmin */.GJ)() || (0,authority/* isStudent */.dE)() && (answerData === null || answerData === void 0 || (_answerData$exercise10 = answerData.exercise) === null || _answerData$exercise10 === void 0 ? void 0 : _answerData$exercise10.user_exercise_status) > 0 && (answerData === null || answerData === void 0 || (_answerData$exercise11 = answerData.exercise) === null || _answerData$exercise11 === void 0 ? void 0 : _answerData$exercise11.open_score)) && /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "end",
|
|
|
className: "mb20",
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font14",
|
|
|
style: {
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u5F97\u5206"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font14 ml10",
|
|
|
children: [(item === null || item === void 0 ? void 0 : item.user_score) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Answer_scoreStatusMapping[Number(item === null || item === void 0 ? void 0 : item.answer_status)] || 'c-orange-ff9',
|
|
|
children: item === null || item === void 0 ? void 0 : item.user_score
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
marginLeft: 5,
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u5206"
|
|
|
})]
|
|
|
}), !(item !== null && item !== void 0 && item.user_score) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-red",
|
|
|
children: "\u672A\u8BC4"
|
|
|
})]
|
|
|
})]
|
|
|
}), (item === null || item === void 0 ? void 0 : item.standard_answer_show) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Answermodules.analysisWrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Answermodules.greyBg,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: "mb20",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
className: "font14 mr10",
|
|
|
style: {
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u3010\u7B54\u6848\u3011"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: answerBool ? answerText : item === null || item === void 0 ? void 0 : item.standard_answer_show
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font14 mr10",
|
|
|
style: {
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u3010\u89E3\u6790\u3011"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
className: Answermodules.renderHtml,
|
|
|
value: item === null || item === void 0 ? void 0 : item.analysis
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var renderSingles = function renderSingles(items, keys, i) {
|
|
|
var _answerData$exercise12, _items$sub_exercise_q4;
|
|
|
var disabled = (answerData === null || answerData === void 0 || (_answerData$exercise12 = answerData.exercise) === null || _answerData$exercise12 === void 0 ? void 0 : _answerData$exercise12.user_exercise_status) === 1 || !items.repeat_answer && items.ques_status !== 0;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: items === null || items === void 0 || (_items$sub_exercise_q4 = items.sub_exercise_questions) === null || _items$sub_exercise_q4 === void 0 ? void 0 : _items$sub_exercise_q4.map(function (item, key) {
|
|
|
var _item$question_choice3, _item$user_answer4, _item$question_choice4, _answerData$exercise13, _answerData$exercise14;
|
|
|
var answerText = '';
|
|
|
item === null || item === void 0 || (_item$question_choice3 = item.question_choices) === null || _item$question_choice3 === void 0 || _item$question_choice3.forEach(function (k, i) {
|
|
|
if (k.standard_boolean) {
|
|
|
answerText = answerText + tagList[i];
|
|
|
}
|
|
|
});
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "".concat(Answermodules.baseMargin, " ").concat(Answermodules.singleItem, " mb20"),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
display: 'flex',
|
|
|
alignItems: 'baseline',
|
|
|
userSelect: "none",
|
|
|
marginBottom: 40
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
style: {
|
|
|
flexShrink: 0,
|
|
|
color: '#999999'
|
|
|
},
|
|
|
className: "font14",
|
|
|
children: ["\uFF08", item === null || item === void 0 ? void 0 : item.question_score, "\u5206\uFF09"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
flexShrink: 0,
|
|
|
marginRight: 6
|
|
|
},
|
|
|
className: "font16",
|
|
|
children: i + 1 + '.' + (key + 1)
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item === null || item === void 0 ? void 0 : item.question_title
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Group */.ZP.Group, {
|
|
|
style: {
|
|
|
marginLeft: 66
|
|
|
},
|
|
|
disabled: disabled,
|
|
|
defaultValue: item === null || item === void 0 || (_item$user_answer4 = item.user_answer) === null || _item$user_answer4 === void 0 ? void 0 : _item$user_answer4[0],
|
|
|
onChange: function onChange(e) {
|
|
|
return handleChangeSingles(e.target.value, items === null || items === void 0 ? void 0 : items.question_id, key, item, items);
|
|
|
},
|
|
|
className: item.user_score && "edu-radio-".concat(item.user_score === item.question_score ? "green" : "red"),
|
|
|
children: item === null || item === void 0 || (_item$question_choice4 = item.question_choices) === null || _item$question_choice4 === void 0 ? void 0 : _item$question_choice4.map(function (answer, index) {
|
|
|
var isJudge = item.question_type == 2;
|
|
|
var prefix = isJudge ? '' : "".concat(tagList[index], ".");
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Answermodules.answerWrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default */.ZP, {
|
|
|
className: Answermodules.noWrap,
|
|
|
value: answer === null || answer === void 0 ? void 0 : answer.choice_id,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#333333'
|
|
|
},
|
|
|
className: "mr3 font16 ".concat(Answermodules.noWrap),
|
|
|
children: prefix
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
style: {
|
|
|
width: 734
|
|
|
},
|
|
|
className: Answermodules.renderHtml,
|
|
|
value: answer === null || answer === void 0 ? void 0 : answer.choice_text
|
|
|
})]
|
|
|
})
|
|
|
}, index);
|
|
|
})
|
|
|
}), ((0,authority/* isAdmin */.GJ)() || (0,authority/* isStudent */.dE)() && (answerData === null || answerData === void 0 || (_answerData$exercise13 = answerData.exercise) === null || _answerData$exercise13 === void 0 ? void 0 : _answerData$exercise13.user_exercise_status) > 0 && (answerData === null || answerData === void 0 || (_answerData$exercise14 = answerData.exercise) === null || _answerData$exercise14 === void 0 ? void 0 : _answerData$exercise14.open_score)) && /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "end",
|
|
|
className: "mb20",
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font14",
|
|
|
style: {
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u5F97\u5206"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font14 ml10",
|
|
|
children: [(item === null || item === void 0 ? void 0 : item.user_score) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Answer_scoreStatusMapping[Number(item === null || item === void 0 ? void 0 : item.answer_status)] || 'c-orange-ff9',
|
|
|
children: item === null || item === void 0 ? void 0 : item.user_score
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
marginLeft: 5,
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u5206"
|
|
|
})]
|
|
|
}), !(item !== null && item !== void 0 && item.user_score) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-red",
|
|
|
children: "\u672A\u8BC4"
|
|
|
})]
|
|
|
})]
|
|
|
}), (item === null || item === void 0 ? void 0 : item.standard_answer_show) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Answermodules.analysisWrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Answermodules.greyBg,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: "mb20",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
className: "font14 mr10",
|
|
|
style: {
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u3010\u7B54\u6848\u3011"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: answerText
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font14 mr10",
|
|
|
style: {
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u3010\u89E3\u6790\u3011"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
className: Answermodules.renderHtml,
|
|
|
value: item === null || item === void 0 ? void 0 : item.analysis
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
}, key);
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
var renderMultiple = function renderMultiple(item, key) {
|
|
|
var _answerData$exercise15, _item$user_answer5, _item$question_choice6, _answerData$exercise16, _answerData$exercise17;
|
|
|
var answerText = '';
|
|
|
var answerBool = (item === null || item === void 0 ? void 0 : item.question_type) === 0 || (item === null || item === void 0 ? void 0 : item.question_type) === 1;
|
|
|
if (answerBool) {
|
|
|
var _item$question_choice5;
|
|
|
item === null || item === void 0 || (_item$question_choice5 = item.question_choices) === null || _item$question_choice5 === void 0 || _item$question_choice5.forEach(function (k, i) {
|
|
|
if (k.standard_boolean) {
|
|
|
answerText = answerText + tagList[i];
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
var disabled = (answerData === null || answerData === void 0 || (_answerData$exercise15 = answerData.exercise) === null || _answerData$exercise15 === void 0 ? void 0 : _answerData$exercise15.user_exercise_status) === 1 || !item.repeat_answer && (item === null || item === void 0 || (_item$user_answer5 = item.user_answer) === null || _item$user_answer5 === void 0 ? void 0 : _item$user_answer5.length) > 0 && item.ques_status !== 0;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Answermodules.baseMargin,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z.Group, {
|
|
|
disabled: disabled,
|
|
|
defaultValue: item === null || item === void 0 ? void 0 : item.user_answer,
|
|
|
style: {
|
|
|
flexDirection: 'column'
|
|
|
},
|
|
|
onChange: function onChange(value) {
|
|
|
return handleChangeMultiple(value, item === null || item === void 0 ? void 0 : item.question_id, item);
|
|
|
},
|
|
|
className: item.user_score && "edu-checkbox-".concat(item.user_score === item.question_score ? "green" : "red"),
|
|
|
children: item === null || item === void 0 || (_item$question_choice6 = item.question_choices) === null || _item$question_choice6 === void 0 ? void 0 : _item$question_choice6.map(function (answer, index) {
|
|
|
var prefix = "".concat(tagList[index], ".");
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Answermodules.answerWrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_checkbox/* default */.Z, {
|
|
|
value: answer === null || answer === void 0 ? void 0 : answer.choice_id,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#333333'
|
|
|
},
|
|
|
className: "font16 mr3",
|
|
|
children: prefix
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
className: Answermodules.renderHtml,
|
|
|
value: answer === null || answer === void 0 ? void 0 : answer.choice_text
|
|
|
})]
|
|
|
})
|
|
|
});
|
|
|
})
|
|
|
})
|
|
|
}), ((0,authority/* isAdmin */.GJ)() || (0,authority/* isStudent */.dE)() && (answerData === null || answerData === void 0 || (_answerData$exercise16 = answerData.exercise) === null || _answerData$exercise16 === void 0 ? void 0 : _answerData$exercise16.user_exercise_status) > 0 && (answerData === null || answerData === void 0 || (_answerData$exercise17 = answerData.exercise) === null || _answerData$exercise17 === void 0 ? void 0 : _answerData$exercise17.open_score)) && /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "end",
|
|
|
className: "mb20",
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font14",
|
|
|
style: {
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u5F97\u5206"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font14 ml10",
|
|
|
children: [(item === null || item === void 0 ? void 0 : item.user_score) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Answer_scoreStatusMapping[Number(item === null || item === void 0 ? void 0 : item.answer_status)] || 'c-orange-ff9',
|
|
|
children: item === null || item === void 0 ? void 0 : item.user_score
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
marginLeft: 5,
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u5206"
|
|
|
})]
|
|
|
}), !(item !== null && item !== void 0 && item.user_score) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-red",
|
|
|
children: "\u672A\u8BC4"
|
|
|
})]
|
|
|
})]
|
|
|
}), (item === null || item === void 0 ? void 0 : item.standard_answer_show) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Answermodules.analysisWrap,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Answermodules.greyBg,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: "mb20",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
className: "font14 mr10",
|
|
|
style: {
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u3010\u7B54\u6848\u3011"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: answerBool ? answerText : item === null || item === void 0 ? void 0 : item.standard_answer_show
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font14 mr10",
|
|
|
style: {
|
|
|
color: '#6A7283'
|
|
|
},
|
|
|
children: "\u3010\u89E3\u6790\u3011"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
className: Answermodules.renderHtml,
|
|
|
value: item === null || item === void 0 ? void 0 : item.analysis
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var renderFill = function renderFill(item, key) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(components_Fill, {
|
|
|
item: item,
|
|
|
sign: sign,
|
|
|
answerData: answerData,
|
|
|
onBlur: /*#__PURE__*/function () {
|
|
|
var _ref21 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee26(value, index, userAnswer) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee26$(_context26) {
|
|
|
while (1) switch (_context26.prev = _context26.next) {
|
|
|
case 0:
|
|
|
_context26.next = 2;
|
|
|
return handleBlurFill(value, index, item === null || item === void 0 ? void 0 : item.question_id, userAnswer, item);
|
|
|
case 2:
|
|
|
return _context26.abrupt("return", _context26.sent);
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context26.stop();
|
|
|
}
|
|
|
}, _callee26);
|
|
|
}));
|
|
|
return function (_x34, _x35, _x36) {
|
|
|
return _ref21.apply(this, arguments);
|
|
|
};
|
|
|
}()
|
|
|
});
|
|
|
};
|
|
|
|
|
|
// 简答题
|
|
|
var renderSimple = function renderSimple(item, key) {
|
|
|
if (isEducation) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(Simple2, {
|
|
|
item: item,
|
|
|
answerData: answerData,
|
|
|
onBlur: function onBlur(value, kp_content, kp_clazz) {
|
|
|
return handleSave(item === null || item === void 0 ? void 0 : item.question_id, null, value, undefined, kp_content, kp_clazz);
|
|
|
},
|
|
|
isEducation: isEducation
|
|
|
});
|
|
|
} else {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(components_Simple, {
|
|
|
item: item,
|
|
|
answerData: answerData,
|
|
|
onBlur: function onBlur(value, hideLoading) {
|
|
|
return handleBlurSimple(value, item === null || item === void 0 ? void 0 : item.question_id, item, hideLoading);
|
|
|
},
|
|
|
isEducation: isEducation,
|
|
|
sign: sign
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
var renderShixun = function renderShixun(item, key) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(components_Shixun, {
|
|
|
item: item,
|
|
|
answerData: answerData,
|
|
|
exerciseId: params.categoryId,
|
|
|
coursesId: params.coursesId
|
|
|
});
|
|
|
};
|
|
|
var renderProgram = function renderProgram(item, key) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(components_Program, {
|
|
|
item: item,
|
|
|
answerData: answerData
|
|
|
});
|
|
|
};
|
|
|
var renderBProgram = function renderBProgram(item, key) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(components_BFill, {
|
|
|
item: item,
|
|
|
answerData: answerData,
|
|
|
onBlur: /*#__PURE__*/function () {
|
|
|
var _ref22 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee27(value, index, userAnswer) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee27$(_context27) {
|
|
|
while (1) switch (_context27.prev = _context27.next) {
|
|
|
case 0:
|
|
|
_context27.next = 2;
|
|
|
return handleBlurBProgram(value, index, item === null || item === void 0 ? void 0 : item.question_id, userAnswer, item);
|
|
|
case 2:
|
|
|
return _context27.abrupt("return", _context27.sent);
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context27.stop();
|
|
|
}
|
|
|
}, _callee27);
|
|
|
}));
|
|
|
return function (_x37, _x38, _x39) {
|
|
|
return _ref22.apply(this, arguments);
|
|
|
};
|
|
|
}()
|
|
|
});
|
|
|
};
|
|
|
var renderAnswerCard = function renderAnswerCard(title, key, index) {
|
|
|
var _answerData$exercise_4, _obj$items;
|
|
|
var obj = answerData === null || answerData === void 0 || (_answerData$exercise_4 = answerData.exercise_question_types) === null || _answerData$exercise_4 === void 0 ? void 0 : _answerData$exercise_4.find(function (item) {
|
|
|
return item.question_type === key;
|
|
|
});
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Answermodules.answerSheetWrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Answermodules.answerSheetQuestionTitle,
|
|
|
onClick: function onClick() {
|
|
|
hideAnswerCard[key] = !hideAnswerCard[key];
|
|
|
setHideAnswerCard(objectSpread2_default()({}, hideAnswerCard));
|
|
|
},
|
|
|
children: [!hideAnswerCard[key] && /*#__PURE__*/(0,jsx_runtime.jsx)(MinusSquareOutlined/* default */.Z, {}), hideAnswerCard[key] && /*#__PURE__*/(0,jsx_runtime.jsx)(PlusSquareOutlined/* default */.Z, {}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "ml5 c-grey-666",
|
|
|
children: title
|
|
|
})]
|
|
|
}), !hideAnswerCard[key] && /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
|
|
|
className: Answermodules.answerSheet,
|
|
|
gutter: [20, 20],
|
|
|
children: obj === null || obj === void 0 || (_obj$items = obj.items) === null || _obj$items === void 0 ? void 0 : _obj$items.map(function (item, k) {
|
|
|
if (item.question_type === key) {
|
|
|
var _answerData$question_2, _answerData$question_3, _answerData$question_4;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
onClick: function onClick() {
|
|
|
if (index === oneindex && k === twoindex) {
|
|
|
//点击的答题卡选项恰好是当前题目时不该做任何操作
|
|
|
return;
|
|
|
}
|
|
|
if (sign.current) {
|
|
|
sign.current = 'appoint';
|
|
|
skipData.current = {
|
|
|
oneindex: index,
|
|
|
twoindex: k
|
|
|
};
|
|
|
return;
|
|
|
}
|
|
|
skipAppointQuestion({
|
|
|
oneindex: index,
|
|
|
twoindex: k
|
|
|
});
|
|
|
},
|
|
|
className: "\n ".concat(Answermodules.answerSheetItem, "\n ").concat(answerData !== null && answerData !== void 0 && (_answerData$question_2 = answerData.question_status) !== null && _answerData$question_2 !== void 0 && _answerData$question_2.some(function (val) {
|
|
|
return val.ques_id === item.question_id && (val === null || val === void 0 ? void 0 : val.ques_status) === 1;
|
|
|
}) ? Answermodules.active : '', "\n ").concat(answerData !== null && answerData !== void 0 && (_answerData$question_3 = answerData.question_status) !== null && _answerData$question_3 !== void 0 && _answerData$question_3.some(function (val) {
|
|
|
return val.ques_id === item.question_id && (val === null || val === void 0 ? void 0 : val.ques_status) === 2;
|
|
|
}) ? Answermodules.partialActive : '', "\n ").concat(index === oneindex && k === twoindex ? Answermodules.selected : '', "\n "),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Answermodules.qindex,
|
|
|
children: k + 1
|
|
|
}), (answerData === null || answerData === void 0 || (_answerData$question_4 = answerData.question_status) === null || _answerData$question_4 === void 0 ? void 0 : _answerData$question_4.some(function (val) {
|
|
|
return val.ques_id === item.question_id && (val === null || val === void 0 ? void 0 : val.ques_status) === 2;
|
|
|
})) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
height: 12,
|
|
|
background: '#3061D0',
|
|
|
position: 'absolute',
|
|
|
width: '100%',
|
|
|
bottom: 0
|
|
|
}
|
|
|
}), item.is_marked && /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-biaoji1 ".concat(Answermodules.markIcon)
|
|
|
})]
|
|
|
}, k)
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
}, key)]
|
|
|
});
|
|
|
};
|
|
|
var renderQuestion = function renderQuestion(item, i) {
|
|
|
var _item$schools, _answerData$exercise18, _answerData$exercise19;
|
|
|
var answerText = '';
|
|
|
var answerBool = (item === null || item === void 0 ? void 0 : item.question_type) === 0 || (item === null || item === void 0 ? void 0 : item.question_type) === 1;
|
|
|
if (answerBool) {
|
|
|
var _item$question_choice7;
|
|
|
item === null || item === void 0 || (_item$question_choice7 = item.question_choices) === null || _item$question_choice7 === void 0 || _item$question_choice7.forEach(function (k, i) {
|
|
|
if (k.standard_boolean) {
|
|
|
answerText = answerText + tagList[i];
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Answermodules.questionItem,
|
|
|
id: "Anchor_".concat(item === null || item === void 0 ? void 0 : item.question_type, "_").concat(i),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
display: 'flex',
|
|
|
alignItems: 'baseline',
|
|
|
marginBottom: 40,
|
|
|
userSelect: "none"
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "".concat(Answermodules.questionScore, " mr10"),
|
|
|
children: [item === null || item === void 0 ? void 0 : item.question_score, "\u5206"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font16 ".concat(Answermodules.noWrap),
|
|
|
children: [i + 1, "\u3001"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: (item === null || item === void 0 ? void 0 : item.question_type) === 8 ? item === null || item === void 0 ? void 0 : item.description : item === null || item === void 0 ? void 0 : item.question_title
|
|
|
}), !!(item !== null && item !== void 0 && (_item$schools = item.schools) !== null && _item$schools !== void 0 && _item$schools.length) && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u8BE5\u5B9E\u8BAD\u9898\u9762\u5411\u6307\u5B9A\u5355\u4F4D\u5F00\u653E",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-zhidinggongkai1 line24 font18 c-orange"
|
|
|
})
|
|
|
})]
|
|
|
}),
|
|
|
// 单选题
|
|
|
(item === null || item === void 0 ? void 0 : item.question_type) == 0 && renderSingle(item, item === null || item === void 0 ? void 0 : item.question_type),
|
|
|
// 判断题
|
|
|
(item === null || item === void 0 ? void 0 : item.question_type) == 2 && renderSingle(item, item === null || item === void 0 ? void 0 : item.question_type),
|
|
|
// 多选题
|
|
|
(item === null || item === void 0 ? void 0 : item.question_type) == 1 && renderMultiple(item, item === null || item === void 0 ? void 0 : item.question_type),
|
|
|
// 填空题
|
|
|
(item === null || item === void 0 ? void 0 : item.question_type) == 3 && renderFill(item, item === null || item === void 0 ? void 0 : item.question_type),
|
|
|
// 简答题
|
|
|
(item === null || item === void 0 ? void 0 : item.question_type) == 4 && renderSimple(item, item === null || item === void 0 ? void 0 : item.question_type),
|
|
|
// 实训题
|
|
|
(item === null || item === void 0 ? void 0 : item.question_type) == 5 && renderShixun(item, item === null || item === void 0 ? void 0 : item.question_type),
|
|
|
// 编程题
|
|
|
(item === null || item === void 0 ? void 0 : item.question_type) == 6 && renderProgram(item, item === null || item === void 0 ? void 0 : item.question_type),
|
|
|
// 组合题
|
|
|
(item === null || item === void 0 ? void 0 : item.question_type) == 7 && renderSingles(item, item === null || item === void 0 ? void 0 : item.question_type, i),
|
|
|
// 编程题
|
|
|
(item === null || item === void 0 ? void 0 : item.question_type) == 8 && renderBProgram(item, item === null || item === void 0 ? void 0 : item.question_type), (item === null || item === void 0 ? void 0 : item.answer_comments) && /*#__PURE__*/(0,jsx_runtime.jsx)(components_NewAnswerComments, {
|
|
|
hideScore: true,
|
|
|
list: item === null || item === void 0 ? void 0 : item.answer_comments
|
|
|
}),
|
|
|
// 实训题 ,答题
|
|
|
(item === null || item === void 0 ? void 0 : item.question_type) == 5 && (answerData === null || answerData === void 0 || (_answerData$exercise18 = answerData.exercise) === null || _answerData$exercise18 === void 0 ? void 0 : _answerData$exercise18.user_exercise_status) === 0 && (item === null || item === void 0 ? void 0 : item.answer_status) != 3 && /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
|
|
|
justify: "end",
|
|
|
className: "mt20",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AsyncButton/* AsyncButton */.Z, {
|
|
|
type: "primary",
|
|
|
className: Answermodules.toIframeBtn,
|
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee28() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee28$(_context28) {
|
|
|
while (1) switch (_context28.prev = _context28.next) {
|
|
|
case 0:
|
|
|
_context28.next = 2;
|
|
|
return handleJoinShixun(item);
|
|
|
case 2:
|
|
|
return _context28.abrupt("return", _context28.sent);
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context28.stop();
|
|
|
}
|
|
|
}, _callee28);
|
|
|
})),
|
|
|
children: "\u8FDB\u5165\u7B54\u9898"
|
|
|
})
|
|
|
}),
|
|
|
// 编程题 ,答题
|
|
|
(0,authority/* isStudent */.dE)() && (answerData === null || answerData === void 0 || (_answerData$exercise19 = answerData.exercise) === null || _answerData$exercise19 === void 0 ? void 0 : _answerData$exercise19.user_exercise_status) === 0 && (item === null || item === void 0 ? void 0 : item.question_type) == 6 && /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
|
|
|
justify: "end",
|
|
|
className: "mt20",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AsyncButton/* AsyncButton */.Z, {
|
|
|
type: "primary",
|
|
|
className: Answermodules.toIframeBtn,
|
|
|
onClick: function onClick() {
|
|
|
return handleJoinProgram(item);
|
|
|
},
|
|
|
children: "\u8FDB\u5165\u7B54\u9898"
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var renderCardList = function renderCardList(item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(_react_17_0_2_react.Fragment, {
|
|
|
children: renderAnswerCard((item === null || item === void 0 ? void 0 : item.name) || constant/* QUESTIONTYPE */.f[item.question_type].name, item.question_type, index)
|
|
|
});
|
|
|
};
|
|
|
var sign = (0,_react_17_0_2_react.useRef)(false);
|
|
|
var skipData = (0,_react_17_0_2_react.useRef)({});
|
|
|
var switchType = (0,_react_17_0_2_react.useRef)();
|
|
|
var switchData = (0,_react_17_0_2_react.useRef)({});
|
|
|
var skipPrevQuestion = function skipPrevQuestion() {
|
|
|
var _answerData$exercise_5, _answerData$exercise20, _currentQuestionItem$2;
|
|
|
window.blur();
|
|
|
var currentQuestionItem = (_answerData$exercise_5 = answerData.exercise_question_types) === null || _answerData$exercise_5 === void 0 || (_answerData$exercise_5 = _answerData$exercise_5[oneindex]) === null || _answerData$exercise_5 === void 0 || (_answerData$exercise_5 = _answerData$exercise_5.items) === null || _answerData$exercise_5 === void 0 ? void 0 : _answerData$exercise_5[twoindex];
|
|
|
if (!ischecked && (answerData === null || answerData === void 0 || (_answerData$exercise20 = answerData.exercise) === null || _answerData$exercise20 === void 0 ? void 0 : _answerData$exercise20.user_exercise_status) === 0 && (0,authority/* isStudent */.dE)()) {
|
|
|
var _currentQuestionItem$;
|
|
|
if (!(currentQuestionItem !== null && currentQuestionItem !== void 0 && currentQuestionItem.repeat_answer) && (currentQuestionItem === null || currentQuestionItem === void 0 || (_currentQuestionItem$ = currentQuestionItem.user_answer) === null || _currentQuestionItem$ === void 0 ? void 0 : _currentQuestionItem$.length) > 0) {
|
|
|
if ((currentQuestionItem === null || currentQuestionItem === void 0 ? void 0 : currentQuestionItem.ques_status) === 0) {
|
|
|
switchType.current = 'prev';
|
|
|
setisshowmodal(true);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (!(currentQuestionItem !== null && currentQuestionItem !== void 0 && currentQuestionItem.repeat_answer) && (currentQuestionItem === null || currentQuestionItem === void 0 || (_currentQuestionItem$2 = currentQuestionItem.user_answer) === null || _currentQuestionItem$2 === void 0 ? void 0 : _currentQuestionItem$2.length) > 0) {
|
|
|
//如果勾选了不再提示,则手动设为已答
|
|
|
currentQuestionItem.ques_status = 1;
|
|
|
}
|
|
|
questionPartRef.current.scrollTo({
|
|
|
top: 0,
|
|
|
left: 0,
|
|
|
behavior: "smooth"
|
|
|
});
|
|
|
if (twoindex === 0) {
|
|
|
oneindex -= 1;
|
|
|
twoindex = answerData.exercise_question_types[oneindex].items.length - 1;
|
|
|
} else {
|
|
|
twoindex -= 1;
|
|
|
}
|
|
|
setoneindex(oneindex);
|
|
|
settwoindex(twoindex);
|
|
|
};
|
|
|
var skipNextQuestion = function skipNextQuestion() {
|
|
|
var _answerData$exercise_6, _answerData$exercise21, _currentQuestionItem$4;
|
|
|
window.blur();
|
|
|
var currentQuestionItem = (_answerData$exercise_6 = answerData.exercise_question_types) === null || _answerData$exercise_6 === void 0 || (_answerData$exercise_6 = _answerData$exercise_6[oneindex]) === null || _answerData$exercise_6 === void 0 || (_answerData$exercise_6 = _answerData$exercise_6.items) === null || _answerData$exercise_6 === void 0 ? void 0 : _answerData$exercise_6[twoindex];
|
|
|
//提示不允许重复作答弹窗的逻辑
|
|
|
if (!ischecked && (answerData === null || answerData === void 0 || (_answerData$exercise21 = answerData.exercise) === null || _answerData$exercise21 === void 0 ? void 0 : _answerData$exercise21.user_exercise_status) === 0 && (0,authority/* isStudent */.dE)()) {
|
|
|
var _currentQuestionItem$3;
|
|
|
if (!(currentQuestionItem !== null && currentQuestionItem !== void 0 && currentQuestionItem.repeat_answer) && (currentQuestionItem === null || currentQuestionItem === void 0 || (_currentQuestionItem$3 = currentQuestionItem.user_answer) === null || _currentQuestionItem$3 === void 0 ? void 0 : _currentQuestionItem$3.length) > 0) {
|
|
|
if ((currentQuestionItem === null || currentQuestionItem === void 0 ? void 0 : currentQuestionItem.ques_status) === 0) {
|
|
|
switchType.current = 'next';
|
|
|
setisshowmodal(true);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (!(currentQuestionItem !== null && currentQuestionItem !== void 0 && currentQuestionItem.repeat_answer) && (currentQuestionItem === null || currentQuestionItem === void 0 || (_currentQuestionItem$4 = currentQuestionItem.user_answer) === null || _currentQuestionItem$4 === void 0 ? void 0 : _currentQuestionItem$4.length) > 0) {
|
|
|
//如果勾选了不再提示,则手动设为已答
|
|
|
currentQuestionItem.ques_status = 1;
|
|
|
}
|
|
|
questionPartRef.current.scrollTo({
|
|
|
top: 0,
|
|
|
left: 0,
|
|
|
behavior: "smooth"
|
|
|
});
|
|
|
if (answerData.exercise_question_types[oneindex].items.length - 1 === twoindex) {
|
|
|
oneindex = oneindex + 1;
|
|
|
twoindex = 0;
|
|
|
} else {
|
|
|
twoindex = twoindex + 1;
|
|
|
}
|
|
|
setoneindex(oneindex);
|
|
|
settwoindex(twoindex);
|
|
|
};
|
|
|
var skipAppointQuestion = function skipAppointQuestion(p) {
|
|
|
var _answerData$exercise_7, _answerData$exercise22, _currentQuestionItem$6;
|
|
|
var record = p || skipData.current;
|
|
|
var currentQuestionItem = (_answerData$exercise_7 = answerData.exercise_question_types) === null || _answerData$exercise_7 === void 0 || (_answerData$exercise_7 = _answerData$exercise_7[oneindex]) === null || _answerData$exercise_7 === void 0 || (_answerData$exercise_7 = _answerData$exercise_7.items) === null || _answerData$exercise_7 === void 0 ? void 0 : _answerData$exercise_7[twoindex];
|
|
|
if (!ischecked && (answerData === null || answerData === void 0 || (_answerData$exercise22 = answerData.exercise) === null || _answerData$exercise22 === void 0 ? void 0 : _answerData$exercise22.user_exercise_status) === 0 && (0,authority/* isStudent */.dE)()) {
|
|
|
var _currentQuestionItem$5;
|
|
|
if (!(currentQuestionItem !== null && currentQuestionItem !== void 0 && currentQuestionItem.repeat_answer) && (currentQuestionItem === null || currentQuestionItem === void 0 || (_currentQuestionItem$5 = currentQuestionItem.user_answer) === null || _currentQuestionItem$5 === void 0 ? void 0 : _currentQuestionItem$5.length) > 0) {
|
|
|
if ((currentQuestionItem === null || currentQuestionItem === void 0 ? void 0 : currentQuestionItem.ques_status) === 0) {
|
|
|
switchType.current = 'appoint';
|
|
|
switchData.current = record;
|
|
|
setisshowmodal(true);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (!(currentQuestionItem !== null && currentQuestionItem !== void 0 && currentQuestionItem.repeat_answer) && (currentQuestionItem === null || currentQuestionItem === void 0 || (_currentQuestionItem$6 = currentQuestionItem.user_answer) === null || _currentQuestionItem$6 === void 0 ? void 0 : _currentQuestionItem$6.length) > 0) {
|
|
|
//如果勾选了不再提示,则手动设为已答
|
|
|
currentQuestionItem.ques_status = 1;
|
|
|
}
|
|
|
setoneindex(record === null || record === void 0 ? void 0 : record.oneindex);
|
|
|
settwoindex(record === null || record === void 0 ? void 0 : record.twoindex);
|
|
|
questionPartRef.current.scrollTo({
|
|
|
top: 0,
|
|
|
left: 0,
|
|
|
behavior: 'smooth'
|
|
|
});
|
|
|
};
|
|
|
var handleRefresh = /*#__PURE__*/function () {
|
|
|
var _ref24 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee29() {
|
|
|
var _answerData$exercise23;
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee29$(_context29) {
|
|
|
while (1) switch (_context29.prev = _context29.next) {
|
|
|
case 0:
|
|
|
if (!sign.current) {
|
|
|
_context29.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
sign.current = 'refresh';
|
|
|
return _context29.abrupt("return");
|
|
|
case 3:
|
|
|
_context29.next = 5;
|
|
|
return initData();
|
|
|
case 5:
|
|
|
res = _context29.sent;
|
|
|
if (!(answerData !== null && answerData !== void 0 && (_answerData$exercise23 = answerData.exercise) !== null && _answerData$exercise23 !== void 0 && _answerData$exercise23.left_time)) {
|
|
|
_context29.next = 9;
|
|
|
break;
|
|
|
}
|
|
|
_context29.next = 9;
|
|
|
return handleLeftTime();
|
|
|
case 9:
|
|
|
if (!(res !== null && res !== void 0 && res.status)) {
|
|
|
message/* default */.ZP.success('更新成功');
|
|
|
}
|
|
|
case 10:
|
|
|
case "end":
|
|
|
return _context29.stop();
|
|
|
}
|
|
|
}, _callee29);
|
|
|
}));
|
|
|
return function handleRefresh() {
|
|
|
return _ref24.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var signConfigFuc = function signConfigFuc() {
|
|
|
var _document$activeEleme;
|
|
|
switch (sign.current) {
|
|
|
case "prev":
|
|
|
skipPrevQuestion();
|
|
|
break;
|
|
|
case "next":
|
|
|
skipNextQuestion();
|
|
|
break;
|
|
|
case "appoint":
|
|
|
skipAppointQuestion();
|
|
|
break;
|
|
|
case "submit":
|
|
|
handleVerifySave(false);
|
|
|
break;
|
|
|
case "refresh":
|
|
|
handleRefresh();
|
|
|
break;
|
|
|
default:
|
|
|
}
|
|
|
if (((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.localName) === 'textarea') {
|
|
|
sign.current = true;
|
|
|
} else {
|
|
|
sign.current = false;
|
|
|
}
|
|
|
skipData.current = {};
|
|
|
};
|
|
|
var renderClassifyQuestion = function renderClassifyQuestion() {
|
|
|
var _answerData$exercise_8, _answerData$exercise_9, _answerData$exercise_10, _answerData$exercise_11, _answerData$exercise_12, _answerData$exercise_13;
|
|
|
var currentItem = answerData === null || answerData === void 0 || (_answerData$exercise_8 = answerData.exercise_question_types) === null || _answerData$exercise_8 === void 0 || (_answerData$exercise_8 = _answerData$exercise_8[oneindex].items) === null || _answerData$exercise_8 === void 0 ? void 0 : _answerData$exercise_8[twoindex];
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "pt20 mb20",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: Answermodules.questionTypeTitle,
|
|
|
children: [(0,util/* toChineseNumber */.EM)(oneindex + 1), "\u3001", answerData === null || answerData === void 0 || (_answerData$exercise_9 = answerData.exercise_question_types) === null || _answerData$exercise_9 === void 0 || (_answerData$exercise_9 = _answerData$exercise_9[oneindex]) === null || _answerData$exercise_9 === void 0 ? void 0 : _answerData$exercise_9.name]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: Answermodules.questionTypeInfo,
|
|
|
children: ["\uFF08\u5171", answerData === null || answerData === void 0 || (_answerData$exercise_10 = answerData.exercise_question_types) === null || _answerData$exercise_10 === void 0 || (_answerData$exercise_10 = _answerData$exercise_10[oneindex]) === null || _answerData$exercise_10 === void 0 ? void 0 : _answerData$exercise_10.count, "\u9898\uFF1B", (answerData === null || answerData === void 0 || (_answerData$exercise_11 = answerData.exercise_question_types) === null || _answerData$exercise_11 === void 0 || (_answerData$exercise_11 = _answerData$exercise_11[oneindex]) === null || _answerData$exercise_11 === void 0 ? void 0 : _answerData$exercise_11.question_type) === 7 ? "\u5305\u542B".concat(answerData === null || answerData === void 0 || (_answerData$exercise_12 = answerData.exercise_question_types) === null || _answerData$exercise_12 === void 0 || (_answerData$exercise_12 = _answerData$exercise_12[oneindex]) === null || _answerData$exercise_12 === void 0 ? void 0 : _answerData$exercise_12.sub_questions_count, "\u5C0F\u9898") : '', " \u5171", answerData === null || answerData === void 0 || (_answerData$exercise_13 = answerData.exercise_question_types) === null || _answerData$exercise_13 === void 0 || (_answerData$exercise_13 = _answerData$exercise_13[oneindex]) === null || _answerData$exercise_13 === void 0 ? void 0 : _answerData$exercise_13.score, "\u5206\uFF09"]
|
|
|
}), !(currentItem !== null && currentItem !== void 0 && currentItem.repeat_answer) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#E30000',
|
|
|
marginLeft: 20,
|
|
|
fontSize: 14
|
|
|
},
|
|
|
children: "\u6CE8\u610F\uFF1A\u8BE5\u9898\u4F5C\u7B54\u4E4B\u540E\u4E0D\u5141\u8BB8\u4FEE\u6539\u7B54\u6848\u3002"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(_react_17_0_2_react.Fragment, {
|
|
|
children: renderQuestion(currentItem, twoindex)
|
|
|
}, twoindex)]
|
|
|
}, oneindex);
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(spin/* default */.Z, {
|
|
|
size: 'middle',
|
|
|
spinning: isSpin,
|
|
|
children: [openFullScreen && (answerData === null || answerData === void 0 || (_answerData$exercise24 = answerData.exercise) === null || _answerData$exercise24 === void 0 ? void 0 : _answerData$exercise24.user_exercise_status) === 0 && /*#__PURE__*/(0,jsx_runtime.jsx)(recordScreen/* default */.Z, {
|
|
|
exerciseUserInfo: exercise.exerciseUserInfo,
|
|
|
iframe: iframe,
|
|
|
socket: socket,
|
|
|
onStartScreenshot: function onStartScreenshot() {
|
|
|
if (answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.screen_shot_open) {
|
|
|
setStartScreenshot(true);
|
|
|
}
|
|
|
},
|
|
|
onCloseScreenshot: function onCloseScreenshot() {
|
|
|
if (answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.screen_shot_open) {
|
|
|
setStartScreenshot(false);
|
|
|
}
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(components_ReactCaptureScreens, {
|
|
|
id: params.categoryId,
|
|
|
startRecording: startRecording,
|
|
|
startScreenshot: startScreenshot,
|
|
|
onSuccuss: function onSuccuss() {
|
|
|
setOpenFullScreen(answerCheckData === null || answerCheckData === void 0 ? void 0 : answerCheckData.screen_open);
|
|
|
initData();
|
|
|
},
|
|
|
onBack: handleToDetail
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("iframe", {
|
|
|
style: {
|
|
|
display: iframeBlock
|
|
|
},
|
|
|
id: "iframeShixuns",
|
|
|
className: Answermodules.iframe,
|
|
|
src: iframeUrl,
|
|
|
ref: iframe,
|
|
|
frameBorder: "0"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Answermodules.fixHeader,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
wrap: false,
|
|
|
align: "middle",
|
|
|
className: "edu-container",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: (0,util/* exerciseTips */.vB)(answerData === null || answerData === void 0 || (_answerData$exercise25 = answerData.exercise) === null || _answerData$exercise25 === void 0 ? void 0 : _answerData$exercise25.exercise_status)
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
className: "".concat(Answermodules.exerciseTitle, " ml10"),
|
|
|
title: answerData === null || answerData === void 0 || (_answerData$exercise26 = answerData.exercise) === null || _answerData$exercise26 === void 0 ? void 0 : _answerData$exercise26.exercise_name,
|
|
|
children: answerData === null || answerData === void 0 || (_answerData$exercise27 = answerData.exercise) === null || _answerData$exercise27 === void 0 ? void 0 : _answerData$exercise27.exercise_name
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
style: {
|
|
|
marginLeft: 'auto'
|
|
|
},
|
|
|
children: !((0,authority/* isAdmin */.GJ)() || (0,authority/* isStudent */.dE)() && (answerData === null || answerData === void 0 || (_answerData$exercise28 = answerData.exercise) === null || _answerData$exercise28 === void 0 ? void 0 : _answerData$exercise28.user_exercise_status) == 1) && !!(answerData !== null && answerData !== void 0 && (_answerData$exercise29 = answerData.exercise) !== null && _answerData$exercise29 !== void 0 && _answerData$exercise29.left_time) && /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
className: "".concat(Answermodules.countDown, " ").concat(countDownColor),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-daojishi",
|
|
|
style: {
|
|
|
marginRight: 6
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Answermodules.cnText,
|
|
|
children: "\u5269\u4F59\u7B54\u9898\u65F6\u957F"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Countdown, {
|
|
|
value: time,
|
|
|
onFinish: handleLeftTime
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: !((0,authority/* isAdmin */.GJ)() || (0,authority/* isStudent */.dE)() && (answerData === null || answerData === void 0 || (_answerData$exercise30 = answerData.exercise) === null || _answerData$exercise30 === void 0 ? void 0 : _answerData$exercise30.user_exercise_status) == 1) && exercise.actionTabs.key !== 'student-unlock' && normalClose && /*#__PURE__*/(0,jsx_runtime.jsxs)(AsyncButton/* AsyncButton */.Z, {
|
|
|
className: "".concat(Answermodules.refreshBtn, " ml30"),
|
|
|
onClick: handleRefresh,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "iconfont icon-shuaxin2 mr5"
|
|
|
}), "\u5237\u65B0"]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: (0,authority/* isStudent */.dE)() && (answerData === null || answerData === void 0 || (_answerData$exercise31 = answerData.exercise) === null || _answerData$exercise31 === void 0 ? void 0 : _answerData$exercise31.user_exercise_status) === 0 && /*#__PURE__*/(0,jsx_runtime.jsx)(AsyncButton/* AsyncButton */.Z, {
|
|
|
className: "".concat(Answermodules.submitButton, " ml10"),
|
|
|
type: "primary",
|
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee30() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee30$(_context30) {
|
|
|
while (1) switch (_context30.prev = _context30.next) {
|
|
|
case 0:
|
|
|
if (!sign.current) {
|
|
|
_context30.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
sign.current = 'submit';
|
|
|
return _context30.abrupt("return");
|
|
|
case 3:
|
|
|
_context30.next = 5;
|
|
|
return handleVerifySave(false);
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context30.stop();
|
|
|
}
|
|
|
}, _callee30);
|
|
|
})),
|
|
|
children: "\u4EA4\u5377"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: ((answerData === null || answerData === void 0 || (_answerData$exercise32 = answerData.exercise) === null || _answerData$exercise32 === void 0 ? void 0 : _answerData$exercise32.commit_status) == 1 || (answerData === null || answerData === void 0 || (_answerData$exercise33 = answerData.exercise) === null || _answerData$exercise33 === void 0 ? void 0 : _answerData$exercise33.exercise_status) == 3) && (answerData === null || answerData === void 0 || (_answerData$exercise_14 = answerData.exercise_answer_user) === null || _answerData$exercise_14 === void 0 ? void 0 : _answerData$exercise_14.analysis) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: Answermodules.teachAnalysis,
|
|
|
onClick: function onClick() {
|
|
|
return setTeachAnalysisModal(true);
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-jiaoshipingjia"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "ml5",
|
|
|
children: "\u6559\u5E08\u8BC4\u4EF7"
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: "edu-container ".concat(Answermodules.wrapper, " ").concat(isEducation && Answermodules.wrpAnswer),
|
|
|
children: [(answerData === null || answerData === void 0 || (_answerData$exercise34 = answerData.exercise) === null || _answerData$exercise34 === void 0 || (_answerData$exercise34 = _answerData$exercise34.exercise_description) === null || _answerData$exercise34 === void 0 ? void 0 : _answerData$exercise34.length) > 0 && /*#__PURE__*/(0,jsx_runtime.jsx)(es_alert/* default */.Z, {
|
|
|
className: Answermodules.exerciseAlert,
|
|
|
description: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
wrap: false,
|
|
|
gutter: 10,
|
|
|
align: "top",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
className: Answermodules.title,
|
|
|
children: "\u8003\u8BD5\u987B\u77E5"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
className: Answermodules.content,
|
|
|
children: answerData === null || answerData === void 0 || (_answerData$exercise35 = answerData.exercise) === null || _answerData$exercise35 === void 0 ? void 0 : _answerData$exercise35.exercise_description
|
|
|
})]
|
|
|
}),
|
|
|
closable: true
|
|
|
}), checkStatus.status === 0 && /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: "".concat(isEducation ? "mt70" : "", " ").concat(Answermodules.mainPart),
|
|
|
wrap: false,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: showAnswerCard ? "280px" : "0px",
|
|
|
className: isEducation ? "mb100" : "",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Answermodules.leftPart,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
children: [showAnswerCard && /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
style: {
|
|
|
background: '#fff',
|
|
|
marginBottom: '10px',
|
|
|
padding: '20px'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
marginBottom: 15
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#5F6368'
|
|
|
},
|
|
|
children: "\u59D3\u540D"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "ml10 ".concat(Answermodules.userInfoText),
|
|
|
children: (answerData === null || answerData === void 0 || (_answerData$exercise36 = answerData.exercise) === null || _answerData$exercise36 === void 0 ? void 0 : _answerData$exercise36.user_name) || '- -'
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#5F6368'
|
|
|
},
|
|
|
children: "\u5B66\u53F7"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "ml10 ".concat(Answermodules.userInfoText),
|
|
|
children: (answerData === null || answerData === void 0 || (_answerData$exercise37 = answerData.exercise) === null || _answerData$exercise37 === void 0 ? void 0 : _answerData$exercise37.student_id) || '- -'
|
|
|
})]
|
|
|
})]
|
|
|
}), showAnswerCard && (0,authority/* isStudent */.dE)() && ((_answerData$exercise38 = answerData.exercise) === null || _answerData$exercise38 === void 0 ? void 0 : _answerData$exercise38.user_exercise_status) === 0 && ((_answerData$exercise39 = answerData.exercise) === null || _answerData$exercise39 === void 0 ? void 0 : _answerData$exercise39.open_phone_video_recording) && /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: Answermodules.eduQrcode,
|
|
|
style: {
|
|
|
marginTop: 10
|
|
|
},
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)((lib_default()), {
|
|
|
value: "https://".concat(document.domain, "/live-push.html?id=").concat(params.categoryId, "&login=").concat(params.login, "&cookie=").concat((0,util/* getCookie */.ej)("_educoder_session"))
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: "ml15",
|
|
|
children: ["\u6253\u5F00\u5FAE\u4FE1\u626B\u4E00\u626B", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u5F00\u542F\u624B\u673A\u89C6\u9891\u5F55\u5236"]
|
|
|
})]
|
|
|
}), showAnswerCard && /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
className: "bg-white",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
className: Answermodules.answerInfo,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-between",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: "\u7B54\u9898\u8FDB\u5EA6"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: Answermodules.answerProgress,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#165DFF'
|
|
|
},
|
|
|
children: answerData === null || answerData === void 0 || (_answerData$question_5 = answerData.question_status) === null || _answerData$question_5 === void 0 || (_answerData$question_5 = _answerData$question_5.filter(function (val) {
|
|
|
return val.ques_status === 1;
|
|
|
})) === null || _answerData$question_5 === void 0 ? void 0 : _answerData$question_5.length
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
style: {
|
|
|
color: '#999999'
|
|
|
},
|
|
|
children: ["/", answerData === null || answerData === void 0 || (_answerData$exercise_15 = answerData.exercise_types) === null || _answerData$exercise_15 === void 0 ? void 0 : _answerData$exercise_15.q_counts]
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_progress/* default */.Z, {
|
|
|
strokeColor: "#165dffa6",
|
|
|
trailColor: "#0000000d",
|
|
|
percent: (answerData === null || answerData === void 0 || (_answerData$question_6 = answerData.question_status) === null || _answerData$question_6 === void 0 || (_answerData$question_6 = _answerData$question_6.filter(function (val) {
|
|
|
return val.ques_status === 1;
|
|
|
})) === null || _answerData$question_6 === void 0 ? void 0 : _answerData$question_6.length) / (answerData === null || answerData === void 0 || (_answerData$exercise_16 = answerData.exercise_types) === null || _answerData$exercise_16 === void 0 ? void 0 : _answerData$exercise_16.q_counts) * 100,
|
|
|
showInfo: false
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "c-grey-333",
|
|
|
children: ["\u5171 ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#165DFF'
|
|
|
},
|
|
|
children: (answerData === null || answerData === void 0 || (_answerData$exercise_17 = answerData.exercise_types) === null || _answerData$exercise_17 === void 0 ? void 0 : _answerData$exercise_17.q_counts) || (answerData === null || answerData === void 0 || (_answerData$exercise_18 = answerData.exercise_scores) === null || _answerData$exercise_18 === void 0 || (_answerData$exercise_18 = _answerData$exercise_18.exercise_types) === null || _answerData$exercise_18 === void 0 ? void 0 : _answerData$exercise_18.q_counts)
|
|
|
}), " \u9898\uFF1A"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "c-grey-333",
|
|
|
children: ["\u6EE1\u5206 ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#FA6400'
|
|
|
},
|
|
|
children: (answerData === null || answerData === void 0 || (_answerData$exercise_19 = answerData.exercise_types) === null || _answerData$exercise_19 === void 0 ? void 0 : _answerData$exercise_19.q_scores) || (answerData === null || answerData === void 0 || (_answerData$exercise_20 = answerData.exercise_scores) === null || _answerData$exercise_20 === void 0 || (_answerData$exercise_20 = _answerData$exercise_20.exercise_types) === null || _answerData$exercise_20 === void 0 ? void 0 : _answerData$exercise_20.q_scores)
|
|
|
}), " \u5206"]
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: Answermodules.dottedLineWrapper,
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
className: Answermodules.leftHalfCircle
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: 1,
|
|
|
className: Answermodules.dottedLine
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
className: Answermodules.rightHalfCircle
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
|
className: "".concat(Answermodules.cardList, " ").concat((_answerData$exercise40 = answerData.exercise) !== null && _answerData$exercise40 !== void 0 && _answerData$exercise40.open_phone_video_recording ? Answermodules.withQrcode : ''),
|
|
|
children: answerData === null || answerData === void 0 || (_answerData$exercise_21 = answerData.exercise_question_types) === null || _answerData$exercise_21 === void 0 ? void 0 : _answerData$exercise_21.map(function (er, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(_react_17_0_2_react.Fragment, {
|
|
|
children: renderCardList(er, index)
|
|
|
}, er.question_type);
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
}), (0,authority/* isStudent */.dE)() && /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
justify: "space-around",
|
|
|
align: "middle",
|
|
|
className: Answermodules.answerSheetBottom,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: Answermodules.tooltipWrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Answermodules.answerYes
|
|
|
}), "\u5DF2\u7B54"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: Answermodules.tooltipWrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "".concat(Answermodules.answerNo, " ml10"),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
height: '50%',
|
|
|
width: '100%',
|
|
|
background: '#0152d9'
|
|
|
}
|
|
|
})
|
|
|
}), "\u90E8\u5206\u7B54\u9898"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: Answermodules.tooltipWrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "".concat(Answermodules.answerNo, " ml10")
|
|
|
}), "\u672A\u7B54"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: Answermodules.tooltipWrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-biaoji1",
|
|
|
style: {
|
|
|
marginRight: 4,
|
|
|
color: '#FFB538'
|
|
|
}
|
|
|
}), "\u6807\u8BB0"]
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Answermodules.fold,
|
|
|
onClick: function onClick() {
|
|
|
return setShowAnswerCard(!showAnswerCard);
|
|
|
},
|
|
|
children: [showAnswerCard && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u6536\u8D77\u7B54\u9898\u5361",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "icon-zuojiantou iconfont c-grey-c"
|
|
|
})
|
|
|
}), !showAnswerCard && /*#__PURE__*/(0,jsx_runtime.jsxs)(tooltip/* default */.Z, {
|
|
|
title: "\u5C55\u5F00",
|
|
|
children: [" ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "icon-youjiantou iconfont c-grey-c"
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: [Answermodules.rightPart, 'ml20'].join(' '),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "".concat(Answermodules.questionPart, " pl30 pr30"),
|
|
|
ref: questionPartRef,
|
|
|
children: renderClassifyQuestion()
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: Answermodules.bottom,
|
|
|
align: "middle",
|
|
|
justify: "space-between",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AsyncButton/* AsyncButton */.Z, {
|
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont ".concat((_answerData$exercise_22 = answerData.exercise_question_types) !== null && _answerData$exercise_22 !== void 0 && (_answerData$exercise_22 = _answerData$exercise_22[oneindex].items[twoindex]) !== null && _answerData$exercise_22 !== void 0 && _answerData$exercise_22.is_marked ? 'icon-biaoji1' : 'icon-biaojigaiti'),
|
|
|
style: {
|
|
|
color: '#FFB538',
|
|
|
marginRight: 6
|
|
|
}
|
|
|
}),
|
|
|
className: Answermodules.markBtn,
|
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee31() {
|
|
|
var _answerData$exercise_23;
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee31$(_context31) {
|
|
|
while (1) switch (_context31.prev = _context31.next) {
|
|
|
case 0:
|
|
|
_context31.next = 2;
|
|
|
return (0,service_exercise/* markQuestion */.sS)(params.categoryId, {
|
|
|
exercise_question_id: (_answerData$exercise_23 = answerData.exercise_question_types[oneindex].items[twoindex]) === null || _answerData$exercise_23 === void 0 ? void 0 : _answerData$exercise_23.question_id
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context31.sent;
|
|
|
if (res.status === 0) {
|
|
|
initData();
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context31.stop();
|
|
|
}
|
|
|
}, _callee31);
|
|
|
})),
|
|
|
children: (_answerData$exercise_24 = answerData.exercise_question_types) !== null && _answerData$exercise_24 !== void 0 && (_answerData$exercise_24 = _answerData$exercise_24[oneindex].items[twoindex]) !== null && _answerData$exercise_24 !== void 0 && _answerData$exercise_24.is_marked ? '取消标记' : '标记该题'
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: [(oneindex != 0 || twoindex != 0) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
className: "".concat(Answermodules.changeButton, " ").concat(Answermodules.prevBtn, " mr20"),
|
|
|
type: "default",
|
|
|
onClick: function onClick() {
|
|
|
if (sign.current) {
|
|
|
sign.current = 'prev';
|
|
|
return;
|
|
|
}
|
|
|
skipPrevQuestion();
|
|
|
},
|
|
|
children: "\u4E0A\u4E00\u9898"
|
|
|
}), !(oneindex === (answerData === null || answerData === void 0 || (_answerData$exercise_25 = answerData.exercise_question_types) === null || _answerData$exercise_25 === void 0 ? void 0 : _answerData$exercise_25.length) - 1 && twoindex === (answerData === null || answerData === void 0 || (_answerData$exercise_26 = answerData.exercise_question_types) === null || _answerData$exercise_26 === void 0 || (_answerData$exercise_26 = _answerData$exercise_26[oneindex]) === null || _answerData$exercise_26 === void 0 || (_answerData$exercise_26 = _answerData$exercise_26.items) === null || _answerData$exercise_26 === void 0 ? void 0 : _answerData$exercise_26.length) - 1) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
className: Answermodules.changeButton,
|
|
|
type: "primary",
|
|
|
onClick: function onClick() {
|
|
|
if (sign.current) {
|
|
|
sign.current = 'next';
|
|
|
return;
|
|
|
}
|
|
|
skipNextQuestion();
|
|
|
},
|
|
|
children: "\u4E0B\u4E00\u9898"
|
|
|
})]
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
}), checkStatus.status !== 0 && /*#__PURE__*/(0,jsx_runtime.jsx)(ErrCheckIpTip, {
|
|
|
data: checkStatus
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_modal/* default */.Z, {
|
|
|
title: "\u6CE8\u610F",
|
|
|
open: isShowmodal,
|
|
|
closable: false,
|
|
|
footer: false,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
style: {
|
|
|
marginBottom: 0
|
|
|
},
|
|
|
children: "\u79BB\u5F00\u8BE5\u9898\u540E\u4E0D\u5141\u8BB8\u518D\u6B21\u4FEE\u6539\u7B54\u6848\uFF0C\u786E\u8BA4\u79BB\u5F00\u5417\uFF1F"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
marginTop: 60,
|
|
|
display: 'flex',
|
|
|
justifyContent: 'space-between',
|
|
|
alignItems: 'center'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
checked: ischecked,
|
|
|
onChange: function onChange(e) {
|
|
|
setischecked(e.target.checked);
|
|
|
},
|
|
|
children: "\u4E0B\u6B21\u4E0D\u518D\u663E\u793A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
onClick: function onClick() {
|
|
|
setisshowmodal(false);
|
|
|
setischecked(false);
|
|
|
},
|
|
|
children: "\u6211\u518D\u60F3\u60F3"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
onClick: function onClick() {
|
|
|
answerData.exercise_question_types[oneindex].items[twoindex].ques_status = 1;
|
|
|
setAnswerData(objectSpread2_default()({}, answerData));
|
|
|
if (switchType.current === 'prev') {
|
|
|
if (twoindex === 0) {
|
|
|
oneindex -= 1;
|
|
|
twoindex = answerData.exercise_question_types[oneindex].items.length - 1;
|
|
|
} else {
|
|
|
twoindex -= 1;
|
|
|
}
|
|
|
setoneindex(oneindex);
|
|
|
settwoindex(twoindex);
|
|
|
} else if (switchType.current === 'next') {
|
|
|
if (answerData.exercise_question_types[oneindex].items.length - 1 === twoindex) {
|
|
|
oneindex = oneindex + 1;
|
|
|
twoindex = 0;
|
|
|
} else {
|
|
|
twoindex = twoindex + 1;
|
|
|
}
|
|
|
setoneindex(oneindex);
|
|
|
settwoindex(twoindex);
|
|
|
} else {
|
|
|
setoneindex(switchData.current.oneindex);
|
|
|
settwoindex(switchData.current.twoindex);
|
|
|
}
|
|
|
setisshowmodal(false);
|
|
|
},
|
|
|
type: "primary",
|
|
|
style: {
|
|
|
marginLeft: 30
|
|
|
},
|
|
|
children: "\u786E\u8BA4"
|
|
|
})]
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Unlock/* default */.Z, {
|
|
|
successCb: checkCamera
|
|
|
})]
|
|
|
}), showCamera && /*#__PURE__*/(0,jsx_runtime.jsx)((cjs_default()), {
|
|
|
disabled: disabled,
|
|
|
bounds: bounds,
|
|
|
onStart: function onStart(event, uiData) {
|
|
|
return _onStart(event, uiData);
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
ref: draggleRef,
|
|
|
style: {
|
|
|
position: 'absolute',
|
|
|
left: 40,
|
|
|
top: 200,
|
|
|
zIndex: 101
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
onMouseOver: function onMouseOver() {
|
|
|
if (disabled) {
|
|
|
setDisabled(false);
|
|
|
}
|
|
|
},
|
|
|
onMouseOut: function onMouseOut() {
|
|
|
setDisabled(true);
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: Answermodules.cameraHeader,
|
|
|
align: "middle",
|
|
|
justify: "space-between",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-kaiqishexiangtou"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u5DF2\u5F00\u542F\u6444\u50CF\u5934"
|
|
|
})]
|
|
|
}), isopen ? /*#__PURE__*/(0,jsx_runtime.jsx)(MinusOutlined/* default */.Z, {
|
|
|
onClick: function onClick() {
|
|
|
setisopen(false);
|
|
|
}
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(PlusOutlined/* default */.Z, {
|
|
|
onClick: function onClick() {
|
|
|
setisopen(true);
|
|
|
}
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
display: isopen ? 'flex' : 'none'
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(components_CaptureVideo, {
|
|
|
number: (answerData === null || answerData === void 0 || (_answerData$exercise41 = answerData.exercise) === null || _answerData$exercise41 === void 0 ? void 0 : _answerData$exercise41.photo_count) - (answerData === null || answerData === void 0 || (_answerData$exercise42 = answerData.exercise) === null || _answerData$exercise42 === void 0 ? void 0 : _answerData$exercise42.take_photo),
|
|
|
take_photo: answerData === null || answerData === void 0 || (_answerData$exercise43 = answerData.exercise) === null || _answerData$exercise43 === void 0 ? void 0 : _answerData$exercise43.take_photo,
|
|
|
ref: captureRef,
|
|
|
id: params.categoryId,
|
|
|
time: (_answerData$exercise44 = answerData.exercise) === null || _answerData$exercise44 === void 0 ? void 0 : _answerData$exercise44.left_time,
|
|
|
update: initData,
|
|
|
supportCamera: function supportCamera(type) {
|
|
|
if (type === 2) {
|
|
|
setOpenCameraSuccess(true);
|
|
|
setStartRecording(answerCheckData === null || answerCheckData === void 0 ? void 0 : answerCheckData.screen_shot_open);
|
|
|
if (!(answerCheckData !== null && answerCheckData !== void 0 && answerCheckData.screen_shot_open)) {
|
|
|
setOpenFullScreen(answerCheckData === null || answerCheckData === void 0 ? void 0 : answerCheckData.screen_open);
|
|
|
initData();
|
|
|
}
|
|
|
|
|
|
// window.onblur = function () {
|
|
|
// if (IsFull()) {
|
|
|
// exitFull()
|
|
|
// }
|
|
|
// };
|
|
|
} else if (type === 1) {
|
|
|
setTimeout(function () {
|
|
|
return _umi_production_exports.history.push("/");
|
|
|
}, 3000);
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_modal/* default */.Z, {
|
|
|
destroyOnClose: true,
|
|
|
closable: false,
|
|
|
centered: true,
|
|
|
className: Answermodules.teachAnalysisModal,
|
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
justify: "space-between",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
style: {
|
|
|
color: "rgba(0,0,0,0.9)",
|
|
|
fontSize: "16px"
|
|
|
},
|
|
|
children: "\u6559\u5E08\u8BC4\u4EF7"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-guanbi7",
|
|
|
style: {
|
|
|
fontSize: "15px",
|
|
|
cursor: "pointer"
|
|
|
},
|
|
|
onClick: function onClick() {
|
|
|
return setTeachAnalysisModal(false);
|
|
|
}
|
|
|
})
|
|
|
})]
|
|
|
}),
|
|
|
open: teachAnalysisModal,
|
|
|
footer: false,
|
|
|
onCancel: function onCancel() {
|
|
|
return setTeachAnalysisModal(false);
|
|
|
},
|
|
|
children: answerData === null || answerData === void 0 || (_answerData$exercise_27 = answerData.exercise_answer_user) === null || _answerData$exercise_27 === void 0 ? void 0 : _answerData$exercise_27.analysis
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var Exercise_Answer = ((0,_umi_production_exports.connect)(function (_ref27) {
|
|
|
var loading = _ref27.loading,
|
|
|
user = _ref27.user,
|
|
|
exercise = _ref27.exercise,
|
|
|
globalSetting = _ref27.globalSetting;
|
|
|
return {
|
|
|
globalSetting: globalSetting,
|
|
|
user: user,
|
|
|
exercise: exercise,
|
|
|
loading: loading.effects
|
|
|
};
|
|
|
})(Answer));
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 14303:
|
|
|
/*!*******************************************************************!*\
|
|
|
!*** ./src/pages/Classrooms/Lists/Exercise/components/Unlock.tsx ***!
|
|
|
\*******************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/typeof.js */ 5773);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_typeof_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_typeof_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js */ 10574);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js */ 39343);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js */ 11006);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ 59301);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! antd */ 31797);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! antd */ 78241);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! antd */ 43418);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! antd */ 72315);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! antd */ 1056);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! antd */ 95237);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! antd */ 43604);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! antd */ 3113);
|
|
|
/* harmony import */ var _service_exercise__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/service/exercise */ 35367);
|
|
|
/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! moment */ 9498);
|
|
|
/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_6__);
|
|
|
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! umi */ 45295);
|
|
|
/* harmony import */ var _utils_util__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/utils/util */ 22739);
|
|
|
/* harmony import */ var _components_Exercise_ip__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/components/Exercise/ip */ 56780);
|
|
|
/* harmony import */ var _utils_authority__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/utils/authority */ 13186);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Countdown = antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z.Countdown;
|
|
|
var Unlock = function Unlock(_ref) {
|
|
|
var _actionTabs$exerciseP9, _actionTabs$exerciseP10, _actionTabs$exerciseP11, _actionTabs$exerciseP12;
|
|
|
var exercise = _ref.exercise,
|
|
|
successCb = _ref.successCb,
|
|
|
dispatch = _ref.dispatch;
|
|
|
var params = (0,umi__WEBPACK_IMPORTED_MODULE_7__.useParams)();
|
|
|
var _Form$useForm = antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.useForm(),
|
|
|
_Form$useForm2 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_4__.useState)(false),
|
|
|
_useState2 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState, 2),
|
|
|
isLoading = _useState2[0],
|
|
|
setIsLoading = _useState2[1];
|
|
|
var localIpRef = (0,react__WEBPACK_IMPORTED_MODULE_4__.useRef)();
|
|
|
var actionTabs = exercise.actionTabs;
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_4__.useEffect)(function () {
|
|
|
if (exercise.actionTabs.key === 'student-unlock') {
|
|
|
// if (actionTabs?.exerciseParams?.ip_limit !== 'no' || actionTabs?.exerciseParams?.ip_bind)
|
|
|
// getLocalIp();
|
|
|
setIsLoading(false);
|
|
|
form.resetFields();
|
|
|
}
|
|
|
}, [exercise.actionTabs.key]);
|
|
|
var getLocalIp = function getLocalIp() {
|
|
|
return new Promise( /*#__PURE__*/function () {
|
|
|
var _ref2 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee(resolve) {
|
|
|
var _actionTabs$exerciseP, _actionTabs$exerciseP2;
|
|
|
return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return (0,_components_Exercise_ip__WEBPACK_IMPORTED_MODULE_9__/* .findLocalIp */ .y)({
|
|
|
ip_limit: actionTabs === null || actionTabs === void 0 || (_actionTabs$exerciseP = actionTabs.exerciseParams) === null || _actionTabs$exerciseP === void 0 ? void 0 : _actionTabs$exerciseP.ip_limit,
|
|
|
ip_bind: actionTabs === null || actionTabs === void 0 || (_actionTabs$exerciseP2 = actionTabs.exerciseParams) === null || _actionTabs$exerciseP2 === void 0 ? void 0 : _actionTabs$exerciseP2.ip_bind
|
|
|
});
|
|
|
case 2:
|
|
|
localIpRef.current = _context.sent;
|
|
|
return _context.abrupt("return", resolve());
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function (_x) {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}());
|
|
|
};
|
|
|
var handleOk = /*#__PURE__*/function () {
|
|
|
var _ref3 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee2() {
|
|
|
var _actionTabs$exerciseP3, _actionTabs$exerciseP4, _actionTabs$exerciseP5, _actionTabs$exerciseP6;
|
|
|
var formValue, unlockRes, _userInfo, _actionTabs$exerciseP7, _actionTabs$exerciseP8, delayedParams, v;
|
|
|
return _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.next = 2;
|
|
|
return form.validateFields();
|
|
|
case 2:
|
|
|
formValue = form.getFieldsValue();
|
|
|
setIsLoading(true);
|
|
|
if (!((actionTabs === null || actionTabs === void 0 || (_actionTabs$exerciseP3 = actionTabs.exerciseParams) === null || _actionTabs$exerciseP3 === void 0 ? void 0 : _actionTabs$exerciseP3.ip_limit) !== 'no' || actionTabs !== null && actionTabs !== void 0 && (_actionTabs$exerciseP4 = actionTabs.exerciseParams) !== null && _actionTabs$exerciseP4 !== void 0 && _actionTabs$exerciseP4.ip_bind)) {
|
|
|
_context2.next = 7;
|
|
|
break;
|
|
|
}
|
|
|
_context2.next = 7;
|
|
|
return getLocalIp();
|
|
|
case 7:
|
|
|
_context2.next = 9;
|
|
|
return (0,_service_exercise__WEBPACK_IMPORTED_MODULE_5__/* .unlockUser */ .ZD)(actionTabs === null || actionTabs === void 0 || (_actionTabs$exerciseP5 = actionTabs.exerciseParams) === null || _actionTabs$exerciseP5 === void 0 ? void 0 : _actionTabs$exerciseP5.id, {
|
|
|
exercise_user_id: actionTabs === null || actionTabs === void 0 || (_actionTabs$exerciseP6 = actionTabs.exerciseParams) === null || _actionTabs$exerciseP6 === void 0 ? void 0 : _actionTabs$exerciseP6.exercise_user_id,
|
|
|
unlock_key: formValue.unlock_key,
|
|
|
ip: localIpRef.current
|
|
|
});
|
|
|
case 9:
|
|
|
unlockRes = _context2.sent;
|
|
|
if (!(unlockRes.status === 0)) {
|
|
|
_context2.next = 22;
|
|
|
break;
|
|
|
}
|
|
|
if (!successCb) {
|
|
|
_context2.next = 15;
|
|
|
break;
|
|
|
}
|
|
|
dispatch({
|
|
|
type: 'exercise/setActionTabs',
|
|
|
payload: {}
|
|
|
});
|
|
|
successCb();
|
|
|
return _context2.abrupt("return");
|
|
|
case 15:
|
|
|
if (!formValue.time) {
|
|
|
_context2.next = 19;
|
|
|
break;
|
|
|
}
|
|
|
delayedParams = {
|
|
|
time: moment__WEBPACK_IMPORTED_MODULE_6___default()(formValue.time).format("YYYY-MM-DD HH:mm"),
|
|
|
exercise_user_id: actionTabs === null || actionTabs === void 0 || (_actionTabs$exerciseP7 = actionTabs.exerciseParams) === null || _actionTabs$exerciseP7 === void 0 ? void 0 : _actionTabs$exerciseP7.exercise_user_id,
|
|
|
id: actionTabs === null || actionTabs === void 0 || (_actionTabs$exerciseP8 = actionTabs.exerciseParams) === null || _actionTabs$exerciseP8 === void 0 ? void 0 : _actionTabs$exerciseP8.id
|
|
|
};
|
|
|
_context2.next = 19;
|
|
|
return (0,_service_exercise__WEBPACK_IMPORTED_MODULE_5__/* .delayedTime */ .qz)(delayedParams);
|
|
|
case 19:
|
|
|
v = actionTabs === null || actionTabs === void 0 ? void 0 : actionTabs.exerciseParams;
|
|
|
(0,_utils_util__WEBPACK_IMPORTED_MODULE_8__/* .startExercise */ .nr)({
|
|
|
inner_ip: v.inner_ip,
|
|
|
public_ip: v.public_ip,
|
|
|
open_camera: v.open_camera,
|
|
|
ip_limit: v.ip_limit,
|
|
|
ip_bind: v.ip_bind,
|
|
|
exercise_tips: v.exercise_tips,
|
|
|
exerciseId: v.id,
|
|
|
screen_open: v.screen_open,
|
|
|
screen_num: v.screen_num,
|
|
|
screen_sec: v.screen_sec,
|
|
|
coursesId: params.coursesId,
|
|
|
login: (_userInfo = (0,_utils_authority__WEBPACK_IMPORTED_MODULE_10__/* .userInfo */ .eY)()) === null || _userInfo === void 0 ? void 0 : _userInfo.login,
|
|
|
history: history,
|
|
|
identity_verify: v.identity_verify,
|
|
|
open_phone_video_recording: v.open_phone_video_recording,
|
|
|
current_status: v.current_status
|
|
|
});
|
|
|
dispatch({
|
|
|
type: 'exercise/setActionTabs',
|
|
|
payload: {}
|
|
|
});
|
|
|
case 22:
|
|
|
setIsLoading(false);
|
|
|
case 23:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function handleOk() {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var columns = [{
|
|
|
title: 'IP地址',
|
|
|
dataIndex: 'ip',
|
|
|
key: 'ip',
|
|
|
render: function render(text) {
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
|
|
|
className: text.indexOf("异常") > -1 ? 'c-red' : 'c-green',
|
|
|
children: text
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: '浏览器',
|
|
|
dataIndex: 'browser',
|
|
|
key: 'browser',
|
|
|
render: function render(text) {
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
|
|
|
className: text.indexOf("异常") > -1 ? 'c-red' : 'c-green',
|
|
|
children: text
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: '上次登录时间',
|
|
|
dataIndex: 'last_login_time',
|
|
|
key: 'last_login_time'
|
|
|
}];
|
|
|
var hasError5 = (actionTabs === null || actionTabs === void 0 || (_actionTabs$exerciseP9 = actionTabs.exerciseParams) === null || _actionTabs$exerciseP9 === void 0 ? void 0 : _actionTabs$exerciseP9.errorMessage) && _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_typeof_js__WEBPACK_IMPORTED_MODULE_0___default()(actionTabs === null || actionTabs === void 0 || (_actionTabs$exerciseP10 = actionTabs.exerciseParams) === null || _actionTabs$exerciseP10 === void 0 ? void 0 : _actionTabs$exerciseP10.errorMessage) === "object";
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.Fragment, {
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, {
|
|
|
width: 514,
|
|
|
centered: true,
|
|
|
closable: !!(actionTabs !== null && actionTabs !== void 0 && (_actionTabs$exerciseP11 = actionTabs.exerciseParams) !== null && _actionTabs$exerciseP11 !== void 0 && _actionTabs$exerciseP11.unlockClose),
|
|
|
maskClosable: false,
|
|
|
keyboard: false,
|
|
|
maskStyle: {
|
|
|
background: "#000"
|
|
|
},
|
|
|
title: '提示',
|
|
|
open: exercise.actionTabs.key === 'student-unlock',
|
|
|
footer: null,
|
|
|
onCancel: function onCancel() {
|
|
|
dispatch({
|
|
|
type: 'exercise/setActionTabs',
|
|
|
payload: {}
|
|
|
});
|
|
|
},
|
|
|
children: [hasError5 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div", {
|
|
|
style: {
|
|
|
marginBottom: 16
|
|
|
},
|
|
|
children: "\u8BE5\u8D26\u53F7\u5DF2\u7ECF\u5B58\u5728\u5F02\u5E38\u60C5\u51B5\uFF0C\u82E5\u975E\u672C\u4EBA\u64CD\u4F5C\uFF0C\u8BF7\u8054\u7CFB\u76D1\u8003\u8001\u5E08\u8BF4\u660E\u60C5\u51B5\u3002 "
|
|
|
}), !hasError5 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div", {
|
|
|
style: {
|
|
|
marginBottom: 16
|
|
|
},
|
|
|
children: "\u7CFB\u7EDF\u68C0\u6D4B\u5230\u60A8\u5728\u8003\u8BD5\u65F6\u4E2D\u9014\u9000\u51FA\uFF0C\u73B0\u5DF2\u5C06\u8003\u8BD5\u9501\u5B9A\u3002\u5982\u9700\u7EE7\u7EED\u8FDB\u884C\u8003\u8BD5\uFF0C \u8BF7\u5C3D\u5FEB\u8054\u7CFB\u8BFE\u5802\u8001\u5E08\u8FDB\u884C\u89E3\u9501\uFF01"
|
|
|
}), hasError5 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, {
|
|
|
className: "mb20",
|
|
|
pagination: {
|
|
|
hideOnSinglePage: true
|
|
|
},
|
|
|
dataSource: [(actionTabs === null || actionTabs === void 0 || (_actionTabs$exerciseP12 = actionTabs.exerciseParams) === null || _actionTabs$exerciseP12 === void 0 ? void 0 : _actionTabs$exerciseP12.errorMessage) || {}],
|
|
|
columns: columns
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div", {
|
|
|
className: "",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z, {
|
|
|
form: form,
|
|
|
layout: "vertical",
|
|
|
autoComplete: "off",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z.Item, {
|
|
|
label: "\u8003\u8BD5\u89E3\u9501\u7801",
|
|
|
name: "unlock_key",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入考试解锁码'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z.Password, {
|
|
|
autoComplete: "off",
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u8003\u8BD5\u89E3\u9501\u7801",
|
|
|
visibilityToggle: false
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_17__/* ["default"] */ .Z, {
|
|
|
justify: "space-between",
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_18__/* ["default"] */ .Z, {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_18__/* ["default"] */ .Z, {
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_19__/* ["default"] */ .ZP, {
|
|
|
loading: isLoading,
|
|
|
onClick: handleOk,
|
|
|
children: "\u8FDB\u5165\u8003\u8BD5"
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ __webpack_exports__.Z = ((0,umi__WEBPACK_IMPORTED_MODULE_7__.connect)(function (_ref4) {
|
|
|
var exercise = _ref4.exercise;
|
|
|
return {
|
|
|
exercise: exercise
|
|
|
};
|
|
|
})(Unlock));
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 90678:
|
|
|
/*!*****************************************************************!*\
|
|
|
!*** ./src/pages/MyProblem/TestCasePanel/index.tsx + 1 modules ***!
|
|
|
\*****************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
Y4: function() { return /* binding */ DetailCommitOut; },
|
|
|
Im: function() { return /* binding */ ExecuteDict; },
|
|
|
ZP: function() { return /* binding */ TestCasePanel; }
|
|
|
});
|
|
|
|
|
|
// UNUSED EXPORTS: getCommitOut
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(11006);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js
|
|
|
var regeneratorRuntime = __webpack_require__(10574);
|
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js
|
|
|
var asyncToGenerator = __webpack_require__(39343);
|
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(26801);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/defineProperty.js
|
|
|
var defineProperty = __webpack_require__(22060);
|
|
|
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
|
|
|
var input = __webpack_require__(1056);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(3113);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/DownOutlined.js + 1 modules
|
|
|
var DownOutlined = __webpack_require__(42884);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/UpOutlined.js + 1 modules
|
|
|
var UpOutlined = __webpack_require__(20114);
|
|
|
// EXTERNAL MODULE: ./src/pages/MyProblem/interface.ts
|
|
|
var MyProblem_interface = __webpack_require__(59820);
|
|
|
// EXTERNAL MODULE: ./node_modules/_js-base64@2.6.4@js-base64/base64.js
|
|
|
var base64 = __webpack_require__(24334);
|
|
|
;// CONCATENATED MODULE: ./src/pages/MyProblem/TestCasePanel/index.less
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
// EXTERNAL MODULE: ./src/components/Spinner/index.tsx + 1 modules
|
|
|
var Spinner = __webpack_require__(40807);
|
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules
|
|
|
var RenderHtml = __webpack_require__(11436);
|
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
|
var util = __webpack_require__(22739);
|
|
|
// EXTERNAL MODULE: ./node_modules/_xterm@4.8.1@xterm/lib/xterm.js
|
|
|
var xterm = __webpack_require__(34376);
|
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
|
var utils_fetch = __webpack_require__(91506);
|
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
|
|
|
var _umi_production_exports = __webpack_require__(45295);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/pages/MyProblem/TestCasePanel/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _ExecuteDict;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TextArea = input/* default */.Z.TextArea;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var initialState = {
|
|
|
visible: false,
|
|
|
tabIndex: '0'
|
|
|
};
|
|
|
var ExecuteDict = (_ExecuteDict = {}, defineProperty_default()(_ExecuteDict, MyProblem_interface/* ExecuteStatus */.h.NOMATCH, '测试用例结果不匹配'), defineProperty_default()(_ExecuteDict, MyProblem_interface/* ExecuteStatus */.h.OK, '调试通过'), defineProperty_default()(_ExecuteDict, 2, '调试超时'), defineProperty_default()(_ExecuteDict, 3, '调试pod失败'), defineProperty_default()(_ExecuteDict, 4, '编译失败'), defineProperty_default()(_ExecuteDict, 5, '执行失败'), _ExecuteDict);
|
|
|
var Types = /*#__PURE__*/function (Types) {
|
|
|
Types[Types["SET_VISIBLE"] = 0] = "SET_VISIBLE";
|
|
|
Types[Types["SET_TABINDEX"] = 1] = "SET_TABINDEX";
|
|
|
return Types;
|
|
|
}(Types || {});
|
|
|
function Reducer(state, action) {
|
|
|
switch (action.type) {
|
|
|
case Types.SET_VISIBLE:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
visible: action.payload
|
|
|
});
|
|
|
case Types.SET_TABINDEX:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
tabIndex: action.payload
|
|
|
});
|
|
|
default:
|
|
|
throw new Error();
|
|
|
}
|
|
|
}
|
|
|
function DetailCommitOut(debugResult) {
|
|
|
var status = debugResult.status,
|
|
|
error_msg = debugResult.error_msg,
|
|
|
output = debugResult.output,
|
|
|
input = debugResult.input,
|
|
|
expected_output = debugResult.expected_output,
|
|
|
is_file = debugResult.is_file,
|
|
|
input_file_url = debugResult.input_file_url,
|
|
|
output_file_url = debugResult.output_file_url,
|
|
|
expected_output_file_url = debugResult.expected_output_file_url,
|
|
|
setMonacoValue = debugResult.setMonacoValue,
|
|
|
setData = debugResult.setData;
|
|
|
var outputRef = (0,_react_17_0_2_react.useRef)();
|
|
|
var inputRef = (0,_react_17_0_2_react.useRef)();
|
|
|
var expectedOutputRef = (0,_react_17_0_2_react.useRef)();
|
|
|
var rs = null;
|
|
|
var mdStyle = {
|
|
|
minHeight: 150,
|
|
|
marginBottom: 10,
|
|
|
paddingLeft: 24,
|
|
|
background: '#070f19',
|
|
|
color: '#fff'
|
|
|
};
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (output && !is_file && outputRef.current) {
|
|
|
var term = new xterm.Terminal({
|
|
|
fontSize: 14,
|
|
|
letterSpacing: 1,
|
|
|
cols: 83,
|
|
|
rows: 10
|
|
|
});
|
|
|
term.open(outputRef.current);
|
|
|
var actual_output_format = (0,util/* findEndWhitespace */.pp)(base64.Base64.decode(output));
|
|
|
term.write(actual_output_format);
|
|
|
term.setOption('theme', {
|
|
|
background: '#1e1e1e'
|
|
|
});
|
|
|
}
|
|
|
if (input && !is_file && inputRef.current) {
|
|
|
var term2 = new xterm.Terminal({
|
|
|
fontSize: 14,
|
|
|
letterSpacing: 1,
|
|
|
cols: 83,
|
|
|
rows: 10
|
|
|
});
|
|
|
term2.open(inputRef.current);
|
|
|
term2.write((0,util/* findEndWhitespace */.pp)(input));
|
|
|
term2.setOption('theme', {
|
|
|
background: '#1e1e1e'
|
|
|
});
|
|
|
}
|
|
|
if (expected_output && !is_file && expectedOutputRef.current) {
|
|
|
var term3 = new xterm.Terminal({
|
|
|
fontSize: 14,
|
|
|
letterSpacing: 1,
|
|
|
cols: 83,
|
|
|
rows: 10
|
|
|
});
|
|
|
term3.open(expectedOutputRef.current);
|
|
|
term3.write((0,util/* findEndWhitespace */.pp)(base64.Base64.decode(expected_output)));
|
|
|
term3.setOption('theme', {
|
|
|
background: '#1e1e1e'
|
|
|
});
|
|
|
}
|
|
|
}, [output]);
|
|
|
switch (status) {
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.NOMATCH:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "c-red",
|
|
|
children: "\u5B9E\u9645\u8F93\u5165\uFF1A"
|
|
|
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
ref: inputRef
|
|
|
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: mdStyle,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
// href={input_file_url}
|
|
|
style: {
|
|
|
fontSize: '16px'
|
|
|
},
|
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return fetch(input_file_url, {
|
|
|
method: "Get",
|
|
|
headers: {
|
|
|
"Content-Type": "application/octet-stream",
|
|
|
"Accept": "*/*"
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context.sent;
|
|
|
_context.t0 = setMonacoValue;
|
|
|
_context.next = 6;
|
|
|
return res.text();
|
|
|
case 6:
|
|
|
_context.t1 = _context.sent;
|
|
|
(0, _context.t0)(_context.t1);
|
|
|
setTimeout(function () {
|
|
|
setData(input_file_url);
|
|
|
}, 200);
|
|
|
// download(input_file_url, input)
|
|
|
case 9:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}))
|
|
|
// download={expected_output}
|
|
|
// target="_blank"
|
|
|
,
|
|
|
children: input
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "c-red",
|
|
|
children: "\u5B9E\u9645\u8F93\u51FA\uFF1A"
|
|
|
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
ref: outputRef
|
|
|
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: mdStyle,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
// href={output_file_url}
|
|
|
style: {
|
|
|
fontSize: '16px'
|
|
|
},
|
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.next = 2;
|
|
|
return (0,utils_fetch/* default */.ZP)(output_file_url, {
|
|
|
method: "Get",
|
|
|
headers: {
|
|
|
"Content-Type": "application/xml",
|
|
|
"Accept": "*/*"
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context2.sent;
|
|
|
setMonacoValue(res);
|
|
|
setTimeout(function () {
|
|
|
setData(output_file_url);
|
|
|
}, 200);
|
|
|
|
|
|
// download(output_file_url, output)
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}))
|
|
|
// download={expected_output} target="_blank"
|
|
|
,
|
|
|
children: output
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "c-red",
|
|
|
children: "\u9884\u671F\u8F93\u51FA\uFF1A"
|
|
|
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
ref: expectedOutputRef
|
|
|
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: mdStyle,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
// href={expected_output_file_url}
|
|
|
style: {
|
|
|
fontSize: '16px'
|
|
|
},
|
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
_context3.next = 2;
|
|
|
return fetch(expected_output_file_url, {
|
|
|
method: "Get",
|
|
|
headers: {
|
|
|
"Content-Type": "application/octet-stream",
|
|
|
"Accept": "*/*"
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context3.sent;
|
|
|
_context3.t0 = setMonacoValue;
|
|
|
_context3.next = 6;
|
|
|
return res.text();
|
|
|
case 6:
|
|
|
_context3.t1 = _context3.sent;
|
|
|
(0, _context3.t0)(_context3.t1);
|
|
|
setTimeout(function () {
|
|
|
setData(expected_output_file_url);
|
|
|
}, 200);
|
|
|
case 9:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}))
|
|
|
// download={expected_output} target="_blank"
|
|
|
,
|
|
|
children: expected_output
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.EXECUTEFAILURE:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
border: '1px #F6F7F9 solid'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
style: {
|
|
|
width: '100%',
|
|
|
height: 40,
|
|
|
background: '#F6F7F9',
|
|
|
lineHeight: '40px',
|
|
|
color: "#666666",
|
|
|
paddingLeft: '12px'
|
|
|
},
|
|
|
children: "\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"
|
|
|
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: input,
|
|
|
style: mdStyle
|
|
|
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: mdStyle,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
// href={input_file_url} style={{fontSize:'16px'}} target="_blank"
|
|
|
onClick: function onClick() {
|
|
|
return (0,util/* download */.LR)(input_file_url, input);
|
|
|
},
|
|
|
children: input
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
border: '1px #F6F7F9 solid',
|
|
|
marginTop: '10px'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
style: {
|
|
|
width: '100%',
|
|
|
height: 40,
|
|
|
background: '#F6F7F9',
|
|
|
lineHeight: '40px',
|
|
|
color: "#666666",
|
|
|
paddingLeft: '12px'
|
|
|
},
|
|
|
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("pre", {
|
|
|
className: "error",
|
|
|
style: {
|
|
|
color: '#E30000',
|
|
|
padding: '0 10px'
|
|
|
},
|
|
|
children: [base64.Base64.decode(error_msg), "111"]
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.COMPILEFAILURE:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"
|
|
|
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
ref: inputRef
|
|
|
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: mdStyle,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
// href={input_file_url} style={{fontSize:'16px'}} target="_blank"
|
|
|
onClick: function onClick() {
|
|
|
return (0,util/* download */.LR)(input_file_url, input);
|
|
|
},
|
|
|
children: input
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
className: "error",
|
|
|
children: base64.Base64.decode(error_msg)
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.PODFAILURE:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
|
|
|
});
|
|
|
break;
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.TIMEOUT:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
|
|
|
});
|
|
|
break;
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [" ", rs, " "]
|
|
|
});
|
|
|
}
|
|
|
function getCommitOut(debugResult) {
|
|
|
var status = debugResult.status,
|
|
|
error_msg = debugResult.error_msg,
|
|
|
execute_time = debugResult.execute_time,
|
|
|
output = debugResult.output,
|
|
|
input = debugResult.input,
|
|
|
expected_output = debugResult.expected_output,
|
|
|
is_file = debugResult.is_file,
|
|
|
input_file_url = debugResult.input_file_url,
|
|
|
output_file_url = debugResult.output_file_url,
|
|
|
expected_output_file_url = debugResult.expected_output_file_url;
|
|
|
var rs = null;
|
|
|
switch (status) {
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.OK:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u6267\u884C\u7528\u65F6\uFF1A", execute_time / 1000, "\u79D2"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u6267\u884C\u7ED3\u679C\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
children: base64.Base64.decode(output)
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.NOMATCH:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u8F93\u5165\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
children: input
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u8F93\u51FA\uFF1A", output && base64.Base64.decode(output)]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u9884\u671F\u8F93\u51FA\uFF1A", expected_output && base64.Base64.decode(expected_output)]
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.EXECUTEFAILURE:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
children: input
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
className: "error",
|
|
|
children: base64.Base64.decode(error_msg)
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.COMPILEFAILURE:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
children: input
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
className: "error",
|
|
|
children: base64.Base64.decode(error_msg)
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.PODFAILURE:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
|
|
|
});
|
|
|
break;
|
|
|
case MyProblem_interface/* ExecuteStatus */.h.TIMEOUT:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
|
|
|
});
|
|
|
break;
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [" ", rs, " "]
|
|
|
});
|
|
|
}
|
|
|
/* harmony default export */ var TestCasePanel = (function (_ref4) {
|
|
|
var input = _ref4.input,
|
|
|
debuging = _ref4.debuging,
|
|
|
submitting = _ref4.submitting,
|
|
|
executingMessage = _ref4.executingMessage,
|
|
|
debugResult = _ref4.debugResult,
|
|
|
onChangeInput = _ref4.onChangeInput,
|
|
|
onDebugCode = _ref4.onDebugCode,
|
|
|
onSubmitCode = _ref4.onSubmitCode,
|
|
|
hack = _ref4.hack,
|
|
|
user = _ref4.user;
|
|
|
var _useReducer = (0,_react_17_0_2_react.useReducer)(Reducer, initialState),
|
|
|
_useReducer2 = slicedToArray_default()(_useReducer, 2),
|
|
|
state = _useReducer2[0],
|
|
|
dispatch = _useReducer2[1];
|
|
|
var visible = state.visible,
|
|
|
tabIndex = state.tabIndex;
|
|
|
var _useSearchParams = (0,_umi_production_exports.useSearchParams)(),
|
|
|
_useSearchParams2 = slicedToArray_default()(_useSearchParams, 1),
|
|
|
searchParams = _useSearchParams2[0];
|
|
|
function onTabIndexChange(e) {
|
|
|
var id = e.target.id;
|
|
|
dispatch({
|
|
|
type: Types.SET_TABINDEX,
|
|
|
payload: id
|
|
|
});
|
|
|
}
|
|
|
function onTriggerCollapse() {
|
|
|
dispatch({
|
|
|
type: Types.SET_VISIBLE,
|
|
|
payload: !visible
|
|
|
});
|
|
|
}
|
|
|
var executeResult = (0,_react_17_0_2_react.useMemo)(function () {
|
|
|
if (debugResult) {
|
|
|
var status = debugResult.status;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: getCommitOut(debugResult)
|
|
|
});
|
|
|
}
|
|
|
return null;
|
|
|
}, [debugResult]);
|
|
|
function onDebug() {
|
|
|
dispatch({
|
|
|
type: Types.SET_VISIBLE,
|
|
|
payload: true
|
|
|
});
|
|
|
dispatch({
|
|
|
type: Types.SET_TABINDEX,
|
|
|
payload: '1'
|
|
|
});
|
|
|
onDebugCode();
|
|
|
}
|
|
|
var skip = /*#__PURE__*/function () {
|
|
|
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4(text) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
_context4.next = 2;
|
|
|
return (0,utils_fetch/* default */.ZP)("/api/problems/".concat(text, "/start.json"), {
|
|
|
method: 'get',
|
|
|
params: {
|
|
|
hack_user_id: user === null || user === void 0 ? void 0 : user.user_id
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context4.sent;
|
|
|
if (res) {
|
|
|
window.location.href = "/myproblems/".concat(res === null || res === void 0 ? void 0 : res.identifier, "?type=1");
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
return function skip(_x) {
|
|
|
return _ref5.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "test-case-panel",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "test-case-panel-body ".concat(visible ? 'active' : ''),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
|
className: "s-navs",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
className: tabIndex === '0' ? 'active' : '',
|
|
|
id: "0",
|
|
|
onClick: onTabIndexChange,
|
|
|
children: "\u81EA\u5B9A\u4E49\u6D4B\u8BD5\u7528\u4F8B"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
className: tabIndex === '1' ? 'active' : '',
|
|
|
id: "1",
|
|
|
onClick: onTabIndexChange,
|
|
|
children: "\u4EE3\u7801\u6267\u884C\u7ED3\u679C"
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "tab-panel-body ".concat(tabIndex === '0' ? '' : 'hide'),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(TextArea, {
|
|
|
placeholder: "\u8BF7\u586B\u5199\u6D4B\u8BD5\u7528\u4F8B\u7684\u8F93\u5165\u503C\uFF0C\u70B9\u51FB\u201C\u8C03\u8BD5\u4EE3\u7801\u201D",
|
|
|
value: input,
|
|
|
onChange: onChangeInput
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "tab-panel-body ".concat(tabIndex === '1' ? '' : 'hide'),
|
|
|
children: debuging ? /*#__PURE__*/(0,jsx_runtime.jsx)(Spinner/* default */.Z, {
|
|
|
message: executingMessage
|
|
|
}) : debugResult ? /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
style: {
|
|
|
height: 200
|
|
|
},
|
|
|
children: [" ", executeResult, " "]
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "tip",
|
|
|
children: "\u8BF7\u586B\u5199\u6D4B\u8BD5\u7528\u4F8B\u7684\u8F93\u5165\u503C\uFF0C\u70B9\u51FB\u201C\u8C03\u8BD5\u4EE3\u7801\u201D"
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
className: "btn-collapse ".concat(visible ? 'up' : ''),
|
|
|
onClick: onTriggerCollapse,
|
|
|
children: visible ? /*#__PURE__*/(0,jsx_runtime.jsx)(DownOutlined/* default */.Z, {}) : /*#__PURE__*/(0,jsx_runtime.jsx)(UpOutlined/* default */.Z, {})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("footer", {
|
|
|
className: "footer",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u63A7\u5236\u53F0"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "flex-container",
|
|
|
children: [(hack === null || hack === void 0 ? void 0 : hack.is_program) && (hack === null || hack === void 0 ? void 0 : hack.above_question) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
onClick: function onClick() {
|
|
|
return skip(hack === null || hack === void 0 ? void 0 : hack.above_question);
|
|
|
},
|
|
|
id: "oj-prev",
|
|
|
className: "btn-blue",
|
|
|
type: "ghost",
|
|
|
children: "\u4E0A\u4E00\u9898"
|
|
|
}), (hack === null || hack === void 0 ? void 0 : hack.is_program) && (hack === null || hack === void 0 ? void 0 : hack.under_question) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
onClick: function onClick() {
|
|
|
return skip(hack === null || hack === void 0 ? void 0 : hack.under_question);
|
|
|
},
|
|
|
id: "oj-next",
|
|
|
className: "btn-blue",
|
|
|
type: "ghost",
|
|
|
children: "\u4E0B\u4E00\u9898"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
className: "btn-green",
|
|
|
type: "ghost",
|
|
|
loading: debuging,
|
|
|
onClick: onDebug,
|
|
|
children: "\u8C03\u8BD5\u4EE3\u7801"
|
|
|
}), searchParams.get("qtype") !== '8' && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
type: "primary",
|
|
|
className: "custom-ant-disabled",
|
|
|
loading: submitting,
|
|
|
disabled: submitting,
|
|
|
onClick: function onClick() {
|
|
|
dispatch({
|
|
|
type: Types.SET_VISIBLE,
|
|
|
payload: false
|
|
|
});
|
|
|
// dispatch({
|
|
|
// type: Types.SET_TABINDEX,
|
|
|
// payload: '1'
|
|
|
// })
|
|
|
onSubmitCode();
|
|
|
},
|
|
|
children: "\u8BC4\u6D4B\u5E76\u63D0\u4EA4"
|
|
|
})]
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 59820:
|
|
|
/*!******************************************!*\
|
|
|
!*** ./src/pages/MyProblem/interface.ts ***!
|
|
|
\******************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ h: function() { return /* binding */ ExecuteStatus; }
|
|
|
/* harmony export */ });
|
|
|
// created_at: "2020-07-09T19:53:54.000+08:00"
|
|
|
// execute_memory: null
|
|
|
// execute_time: 0.269
|
|
|
// id: 872
|
|
|
// language: "C"
|
|
|
// status: 4
|
|
|
var ExecuteStatus = /*#__PURE__*/function (ExecuteStatus) {
|
|
|
ExecuteStatus[ExecuteStatus["NOMATCH"] = -1] = "NOMATCH";
|
|
|
ExecuteStatus[ExecuteStatus["OK"] = 0] = "OK";
|
|
|
ExecuteStatus[ExecuteStatus["TIMEOUT"] = 2] = "TIMEOUT";
|
|
|
ExecuteStatus[ExecuteStatus["PODFAILURE"] = 3] = "PODFAILURE";
|
|
|
ExecuteStatus[ExecuteStatus["COMPILEFAILURE"] = 4] = "COMPILEFAILURE";
|
|
|
ExecuteStatus[ExecuteStatus["EXECUTEFAILURE"] = 5] = "EXECUTEFAILURE";
|
|
|
return ExecuteStatus;
|
|
|
}({});
|
|
|
|
|
|
// "id": "1",
|
|
|
// "status": 2, # -1测试用例结果不匹配; 0: 评测通过; ;2 评测超时;3 创建pod失败; 4 编译失败;5 执行失败
|
|
|
// "error_line": 3, # 错误行数
|
|
|
// "error_msg": "error line 7 input.." , # 报错信息
|
|
|
// "input": "3 4", # 输入
|
|
|
// "output": "7", # 输出
|
|
|
// "execute_time": 3, #执行时间
|
|
|
// "execute_memory": 300, #消耗内存
|
|
|
// "expected_output": "7" # 如果提交模式 会多这个参数
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 43887:
|
|
|
/*!****************************************!*\
|
|
|
!*** ./src/pages/MyProblem/service.ts ***!
|
|
|
\****************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ H7: function() { return /* binding */ resetCode; },
|
|
|
/* harmony export */ MK: function() { return /* binding */ addNotes; },
|
|
|
/* harmony export */ MU: function() { return /* binding */ debugCode; },
|
|
|
/* harmony export */ X6: function() { return /* binding */ getRecordDetail; },
|
|
|
/* harmony export */ bM: function() { return /* binding */ sumbitCode; },
|
|
|
/* harmony export */ fi: function() { return /* binding */ syncCode; },
|
|
|
/* harmony export */ fu: function() { return /* binding */ getProgrammingTopic; },
|
|
|
/* harmony export */ n4: function() { return /* binding */ updateCode; },
|
|
|
/* harmony export */ rX: function() { return /* binding */ getOperationResult; },
|
|
|
/* harmony export */ vl: function() { return /* binding */ triggerPlus; },
|
|
|
/* harmony export */ zO: function() { return /* binding */ getSubmitRecords; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/utils/fetch.ts */ 91506);
|
|
|
|
|
|
|
|
|
function getProgrammingTopic(id, params) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .get */ .U2)("myproblems/".concat(id, ".json"), _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({
|
|
|
hidePopLogin: true
|
|
|
}, params || {}));
|
|
|
}
|
|
|
function sumbitCode(id, params) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/code_submit.json"), params);
|
|
|
}
|
|
|
function debugCode(id, params) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/code_debug.json"), params);
|
|
|
}
|
|
|
function getSubmitRecords(id, params) {
|
|
|
if (params.language) {
|
|
|
params.language = encodeURIComponent(params.language);
|
|
|
}
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .get */ .U2)("myproblems/".concat(id, "/submit_records.json"), params);
|
|
|
}
|
|
|
function getRecordDetail(id) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .get */ .U2)("myproblems/record_detail.json", {
|
|
|
id: id
|
|
|
});
|
|
|
}
|
|
|
function getOperationResult(id, mode) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .get */ .U2)("myproblems/".concat(id, "/result.json"), {
|
|
|
mode: mode
|
|
|
});
|
|
|
}
|
|
|
function addNotes(id, params) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/add_notes.json"), params);
|
|
|
}
|
|
|
function resetCode(id) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/restore_initial_code.json"));
|
|
|
}
|
|
|
function syncCode(id) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/sync_code.json"));
|
|
|
}
|
|
|
function updateCode(id, params) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/update_code.json"), params);
|
|
|
}
|
|
|
function triggerPlus(id, params) {
|
|
|
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("discusses/".concat(id, "/plus.json"), params);
|
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 64066:
|
|
|
/*!********************************************!*\
|
|
|
!*** ./src/utils/hooks/useRemindModal.tsx ***!
|
|
|
\********************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ _: function() { return /* binding */ useRemindModal; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/createForOfIteratorHelper.js */ 98190);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ 59301);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! antd */ 43418);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//只需要left_time和exercise_events参数,实际上传进来的answerData还有很多其它的属性
|
|
|
|
|
|
var useRemindModal = function useRemindModal(answerData) {
|
|
|
var _answerData$exercise6, _answerData$exercise7;
|
|
|
var countDownRefArr = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)([]);
|
|
|
var clearCountdownTimeout = function clearCountdownTimeout() {
|
|
|
var _iterator = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_0___default()(countDownRefArr.current),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var id = _step.value;
|
|
|
clearTimeout(id);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
countDownRefArr.current = [];
|
|
|
};
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
|
|
|
var _answerData$exercise, _answerData$exercise2;
|
|
|
clearCountdownTimeout();
|
|
|
if (answerData !== null && answerData !== void 0 && (_answerData$exercise = answerData.exercise) !== null && _answerData$exercise !== void 0 && _answerData$exercise.left_time && (answerData === null || answerData === void 0 || (_answerData$exercise2 = answerData.exercise) === null || _answerData$exercise2 === void 0 || (_answerData$exercise2 = _answerData$exercise2.exercise_events) === null || _answerData$exercise2 === void 0 ? void 0 : _answerData$exercise2.length) > 0) {
|
|
|
var _answerData$exercise3;
|
|
|
var _iterator2 = _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_0___default()(answerData === null || answerData === void 0 || (_answerData$exercise3 = answerData.exercise) === null || _answerData$exercise3 === void 0 ? void 0 : _answerData$exercise3.exercise_events),
|
|
|
_step2;
|
|
|
try {
|
|
|
var _loop = function _loop() {
|
|
|
var _answerData$exercise4;
|
|
|
var eventItem = _step2.value;
|
|
|
if ((answerData === null || answerData === void 0 || (_answerData$exercise4 = answerData.exercise) === null || _answerData$exercise4 === void 0 ? void 0 : _answerData$exercise4.left_time) > (eventItem === null || eventItem === void 0 ? void 0 : eventItem.reminder_time) * 60) {
|
|
|
var _answerData$exercise5;
|
|
|
var timeoutId = setTimeout(function () {
|
|
|
antd__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.info({
|
|
|
content: "".concat(eventItem === null || eventItem === void 0 ? void 0 : eventItem.reminder_content),
|
|
|
icon: null,
|
|
|
title: '提示',
|
|
|
centered: true,
|
|
|
okText: "知道了"
|
|
|
});
|
|
|
}, ((answerData === null || answerData === void 0 || (_answerData$exercise5 = answerData.exercise) === null || _answerData$exercise5 === void 0 ? void 0 : _answerData$exercise5.left_time) - (eventItem === null || eventItem === void 0 ? void 0 : eventItem.reminder_time) * 60) * 1000);
|
|
|
countDownRefArr.current.push(timeoutId);
|
|
|
}
|
|
|
};
|
|
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
|
_loop();
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator2.e(err);
|
|
|
} finally {
|
|
|
_iterator2.f();
|
|
|
}
|
|
|
}
|
|
|
}, [answerData === null || answerData === void 0 || (_answerData$exercise6 = answerData.exercise) === null || _answerData$exercise6 === void 0 ? void 0 : _answerData$exercise6.left_time, answerData === null || answerData === void 0 || (_answerData$exercise7 = answerData.exercise) === null || _answerData$exercise7 === void 0 ? void 0 : _answerData$exercise7.exercise_events]);
|
|
|
return clearCountdownTimeout;
|
|
|
};
|
|
|
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
}]); |