|
|
"use strict";
|
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[48431,67570],{
|
|
|
|
|
|
/***/ 96403:
|
|
|
/*!*********************************!*\
|
|
|
!*** ./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 */ 59758);
|
|
|
|
|
|
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"].API_SERVER */ .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';
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 75490:
|
|
|
/*!************************************************************!*\
|
|
|
!*** ./src/components/image-preview/index.tsx + 1 modules ***!
|
|
|
\************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"Z": function() { return /* binding */ image_preview; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/button/style/index.js + 1 modules
|
|
|
var style = __webpack_require__(29913);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(71577);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(27424);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
|
var react = __webpack_require__(67294);
|
|
|
;// CONCATENATED MODULE: ./src/components/image-preview/index.less
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
// EXTERNAL MODULE: ./src/components/mediator.js
|
|
|
var mediator = __webpack_require__(91562);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/ReloadOutlined.js + 1 modules
|
|
|
var ReloadOutlined = __webpack_require__(33160);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/DownloadOutlined.js
|
|
|
var DownloadOutlined = __webpack_require__(69753);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/CloseOutlined.js
|
|
|
var CloseOutlined = __webpack_require__(28508);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
|
;// CONCATENATED MODULE: ./src/components/image-preview/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* harmony default export */ var image_preview = (function () {
|
|
|
var _useState = (0,react.useState)(''),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
url = _useState2[0],
|
|
|
setUrl = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)(0),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
deg = _useState4[0],
|
|
|
setDeg = _useState4[1];
|
|
|
var saveUrl = (0,react.useRef)('');
|
|
|
(0,react.useEffect)(function () {
|
|
|
var unSub = mediator/* default.subscribe */.Z.subscribe('preview-image', function (value) {
|
|
|
setUrl(value);
|
|
|
// window.document.body
|
|
|
// document.body.style.height='100%'
|
|
|
document.body.style.overflow = 'hidden';
|
|
|
});
|
|
|
return unSub;
|
|
|
}, []);
|
|
|
(0,react.useEffect)(function () {
|
|
|
document.addEventListener('keydown', onViewEscClose);
|
|
|
return function () {
|
|
|
document.removeEventListener('keydown', onViewEscClose);
|
|
|
};
|
|
|
}, []);
|
|
|
(0,react.useEffect)(function () {
|
|
|
saveUrl.current = url;
|
|
|
}, [url]);
|
|
|
function onViewEscClose(e) {
|
|
|
if (e.keyCode == 27 && saveUrl.current) {
|
|
|
onClose();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// https://data.educoder.net/api/attachments/1571649
|
|
|
function onClose() {
|
|
|
// document.body.style.height='100%'
|
|
|
document.body.style.overflow = 'auto';
|
|
|
setUrl('');
|
|
|
}
|
|
|
function onRotate() {
|
|
|
setDeg(deg + 90);
|
|
|
}
|
|
|
var maskRef = (0,react.useRef)();
|
|
|
var previewWrapperRef = (0,react.useRef)();
|
|
|
var handleMaskClick = function handleMaskClick(e) {
|
|
|
if (e.nativeEvent.target === maskRef.current || e.nativeEvent.target === previewWrapperRef.current) {
|
|
|
onClose();
|
|
|
}
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(react.Fragment, {
|
|
|
children: !url ? null : /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "image-preview-container",
|
|
|
ref: maskRef,
|
|
|
onClick: handleMaskClick,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "button-group",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.Z, {
|
|
|
onClick: onRotate,
|
|
|
children: ["\u65CB\u8F6C", /*#__PURE__*/(0,jsx_runtime.jsx)(ReloadOutlined/* default */.Z, {})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.Z, {
|
|
|
href: url,
|
|
|
children: ["\u4E0B\u8F7D", /*#__PURE__*/(0,jsx_runtime.jsx)(DownloadOutlined/* default */.Z, {})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.Z, {
|
|
|
onClick: onClose,
|
|
|
children: ["\u5173\u95ED", /*#__PURE__*/(0,jsx_runtime.jsx)(CloseOutlined/* default */.Z, {})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "preview-wrp-group",
|
|
|
ref: previewWrapperRef,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
className: "image-preview",
|
|
|
src: url,
|
|
|
alt: "\u9884\u89C8\u5927\u56FE",
|
|
|
style: {
|
|
|
transform: "rotate(".concat(deg, "deg)")
|
|
|
}
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
});
|
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 97501:
|
|
|
/*!*************************************************************!*\
|
|
|
!*** ./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_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/objectSpread2.js */ 42122);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var antd_es_button_style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/es/button/style */ 29913);
|
|
|
/* harmony import */ var antd_es_button__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! antd/es/button */ 71577);
|
|
|
/* harmony import */ var antd_es_form_style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! antd/es/form/style */ 75627);
|
|
|
/* harmony import */ var antd_es_form__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! antd/es/form */ 51018);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/slicedToArray.js */ 27424);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var antd_es_select_style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd/es/select/style */ 95985);
|
|
|
/* harmony import */ var antd_es_select__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! antd/es/select */ 34041);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react */ 67294);
|
|
|
/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! codemirror */ 4631);
|
|
|
/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(codemirror__WEBPACK_IMPORTED_MODULE_6__);
|
|
|
/* harmony import */ var codemirror_lib_codemirror_css__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! codemirror/lib/codemirror.css */ 71749);
|
|
|
/* harmony import */ var codemirror_theme_blackboard_css__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! codemirror/theme/blackboard.css */ 30483);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! react/jsx-runtime */ 85893);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Option = antd_es_select__WEBPACK_IMPORTED_MODULE_10__/* ["default"].Option */ .Z.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_5__.useState)('python'),
|
|
|
_useState2 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___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_9__.jsxs)(antd_es_form__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z, _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_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_9__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_11__/* ["default"].Item */ .Z.Item, {
|
|
|
label: "\u4EE3\u7801\u8BED\u8A00",
|
|
|
name: "language",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd_es_select__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z, {
|
|
|
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_9__.jsx)(Option, {
|
|
|
value: item,
|
|
|
children: LanguageDesc[item][0]
|
|
|
}, item);
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd_es_form__WEBPACK_IMPORTED_MODULE_11__/* ["default"].Item */ .Z.Item, {
|
|
|
label: "\u4EE3\u7801\u5185\u5BB9",
|
|
|
name: "content",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入代码内容'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(MyCodeMirror, {
|
|
|
mode: mode
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("div", {
|
|
|
className: "flex-container flex-end",
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd_es_button__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, {
|
|
|
type: "primary",
|
|
|
htmlType: "submit",
|
|
|
style: {
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: "\u786E\u5B9A"
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(antd_es_button__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, {
|
|
|
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_5__.useRef)();
|
|
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(),
|
|
|
_useState4 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState3, 2),
|
|
|
cm = _useState4[0],
|
|
|
setCm = _useState4[1];
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_5__.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_5__.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
cm.setOption('mode', mode);
|
|
|
}
|
|
|
}, [cm, mode]);
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_5__.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
if (value !== cm.getValue() || value === '') {
|
|
|
setTimeout(function () {
|
|
|
cm.setValue(value || ' ');
|
|
|
}, 300);
|
|
|
}
|
|
|
}
|
|
|
}, [cm, value]);
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_5__.useEffect)(function () {
|
|
|
if (el.current && !cm) {
|
|
|
var instance = codemirror__WEBPACK_IMPORTED_MODULE_6___default().fromTextArea(el.current, _root_workspace_ppte5yg23_SJ5m_develop_node_modules_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_9__.jsx)("div", {
|
|
|
className: "my-codemirror-container",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("textarea", {
|
|
|
ref: el
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 55373:
|
|
|
/*!***************************************************************!*\
|
|
|
!*** ./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/antd/es/modal/style/index.js + 1 modules
|
|
|
var style = __webpack_require__(35611);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/modal/index.js + 7 modules
|
|
|
var modal = __webpack_require__(85402);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js
|
|
|
var createForOfIteratorHelper = __webpack_require__(74704);
|
|
|
var createForOfIteratorHelper_default = /*#__PURE__*/__webpack_require__.n(createForOfIteratorHelper);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/message/style/index.js + 1 modules
|
|
|
var message_style = __webpack_require__(14934);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/message/index.js + 1 modules
|
|
|
var message = __webpack_require__(12461);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(27424);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/defineProperty.js
|
|
|
var defineProperty = __webpack_require__(38416);
|
|
|
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
|
var react = __webpack_require__(67294);
|
|
|
// EXTERNAL MODULE: ./node_modules/codemirror/lib/codemirror.js
|
|
|
var codemirror = __webpack_require__(4631);
|
|
|
var codemirror_default = /*#__PURE__*/__webpack_require__.n(codemirror);
|
|
|
// EXTERNAL MODULE: ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js
|
|
|
var ResizeObserver_es = __webpack_require__(91033);
|
|
|
// EXTERNAL MODULE: ./node_modules/codemirror/lib/codemirror.css
|
|
|
var lib_codemirror = __webpack_require__(71749);
|
|
|
// EXTERNAL MODULE: ./node_modules/codemirror/addon/edit/closetag.js
|
|
|
var closetag = __webpack_require__(57341);
|
|
|
// EXTERNAL MODULE: ./node_modules/codemirror/addon/edit/closebrackets.js
|
|
|
var closebrackets = __webpack_require__(82801);
|
|
|
// EXTERNAL MODULE: ./node_modules/codemirror/addon/display/placeholder.js
|
|
|
var placeholder = __webpack_require__(88386);
|
|
|
// EXTERNAL MODULE: ./node_modules/codemirror/mode/markdown/markdown.js
|
|
|
var markdown = __webpack_require__(49047);
|
|
|
// EXTERNAL MODULE: ./node_modules/codemirror/mode/stex/stex.js
|
|
|
var stex = __webpack_require__(80785);
|
|
|
;// 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__(12768);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
|
;// 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.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/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(42122);
|
|
|
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,
|
|
|
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",
|
|
|
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, 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 components_modal = __webpack_require__(12264);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/button/style/index.js + 1 modules
|
|
|
var button_style = __webpack_require__(29913);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(71577);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/form/style/index.js + 1 modules
|
|
|
var form_style = __webpack_require__(75627);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/form/index.js + 17 modules
|
|
|
var es_form = __webpack_require__(51018);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input/style/index.js + 1 modules
|
|
|
var input_style = __webpack_require__(69463);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input/index.js + 5 modules
|
|
|
var input = __webpack_require__(75008);
|
|
|
;// 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.Item */.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.Item */.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 */.Z, {
|
|
|
type: "primary",
|
|
|
htmlType: "submit",
|
|
|
style: {
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: "\u786E\u5B9A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
type: "ghost",
|
|
|
onClick: onCancel,
|
|
|
children: "\u53D6\u6D88"
|
|
|
})]
|
|
|
})]
|
|
|
}));
|
|
|
});
|
|
|
// EXTERNAL MODULE: ./src/components/markdown-editor/code-block/index.tsx
|
|
|
var code_block = __webpack_require__(97501);
|
|
|
;// 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__(96403);
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/upload-image/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var useForm = es_form/* default.useForm */.Z.useForm;
|
|
|
var upload_image_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];
|
|
|
function onSubmit(values) {
|
|
|
callback(values);
|
|
|
}
|
|
|
function onAddUrl(data, file) {
|
|
|
if (data.status === -1) {
|
|
|
message/* default.error */.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];
|
|
|
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,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.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.Item */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: "src",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入图片地址'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
style: upload_image_style
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(UploadButton, {
|
|
|
onFileChange: onFileChange
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.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.Item */.Z.Item, {
|
|
|
style: {
|
|
|
textAlign: "right"
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
type: "primary",
|
|
|
htmlType: "submit",
|
|
|
style: {
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: "\u786E\u5B9A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
type: "ghost",
|
|
|
onClick: onCancel,
|
|
|
children: "\u53D6\u6D88"
|
|
|
})]
|
|
|
})]
|
|
|
}));
|
|
|
});
|
|
|
function UploadButton(_ref2) {
|
|
|
var onFileChange = _ref2.onFileChange;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
|
|
|
className: "upload-button",
|
|
|
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/es/input-number/style/index.js + 1 modules
|
|
|
var input_number_style = __webpack_require__(25359);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input-number/index.js + 9 modules
|
|
|
var input_number = __webpack_require__(87799);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/radio/style/index.js + 1 modules
|
|
|
var radio_style = __webpack_require__(83822);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/radio/index.js + 4 modules
|
|
|
var es_radio = __webpack_require__(29924);
|
|
|
;// 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.Item */.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.Item */.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.Item */.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 */.Z, {
|
|
|
type: "primary",
|
|
|
htmlType: "submit",
|
|
|
style: {
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: "\u786E\u5B9A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
type: "ghost",
|
|
|
onClick: onCancel,
|
|
|
children: "\u53D6\u6D88"
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
|
var env = __webpack_require__(59758);
|
|
|
;// 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__(61891);
|
|
|
;// CONCATENATED MODULE: ./src/components/markdown-editor/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _DEFAULTKEYMAP, _TitleDesc;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function noop() {}
|
|
|
var pending = 0;
|
|
|
var StorageTimeTicket = 10000;
|
|
|
var NULL_CH = '▁';
|
|
|
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 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$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$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.useState)(null),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
cm = _useState2[0],
|
|
|
setCm = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)(defaultValue),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
value = _useState4[0],
|
|
|
setValue = _useState4[1];
|
|
|
var _useState5 = (0,react.useState)(watch),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
preview = _useState6[0],
|
|
|
setPreview = _useState6[1];
|
|
|
var _useState7 = (0,react.useState)(fullScreen),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
isFull = _useState8[0],
|
|
|
setIsFull = _useState8[1];
|
|
|
var _useState9 = (0,react.useState)(''),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
action = _useState10[0],
|
|
|
setAction = _useState10[1];
|
|
|
var _useState11 = (0,react.useState)(0),
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
lastedUpdateTime = _useState12[0],
|
|
|
setLastedUpdateTime = _useState12[1];
|
|
|
var _useState13 = (0,react.useState)(height),
|
|
|
_useState14 = slicedToArray_default()(_useState13, 2),
|
|
|
h = _useState14[0],
|
|
|
setH = _useState14[1];
|
|
|
var _useState15 = (0,react.useState)(false),
|
|
|
_useState16 = slicedToArray_default()(_useState15, 2),
|
|
|
tip = _useState16[0],
|
|
|
setTip = _useState16[1];
|
|
|
var cmEl = (0,react.useRef)();
|
|
|
var containerEl = (0,react.useRef)();
|
|
|
var resizeBarEl = (0,react.useRef)();
|
|
|
var previewEl = (0,react.useRef)();
|
|
|
|
|
|
// useEffect(() => {
|
|
|
// setValue(defaultValue)
|
|
|
// cm?.setValue(defaultValue)
|
|
|
// },[])
|
|
|
(0,react.useEffect)(function () {
|
|
|
setValue(values);
|
|
|
cm === null || cm === void 0 ? void 0 : cm.setValue(values);
|
|
|
}, [values]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
onFullScreen === null || onFullScreen === void 0 ? void 0 : onFullScreen(isFull);
|
|
|
}, [isFull]);
|
|
|
(0,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;
|
|
|
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"];
|
|
|
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 ? 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 ? 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.API_SERVER */.Z.API_SERVER, "/api/attachments/").concat(data.id, "\"></video>"));
|
|
|
} else if ((file === null || file === void 0 ? 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.API_SERVER */.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.API_SERVER */.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.API_SERVER */.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.warn */.ZP.warn("请使用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
|
|
|
});
|
|
|
isFocus && instance.focus();
|
|
|
instance.on('paste', onPaste);
|
|
|
setCm(instance);
|
|
|
return function () {
|
|
|
instance.off('paste', onPaste);
|
|
|
};
|
|
|
}
|
|
|
}, []);
|
|
|
var resizeEditorBodyHeight = (0,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.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.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
var keymap = [];
|
|
|
var _loop = function _loop() {
|
|
|
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++) {
|
|
|
_loop();
|
|
|
}
|
|
|
return function () {
|
|
|
for (var _i2 = 0, _keymap = keymap; _i2 < _keymap.length; _i2++) {
|
|
|
var m = _keymap[_i2];
|
|
|
cm.removeKeyMap(m);
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
}, [cm]);
|
|
|
(0,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.useEffect)(function () {
|
|
|
setPreview(watch);
|
|
|
}, [cm, watch]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
isFocus && cm.focus();
|
|
|
}
|
|
|
}, [cm, isFocus]);
|
|
|
(0,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.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.useEffect)(function () {
|
|
|
if (cm && onBlur) {
|
|
|
var onBlurHandler = function onBlurHandler() {
|
|
|
onBlur(cm.getValue());
|
|
|
};
|
|
|
cm.on('blur', onBlurHandler);
|
|
|
return function () {
|
|
|
cm.off('blur', onBlurHandler);
|
|
|
};
|
|
|
}
|
|
|
}, [cm, onBlur]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
var onChangeHandler = function onChangeHandler(cm) {
|
|
|
var content = cm.getValue();
|
|
|
setValue(content);
|
|
|
setLastedUpdateTime(new Date().getTime());
|
|
|
cm.getScrollerElement().dispatchEvent(new CustomEvent('scroll'));
|
|
|
onChange && onChange(content);
|
|
|
};
|
|
|
cm.on('change', onChangeHandler);
|
|
|
return function () {
|
|
|
cm.off('change', onChangeHandler);
|
|
|
};
|
|
|
}
|
|
|
}, [cm, onChange]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
if (cm) {
|
|
|
// isFocus && cm.focus()
|
|
|
if (defaultValue === null || defaultValue === undefined) {
|
|
|
cm.setValue('');
|
|
|
setValue('');
|
|
|
} else {
|
|
|
if (defaultValue !== cm.getValue()) {
|
|
|
cm.setValue(defaultValue);
|
|
|
setValue(defaultValue);
|
|
|
cm.setCursor(cm.lineCount(), 0);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, [cm, defaultValue]);
|
|
|
var onActionCallback = (0,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 '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.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.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.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.useEffect)(function () {
|
|
|
setH(height);
|
|
|
}, [height]);
|
|
|
var fixedWidth = processSize(width);
|
|
|
var fixedHeight = processSize(h);
|
|
|
var style = {
|
|
|
width: fixedWidth,
|
|
|
height: fixedHeight
|
|
|
};
|
|
|
var saveTime = (0,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]);
|
|
|
function onCancelStorage() {
|
|
|
window.sessionStorage.removeItem(id);
|
|
|
setTip(false);
|
|
|
setLastedUpdateTime(0);
|
|
|
}
|
|
|
function onReset() {
|
|
|
setTip(false);
|
|
|
setLastedUpdateTime(0);
|
|
|
cm.setValue(window.sessionStorage.getItem(id));
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(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,
|
|
|
onActionCallback: onActionCallback,
|
|
|
hidetoolBar: hidetoolBar
|
|
|
}), /*#__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, {
|
|
|
value: value
|
|
|
})]
|
|
|
}) : null]
|
|
|
})]
|
|
|
})
|
|
|
}), showResizeBar ? /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
ref: resizeBarEl,
|
|
|
className: "editor-resize"
|
|
|
}) : null, /*#__PURE__*/(0,jsx_runtime.jsx)(components_modal/* default */.Z, {
|
|
|
children: TitleDesc[action] ? /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
centered: true,
|
|
|
title: TitleDesc[action],
|
|
|
open: true,
|
|
|
onCancel: onCancel,
|
|
|
footer: null,
|
|
|
className: "markdown-popup-form",
|
|
|
children: PluginEl
|
|
|
}) : null
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 12264:
|
|
|
/*!**********************************!*\
|
|
|
!*** ./src/components/modal.tsx ***!
|
|
|
\**********************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ "Z": function() { return /* binding */ Dialog; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/classCallCheck.js */ 56690);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/createClass.js */ 89728);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/inherits.js */ 61655);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/createSuper.js */ 26389);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ 67294);
|
|
|
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react-dom */ 73935);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Dialog = /*#__PURE__*/function (_React$Component) {
|
|
|
_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_2___default()(Dialog, _React$Component);
|
|
|
var _super = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_3___default()(Dialog);
|
|
|
function Dialog(props) {
|
|
|
var _this;
|
|
|
_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0___default()(this, Dialog);
|
|
|
_this = _super.call(this, props);
|
|
|
var doc = window.document;
|
|
|
_this.node = doc.createElement('div');
|
|
|
doc.body.appendChild(_this.node);
|
|
|
return _this;
|
|
|
}
|
|
|
_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_1___default()(Dialog, [{
|
|
|
key: "render",
|
|
|
value: function render() {
|
|
|
var children = this.props.children;
|
|
|
return /*#__PURE__*/(0,react_dom__WEBPACK_IMPORTED_MODULE_5__.createPortal)(children, this.node);
|
|
|
}
|
|
|
}, {
|
|
|
key: "componentWillUnmount",
|
|
|
value: function componentWillUnmount() {
|
|
|
window.document.body.removeChild(this.node);
|
|
|
}
|
|
|
}]);
|
|
|
return Dialog;
|
|
|
}(react__WEBPACK_IMPORTED_MODULE_4__.Component);
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 61891:
|
|
|
/*!****************************************!*\
|
|
|
!*** ./src/components/useInterval.tsx ***!
|
|
|
\****************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ "Z": function() { return /* binding */ useInterval; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 67294);
|
|
|
|
|
|
function useInterval(callback, delay) {
|
|
|
var savedCallback = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
|
|
|
|
// 保存新回调
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
|
savedCallback.current = callback;
|
|
|
});
|
|
|
|
|
|
// 建立 interval
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
|
function tick() {
|
|
|
savedCallback.current();
|
|
|
}
|
|
|
if (delay !== null) {
|
|
|
var id = setInterval(tick, delay);
|
|
|
return function () {
|
|
|
return clearInterval(id);
|
|
|
};
|
|
|
}
|
|
|
}, [delay]);
|
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 92170:
|
|
|
/*!******************************************************************************************!*\
|
|
|
!*** ./src/pages/Classrooms/Lists/Exercise/Export/components/Head/index.tsx + 5 modules ***!
|
|
|
\******************************************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"Z": function() { return /* binding */ components_Head; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/table/style/index.js + 1 modules
|
|
|
var style = __webpack_require__(71854);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/table/index.js + 58 modules
|
|
|
var table = __webpack_require__(67250);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/row/style/index.js
|
|
|
var row_style = __webpack_require__(13062);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/row/index.js
|
|
|
var row = __webpack_require__(71230);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/button/style/index.js + 1 modules
|
|
|
var button_style = __webpack_require__(29913);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(71577);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js
|
|
|
var regeneratorRuntime = __webpack_require__(17061);
|
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/asyncToGenerator.js
|
|
|
var asyncToGenerator = __webpack_require__(17156);
|
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/toConsumableArray.js
|
|
|
var toConsumableArray = __webpack_require__(861);
|
|
|
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(42122);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(27424);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
|
var react = __webpack_require__(67294);
|
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 8 modules
|
|
|
var _umi_production_exports = __webpack_require__(89214);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/SettingOutlined.js + 1 modules
|
|
|
var SettingOutlined = __webpack_require__(42952);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Export/components/Head/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var Headmodules = ({"wrap":"wrap___SSpd0","img":"img___nbd2O","table":"table___fcP71","totalScore":"totalScore___YxSMe","people":"people___bf9pK","glassSeal":"glassSeal___dYhKO","paperHeader":"paperHeader___gYUbq","exportBtn":"exportBtn___nyRYQ"});
|
|
|
// EXTERNAL MODULE: ./src/service/exercise.ts
|
|
|
var service_exercise = __webpack_require__(51412);
|
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules
|
|
|
var RenderHtml = __webpack_require__(12768);
|
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
|
var util = __webpack_require__(29427);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/modal/style/index.js + 1 modules
|
|
|
var modal_style = __webpack_require__(35611);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/modal/index.js + 7 modules
|
|
|
var modal = __webpack_require__(85402);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/spin/style/index.js + 1 modules
|
|
|
var spin_style = __webpack_require__(22536);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/spin/index.js
|
|
|
var spin = __webpack_require__(11382);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input-number/style/index.js + 1 modules
|
|
|
var input_number_style = __webpack_require__(25359);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input-number/index.js + 9 modules
|
|
|
var input_number = __webpack_require__(87799);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/col/style/index.js
|
|
|
var col_style = __webpack_require__(89032);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/col/index.js
|
|
|
var col = __webpack_require__(15746);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/checkbox/style/index.js + 1 modules
|
|
|
var checkbox_style = __webpack_require__(82000);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/checkbox/index.js + 2 modules
|
|
|
var es_checkbox = __webpack_require__(32808);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/upload/style/index.js + 1 modules
|
|
|
var upload_style = __webpack_require__(13759);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/upload/index.js + 20 modules
|
|
|
var upload = __webpack_require__(7426);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/message/style/index.js + 1 modules
|
|
|
var message_style = __webpack_require__(14934);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/message/index.js + 1 modules
|
|
|
var message = __webpack_require__(12461);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input/style/index.js + 1 modules
|
|
|
var input_style = __webpack_require__(69463);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input/index.js + 5 modules
|
|
|
var input = __webpack_require__(75008);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/PlusOutlined.js
|
|
|
var PlusOutlined = __webpack_require__(51042);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Export/components/ExportSetting/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var ExportSettingmodules = ({"modalWrapper":"modalWrapper___rWDvO","exportSettingWrapper":"exportSettingWrapper___pCClH","imgPreviewPart":"imgPreviewPart___PCv0Y","tips":"tips___EVeBl","pottedLine":"pottedLine___AaY68","text":"text___ho3u_"});
|
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
|
var fetch = __webpack_require__(84519);
|
|
|
// EXTERNAL MODULE: ./src/components/ImagesIcon/index.ts + 31 modules
|
|
|
var ImagesIcon = __webpack_require__(44190);
|
|
|
// EXTERNAL MODULE: ./src/components/mediator.js
|
|
|
var mediator = __webpack_require__(91562);
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
|
var env = __webpack_require__(59758);
|
|
|
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 10 modules
|
|
|
var markdown_editor = __webpack_require__(55373);
|
|
|
// EXTERNAL MODULE: ./src/components/image-preview/index.tsx + 1 modules
|
|
|
var image_preview = __webpack_require__(75490);
|
|
|
;// CONCATENATED MODULE: ./src/assets/images/classrooms/halfDottedLine.png
|
|
|
var halfDottedLine_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAAAECAYAAADLcnBRAAAAAXNSR0IArs4c6QAAAcNJREFUSEvtlT1oFFEURs+dndmAqGBAMCAoKAqChT+lYGER6xQLlsGdXWMQFETbtREhjQgmuxmLdJIEi1SxCdjYRpCQbkEhoihioYjMneyVCDtMCuG+fqedc9437775ZoTRNZrAaAL/nYDs3bFZTmjB0dA5Jbt8kRfseD2b4YgOOOXlh1wCv6XHttezFWq6wQUvX+WSa7yTBrte19qcUzjg5cs9RfRlgR9ez5oc1xrHvHyZE/NNnvPR69kdDmvOGS9f5gh/pMtWiJe3uRzCl1kTvJcOude1Gc7qgENevswxPvwrSN6kB7RCF5CIuWSRB16vSGkMjGUvX3LCZj3jkteze4zrT757+X0FSRgPeXHzJpsQXsYoohEvsup9Rk2ZM+O+lx9ykdCLM255PU2ZNOO1l6+cUb+ecdrrWYdYd1Avv++MxjgZUnpNeWPG1dCsCJrDgsyKcD10AYFXccaS19MWVzAeevkK108y7no9u83BQnnp5atcnHBD5vnldTXlKYT/FanxJOny1ptTtJm2AVNefsgZrNcz5r2etbhYGI+8fCXncz3zf2StQ1R8Yi00Z4+Pa9yULl+9rqY8Bs57+ZKLePYXdsiA6BdYLZkAAAAASUVORK5CYII=";
|
|
|
;// CONCATENATED MODULE: ./src/assets/images/classrooms/dottedLine.png
|
|
|
var dottedLine_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAn4AAAAECAYAAAAQ9jLuAAAAAXNSR0IArs4c6QAABLVJREFUaEPtmVuIVVUYgL+1z17H0S6kliWaJdlVS7pQBHajoLAMKpjo8hKdfc7MiNmoaA8Fx4IIjMzIuZx9sijLrkRGGURQdHkJjSy7G2bqWHaTKbO99pw/ztRs9rz9ax58qHPeDnzf+tf6/7XWXmtvQ+vXykArA60MtDLQykArA60MtDLwv8iAaY5SFnKCSznGd8R2iL2mzi6tJ51MdA1O0vIjnIUDpp/PtJ48T8G9xdlaPs/Zy/nItDOkdaXCGQ4maPlsTAHbTS+/aj0pMd0VOE7LZ3FC9pm1fKf1ZBFHuoRTtHwWx3DQ9PGpj5dUOM+Hz2JNZaupkmhd6eRU1+AILZ/FEXaYGj9pPSkz1RmmafncXPjF9PKt1pNlHOYGOV3L59aRM/187ONJmXOcIfBxmqydwDazmj+1nnQxyw1xlJbPxtTG92YNP2g96WCKE2Zo+SxOgd9MD99oPanS5gaYo+Vzc65hamzx8aTCXAfWxxmuUYEvTA+/az0pMdMVmKzlszFZ9phH2dP8P+Y6G3aaPn7Uxj5kde5mvDvAbG2//tN1FnabGgPaXMhCJruUmVo+t18Oml6+1HpSpegGOEvL5znbx2ZjEK0rHcxxQpuWz82Hr02N/VpPysxwhilaPovz75lt+OCXlOgHyr6NmIBVtsZyrZdGtDeE57R8xhm2FGPO1XrSzSQ3yM9aflShLZN8DmRJaXiT9j5kBgHtYY0XtH10EatEWKblR7jA0B/GdGg9F3GlCG9o+VyNthdjZmk9qRK6XTgtP6pG4zjR5zDrIt4W4RLfWAGUwjqPaT0XcbcI92n5XO42FGNu1nquwoUyxAdafoQzsM/W/TYLF/GHyBguNpa5ppet2j66EhsFFmj5jAtYUqyxWuslZe6gwRotn8vd67bO1VpPImY78bsINds2hr9s7PfgcCUGBP9LoQm4yNZ4TzumpMRTwK1aPstdwEpbo9r87yJeFeEa3zaA7mKdh7VeErEY0fNZXw2v2Vjfv+EHfcon2n7l5tNBW2e8j+dK7BU41scZnlMh82wf72u9JGI9wi1aPjemqq2zUuulFW5rDLFOy+dq9K6NuVjrSRfHu4SdWj7P2emM83nJkER8hXCyb6zAMD+M2aT10hI9DejU8rncPWRjlo4c/BYaw1XejcBLYcwTWs+VmYewQsvnuO025k6tJ10cnjo2aPk8F1pu8rkFu2h4c/F+i0mBB3wWY3ORSIPrfccksKkY06P1mm94UtEv3pF2BQaKsf7yIFWCdDevaPs1qkYFbve5/buI+4EzvWMFPGL7eVPrpRVulIb/gxF4x8Y8qI0jZU5LhVVaPlej/cXYr38u4kVgnG+ssMAi08cOrdc8NAMXaPlsIxPqYV0/j9IKC6Shn6e5/nxoY+7V9q95I0+FtVo+xzkb+63zJOJJAxN9Y4UBK3y+pLiIJcBlvnGM8ExY/2c/dmXuQTjfuw2Iw5iNWi+NuFYg0vKHvM5CYuvc4NO/MdfZstz08Lk2liuzFOFSLZ+tRXg6jHlW67mIK4DFWj7HbbMxd2k9KXN0Kjyu5Uc9a6ZxnamSat00ok/w/+ojQrVYZ7M2TlKm0wjztXyuRi+HMev+Bu2qoBRawxtVAAAAAElFTkSuQmCC";
|
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Export/components/ExportSetting/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TextArea = input/* default.TextArea */.Z.TextArea;
|
|
|
var ExportSetting = function ExportSetting(_ref) {
|
|
|
var _data$file_list;
|
|
|
var exercise = _ref.exercise,
|
|
|
loading = _ref.loading,
|
|
|
dispatch = _ref.dispatch;
|
|
|
var workSetting = exercise.workSetting;
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
params.category = params.categoryId || params.exerciseId;
|
|
|
params.categoryId = params.categoryId || params.exerciseId;
|
|
|
var _useState = (0,react.useState)(false),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
disabled = _useState2[0],
|
|
|
setDisabled = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)(false),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
pageLoading = _useState4[0],
|
|
|
setPageLoading = _useState4[1];
|
|
|
var _useState5 = (0,react.useState)({
|
|
|
file_list: [],
|
|
|
attachment_id: '',
|
|
|
//卷头左角标附件id
|
|
|
show_title: false,
|
|
|
//展示试卷标题
|
|
|
show_body: false,
|
|
|
//展示考试内容
|
|
|
show_info: false,
|
|
|
//展示题量、分值、考试时长
|
|
|
show_table: false,
|
|
|
//展示得分、评分表格
|
|
|
show_user: false,
|
|
|
//密封线区域设置姓名
|
|
|
show_no: false,
|
|
|
//密封线区域设置学号
|
|
|
show_group: false,
|
|
|
//密封线区域设置专业班级
|
|
|
show_phone: false,
|
|
|
//密封线区域设置手机号
|
|
|
show_school_name: false,
|
|
|
//密封区域设置学校/单位
|
|
|
export_page_num: 40,
|
|
|
//每页导出最大试题数
|
|
|
show_desc: false,
|
|
|
//考试说明选择框
|
|
|
description: '' // 考试说明内容
|
|
|
}),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
data = _useState6[0],
|
|
|
setData = _useState6[1];
|
|
|
(0,react.useEffect)(function () {
|
|
|
setDefaultData();
|
|
|
}, [workSetting]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
dispatch({
|
|
|
type: 'exercise/getWorkSetting',
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
}, []);
|
|
|
var setDefaultData = function setDefaultData() {
|
|
|
var _res$exercise_header2, _res$exercise_header3, _res$exercise_header4, _res$exercise_header5;
|
|
|
var res = JSON.parse(JSON.stringify(workSetting));
|
|
|
Object.keys(data).forEach(function (item) {
|
|
|
var _res$exercise_header;
|
|
|
data[item] = res === null || res === void 0 ? void 0 : (_res$exercise_header = res['exercise_header']) === null || _res$exercise_header === void 0 ? void 0 : _res$exercise_header[item];
|
|
|
});
|
|
|
data.file_list = res !== null && res !== void 0 && (_res$exercise_header2 = res['exercise_header']) !== null && _res$exercise_header2 !== void 0 && _res$exercise_header2.attachment_id ? [{
|
|
|
uid: res === null || res === void 0 ? void 0 : (_res$exercise_header3 = res['exercise_header']) === null || _res$exercise_header3 === void 0 ? void 0 : _res$exercise_header3.attachment_id,
|
|
|
id: res === null || res === void 0 ? void 0 : (_res$exercise_header4 = res['exercise_header']) === null || _res$exercise_header4 === void 0 ? void 0 : _res$exercise_header4.attachment_id,
|
|
|
url: res === null || res === void 0 ? void 0 : (_res$exercise_header5 = res['exercise_header']) === null || _res$exercise_header5 === void 0 ? void 0 : _res$exercise_header5.photo_url
|
|
|
}] : [];
|
|
|
setData(data);
|
|
|
};
|
|
|
var handleSubmit = function handleSubmit() {
|
|
|
var _bodyData$file_list, _bodyData$file_list$, _bodyData$file_list$$;
|
|
|
var bodyData = JSON.parse(JSON.stringify(data));
|
|
|
bodyData.categoryId = params.categoryId;
|
|
|
bodyData.attachment_id = ((_bodyData$file_list = bodyData.file_list) === null || _bodyData$file_list === void 0 ? void 0 : (_bodyData$file_list$ = _bodyData$file_list[0]) === null || _bodyData$file_list$ === void 0 ? void 0 : (_bodyData$file_list$$ = _bodyData$file_list$.response) === null || _bodyData$file_list$$ === void 0 ? void 0 : _bodyData$file_list$$.id) || null;
|
|
|
handleUpdate(bodyData);
|
|
|
};
|
|
|
var handleUpdate = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(bodyData) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
setPageLoading(true);
|
|
|
_context.next = 3;
|
|
|
return (0,fetch/* default */.ZP)("/api/exercises/".concat(params === null || params === void 0 ? void 0 : params.categoryId, "/foramt_settings.json"), {
|
|
|
method: 'post',
|
|
|
body: bodyData
|
|
|
});
|
|
|
case 3:
|
|
|
res = _context.sent;
|
|
|
if (res.status === 0) {
|
|
|
message/* default.success */.ZP.success('更新成功');
|
|
|
dispatch({
|
|
|
type: 'exercise/getCommonHeader',
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
dispatch({
|
|
|
type: 'exercise/getWorkSetting',
|
|
|
payload: objectSpread2_default()({}, params)
|
|
|
});
|
|
|
dispatch({
|
|
|
type: 'exercise/getExerciseExportHeadData',
|
|
|
payload: {
|
|
|
id: params.exerciseId || params.categoryId,
|
|
|
identify: params.userId || null
|
|
|
}
|
|
|
});
|
|
|
setPageLoading(false);
|
|
|
}
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function handleUpdate(_x) {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var uploadProps = {
|
|
|
disabled: disabled,
|
|
|
multiple: false,
|
|
|
listType: "picture-card",
|
|
|
onPreview: function onPreview(file) {
|
|
|
mediator/* default.publish */.Z.publish('preview-image', file.thumbUrl || file.url);
|
|
|
},
|
|
|
withCredentials: true,
|
|
|
fileList: data.file_list,
|
|
|
beforeUpload: function beforeUpload(file) {
|
|
|
var fileSize = file.size / 1024;
|
|
|
if (fileSize > 200) {
|
|
|
message/* default.error */.ZP.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(200KB),\u5EFA\u8BAE\u4E0A\u4F20\u5230\u767E\u5EA6\u4E91\u7B49\u5176\u5B83\u5171\u4EAB\u5DE5\u5177\u91CC\uFF0C\u7136\u540E\u518Dtxt\u6587\u6863\u91CC\u7ED9\u51FA\u94FE\u63A5\u4EE5\u53CA\u5171\u4EAB\u5BC6\u7801\u5E76\u4E0A\u4F20");
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
|
},
|
|
|
action: "".concat(env/* default.API_SERVER */.Z.API_SERVER, "/api/attachments.json"),
|
|
|
onChange: function onChange(info) {
|
|
|
var fileList = info.fileList.filter(function (file) {
|
|
|
return !!file.status;
|
|
|
});
|
|
|
data.file_list = fileList;
|
|
|
setData(Object.assign({}, data));
|
|
|
},
|
|
|
onRemove: function () {
|
|
|
var _onRemove = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(file) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
data.file_list = [];
|
|
|
setData(Object.assign({}, data));
|
|
|
return _context2.abrupt("return", true);
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
function onRemove(_x2) {
|
|
|
return _onRemove.apply(this, arguments);
|
|
|
}
|
|
|
return onRemove;
|
|
|
}()
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
title: "\u5BFC\u51FA\u8BBE\u7F6E",
|
|
|
className: ExportSettingmodules.modalWrapper,
|
|
|
width: 900,
|
|
|
centered: true,
|
|
|
open: exercise.actionTabs.key === 'exportSetting',
|
|
|
onOk: function onOk() {
|
|
|
return handleSubmit();
|
|
|
},
|
|
|
onCancel: function onCancel() {
|
|
|
setDefaultData();
|
|
|
dispatch({
|
|
|
type: 'exercise/setActionTabs',
|
|
|
payload: {}
|
|
|
});
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: ExportSettingmodules.exportSettingWrapper,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
|
|
|
spinning: loading['exercise/getWorkSetting'] || pageLoading,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
wrap: false,
|
|
|
justify: "space-between",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u5377\u5934\u5DE6\u89D2\u6807"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: ExportSettingmodules.tips,
|
|
|
children: "\u56FE\u7247\u5EFA\u8BAE\u5C3A\u5BF8\uFF1A700px*500px\uFF0C\u5927\u5C0F\u8BF7\u52FF\u8D85\u8FC7200k"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt15",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(upload/* default */.Z, objectSpread2_default()(objectSpread2_default()({}, uploadProps), {}, {
|
|
|
children: !((_data$file_list = data.file_list) !== null && _data$file_list !== void 0 && _data$file_list.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(PlusOutlined/* default */.Z, {}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
marginTop: 8
|
|
|
},
|
|
|
children: "\u4E0A\u4F20"
|
|
|
})]
|
|
|
})
|
|
|
}))
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
span: 24,
|
|
|
className: "mt15",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
checked: data.show_title,
|
|
|
disabled: disabled,
|
|
|
onChange: function onChange(e) {
|
|
|
data.show_title = e.target.checked;
|
|
|
setData(Object.assign({}, data));
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u5C55\u793A\u8BD5\u5377\u6807\u9898"
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
span: 24,
|
|
|
className: "mt15",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
checked: data.show_body,
|
|
|
disabled: disabled,
|
|
|
onChange: function onChange(e) {
|
|
|
data.show_body = e.target.checked;
|
|
|
setData(Object.assign({}, data));
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u5C55\u793A\u8003\u8BD5\u5185\u5BB9\uFF08\u5373\u672C\u8BD5\u5377\u6240\u5C5E\u8BFE\u7A0B\u540D\u79F0\uFF09"
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
span: 24,
|
|
|
className: "mt15",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
checked: data.show_info,
|
|
|
disabled: disabled,
|
|
|
onChange: function onChange(e) {
|
|
|
data.show_info = e.target.checked;
|
|
|
setData(Object.assign({}, data));
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u5C55\u793A\u9898\u91CF\u3001\u5206\u503C\u3001\u8003\u8BD5\u65F6\u957F"
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
span: 24,
|
|
|
className: "mt15",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
checked: data.show_table,
|
|
|
disabled: disabled,
|
|
|
onChange: function onChange(e) {
|
|
|
data.show_table = e.target.checked;
|
|
|
setData(Object.assign({}, data));
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u5C55\u793A\u5F97\u5206\u3001\u8BC4\u5206\u8868\u683C"
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
className: "mt20 ".concat(ExportSettingmodules.pottedLine),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: halfDottedLine_namespaceObject,
|
|
|
alt: ""
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
className: ExportSettingmodules.text,
|
|
|
children: "\u5BC6\u5C01\u7EBF\u533A\u57DF\u8BBE\u7F6E"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: halfDottedLine_namespaceObject,
|
|
|
alt: ""
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: "mt15",
|
|
|
justify: "center",
|
|
|
style: {
|
|
|
width: 320
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
className: "pl8",
|
|
|
checked: data.show_user,
|
|
|
disabled: disabled,
|
|
|
onChange: function onChange(e) {
|
|
|
data.show_user = e.target.checked;
|
|
|
setData(Object.assign({}, data));
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u59D3\u540D"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
checked: data.show_no,
|
|
|
disabled: disabled,
|
|
|
onChange: function onChange(e) {
|
|
|
data.show_no = e.target.checked;
|
|
|
setData(Object.assign({}, data));
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u5B66\u53F7"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
checked: data.show_group,
|
|
|
disabled: disabled,
|
|
|
onChange: function onChange(e) {
|
|
|
data.show_group = e.target.checked;
|
|
|
setData(Object.assign({}, data));
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u4E13\u4E1A\u73ED\u7EA7"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
checked: data.show_school_name,
|
|
|
disabled: disabled,
|
|
|
onChange: function onChange(e) {
|
|
|
data.show_school_name = e.target.checked;
|
|
|
setData(Object.assign({}, data));
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u5B66\u6821/\u5355\u4F4D"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
checked: data.show_phone,
|
|
|
disabled: disabled,
|
|
|
onChange: function onChange(e) {
|
|
|
data.show_phone = e.target.checked;
|
|
|
setData(Object.assign({}, data));
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u624B\u673A\u53F7"
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: dottedLine_namespaceObject,
|
|
|
alt: "",
|
|
|
className: "mt15",
|
|
|
style: {
|
|
|
width: 320
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
span: 24,
|
|
|
className: "mt15",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u6BCF\u9875\u5BFC\u51FA\u6700\u5927\u8BD5\u9898\u6570\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
size: "large",
|
|
|
min: 1,
|
|
|
value: !data.export_page_num ? 40 : data.export_page_num,
|
|
|
onChange: function onChange(value) {
|
|
|
data.export_page_num = value;
|
|
|
setData(objectSpread2_default()({}, data));
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "ml10",
|
|
|
children: "\u9898"
|
|
|
})]
|
|
|
})
|
|
|
|
|
|
// <Col span={24} className="mt15 pl30">
|
|
|
// <Checkbox
|
|
|
// checked={data.export_page_num}
|
|
|
// disabled={disabled}
|
|
|
// onChange={e => {
|
|
|
// data.export_page_num = e.target.checked
|
|
|
// setData(Object.assign({}, data))
|
|
|
// }}
|
|
|
// >
|
|
|
// <div>每页导出题目数</div>
|
|
|
// </Checkbox>
|
|
|
// </Col>
|
|
|
, /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
|
|
|
className: "mt15",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
checked: data.show_desc,
|
|
|
disabled: disabled,
|
|
|
onChange: function onChange(e) {
|
|
|
data.show_desc = e.target.checked;
|
|
|
setData(Object.assign({}, data));
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u8003\u8BD5\u8BF4\u660E"
|
|
|
})
|
|
|
})
|
|
|
}), data.show_desc && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt15",
|
|
|
children:
|
|
|
/*#__PURE__*/
|
|
|
// disabled ?
|
|
|
// <TextArea style={{ height: 150, width: 550 }} disabled value={data.description} /> :
|
|
|
(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
width: 550,
|
|
|
height: 100,
|
|
|
defaultValue: data.description,
|
|
|
id: "exercise-detail-config-exam-description-id",
|
|
|
onChange: function onChange(value) {
|
|
|
data.description = value;
|
|
|
setData(Object.assign({}, data));
|
|
|
}
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
className: ExportSettingmodules.imgPreviewPart,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "pb10",
|
|
|
children: "\u793A\u4F8B\u56FE\u7247\u9884\u89C8\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: ImagesIcon/* exportExerciseTemplate */.qz
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(image_preview/* default */.Z, {})]
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_ExportSetting = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
|
var exercise = _ref3.exercise,
|
|
|
loading = _ref3.loading,
|
|
|
globalSetting = _ref3.globalSetting;
|
|
|
return {
|
|
|
exercise: exercise,
|
|
|
loading: loading.effects,
|
|
|
globalSetting: globalSetting
|
|
|
};
|
|
|
})(ExportSetting));
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Export/components/Head/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Head = function Head(_ref) {
|
|
|
var _exercise$exerciseExp2, _exercise$commonHeade, _exercise$exerciseExp3, _exercise$commonHeade2;
|
|
|
var _ref$isPreview = _ref.isPreview,
|
|
|
isPreview = _ref$isPreview === void 0 ? false : _ref$isPreview,
|
|
|
_ref$isExportBlank = _ref.isExportBlank,
|
|
|
isExportBlank = _ref$isExportBlank === void 0 ? false : _ref$isExportBlank,
|
|
|
activeTabs = _ref.activeTabs,
|
|
|
exercise = _ref.exercise,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
user = _ref.user,
|
|
|
dispatch = _ref.dispatch,
|
|
|
_ref$showExportBtn = _ref.showExportBtn,
|
|
|
showExportBtn = _ref$showExportBtn === void 0 ? false : _ref$showExportBtn;
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var userInfo = user.userInfo;
|
|
|
var _useState = (0,react.useState)(),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
headData = _useState2[0],
|
|
|
setHeadData = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)(),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
tableData = _useState4[0],
|
|
|
setTableData = _useState4[1];
|
|
|
var leftheight = (0,react.useRef)(null);
|
|
|
var _useState5 = (0,react.useState)(21),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
leftheights = _useState6[0],
|
|
|
setleftheights = _useState6[1];
|
|
|
(0,react.useEffect)(function () {
|
|
|
if ((0,util/* isUnOrNull */.W)(activeTabs)) {
|
|
|
// getData();
|
|
|
} else {
|
|
|
// 兼容试卷预览tab 切换重新获取数据
|
|
|
activeTabs === "2" && getData();
|
|
|
}
|
|
|
}, [params.userId, params.coursesId, params.exerciseId, params.categoryId, activeTabs]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
if (leftheight.current) {
|
|
|
setleftheights(leftheight.current.clientHeight);
|
|
|
}
|
|
|
}, [leftheight.current]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
var _exercise$exerciseExp;
|
|
|
if ((_exercise$exerciseExp = exercise.exerciseExportHeadData) !== null && _exercise$exerciseExp !== void 0 && _exercise$exerciseExp.title) {
|
|
|
var res = exercise.exerciseExportHeadData;
|
|
|
setHeadData(objectSpread2_default()({}, res || {}));
|
|
|
var _ref2 = res || {},
|
|
|
table = _ref2.table;
|
|
|
var total_score;
|
|
|
var actual_total_score;
|
|
|
if (table !== null && table !== void 0 && table.total_singles_scores || table !== null && table !== void 0 && table.total_doubles_scores || table !== null && table !== void 0 && table.total_nulls_scores || table !== null && table !== void 0 && table.total_judges_scores || table !== null && table !== void 0 && table.total_pros_scores || table !== null && table !== void 0 && table.total_shixuns_scores || table !== null && table !== void 0 && table.total_mains_scores || table !== null && table !== void 0 && table.total_combination_scores) {
|
|
|
total_score = Number(table === null || table === void 0 ? void 0 : table.total_singles_scores) + Number(table === null || table === void 0 ? void 0 : table.total_doubles_scores) + Number(table === null || table === void 0 ? void 0 : table.total_nulls_scores) + Number(table === null || table === void 0 ? void 0 : table.total_judges_scores) + Number(table === null || table === void 0 ? void 0 : table.total_pros_scores) + Number(table === null || table === void 0 ? void 0 : table.total_shixuns_scores) + Number(table === null || table === void 0 ? void 0 : table.total_mains_scores) + Number(table === null || table === void 0 ? void 0 : table.total_combination_scores);
|
|
|
}
|
|
|
if (table !== null && table !== void 0 && table.singles_scores || table !== null && table !== void 0 && table.doubles_scores || table !== null && table !== void 0 && table.nulls_scores || table !== null && table !== void 0 && table.judges_scores || table !== null && table !== void 0 && table.pros_scores || table !== null && table !== void 0 && table.shixuns_scores || table !== null && table !== void 0 && table.mains_scores || table !== null && table !== void 0 && table.combination_scores) {
|
|
|
actual_total_score = Number(table === null || table === void 0 ? void 0 : table.singles_scores) + Number(table === null || table === void 0 ? void 0 : table.doubles_scores) + Number(table === null || table === void 0 ? void 0 : table.nulls_scores) + Number(table === null || table === void 0 ? void 0 : table.judges_scores) + Number(table === null || table === void 0 ? void 0 : table.pros_scores) + Number(table === null || table === void 0 ? void 0 : table.shixuns_scores) + Number(table === null || table === void 0 ? void 0 : table.mains_scores) + Number(table === null || table === void 0 ? void 0 : table.combination_scores);
|
|
|
}
|
|
|
var data = [{
|
|
|
key: '1',
|
|
|
name: '应得分',
|
|
|
singles_score: table === null || table === void 0 ? void 0 : table.total_singles_scores,
|
|
|
doubles_score: table === null || table === void 0 ? void 0 : table.total_doubles_scores,
|
|
|
nulls_score: table === null || table === void 0 ? void 0 : table.total_nulls_scores,
|
|
|
judges_score: table === null || table === void 0 ? void 0 : table.total_judges_scores,
|
|
|
pros_score: table === null || table === void 0 ? void 0 : table.total_pros_scores,
|
|
|
shixuns_score: table === null || table === void 0 ? void 0 : table.total_shixuns_scores,
|
|
|
mains_score: table === null || table === void 0 ? void 0 : table.total_mains_scores,
|
|
|
total_combination_scores: table === null || table === void 0 ? void 0 : table.total_combination_scores,
|
|
|
total_score: total_score
|
|
|
}, {
|
|
|
key: '2',
|
|
|
name: '实得分',
|
|
|
singles_score: table === null || table === void 0 ? void 0 : table.singles_scores,
|
|
|
doubles_score: table === null || table === void 0 ? void 0 : table.doubles_scores,
|
|
|
nulls_score: table === null || table === void 0 ? void 0 : table.nulls_scores,
|
|
|
judges_score: table === null || table === void 0 ? void 0 : table.judges_scores,
|
|
|
pros_score: table === null || table === void 0 ? void 0 : table.pros_scores,
|
|
|
shixuns_score: table === null || table === void 0 ? void 0 : table.shixuns_scores,
|
|
|
mains_score: table === null || table === void 0 ? void 0 : table.mains_scores,
|
|
|
total_combination_scores: table === null || table === void 0 ? void 0 : table.combination_scores,
|
|
|
total_score: actual_total_score
|
|
|
}, {
|
|
|
key: '3',
|
|
|
name: '评卷人'
|
|
|
}];
|
|
|
var blankData = [{
|
|
|
key: '1',
|
|
|
name: '应得分',
|
|
|
singles_score: table === null || table === void 0 ? void 0 : table.total_singles_scores,
|
|
|
doubles_score: table === null || table === void 0 ? void 0 : table.total_doubles_scores,
|
|
|
nulls_score: table === null || table === void 0 ? void 0 : table.total_nulls_scores,
|
|
|
judges_score: table === null || table === void 0 ? void 0 : table.total_judges_scores,
|
|
|
pros_score: table === null || table === void 0 ? void 0 : table.total_pros_scores,
|
|
|
shixuns_score: table === null || table === void 0 ? void 0 : table.total_shixuns_scores,
|
|
|
mains_score: table === null || table === void 0 ? void 0 : table.total_mains_scores,
|
|
|
total_combination_scores: table === null || table === void 0 ? void 0 : table.total_combination_scores,
|
|
|
total_score: total_score
|
|
|
}, {
|
|
|
key: '2',
|
|
|
name: '实得分'
|
|
|
}, {
|
|
|
key: '3',
|
|
|
name: '评卷人'
|
|
|
}];
|
|
|
setTableData(toConsumableArray_default()(isExportBlank ? blankData : data));
|
|
|
}
|
|
|
}, [exercise.exerciseExportHeadData]);
|
|
|
var getData = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var query, res, _ref4, table, total_score, actual_total_score, data, blankData;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
query = {
|
|
|
id: params.exerciseId || params.categoryId,
|
|
|
identify: (userInfo === null || userInfo === void 0 ? void 0 : userInfo.login) || null
|
|
|
};
|
|
|
_context.next = 3;
|
|
|
return (0,service_exercise/* getExerciseExportHeadData */.iw)(query);
|
|
|
case 3:
|
|
|
res = _context.sent;
|
|
|
setHeadData(res || {});
|
|
|
_ref4 = res || {}, table = _ref4.table;
|
|
|
if (table !== null && table !== void 0 && table.total_singles_scores || table !== null && table !== void 0 && table.total_doubles_scores || table !== null && table !== void 0 && table.total_nulls_scores || table !== null && table !== void 0 && table.total_judges_scores || table !== null && table !== void 0 && table.total_pros_scores || table !== null && table !== void 0 && table.total_shixuns_scores || table !== null && table !== void 0 && table.total_mains_scores || table !== null && table !== void 0 && table.total_combination_scores) {
|
|
|
total_score = Number(table === null || table === void 0 ? void 0 : table.total_singles_scores) + Number(table === null || table === void 0 ? void 0 : table.total_doubles_scores) + Number(table === null || table === void 0 ? void 0 : table.total_nulls_scores) + Number(table === null || table === void 0 ? void 0 : table.total_judges_scores) + Number(table === null || table === void 0 ? void 0 : table.total_pros_scores) + Number(table === null || table === void 0 ? void 0 : table.total_shixuns_scores) + Number(table === null || table === void 0 ? void 0 : table.total_mains_scores) + Number(table === null || table === void 0 ? void 0 : table.total_combination_scores);
|
|
|
}
|
|
|
if (table !== null && table !== void 0 && table.singles_scores || table !== null && table !== void 0 && table.doubles_scores || table !== null && table !== void 0 && table.nulls_scores || table !== null && table !== void 0 && table.judges_scores || table !== null && table !== void 0 && table.pros_scores || table !== null && table !== void 0 && table.shixuns_scores || table !== null && table !== void 0 && table.mains_scores || table !== null && table !== void 0 && table.combination_scores) {
|
|
|
actual_total_score = Number(table === null || table === void 0 ? void 0 : table.singles_scores) + Number(table === null || table === void 0 ? void 0 : table.doubles_scores) + Number(table === null || table === void 0 ? void 0 : table.nulls_scores) + Number(table === null || table === void 0 ? void 0 : table.judges_scores) + Number(table === null || table === void 0 ? void 0 : table.pros_scores) + Number(table === null || table === void 0 ? void 0 : table.shixuns_scores) + Number(table === null || table === void 0 ? void 0 : table.mains_scores) + Number(table === null || table === void 0 ? void 0 : table.combination_scores);
|
|
|
}
|
|
|
data = [{
|
|
|
key: '1',
|
|
|
name: '应得分',
|
|
|
singles_score: table === null || table === void 0 ? void 0 : table.total_singles_scores,
|
|
|
doubles_score: table === null || table === void 0 ? void 0 : table.total_doubles_scores,
|
|
|
nulls_score: table === null || table === void 0 ? void 0 : table.total_nulls_scores,
|
|
|
judges_score: table === null || table === void 0 ? void 0 : table.total_judges_scores,
|
|
|
pros_score: table === null || table === void 0 ? void 0 : table.total_pros_scores,
|
|
|
shixuns_score: table === null || table === void 0 ? void 0 : table.total_shixuns_scores,
|
|
|
mains_score: table === null || table === void 0 ? void 0 : table.total_mains_scores,
|
|
|
total_combination_scores: table === null || table === void 0 ? void 0 : table.total_combination_scores,
|
|
|
total_score: total_score
|
|
|
}, {
|
|
|
key: '2',
|
|
|
name: '实得分',
|
|
|
singles_score: table === null || table === void 0 ? void 0 : table.singles_scores,
|
|
|
doubles_score: table === null || table === void 0 ? void 0 : table.doubles_scores,
|
|
|
nulls_score: table === null || table === void 0 ? void 0 : table.nulls_scores,
|
|
|
judges_score: table === null || table === void 0 ? void 0 : table.judges_scores,
|
|
|
pros_score: table === null || table === void 0 ? void 0 : table.pros_scores,
|
|
|
shixuns_score: table === null || table === void 0 ? void 0 : table.shixuns_scores,
|
|
|
mains_score: table === null || table === void 0 ? void 0 : table.mains_scores,
|
|
|
total_combination_scores: table === null || table === void 0 ? void 0 : table.combination_scores,
|
|
|
total_score: actual_total_score
|
|
|
}, {
|
|
|
key: '3',
|
|
|
name: '评卷人'
|
|
|
}];
|
|
|
blankData = [{
|
|
|
key: '1',
|
|
|
name: '应得分'
|
|
|
}, {
|
|
|
key: '2',
|
|
|
name: '实得分'
|
|
|
}, {
|
|
|
key: '3',
|
|
|
name: '评卷人'
|
|
|
}];
|
|
|
setTableData(isExportBlank ? blankData : data);
|
|
|
case 11:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function getData() {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var columns = [{
|
|
|
width: '10%',
|
|
|
title: '题型',
|
|
|
align: 'center',
|
|
|
dataIndex: 'name',
|
|
|
render: function render(text) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
children: text
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
width: '10%',
|
|
|
title: '单选题',
|
|
|
align: 'center',
|
|
|
dataIndex: 'singles_score',
|
|
|
render: function render(text) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
children: text === '0.0' ? 0 : text
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
width: '10%',
|
|
|
title: '多选题',
|
|
|
align: 'center',
|
|
|
dataIndex: 'doubles_score',
|
|
|
render: function render(text) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
children: text === '0.0' ? 0 : text
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
width: '10%',
|
|
|
title: '填空题',
|
|
|
align: 'center',
|
|
|
dataIndex: 'nulls_score',
|
|
|
render: function render(text) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
children: text === '0.0' ? 0 : text
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
width: 140,
|
|
|
title: '判断题',
|
|
|
align: 'center',
|
|
|
dataIndex: 'judges_score',
|
|
|
render: function render(text) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
children: text === '0.0' ? 0 : text
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
width: '10%',
|
|
|
title: '编程题',
|
|
|
align: 'center',
|
|
|
dataIndex: 'pros_score',
|
|
|
render: function render(text) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
children: text === '0.0' ? 0 : text
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
width: '10%',
|
|
|
title: '实训题',
|
|
|
align: 'center',
|
|
|
dataIndex: 'shixuns_score',
|
|
|
render: function render(text) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
children: text === '0.0' ? 0 : text
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
width: '10%',
|
|
|
title: '简答题',
|
|
|
align: 'center',
|
|
|
dataIndex: 'mains_score',
|
|
|
render: function render(text) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
children: text === '0.0' ? 0 : text
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
width: '10%',
|
|
|
title: '组合题',
|
|
|
align: 'center',
|
|
|
dataIndex: 'total_combination_scores',
|
|
|
render: function render(text) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
children: text === '0.0' ? 0 : text
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
width: '10%',
|
|
|
title: '总分',
|
|
|
align: 'center',
|
|
|
dataIndex: 'total_score',
|
|
|
render: function render(text) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
children: text === '0.0' ? 0 : text
|
|
|
});
|
|
|
}
|
|
|
}];
|
|
|
var _ref5 = headData || {},
|
|
|
exercise_header = _ref5.exercise_header;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [((exercise_header === null || exercise_header === void 0 ? void 0 : exercise_header.show_user) || (exercise_header === null || exercise_header === void 0 ? void 0 : exercise_header.show_no) || (exercise_header === null || exercise_header === void 0 ? void 0 : exercise_header.show_group)) && /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: Headmodules.glassSeal,
|
|
|
children: [(exercise_header === null || exercise_header === void 0 ? void 0 : exercise_header.show_user) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: ["\u59D3\u540D\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: headData === null || headData === void 0 ? void 0 : headData.user
|
|
|
})]
|
|
|
}), (exercise_header === null || exercise_header === void 0 ? void 0 : exercise_header.show_no) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: ["\u5B66\u53F7\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: headData === null || headData === void 0 ? void 0 : headData.student_id
|
|
|
})]
|
|
|
}), (exercise_header === null || exercise_header === void 0 ? void 0 : exercise_header.show_group) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: ["\u4E13\u4E1A\u73ED\u7EA7\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: headData === null || headData === void 0 ? void 0 : headData.group_name
|
|
|
})]
|
|
|
}), (exercise_header === null || exercise_header === void 0 ? void 0 : exercise_header.show_school_name) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: ["\u5B66\u6821/\u5355\u4F4D\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: headData === null || headData === void 0 ? void 0 : headData.school_name
|
|
|
})]
|
|
|
}), (exercise_header === null || exercise_header === void 0 ? void 0 : exercise_header.show_phone) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: ["\u624B\u673A\u53F7\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: headData === null || headData === void 0 ? void 0 : headData.phone
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: "".concat(Headmodules.wrap, " ").concat(isPreview ? 'pl20' : '', " "),
|
|
|
children: [(headData === null || headData === void 0 ? void 0 : headData.photo_url) && /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
className: Headmodules.img,
|
|
|
src: headData === null || headData === void 0 ? void 0 : headData.photo_url
|
|
|
}), (exercise_header === null || exercise_header === void 0 ? void 0 : exercise_header.show_title) && /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: Headmodules.paperHeader,
|
|
|
justify: "center",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: headData === null || headData === void 0 ? void 0 : headData.title
|
|
|
}), showExportBtn && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)(SettingOutlined/* default */.Z, {}),
|
|
|
className: Headmodules.exportBtn,
|
|
|
onClick: function onClick() {
|
|
|
dispatch({
|
|
|
type: 'exercise/setActionTabs',
|
|
|
payload: {
|
|
|
key: 'exportSetting'
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
children: "\u5BFC\u51FA\u8BBE\u7F6E"
|
|
|
})]
|
|
|
}), (exercise_header === null || exercise_header === void 0 ? void 0 : exercise_header.show_body) && ((exercise === null || exercise === void 0 ? void 0 : (_exercise$exerciseExp2 = exercise.exerciseExportHeadData) === null || _exercise$exerciseExp2 === void 0 ? void 0 : _exercise$exerciseExp2.exercise_description) || (exercise === null || exercise === void 0 ? void 0 : (_exercise$commonHeade = exercise.commonHeader) === null || _exercise$commonHeade === void 0 ? void 0 : _exercise$commonHeade.exercise_description)) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
ref: leftheight,
|
|
|
style: {
|
|
|
justifyContent: leftheights === 21 ? 'center' : 'left',
|
|
|
wordBreak: 'break-all',
|
|
|
display: 'flex',
|
|
|
textAlign: 'left'
|
|
|
},
|
|
|
className: "tc c-grey-333",
|
|
|
children: "\u8BD5\u5377\u987B\u77E5\uFF1A".concat((exercise === null || exercise === void 0 ? void 0 : (_exercise$exerciseExp3 = exercise.exerciseExportHeadData) === null || _exercise$exerciseExp3 === void 0 ? void 0 : _exercise$exerciseExp3.exercise_description) || (exercise === null || exercise === void 0 ? void 0 : (_exercise$commonHeade2 = exercise.commonHeader) === null || _exercise$commonHeade2 === void 0 ? void 0 : _exercise$commonHeade2.exercise_description))
|
|
|
}), (exercise_header === null || exercise_header === void 0 ? void 0 : exercise_header.show_info) && /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
className: "tc c-grey-666",
|
|
|
children: ["\u5171:\u3010", headData === null || headData === void 0 ? void 0 : headData.large_counts, "\u5927\u9898\u3011\u3010", headData === null || headData === void 0 ? void 0 : headData.total_count, "\u5C0F\u9898\u3011\u3010 \u6EE1\u5206", headData === null || headData === void 0 ? void 0 : headData.score, "\u5206\u3011 \u8003\u8BD5\u65F6\u95F4\uFF1A\u3010", (headData === null || headData === void 0 ? void 0 : headData.time) > -1 ? "".concat(headData === null || headData === void 0 ? void 0 : headData.time, "\u5206\u949F") : "\u4E0D\u9650", "\u3011"]
|
|
|
}), (exercise_header === null || exercise_header === void 0 ? void 0 : exercise_header.show_desc) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "mt10",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "font16",
|
|
|
children: "\u8003\u8BD5\u8BF4\u660E\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: headData === null || headData === void 0 ? void 0 : headData.description
|
|
|
})]
|
|
|
}), (exercise_header === null || exercise_header === void 0 ? void 0 : exercise_header.show_table) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt10",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
|
|
|
className: Headmodules.table,
|
|
|
columns: columns,
|
|
|
dataSource: toConsumableArray_default()(tableData || []),
|
|
|
bordered: true,
|
|
|
pagination: false
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(components_ExportSetting, {})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_Head = ((0,_umi_production_exports.connect)(function (_ref6) {
|
|
|
var exercise = _ref6.exercise,
|
|
|
loading = _ref6.loading,
|
|
|
user = _ref6.user,
|
|
|
globalSetting = _ref6.globalSetting;
|
|
|
return {
|
|
|
exercise: exercise,
|
|
|
globalSetting: globalSetting,
|
|
|
user: user,
|
|
|
loading: loading.effects
|
|
|
};
|
|
|
})(Head));
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 43861:
|
|
|
/*!**************************************************************************!*\
|
|
|
!*** ./src/pages/Classrooms/Lists/Exercise/Export/index.tsx + 3 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_Export; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/pagination/style/index.js + 1 modules
|
|
|
var style = __webpack_require__(14182);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/pagination/index.js + 10 modules
|
|
|
var pagination = __webpack_require__(260);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/dropdown/style/index.js + 1 modules
|
|
|
var dropdown_style = __webpack_require__(68018);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/dropdown/index.js
|
|
|
var dropdown = __webpack_require__(13013);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/button/style/index.js + 1 modules
|
|
|
var button_style = __webpack_require__(29913);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(71577);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/breadcrumb/style/index.js + 1 modules
|
|
|
var breadcrumb_style = __webpack_require__(63102);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/breadcrumb/index.js + 3 modules
|
|
|
var breadcrumb = __webpack_require__(58492);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js
|
|
|
var createForOfIteratorHelper = __webpack_require__(74704);
|
|
|
var createForOfIteratorHelper_default = /*#__PURE__*/__webpack_require__.n(createForOfIteratorHelper);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/divider/style/index.js + 1 modules
|
|
|
var divider_style = __webpack_require__(98541);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/divider/index.js
|
|
|
var divider = __webpack_require__(27049);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/checkbox/style/index.js + 1 modules
|
|
|
var checkbox_style = __webpack_require__(82000);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/checkbox/index.js + 2 modules
|
|
|
var es_checkbox = __webpack_require__(32808);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/row/style/index.js
|
|
|
var row_style = __webpack_require__(13062);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/row/index.js
|
|
|
var row = __webpack_require__(71230);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/col/style/index.js
|
|
|
var col_style = __webpack_require__(89032);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/col/index.js
|
|
|
var col = __webpack_require__(15746);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/radio/style/index.js + 1 modules
|
|
|
var radio_style = __webpack_require__(83822);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/radio/index.js + 4 modules
|
|
|
var es_radio = __webpack_require__(29924);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/modal/style/index.js + 1 modules
|
|
|
var modal_style = __webpack_require__(35611);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/modal/index.js + 7 modules
|
|
|
var es_modal = __webpack_require__(85402);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js
|
|
|
var regeneratorRuntime = __webpack_require__(17061);
|
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(42122);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/asyncToGenerator.js
|
|
|
var asyncToGenerator = __webpack_require__(17156);
|
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(27424);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectWithoutProperties.js
|
|
|
var objectWithoutProperties = __webpack_require__(70215);
|
|
|
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input/style/index.js + 1 modules
|
|
|
var input_style = __webpack_require__(69463);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input/index.js + 5 modules
|
|
|
var input = __webpack_require__(75008);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
|
var react = __webpack_require__(67294);
|
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 8 modules
|
|
|
var _umi_production_exports = __webpack_require__(89214);
|
|
|
// EXTERNAL MODULE: ./node_modules/jszip/dist/jszip.min.js
|
|
|
var jszip_min = __webpack_require__(55733);
|
|
|
var jszip_min_default = /*#__PURE__*/__webpack_require__.n(jszip_min);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/ArrowLeftOutlined.js + 1 modules
|
|
|
var ArrowLeftOutlined = __webpack_require__(82826);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/DownloadOutlined.js
|
|
|
var DownloadOutlined = __webpack_require__(69753);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/DeliveredProcedureOutlined.js + 1 modules
|
|
|
var DeliveredProcedureOutlined = __webpack_require__(95604);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/CaretDownOutlined.js
|
|
|
var CaretDownOutlined = __webpack_require__(95025);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/SettingOutlined.js + 1 modules
|
|
|
var SettingOutlined = __webpack_require__(42952);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Export/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var Exportmodules = ({"flex_box_center":"flex_box_center___GW1u0","flex_space_between":"flex_space_between___XhK9z","flex_box_vertical_center":"flex_box_vertical_center___NKIbp","flex_box_center_end":"flex_box_center_end___V3qhT","flex_box_column":"flex_box_column___b4G29","bg":"bg___exMJB","paginationWrapper":"paginationWrapper___ROsRI","totalText":"totalText___PGE6D","num":"num___jLrBF","title":"title___yiXeD","questionIcons":"questionIcons___v75Tz","green":"green___HRGef","orange":"orange___tdW4E","greenTip":"greenTip___f2SpQ","redTip":"redTip___jc8UE","orangeTip":"orangeTip___VMO_s","flexRow":"flexRow___Jshv2","simpleWrap":"simpleWrap___ul6oi","divider":"divider___Of_8z","modal":"modal___oAD7F","programTitle":"programTitle___ybswa","simpleBg":"simpleBg___yLrQy","exportBtn":"exportBtn___x5fcE"});
|
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules
|
|
|
var RenderHtml = __webpack_require__(12768);
|
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
|
var util = __webpack_require__(29427);
|
|
|
// EXTERNAL MODULE: ./src/pages/Classrooms/Lists/Exercise/Review/component/Fill.tsx
|
|
|
var Fill = __webpack_require__(19637);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/table/style/index.js + 1 modules
|
|
|
var table_style = __webpack_require__(71854);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/table/index.js + 58 modules
|
|
|
var table = __webpack_require__(67250);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input-number/style/index.js + 1 modules
|
|
|
var input_number_style = __webpack_require__(25359);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/input-number/index.js + 9 modules
|
|
|
var input_number = __webpack_require__(87799);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/message/style/index.js + 1 modules
|
|
|
var message_style = __webpack_require__(14934);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/message/index.js + 1 modules
|
|
|
var message = __webpack_require__(12461);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/tooltip/style/index.js + 1 modules
|
|
|
var tooltip_style = __webpack_require__(38390);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/tooltip/index.js + 3 modules
|
|
|
var tooltip = __webpack_require__(84908);
|
|
|
// EXTERNAL MODULE: ./src/utils/authority.ts
|
|
|
var authority = __webpack_require__(7);
|
|
|
// EXTERNAL MODULE: ./node_modules/moment/moment.js
|
|
|
var moment = __webpack_require__(30381);
|
|
|
var moment_default = /*#__PURE__*/__webpack_require__.n(moment);
|
|
|
// EXTERNAL MODULE: ./src/components/monaco-editor/index.jsx + 3 modules
|
|
|
var monaco_editor = __webpack_require__(8691);
|
|
|
// EXTERNAL MODULE: ./src/pages/Classrooms/Lists/Exercise/Review/component/index.less?modules
|
|
|
var componentmodules = __webpack_require__(1446);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Review/component/Shixun.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Shixun = function Shixun(_ref) {
|
|
|
var _answerData$exercise, _answerData$exercise2, _item$shixun;
|
|
|
var item = _ref.item,
|
|
|
answerData = _ref.answerData,
|
|
|
_ref$hasChangeScore = _ref.hasChangeScore,
|
|
|
hasChangeScore = _ref$hasChangeScore === void 0 ? true : _ref$hasChangeScore,
|
|
|
autoHeight = _ref.autoHeight,
|
|
|
_ref$saveChangeScore = _ref.saveChangeScore,
|
|
|
saveChangeScore = _ref$saveChangeScore === void 0 ? function () {} : _ref$saveChangeScore;
|
|
|
var _useState = (0,react.useState)([]),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
data = _useState2[0],
|
|
|
setData = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)([]),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
challengeData = _useState4[0],
|
|
|
setChallengeData = _useState4[1];
|
|
|
(0,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 = [];
|
|
|
for (var i = 0; i < (item === null || item === void 0 ? 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, _item$shixun_details7, _item$shixun_details8;
|
|
|
for (var j = 0; j < (item === null || item === void 0 ? void 0 : item.shixun_details[i].stage_list.length); j++) {
|
|
|
var _item$shixun_details3, _item$shixun_details4, _item$shixun_details5, _item$shixun_details6, _item$shixun_details$;
|
|
|
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 ? void 0 : (_item$shixun_details3 = item.shixun_details) === null || _item$shixun_details3 === void 0 ? void 0 : (_item$shixun_details4 = _item$shixun_details3[i]) === null || _item$shixun_details4 === void 0 ? void 0 : (_item$shixun_details5 = _item$shixun_details4.shixun_detail) === null || _item$shixun_details5 === void 0 ? void 0 : (_item$shixun_details6 = _item$shixun_details5[0]) === null || _item$shixun_details6 === void 0 ? void 0 : _item$shixun_details6.game_identifier,
|
|
|
shixun_challenge_id: item === null || item === void 0 ? void 0 : (_item$shixun_details$ = item.shixun_details[i]) === null || _item$shixun_details$ === void 0 ? void 0 : _item$shixun_details$.shixun_challenge_id
|
|
|
}));
|
|
|
}
|
|
|
if (item !== null && item !== void 0 && (_item$shixun_details7 = item.shixun_details) !== null && _item$shixun_details7 !== void 0 && (_item$shixun_details8 = _item$shixun_details7[i]) !== null && _item$shixun_details8 !== void 0 && _item$shixun_details8.shixun_detail) {
|
|
|
var _item$shixun_details9, _item$shixun_details10, _item$shixun_details11;
|
|
|
challenge.push(item === null || item === void 0 ? void 0 : (_item$shixun_details9 = item.shixun_details) === null || _item$shixun_details9 === void 0 ? void 0 : (_item$shixun_details10 = _item$shixun_details9[i]) === null || _item$shixun_details10 === void 0 ? void 0 : (_item$shixun_details11 = _item$shixun_details10.shixun_detail) === null || _item$shixun_details11 === void 0 ? void 0 : _item$shixun_details11[0]);
|
|
|
}
|
|
|
}
|
|
|
setChallengeData(challenge);
|
|
|
setData([].concat(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',
|
|
|
ellipsis: true,
|
|
|
width: 260,
|
|
|
render: function render(name) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: name,
|
|
|
children: /*#__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: "finished_time",
|
|
|
dataIndex: "finished_time",
|
|
|
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 = moment_default()(answerData === null || answerData === void 0 ? void 0 : answerData.exercise.end_time).isBefore(item.finished_time);
|
|
|
} else {
|
|
|
timeOver = moment_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: "experience",
|
|
|
// key: "experience",
|
|
|
// align: 'center',
|
|
|
// render: (exp: any, item: any) => {
|
|
|
// return (
|
|
|
// <span>
|
|
|
// <span className="c-green">{item.myself_experience}</span>/
|
|
|
// {item.experience}
|
|
|
// </span>
|
|
|
// );
|
|
|
// },
|
|
|
// },
|
|
|
{
|
|
|
title: "得分/满分",
|
|
|
dataIndex: "user_score",
|
|
|
key: "user_score",
|
|
|
align: 'center',
|
|
|
render: function render(exp, item) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-orange",
|
|
|
children: item.user_score
|
|
|
}), "/", item.game_score]
|
|
|
});
|
|
|
}
|
|
|
}, hasChangeScore && {
|
|
|
title: "调分",
|
|
|
dataIndex: "user_score",
|
|
|
key: "user_score",
|
|
|
align: 'center',
|
|
|
render: function render(value, data, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
min: 0,
|
|
|
max: Number(data.game_score),
|
|
|
defaultValue: value,
|
|
|
onBlur: /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(e) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
if (!(e.target.value != value)) {
|
|
|
_context.next = 6;
|
|
|
break;
|
|
|
}
|
|
|
_context.next = 3;
|
|
|
return saveChangeScore(objectSpread2_default()(objectSpread2_default()({}, item), {
|
|
|
shixun_challenge_id: data.shixun_challenge_id,
|
|
|
shixunScore: e.target.value
|
|
|
}));
|
|
|
case 3:
|
|
|
res = _context.sent;
|
|
|
console.log('res: ', res);
|
|
|
if (res !== null && res !== void 0 && res.question_comments) {
|
|
|
message/* default.success */.ZP.success("已修改当前评分");
|
|
|
}
|
|
|
case 6:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function (_x) {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}()
|
|
|
});
|
|
|
}
|
|
|
}].filter(function (x) {
|
|
|
return !!x;
|
|
|
});
|
|
|
var outputColumns = [{
|
|
|
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 : "--"
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: '评测时间',
|
|
|
dataIndex: 'updated_at',
|
|
|
key: 'updated_at',
|
|
|
align: 'center',
|
|
|
width: 200,
|
|
|
render: function render(text, record) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: record.updated_at ? record.updated_at : "--"
|
|
|
});
|
|
|
}
|
|
|
}];
|
|
|
var options = {
|
|
|
selectOnLineNumbers: true,
|
|
|
readOnly: true,
|
|
|
minimap: {
|
|
|
enabled: false
|
|
|
},
|
|
|
scrollBeyondLastLine: false
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [((answerData === null || answerData === void 0 ? void 0 : (_answerData$exercise = answerData.exercise) === null || _answerData$exercise === void 0 ? void 0 : _answerData$exercise.student_commit_status) !== 0 || (answerData === null || answerData === void 0 ? void 0 : (_answerData$exercise2 = answerData.exercise) === null || _answerData$exercise2 === void 0 ? void 0 : _answerData$exercise2.user_exercise_status) !== 0) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "mt15",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "font16 c-grey-666",
|
|
|
children: "\u9636\u6BB5\u6210\u7EE9"
|
|
|
}), !!(data !== null && data !== void 0 && data.length) && /*#__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)(jsx_runtime.Fragment, {
|
|
|
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) {
|
|
|
var _chanllenge$outputs;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "mt5",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font16 mr15",
|
|
|
children: [" \u7B2C", chanllenge.position, "\u5173"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
|
className: "current c-black font16",
|
|
|
to: "/tasks/".concat(chanllenge.game_identifier),
|
|
|
children: chanllenge.name
|
|
|
})]
|
|
|
}), !!(chanllenge !== null && chanllenge !== void 0 && (_chanllenge$outputs = chanllenge.outputs) !== null && _chanllenge$outputs !== void 0 && _chanllenge$outputs.length) && /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
|
|
|
bordered: true,
|
|
|
dataSource: chanllenge.outputs.map(function (out) {
|
|
|
return {
|
|
|
key: out.position,
|
|
|
error_msg: out.output_detail,
|
|
|
updated_at: out.updated_at
|
|
|
};
|
|
|
}),
|
|
|
columns: outputColumns,
|
|
|
pagination: false
|
|
|
}), (chanllenge === null || chanllenge === void 0 ? void 0 : chanllenge.st) === 0 && chanllenge.passed_code && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: componentmodules/* default.shixunWrp */.Z.shixunWrp,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("h2", {
|
|
|
children: ["\u6700\u540E\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,
|
|
|
autoHeight: autoHeight,
|
|
|
language: "python",
|
|
|
theme: "default",
|
|
|
value: chanllenge.passed_code,
|
|
|
options: options
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
})]
|
|
|
}), (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 ? void 0 : (_item$shixun = item.shixun) === null || _item$shixun === void 0 ? void 0 : _item$shixun.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"]
|
|
|
})]
|
|
|
});
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mb15"
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var component_Shixun = (Shixun);
|
|
|
// EXTERNAL MODULE: ./node_modules/js-base64/base64.js
|
|
|
var base64 = __webpack_require__(19575);
|
|
|
// EXTERNAL MODULE: ./src/pages/Classrooms/Lists/Exercise/Review/index.less?modules
|
|
|
var Reviewmodules = __webpack_require__(37729);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Review/component/Program.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Program = function Program(_ref) {
|
|
|
var _answerData$exercise, _answerData$exercise2, _answerData$exercise3, _answerData$exercise4, _item$user_answer;
|
|
|
var item = _ref.item,
|
|
|
answerData = _ref.answerData,
|
|
|
autoHeight = _ref.autoHeight;
|
|
|
var _useState = (0,react.useState)([]),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
data = _useState2[0],
|
|
|
setData = _useState2[1];
|
|
|
(0,react.useEffect)(function () {
|
|
|
var _item$evaluate_codes;
|
|
|
if ((item === null || item === void 0 ? 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 ? 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) : '',
|
|
|
created_at: code.created_at
|
|
|
};
|
|
|
}));
|
|
|
} 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: 'created_at',
|
|
|
key: 'created_at',
|
|
|
align: 'center',
|
|
|
width: 200,
|
|
|
render: function render(text, record) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: record.created_at ? moment_default()(record.created_at).format('YYYY-MM-DD HH:mm') : "--"
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
title: '评测结果',
|
|
|
dataIndex: 'error_msg',
|
|
|
key: 'error_msg',
|
|
|
align: 'center',
|
|
|
render: function render(text, record) {
|
|
|
var _record$error_msg;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: record.error_msg ? ((_record$error_msg = record.error_msg) === null || _record$error_msg === void 0 ? void 0 : _record$error_msg.length) > 1000 ? record.error_msg.substring(0, 1000) + "..." : record.error_msg : "--"
|
|
|
});
|
|
|
}
|
|
|
}];
|
|
|
var options = {
|
|
|
selectOnLineNumbers: true,
|
|
|
readOnly: true,
|
|
|
minimap: {
|
|
|
enabled: false
|
|
|
},
|
|
|
scrollBeyondLastLine: false
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "mt15 mb15",
|
|
|
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 && _answerData$exercise.student_commit_status) && (answerData === null || answerData === void 0 ? void 0 : (_answerData$exercise2 = answerData.exercise) === null || _answerData$exercise2 === void 0 ? void 0 : _answerData$exercise2.student_commit_status) !== 0 || !!(answerData !== null && answerData !== void 0 && (_answerData$exercise3 = answerData.exercise) !== null && _answerData$exercise3 !== void 0 && _answerData$exercise3.user_exercise_status) && (answerData === null || answerData === void 0 ? void 0 : (_answerData$exercise4 = answerData.exercise) === null || _answerData$exercise4 === void 0 ? void 0 : _answerData$exercise4.user_exercise_status) !== 0) && /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
|
|
|
className: "mt5",
|
|
|
bordered: true,
|
|
|
dataSource: data,
|
|
|
columns: columns,
|
|
|
pagination: false
|
|
|
}), !!(item !== null && item !== void 0 && (_item$user_answer = item.user_answer) !== null && _item$user_answer !== void 0 && _item$user_answer.length) && (item === null || item === void 0 ? void 0 : item.passed_code) && /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
className: Reviewmodules/* default.shixunWrp */.Z.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) : "",
|
|
|
autoHeight: autoHeight,
|
|
|
options: options
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var component_Program = (Program);
|
|
|
// EXTERNAL MODULE: ./src/pages/Classrooms/Lists/Exercise/Export/components/Head/index.tsx + 5 modules
|
|
|
var Head = __webpack_require__(92170);
|
|
|
// EXTERNAL MODULE: ./node_modules/html2pdf.js/dist/html2pdf.js
|
|
|
var html2pdf = __webpack_require__(80599);
|
|
|
var html2pdf_default = /*#__PURE__*/__webpack_require__.n(html2pdf);
|
|
|
// EXTERNAL MODULE: ./src/utils/enum.ts
|
|
|
var utils_enum = __webpack_require__(70960);
|
|
|
// EXTERNAL MODULE: ./src/pages/Classrooms/Lists/Exercise/Review/component/AnswerComments/index.tsx + 1 modules
|
|
|
var AnswerComments = __webpack_require__(37537);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Export/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["exercise", "globalSetting", "loading", "user", "dispatch"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var PageCount = 30;
|
|
|
var TextArea = input/* default.TextArea */.Z.TextArea;
|
|
|
var questionType = (/* unused pure expression or super */ null && (['单选题', '多选题', '判断题', '填空题', '简答题', '实训题', '编程题']));
|
|
|
var Export = function Export(_ref) {
|
|
|
var _userInfo$course, _exportData$exercise3, _exportData$exercise_2, _exportData$exercise4, _exportData$exercise5, _exportData$exercise6, _exportData$exercise7;
|
|
|
var exercise = _ref.exercise,
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
loading = _ref.loading,
|
|
|
user = _ref.user,
|
|
|
dispatch = _ref.dispatch,
|
|
|
props = objectWithoutProperties_default()(_ref, _excluded);
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var userInfo = user.userInfo;
|
|
|
var _useState = (0,react.useState)({}),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
changeScoreData = _useState2[0],
|
|
|
setChangeScoreData = _useState2[1];
|
|
|
var exportElement = (0,react.useRef)();
|
|
|
var isExportBlank = (0,react.useRef)(false);
|
|
|
var _useState3 = (0,react.useState)(false),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
isLoading = _useState4[0],
|
|
|
setIsLoading = _useState4[1];
|
|
|
var _useState5 = (0,react.useState)({}),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
exportData = _useState6[0],
|
|
|
setExportData = _useState6[1];
|
|
|
var _useState7 = (0,react.useState)(new (jszip_min_default())()),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
zip = _useState8[0],
|
|
|
setZip = _useState8[1];
|
|
|
var _useState9 = (0,react.useState)([]),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
allStudents = _useState10[0],
|
|
|
setAllStudents = _useState10[1];
|
|
|
var _useState11 = (0,react.useState)(false),
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
autoHeight = _useState12[0],
|
|
|
setAutoHeight = _useState12[1];
|
|
|
var _useState13 = (0,react.useState)(false),
|
|
|
_useState14 = slicedToArray_default()(_useState13, 2),
|
|
|
isshowanswer = _useState14[0],
|
|
|
setisshowanswer = _useState14[1]; //导出空白试卷加答案时显示答案
|
|
|
var _useState15 = (0,react.useState)(false),
|
|
|
_useState16 = slicedToArray_default()(_useState15, 2),
|
|
|
userScoreVisible = _useState16[0],
|
|
|
setUserScoreVisible = _useState16[1]; //导出所有学生试卷时需要显示学生得分
|
|
|
var _useState17 = (0,react.useState)(false),
|
|
|
_useState18 = slicedToArray_default()(_useState17, 2),
|
|
|
userCommentVisible = _useState18[0],
|
|
|
setUserCommentVisible = _useState18[1]; //导出所有学生试卷时需要显示评语
|
|
|
var _useState19 = (0,react.useState)(false),
|
|
|
_useState20 = slicedToArray_default()(_useState19, 2),
|
|
|
ismodal = _useState20[0],
|
|
|
setismodal = _useState20[1];
|
|
|
(0,react.useEffect)(function () {
|
|
|
if (userInfo !== null && userInfo !== void 0 && userInfo.login) {
|
|
|
getData();
|
|
|
}
|
|
|
try {
|
|
|
setAllStudents(JSON.parse(localStorage.total_exercise_users));
|
|
|
} catch (e) {}
|
|
|
}, [params.userId, params.coursesId, params.exerciseId, userInfo]);
|
|
|
var handleRemoveSurplusCanvas = function handleRemoveSurplusCanvas() {
|
|
|
document.querySelectorAll('canvas').forEach(function (item) {
|
|
|
(!item.clientWidth || !item.clientHeight) && item.remove();
|
|
|
});
|
|
|
};
|
|
|
var scrollView = function scrollView() {
|
|
|
document.body.scrollIntoView();
|
|
|
};
|
|
|
var randomQuestion = function randomQuestion(res) {
|
|
|
var _res$exercise_answer_, _res$exercise, _res$exercise2;
|
|
|
var random_id = res === null || res === void 0 ? void 0 : (_res$exercise_answer_ = res.exercise_answer_user) === null || _res$exercise_answer_ === void 0 ? void 0 : _res$exercise_answer_.user_id;
|
|
|
if (res !== null && res !== void 0 && (_res$exercise = res.exercise) !== null && _res$exercise !== void 0 && _res$exercise.question_random || res !== null && res !== void 0 && (_res$exercise2 = res.exercise) !== null && _res$exercise2 !== void 0 && _res$exercise2.choice_random) {
|
|
|
var _res$exercise_questio;
|
|
|
var _key = 1;
|
|
|
res.exercise.question_random = res === null || res === void 0 ? void 0 : (_res$exercise_questio = res.exercise_question_types) === null || _res$exercise_questio === void 0 ? void 0 : _res$exercise_questio.map(function (item) {
|
|
|
var _res$exercise3, _res$exercise4;
|
|
|
if (res !== null && res !== void 0 && (_res$exercise3 = res.exercise) !== null && _res$exercise3 !== void 0 && _res$exercise3.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 (res !== null && res !== void 0 && (_res$exercise4 = res.exercise) !== null && _res$exercise4 !== void 0 && _res$exercise4.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;
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
var getData = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
dispatch({
|
|
|
type: "exercise/getExerciseExportHeadData",
|
|
|
payload: {
|
|
|
id: params.exerciseId || params.categoryId,
|
|
|
identify: params.userId || null
|
|
|
}
|
|
|
});
|
|
|
if (!params.userId) {
|
|
|
_context.next = 9;
|
|
|
break;
|
|
|
}
|
|
|
_context.next = 4;
|
|
|
return dispatch({
|
|
|
type: "exercise/getReviewExercise",
|
|
|
payload: {
|
|
|
exerciseId: params.exerciseId,
|
|
|
login: params.userId
|
|
|
}
|
|
|
});
|
|
|
case 4:
|
|
|
res = _context.sent;
|
|
|
randomQuestion(res);
|
|
|
isExportBlank.current = false;
|
|
|
_context.next = 13;
|
|
|
break;
|
|
|
case 9:
|
|
|
_context.next = 11;
|
|
|
return dispatch({
|
|
|
type: 'exercise/editExercise',
|
|
|
payload: {
|
|
|
coursesId: params.coursesId,
|
|
|
categoryId: params.exerciseId
|
|
|
}
|
|
|
});
|
|
|
case 11:
|
|
|
res = _context.sent;
|
|
|
isExportBlank.current = true;
|
|
|
case 13:
|
|
|
setExportData(objectSpread2_default()({}, res || {}));
|
|
|
setTimeout(function () {
|
|
|
var nbPages = 1;
|
|
|
var sourceHtml = document.getElementById("export-id-all");
|
|
|
var max_page_height = 860; //Is the max size of page i want. in px
|
|
|
var current_page_height = 0; //
|
|
|
|
|
|
// let dom = Array.from(document.getElementById("export-all").children);
|
|
|
// dom.map((item, key) => {
|
|
|
// current_page_height += item.scrollHeight
|
|
|
// if (max_page_height <= current_page_height) {
|
|
|
// current_page_height = item.scrollHeight;
|
|
|
// ++nbPages;
|
|
|
// let li = document.createElement("li")
|
|
|
// li.className = 'html2pdf__page-break'
|
|
|
// li.innerHTML = ' '
|
|
|
// document.getElementById("export-all").insertBefore(li, item)
|
|
|
// }
|
|
|
// })
|
|
|
}, 1500);
|
|
|
case 15:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function getData() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var download = function download() {
|
|
|
zip.generateAsync({
|
|
|
type: "blob"
|
|
|
}).then(function (content) {
|
|
|
var _exportData$exercise, _exercise$exerciseExp, _exportData$exercise2;
|
|
|
var link = document.createElement('a');
|
|
|
link.href = window.URL.createObjectURL(content);
|
|
|
link.download = Object.keys(zip.files).length > 1 ? (exportData === null || exportData === void 0 ? void 0 : (_exportData$exercise = exportData.exercise) === null || _exportData$exercise === void 0 ? void 0 : _exportData$exercise.exercise_name) + '.zip' : ((exercise === null || exercise === void 0 ? void 0 : (_exercise$exerciseExp = exercise.exerciseExportHeadData) === null || _exercise$exerciseExp === void 0 ? void 0 : _exercise$exerciseExp.user) || (exportData === null || exportData === void 0 ? void 0 : (_exportData$exercise2 = exportData.exercise) === null || _exportData$exercise2 === void 0 ? void 0 : _exportData$exercise2.exercise_name)) + '.zip';
|
|
|
document.body.appendChild(link);
|
|
|
var evt = document.createEvent("MouseEvents");
|
|
|
evt.initEvent("click", false, false);
|
|
|
link.dispatchEvent(evt);
|
|
|
document.body.removeChild(link);
|
|
|
setZip(new (jszip_min_default())());
|
|
|
});
|
|
|
setisshowanswer(false);
|
|
|
setUserCommentVisible(false);
|
|
|
setUserScoreVisible(false);
|
|
|
setAutoHeight(false);
|
|
|
};
|
|
|
var exportReport = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6(type) {
|
|
|
var _exercise$exerciseExp2;
|
|
|
var nums, modal, pages, title, _exercise$exerciseExp3, _exercise$exerciseExp4, opt, worker, _loop, i, next, _next;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee6$(_context8) {
|
|
|
while (1) switch (_context8.prev = _context8.next) {
|
|
|
case 0:
|
|
|
_next = function _next3() {
|
|
|
_next = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee5$(_context7) {
|
|
|
while (1) switch (_context7.prev = _context7.next) {
|
|
|
case 0:
|
|
|
nums++;
|
|
|
isExportBlank.current = false;
|
|
|
scrollView();
|
|
|
_context7.next = 5;
|
|
|
return dispatch({
|
|
|
type: "exercise/getExerciseExportHeadData",
|
|
|
payload: {
|
|
|
id: params.exerciseId || params.categoryId,
|
|
|
identify: allStudents[nums - 1]['user_login']
|
|
|
}
|
|
|
});
|
|
|
case 5:
|
|
|
_context7.next = 7;
|
|
|
return dispatch({
|
|
|
type: "exercise/getReviewExercise",
|
|
|
payload: {
|
|
|
exerciseId: params.exerciseId,
|
|
|
login: allStudents[nums - 1]['user_login']
|
|
|
}
|
|
|
});
|
|
|
case 7:
|
|
|
res = _context7.sent;
|
|
|
randomQuestion(res);
|
|
|
setExportData(objectSpread2_default()({}, res || {}));
|
|
|
setTimeout( /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
|
|
|
var worker, _loop2, _i;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context6) {
|
|
|
while (1) switch (_context6.prev = _context6.next) {
|
|
|
case 0:
|
|
|
handleRemoveSurplusCanvas();
|
|
|
// const pdfUrl = await html2pdf()
|
|
|
// .from(document.getElementById("export-all"))
|
|
|
// .set(opt)
|
|
|
// // .toPdf()
|
|
|
// .output('blob')
|
|
|
// setIsLoading(false)
|
|
|
worker = html2pdf_default()();
|
|
|
_loop2 = /*#__PURE__*/regeneratorRuntime_default()().mark(function _loop2(i) {
|
|
|
return regeneratorRuntime_default()().wrap(function _loop2$(_context5) {
|
|
|
while (1) switch (_context5.prev = _context5.next) {
|
|
|
case 0:
|
|
|
_context5.next = 2;
|
|
|
return worker.set(opt).from(pages[i]).toContainer().toCanvas().toPdf().get('pdf').then( /*#__PURE__*/function () {
|
|
|
var _ref6 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(pdf) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
if (!(i < pages.length - 1)) {
|
|
|
_context4.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
_context4.next = 3;
|
|
|
return pdf.addPage();
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return function (_x3) {
|
|
|
return _ref6.apply(this, arguments);
|
|
|
};
|
|
|
}());
|
|
|
case 2:
|
|
|
case "end":
|
|
|
return _context5.stop();
|
|
|
}
|
|
|
}, _loop2);
|
|
|
});
|
|
|
_i = 0;
|
|
|
case 4:
|
|
|
if (!(_i < pages.length)) {
|
|
|
_context6.next = 9;
|
|
|
break;
|
|
|
}
|
|
|
return _context6.delegateYield(_loop2(_i), "t0", 6);
|
|
|
case 6:
|
|
|
_i++;
|
|
|
_context6.next = 4;
|
|
|
break;
|
|
|
case 9:
|
|
|
zip.file("".concat(allStudents[nums - 1]['user_name'], "-").concat(moment_default()().format('YYYY-MM-DD HH:mm:ss'), ".pdf"), worker.output("blob"));
|
|
|
modal.update({
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u5F53\u524D\u8FDB\u5EA6: ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-blue",
|
|
|
children: nums + 1
|
|
|
}), "/", allStudents === null || allStudents === void 0 ? void 0 : allStudents.length]
|
|
|
})
|
|
|
});
|
|
|
if (nums == (allStudents === null || allStudents === void 0 ? void 0 : allStudents.length)) {
|
|
|
modal.destroy();
|
|
|
setIsLoading(false);
|
|
|
download();
|
|
|
} else {
|
|
|
next();
|
|
|
}
|
|
|
case 12:
|
|
|
case "end":
|
|
|
return _context6.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
})), 2600);
|
|
|
case 11:
|
|
|
case "end":
|
|
|
return _context7.stop();
|
|
|
}
|
|
|
}, _callee5);
|
|
|
}));
|
|
|
return _next.apply(this, arguments);
|
|
|
};
|
|
|
next = function _next2() {
|
|
|
return _next.apply(this, arguments);
|
|
|
};
|
|
|
if (type === "all") {
|
|
|
isExportBlank.current = false;
|
|
|
} else if (!params.userId) {
|
|
|
isExportBlank.current = true;
|
|
|
}
|
|
|
scrollView();
|
|
|
setAutoHeight(true);
|
|
|
nums = 0;
|
|
|
if (type !== 'all') setIsLoading(true);
|
|
|
// else
|
|
|
modal = es_modal/* default.info */.Z.info({
|
|
|
width: 460,
|
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u6B63\u5728\u5BFC\u51FA\u8BD5\u5377,", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-red",
|
|
|
children: "\u8BF7\u52FF\u5173\u95ED\u6216\u64CD\u4F5C\u5F53\u524D\u6D4F\u89C8\u5668\u7A97\u53E3"
|
|
|
})]
|
|
|
}),
|
|
|
content: type === 'all' ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u5F53\u524D\u8FDB\u5EA6: ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-blue",
|
|
|
children: nums + 1
|
|
|
}), "/", allStudents === null || allStudents === void 0 ? void 0 : allStudents.length]
|
|
|
}) : null,
|
|
|
maskClosable: false,
|
|
|
className: Exportmodules.modal,
|
|
|
onOk: function onOk() {}
|
|
|
});
|
|
|
handleRemoveSurplusCanvas();
|
|
|
_context8.next = 11;
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
setTimeout(function () {
|
|
|
resolve('');
|
|
|
}, 1000);
|
|
|
});
|
|
|
case 11:
|
|
|
// const opt = {
|
|
|
// // margin: [10, 10],
|
|
|
// html2canvas: { letterRendering: true, useCORS: true, allowTaint: false },
|
|
|
// // filename: 'test.pdf',
|
|
|
// // enableLinks: false,
|
|
|
// jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
|
|
|
// // pagebreak: { mode: ['avoid-all', 'css', 'legacy'] },
|
|
|
// // image: { type: 'jpeg', quality: 0.98 }
|
|
|
// }
|
|
|
// let title = `${moment().format('YYYY-MM-DD HH:mm:ss')}`;
|
|
|
// if (exercise.exerciseExportHeadData?.user) {
|
|
|
// title = `${exercise.exerciseExportHeadData?.student_id || ''}${exercise.exerciseExportHeadData?.user}`
|
|
|
// }
|
|
|
// const pdfUrl = await html2pdf()
|
|
|
// .from(document.getElementById("export-all"))
|
|
|
// .set(opt)
|
|
|
// // .toPdf()
|
|
|
// .output('blob')
|
|
|
// setIsLoading(false)
|
|
|
// if (type !== 'all')
|
|
|
// zip.file(`${title}-${moment().format('YYYY-MM-DD HH:mm:ss')}.pdf`, pdfUrl);
|
|
|
// if (type !== 'all') {
|
|
|
// modal.destroy()
|
|
|
// download()
|
|
|
// return;
|
|
|
// }
|
|
|
pages = exportElement.current.children;
|
|
|
title = "".concat(moment_default()().format('YYYY-MM-DD HH:mm:ss'));
|
|
|
if ((_exercise$exerciseExp2 = exercise.exerciseExportHeadData) !== null && _exercise$exerciseExp2 !== void 0 && _exercise$exerciseExp2.user) {
|
|
|
title = "".concat(((_exercise$exerciseExp3 = exercise.exerciseExportHeadData) === null || _exercise$exerciseExp3 === void 0 ? void 0 : _exercise$exerciseExp3.student_id) || '').concat((_exercise$exerciseExp4 = exercise.exerciseExportHeadData) === null || _exercise$exerciseExp4 === void 0 ? void 0 : _exercise$exerciseExp4.user);
|
|
|
}
|
|
|
opt = {
|
|
|
html2canvas: {
|
|
|
letterRendering: true,
|
|
|
useCORS: true,
|
|
|
allowTaint: false
|
|
|
},
|
|
|
jsPDF: {
|
|
|
unit: 'in',
|
|
|
format: 'letter',
|
|
|
orientation: 'portrait'
|
|
|
},
|
|
|
pagebreak: {
|
|
|
mode: ['avoid-all']
|
|
|
}
|
|
|
};
|
|
|
worker = html2pdf_default()();
|
|
|
_loop = /*#__PURE__*/regeneratorRuntime_default()().mark(function _loop(i) {
|
|
|
return regeneratorRuntime_default()().wrap(function _loop$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
_context3.next = 2;
|
|
|
return worker.set(opt).from(pages[i]).toContainer().toCanvas().toPdf().get('pdf').then( /*#__PURE__*/function () {
|
|
|
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(pdf) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
if (!(i < pages.length - 1)) {
|
|
|
_context2.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
_context2.next = 3;
|
|
|
return pdf.addPage();
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function (_x2) {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}());
|
|
|
case 2:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _loop);
|
|
|
});
|
|
|
i = 0;
|
|
|
case 18:
|
|
|
if (!(i < pages.length)) {
|
|
|
_context8.next = 23;
|
|
|
break;
|
|
|
}
|
|
|
return _context8.delegateYield(_loop(i), "t0", 20);
|
|
|
case 20:
|
|
|
i++;
|
|
|
_context8.next = 18;
|
|
|
break;
|
|
|
case 23:
|
|
|
if (!!(allStudents !== null && allStudents !== void 0 && allStudents.length) && type === 'all') {
|
|
|
next();
|
|
|
} else {
|
|
|
// zip.file(`${shixunWorkReport.username}.pdf`, pdfUrl);
|
|
|
zip.file("".concat(title, ".pdf"), worker.output("blob"), {
|
|
|
base64: false
|
|
|
});
|
|
|
// worker.save()
|
|
|
modal.destroy();
|
|
|
setIsLoading(false);
|
|
|
download();
|
|
|
}
|
|
|
// openNewWindow(pdfUrl)
|
|
|
case 24:
|
|
|
case "end":
|
|
|
return _context8.stop();
|
|
|
}
|
|
|
}, _callee6);
|
|
|
}));
|
|
|
return function exportReport(_x) {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var setPdfFooter = function setPdfFooter(pdf) {
|
|
|
var totalPages = pdf.internal.getNumberOfPages();
|
|
|
for (var pageNumber = 1; pageNumber <= totalPages; pageNumber += 1) {
|
|
|
pdf.setPage(pageNumber);
|
|
|
pdf.setFontSize(9);
|
|
|
pdf.setTextColor('#6a6a6a');
|
|
|
pdf.text("".concat(pageNumber, " / ").concat(totalPages), pdf.internal.pageSize.getWidth() - 20, pdf.internal.pageSize.getHeight() - 6);
|
|
|
}
|
|
|
};
|
|
|
var renderQuestion = function renderQuestion(item, i) {
|
|
|
var _item$question_choice, _item$question_choice2, _item$question_choice3, _changeScoreData$item, _item$user_answer4, _item$user_answer_lig, _item$user_answer5, _item$sub_exercise_qu, _item$standard_answer, _item$standard_answer2, _item$standard_answer3, _item$standard_answer4;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
display: 'flex'
|
|
|
},
|
|
|
className: Exportmodules.programTitle,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
style: {
|
|
|
flexShrink: 0
|
|
|
},
|
|
|
className: "font18",
|
|
|
children: [i, "."]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item.question_title
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
style: {
|
|
|
flexShrink: 0
|
|
|
},
|
|
|
className: "font16",
|
|
|
children: ["\uFF08", (item === null || item === void 0 ? void 0 : item.question_type) === 7 ? "\u5171".concat(item === null || item === void 0 ? void 0 : item.sub_q_count, "\u5C0F\u9898") : '', " ", item.question_score, "\u5206\uFF09"]
|
|
|
})]
|
|
|
}),
|
|
|
// 单选题
|
|
|
item.question_type === utils_enum/* QuestionType.Single */.c.Single && /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: (_item$question_choice = item.question_choices) === null || _item$question_choice === void 0 ? void 0 : _item$question_choice.map(function (val, key) {
|
|
|
var _item$user_answer;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "25px",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
width: 25,
|
|
|
overflow: "hidden"
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
|
|
|
checked: (_item$user_answer = item.user_answer) === null || _item$user_answer === void 0 ? void 0 : _item$user_answer.includes(val.choice_id),
|
|
|
style: {
|
|
|
width: 25
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: val.choice_text || ""
|
|
|
})
|
|
|
})]
|
|
|
}, key);
|
|
|
})
|
|
|
}),
|
|
|
// 多选题
|
|
|
item.question_type === utils_enum/* QuestionType.Multiple */.c.Multiple && /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: (_item$question_choice2 = item.question_choices) === null || _item$question_choice2 === void 0 ? void 0 : _item$question_choice2.map(function (val, key) {
|
|
|
var _item$user_answer2;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "25px",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
width: 25,
|
|
|
overflow: "hidden"
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
checked: (_item$user_answer2 = item.user_answer) === null || _item$user_answer2 === void 0 ? void 0 : _item$user_answer2.includes(val.choice_id),
|
|
|
style: {
|
|
|
width: 25
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: val.choice_text || ""
|
|
|
})
|
|
|
})]
|
|
|
}, key);
|
|
|
// return <div className=""><Checkbox checked={item.user_answer?.includes(val.choice_id)}>
|
|
|
// {val.choice_text}
|
|
|
// </Checkbox></div>
|
|
|
})
|
|
|
}),
|
|
|
// 判断题
|
|
|
item.question_type === utils_enum/* QuestionType.Judge */.c.Judge && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Exportmodules.flexRow,
|
|
|
children: (_item$question_choice3 = item.question_choices) === null || _item$question_choice3 === void 0 ? void 0 : _item$question_choice3.map(function (val, key) {
|
|
|
var _item$user_answer3;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "25px",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
width: 25,
|
|
|
overflow: "hidden"
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
|
|
|
checked: (_item$user_answer3 = item.user_answer) === null || _item$user_answer3 === void 0 ? void 0 : _item$user_answer3.includes(val.choice_id),
|
|
|
style: {
|
|
|
width: 25
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
children: val.choice_text
|
|
|
})]
|
|
|
}, key);
|
|
|
// return <div className=""><Radio checked={item.user_answer?.includes(val.choice_id)}>
|
|
|
// {val.choice_text}
|
|
|
// </Radio></div>
|
|
|
})
|
|
|
}), item.question_type === utils_enum/* QuestionType.Fill */.c.Fill && !isExportBlank.current && /*#__PURE__*/(0,jsx_runtime.jsx)(Fill/* default */.Z, {
|
|
|
item: item,
|
|
|
answerData: exportData,
|
|
|
changeScoreData: changeScoreData,
|
|
|
textValue: (_changeScoreData$item = changeScoreData[item.q_position]) === null || _changeScoreData$item === void 0 ? void 0 : _changeScoreData$item.text,
|
|
|
textOnChange: function textOnChange(value) {
|
|
|
changeScoreData[item.q_position].text = value;
|
|
|
setChangeScoreData(objectSpread2_default()({}, changeScoreData));
|
|
|
},
|
|
|
seeAnswerVisible: false
|
|
|
}), item.question_type === utils_enum/* QuestionType.Shixun */.c.Shixun && /*#__PURE__*/(0,jsx_runtime.jsx)(component_Shixun, {
|
|
|
item: item,
|
|
|
answerData: exportData,
|
|
|
hasChangeScore: false,
|
|
|
autoHeight: autoHeight
|
|
|
}), item.question_type === utils_enum/* QuestionType.Subjective */.c.Subjective && item !== null && item !== void 0 && (_item$user_answer4 = item.user_answer) !== null && _item$user_answer4 !== void 0 && _item$user_answer4[0] ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Exportmodules.simpleBg,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
|
className: "font14 c-light-primary mb5",
|
|
|
children: "\u5B66\u751F\u7B54\u9898"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: userCommentVisible ? /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item === null || item === void 0 ? void 0 : (_item$user_answer_lig = item.user_answer_light) === null || _item$user_answer_lig === void 0 ? void 0 : _item$user_answer_lig[0]
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: item === null || item === void 0 ? void 0 : (_item$user_answer5 = item.user_answer) === null || _item$user_answer5 === void 0 ? void 0 : _item$user_answer5[0]
|
|
|
})
|
|
|
})]
|
|
|
}) : null, item.question_type === utils_enum/* QuestionType.Program */.c.Program && /*#__PURE__*/(0,jsx_runtime.jsx)(component_Program, {
|
|
|
item: item,
|
|
|
answerData: exportData,
|
|
|
autoHeight: autoHeight
|
|
|
}), item.question_type === utils_enum/* QuestionType.Combine */.c.Combine && /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: (_item$sub_exercise_qu = item.sub_exercise_questions) === null || _item$sub_exercise_qu === void 0 ? void 0 : _item$sub_exercise_qu.map(function (val, key) {
|
|
|
var _val$question_choices, _val$standard_answer;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
marginLeft: 10
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
style: {
|
|
|
fontSize: '16px'
|
|
|
},
|
|
|
children: [i, ".", key + 1, "\uFF08\u5355\u9009\u9898\uFF09", val === null || val === void 0 ? void 0 : val.question_title, "\uFF08", val === null || val === void 0 ? void 0 : val.question_score, "\u5206\uFF09"]
|
|
|
}), (_val$question_choices = val.question_choices) === null || _val$question_choices === void 0 ? void 0 : _val$question_choices.map(function (vals, keys) {
|
|
|
var _val$user_answer;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "25px",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
width: 25,
|
|
|
overflow: "hidden"
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
|
|
|
checked: (_val$user_answer = val.user_answer) === null || _val$user_answer === void 0 ? void 0 : _val$user_answer.includes(vals.choice_id),
|
|
|
style: {
|
|
|
width: 25
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: vals.choice_text || ""
|
|
|
})
|
|
|
})]
|
|
|
}, keys);
|
|
|
}), (val === null || val === void 0 ? void 0 : val.standard_answer_show) && isshowanswer && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font16 ",
|
|
|
children: ["\u6B63\u786E\u7B54\u6848\uFF1A", val === null || val === void 0 ? void 0 : val.standard_answer_show]
|
|
|
}), ((val === null || val === void 0 ? void 0 : val.standard_answer_show) || (val === null || val === void 0 ? void 0 : (_val$standard_answer = val.standard_answer) === null || _val$standard_answer === void 0 ? void 0 : _val$standard_answer.length) > 0) && isshowanswer && /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
style: {
|
|
|
marginTop: 14
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font16 ",
|
|
|
children: "\u89E3\u6790\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
className: Exportmodules.renderHtml,
|
|
|
value: (val === null || val === void 0 ? void 0 : val.analysis) || '暂无解析'
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
})
|
|
|
}), isshowanswer && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
marginTop: 10
|
|
|
},
|
|
|
children: [(item === null || item === void 0 ? void 0 : item.question_type) < 3 && (item === null || item === void 0 ? void 0 : item.standard_answer_show) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font16 ",
|
|
|
children: ["\u6B63\u786E\u7B54\u6848\uFF1A", item === null || item === void 0 ? void 0 : item.standard_answer_show]
|
|
|
}), !!(item !== null && item !== void 0 && (_item$standard_answer = item.standard_answer) !== null && _item$standard_answer !== void 0 && _item$standard_answer.length) && isshowanswer && (item === null || item === void 0 ? void 0 : item.question_type) === 3 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: item === null || item === void 0 ? 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)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: ["\u53C2\u8003\u7B54\u6848\uFF1A\uFF08\u586B\u7A7A", index + 1, "\uFF09:"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(TextArea, {
|
|
|
autoSize: true,
|
|
|
disabled: true,
|
|
|
value: answer === null || answer === void 0 ? void 0 : answer.answer_text[0]
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
})
|
|
|
}), (item === null || item === void 0 ? void 0 : item.standard_answer) && (item === null || item === void 0 ? void 0 : item.question_type) === 4 && /*#__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 ? void 0 : (_item$standard_answer3 = item.standard_answer) === null || _item$standard_answer3 === void 0 ? void 0 : _item$standard_answer3[0]
|
|
|
})
|
|
|
})]
|
|
|
}), (item === null || item === void 0 ? void 0 : item.question_type) <= 4 && ((item === null || item === void 0 ? void 0 : item.standard_answer_show) || (item === null || item === void 0 ? void 0 : (_item$standard_answer4 = item.standard_answer) === null || _item$standard_answer4 === void 0 ? void 0 : _item$standard_answer4.length) > 0) && /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
style: {
|
|
|
marginTop: 14
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font16 ",
|
|
|
children: "\u89E3\u6790\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
className: Exportmodules.renderHtml,
|
|
|
value: (item === null || item === void 0 ? void 0 : item.analysis) || '暂无解析'
|
|
|
})]
|
|
|
})]
|
|
|
}), userScoreVisible && !Number.isNaN(parseFloat(item === null || item === void 0 ? void 0 : item.user_score)) && (item === null || item === void 0 ? void 0 : item.question_type) !== utils_enum/* QuestionType.Shixun */.c.Shixun && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#0152d9'
|
|
|
},
|
|
|
children: "\u5B66\u751F\u5F97\u5206\uFF1A"
|
|
|
}), item === null || item === void 0 ? void 0 : item.user_score, "\u5206"]
|
|
|
}), (item === null || item === void 0 ? void 0 : item.answer_comments) && userCommentVisible && /*#__PURE__*/(0,jsx_runtime.jsx)(AnswerComments/* default */.Z, {
|
|
|
list: item === null || item === void 0 ? void 0 : item.answer_comments
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {
|
|
|
style: isExportBlank.current ? {
|
|
|
marginTop: 30
|
|
|
} : {}
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
|
|
|
//转换中文
|
|
|
var toChinesNum = function toChinesNum(num) {
|
|
|
var changeNum = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九']; //changeNum[0] = "零"
|
|
|
var unit = ["", "十", "百", "千", "万"];
|
|
|
num = parseInt(num);
|
|
|
var getWan = function getWan(temp) {
|
|
|
var strArr = temp.toString().split("").reverse();
|
|
|
var newNum = "";
|
|
|
for (var i = 0; i < strArr.length; i++) {
|
|
|
newNum = (i == 0 && strArr[i] == 0 ? "" : i > 0 && strArr[i] == 0 && strArr[i - 1] == 0 ? "" : changeNum[strArr[i]] + (strArr[i] == 0 ? unit[0] : unit[i])) + newNum;
|
|
|
}
|
|
|
return newNum;
|
|
|
};
|
|
|
var overWan = Math.floor(num / 10000);
|
|
|
var noWan = num % 10000;
|
|
|
if (noWan.toString().length < 4) noWan = "0" + noWan;
|
|
|
return overWan ? getWan(overWan) + "万" + getWan(noWan) : getWan(num);
|
|
|
};
|
|
|
var renderDom = function renderDom(er, key, index) {
|
|
|
if (er.category) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font16 c-light-primary",
|
|
|
children: [toChinesNum(er === null || er === void 0 ? void 0 : er.category), "\u3001", er.name]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "c-grey-999",
|
|
|
children: ["\uFF08\u5171", er.count, "\u9898\uFF0C", (er === null || er === void 0 ? void 0 : er.question_type) === 7 ? "\u5305\u542B".concat(er === null || er === void 0 ? void 0 : er.sub_count, "\u5C0F\u9898\uFF1B") : '', "\u5171", er.score, "\u5206\uFF09"]
|
|
|
})]
|
|
|
}), renderQuestion(er.questionDetail, key)]
|
|
|
});
|
|
|
} else {
|
|
|
return renderQuestion(er.questionDetail, key);
|
|
|
}
|
|
|
};
|
|
|
var renderClassifyQuestion = (0,react.useCallback)(function () {
|
|
|
var _exercise$exerciseExp5, _exercise$exerciseExp6, _Array, _Array$fill, _Array$fill$map, _exportData$exercise_;
|
|
|
var step = (exercise === null || exercise === void 0 ? void 0 : (_exercise$exerciseExp5 = exercise.exerciseExportHeadData) === null || _exercise$exerciseExp5 === void 0 ? void 0 : (_exercise$exerciseExp6 = _exercise$exerciseExp5.exercise_header) === null || _exercise$exerciseExp6 === void 0 ? void 0 : _exercise$exerciseExp6.export_page_num) || 40;
|
|
|
var newData = [];
|
|
|
var questionIndex = 1; //小题题号
|
|
|
var _iterator = createForOfIteratorHelper_default()((exportData === null || exportData === void 0 ? void 0 : (_exportData$exercise_ = exportData.exercise_question_types) === null || _exportData$exercise_ === void 0 ? void 0 : _exportData$exercise_.entries()) || []),
|
|
|
_step;
|
|
|
try {
|
|
|
var _loop3 = function _loop3() {
|
|
|
var _step$value = slicedToArray_default()(_step.value, 2),
|
|
|
categoryIndex = _step$value[0],
|
|
|
questionItem = _step$value[1];
|
|
|
questionItem.items.forEach(function (question, index) {
|
|
|
if (index === 0) {
|
|
|
newData.push(objectSpread2_default()(objectSpread2_default()({}, questionItem), {}, {
|
|
|
items: null,
|
|
|
category: categoryIndex + 1,
|
|
|
questionDetail: question,
|
|
|
questionIndex: questionIndex
|
|
|
}));
|
|
|
} else {
|
|
|
newData.push({
|
|
|
questionDetail: question,
|
|
|
questionIndex: questionIndex
|
|
|
});
|
|
|
}
|
|
|
questionIndex++;
|
|
|
});
|
|
|
};
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
_loop3();
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
if (newData !== null && newData !== void 0 && newData.length) return (_Array = new Array(Math.ceil((newData === null || newData === void 0 ? void 0 : newData.length) / step))) === null || _Array === void 0 ? void 0 : (_Array$fill = _Array.fill([])) === null || _Array$fill === void 0 ? void 0 : (_Array$fill$map = _Array$fill.map(function (item, key) {
|
|
|
return newData.slice(key * step, key * step + step);
|
|
|
})) === null || _Array$fill$map === void 0 ? void 0 : _Array$fill$map.map(function (i, k) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "pl60 pr30",
|
|
|
style: {
|
|
|
minHeight: k === 0 ? 1000 : "auto"
|
|
|
},
|
|
|
children: [k === 0 && /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(Head/* default */.Z, {
|
|
|
isExportBlank: isExportBlank.current
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(divider/* default */.Z, {
|
|
|
className: Exportmodules.divider
|
|
|
})]
|
|
|
}), i === null || i === void 0 ? void 0 : i.map(function (item, index) {
|
|
|
return renderDom(item, item.questionIndex, index);
|
|
|
})]
|
|
|
}, k);
|
|
|
});
|
|
|
return null;
|
|
|
}, [exportData, exercise, autoHeight]);
|
|
|
var _useState21 = (0,react.useState)({
|
|
|
num: 1
|
|
|
}),
|
|
|
_useState22 = slicedToArray_default()(_useState21, 2),
|
|
|
paginationParams = _useState22[0],
|
|
|
setPaginationParams = _useState22[1];
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: "edu-container",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: "animated fadeIn",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
|
className: "mt10",
|
|
|
children: userInfo && /*#__PURE__*/(0,jsx_runtime.jsxs)(breadcrumb/* default */.Z, {
|
|
|
separator: ">",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default.Item */.Z.Item, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
|
to: "/classrooms/".concat(params.coursesId, "/exercise"),
|
|
|
children: userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$course = userInfo.course) === null || _userInfo$course === void 0 ? void 0 : _userInfo$course.course_name
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default.Item */.Z.Item, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
|
to: "/classrooms/".concat(params.coursesId, "/exercise"),
|
|
|
children: "\u8BD5\u5377\u5217\u8868"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default.Item */.Z.Item, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
|
to: "/classrooms/".concat(params.coursesId, "/exercise/").concat(exportData === null || exportData === void 0 ? void 0 : (_exportData$exercise3 = exportData.exercise) === null || _exportData$exercise3 === void 0 ? void 0 : _exportData$exercise3.id, "/detail"),
|
|
|
children: "\u8BD5\u5377\u8BE6\u60C5"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default.Item */.Z.Item, {
|
|
|
children: (exportData === null || exportData === void 0 ? void 0 : (_exportData$exercise_2 = exportData.exercise_answer_user) === null || _exportData$exercise_2 === void 0 ? void 0 : _exportData$exercise_2.user_name) || (exportData === null || exportData === void 0 ? void 0 : (_exportData$exercise4 = exportData.exercise) === null || _exportData$exercise4 === void 0 ? void 0 : _exportData$exercise4.exercise_name)
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
|
className: [Exportmodules.title, 'mt20'].join(' '),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
style: {
|
|
|
width: "100%"
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
flex: "1",
|
|
|
style: {
|
|
|
lineHeight: '24px'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
|
to: "/classrooms/".concat(params.coursesId, "/exercise/").concat(exportData === null || exportData === void 0 ? void 0 : (_exportData$exercise5 = exportData.exercise) === null || _exportData$exercise5 === void 0 ? void 0 : _exportData$exercise5.id, "/detail"),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(ArrowLeftOutlined/* default */.Z, {
|
|
|
className: "font16 c-black"
|
|
|
})
|
|
|
}), (0,util/* exerciseTips */.vB)((_exportData$exercise6 = exportData.exercise) === null || _exportData$exercise6 === void 0 ? void 0 : _exportData$exercise6.exercise_status), /*#__PURE__*/(0,jsx_runtime.jsx)("strong", {
|
|
|
className: "font20 ml5",
|
|
|
children: exportData === null || exportData === void 0 ? void 0 : (_exportData$exercise7 = exportData.exercise) === null || _exportData$exercise7 === void 0 ? void 0 : _exportData$exercise7.exercise_name
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(dropdown/* default */.Z, {
|
|
|
menu: {
|
|
|
items: [{
|
|
|
label: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.Z, {
|
|
|
type: "text",
|
|
|
onClick: function onClick() {
|
|
|
setisshowanswer(true);
|
|
|
setTimeout(function () {
|
|
|
exportReport("");
|
|
|
}, 500);
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(DownloadOutlined/* default */.Z, {}), "\u5BFC\u51FA\u7A7A\u767D\u8BD5\u5377+\u7B54\u6848"]
|
|
|
}),
|
|
|
key: '1',
|
|
|
show: true
|
|
|
}, {
|
|
|
label: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.Z, {
|
|
|
type: "text",
|
|
|
onClick: function onClick() {
|
|
|
return exportReport("");
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(DownloadOutlined/* default */.Z, {}), "\u5BFC\u51FA\u7A7A\u767D\u8BD5\u5377"]
|
|
|
}),
|
|
|
key: '2',
|
|
|
show: true
|
|
|
}, {
|
|
|
label: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.Z, {
|
|
|
type: "text",
|
|
|
onClick: function onClick() {
|
|
|
setismodal(true);
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(DownloadOutlined/* default */.Z, {}), "\u5BFC\u51FA\u6240\u6709\u5B66\u751F\u8BD5\u5377"]
|
|
|
}),
|
|
|
key: '3',
|
|
|
show: (0,authority/* isAdmin */.GJ)()
|
|
|
}].filter(function (item) {
|
|
|
return item.show;
|
|
|
}).map(function (item) {
|
|
|
return {
|
|
|
label: item.label,
|
|
|
key: item.key
|
|
|
};
|
|
|
})
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.Z, {
|
|
|
className: Exportmodules.exportBtn,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(DeliveredProcedureOutlined/* default */.Z, {}), "\u5BFC\u51FA", /*#__PURE__*/(0,jsx_runtime.jsx)(CaretDownOutlined/* default */.Z, {})]
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
className: "ml20",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)(SettingOutlined/* default */.Z, {}),
|
|
|
className: Exportmodules.exportBtn,
|
|
|
onClick: function onClick() {
|
|
|
dispatch({
|
|
|
type: 'exercise/setActionTabs',
|
|
|
payload: {
|
|
|
key: 'exportSetting'
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
children: "\u5BFC\u51FA\u8BBE\u7F6E"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {})]
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_modal/* default */.Z, {
|
|
|
title: '导出试卷选择'
|
|
|
// okText='是'
|
|
|
,
|
|
|
open: ismodal
|
|
|
// cancelText="否"
|
|
|
,
|
|
|
footer: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
type: "primary",
|
|
|
onClick: function onClick() {
|
|
|
setUserCommentVisible(true);
|
|
|
setUserScoreVisible(true);
|
|
|
setismodal(false);
|
|
|
exportReport("all");
|
|
|
},
|
|
|
children: "\u662F"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
onClick: function onClick() {
|
|
|
setUserScoreVisible(true);
|
|
|
setismodal(false);
|
|
|
exportReport("all");
|
|
|
},
|
|
|
children: "\u5426"
|
|
|
})]
|
|
|
}),
|
|
|
onCancel: function onCancel() {
|
|
|
return setismodal(false);
|
|
|
},
|
|
|
children: "\u662F\u5426\u8FDE\u540C\u8BC4\u9605\u6559\u5E08\u3001\u6559\u5E08\u8BC4\u8BED\u4E00\u8D77\u5BFC\u51FA\uFF1F"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "".concat(Exportmodules.bg, " pt30 mt20"),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(pagination/* default */.Z, {
|
|
|
className: "".concat(Exportmodules.paginationWrapper),
|
|
|
showTotal: function showTotal(total) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: Exportmodules.totalText,
|
|
|
children: ["\u5171\u8BA1", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: Exportmodules.num,
|
|
|
children: total
|
|
|
}), "\u4EFD\u8BD5\u5377"]
|
|
|
});
|
|
|
},
|
|
|
total: exportData === null || exportData === void 0 ? void 0 : exportData.exercise_count,
|
|
|
pageSize: 1,
|
|
|
current: paginationParams.num,
|
|
|
showSizeChanger: false,
|
|
|
onChange: /*#__PURE__*/function () {
|
|
|
var _ref7 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee7(page) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee7$(_context9) {
|
|
|
while (1) switch (_context9.prev = _context9.next) {
|
|
|
case 0:
|
|
|
setPaginationParams({
|
|
|
num: page
|
|
|
});
|
|
|
_context9.next = 3;
|
|
|
return dispatch({
|
|
|
type: 'exercise/editExercise',
|
|
|
payload: {
|
|
|
coursesId: params.coursesId,
|
|
|
categoryId: params.exerciseId,
|
|
|
num: page - 1
|
|
|
}
|
|
|
});
|
|
|
case 3:
|
|
|
res = _context9.sent;
|
|
|
setExportData(res);
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context9.stop();
|
|
|
}
|
|
|
}, _callee7);
|
|
|
}));
|
|
|
return function (_x4) {
|
|
|
return _ref7.apply(this, arguments);
|
|
|
};
|
|
|
}(),
|
|
|
showQuickJumper: true,
|
|
|
hideOnSinglePage: false
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
|
id: "export-all",
|
|
|
className: [Exportmodules.bg, 'pt30', 'pb30', 'mt20', 'mb20', 'relative'].join(' '),
|
|
|
ref: exportElement,
|
|
|
children: renderClassifyQuestion()
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var Exercise_Export = ((0,_umi_production_exports.connect)(function (_ref8) {
|
|
|
var exercise = _ref8.exercise,
|
|
|
loading = _ref8.loading,
|
|
|
user = _ref8.user,
|
|
|
globalSetting = _ref8.globalSetting;
|
|
|
return {
|
|
|
exercise: exercise,
|
|
|
globalSetting: globalSetting,
|
|
|
user: user,
|
|
|
loading: loading.effects
|
|
|
};
|
|
|
})(Export));
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 37537:
|
|
|
/*!***************************************************************************************************!*\
|
|
|
!*** ./src/pages/Classrooms/Lists/Exercise/Review/component/AnswerComments/index.tsx + 1 modules ***!
|
|
|
\***************************************************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"Z": function() { return /* binding */ component_AnswerComments; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/row/style/index.js
|
|
|
var style = __webpack_require__(13062);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/row/index.js
|
|
|
var row = __webpack_require__(71230);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
|
var react = __webpack_require__(67294);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Review/component/AnswerComments/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var AnswerCommentsmodules = ({"flex_box_center":"flex_box_center___hzSR8","flex_space_between":"flex_space_between___Mscip","flex_box_vertical_center":"flex_box_vertical_center___Uckau","flex_box_center_end":"flex_box_center_end___Kw1tf","flex_box_column":"flex_box_column___udgQE","comments":"comments___He0El","line":"line___P3zVB"});
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
|
var env = __webpack_require__(59758);
|
|
|
// EXTERNAL MODULE: ./node_modules/moment/moment.js
|
|
|
var moment = __webpack_require__(30381);
|
|
|
var moment_default = /*#__PURE__*/__webpack_require__.n(moment);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Review/component/AnswerComments/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var AnswerComments = function AnswerComments(_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;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "mt20",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: env/* default.API_SERVER */.Z.API_SERVER + '/images/' + ((_v$user2 = v.user) === null || _v$user2 === void 0 ? void 0 : _v$user2.image_url),
|
|
|
width: "40",
|
|
|
style: {
|
|
|
borderRadius: 40
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "ml10 font16",
|
|
|
children: (_v$user3 = v.user) === null || _v$user3 === void 0 ? void 0 : _v$user3.name
|
|
|
})]
|
|
|
}, v === null || v === void 0 ? void 0 : (_v$user = v.user) === null || _v$user === void 0 ? void 0 : _v$user.user_id), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: AnswerCommentsmodules.comments,
|
|
|
children: v === null || v === void 0 ? void 0 : (_v$comments = v.comments) === null || _v$comments === void 0 ? void 0 : _v$comments.map(function (e, i) {
|
|
|
var _v$user4, _v$comments2;
|
|
|
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"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
flexShrink: 0
|
|
|
},
|
|
|
children: moment_default()(e.updated_at).format('YYYY-MM-DD HH:mm')
|
|
|
})]
|
|
|
}), !!e.comment && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["\u8BC4\u8BED\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-light-primary",
|
|
|
children: e.comment
|
|
|
})]
|
|
|
}), (v === null || v === void 0 ? void 0 : (_v$comments2 = v.comments) === null || _v$comments2 === void 0 ? void 0 : _v$comments2.length) - 1 > i && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: AnswerCommentsmodules.line
|
|
|
})]
|
|
|
}, (v === null || v === void 0 ? void 0 : (_v$user4 = v.user) === null || _v$user4 === void 0 ? void 0 : _v$user4.user_id) + '-' + i);
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var component_AnswerComments = (AnswerComments);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 19637:
|
|
|
/*!***********************************************************************!*\
|
|
|
!*** ./src/pages/Classrooms/Lists/Exercise/Review/component/Fill.tsx ***!
|
|
|
\***********************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/objectSpread2.js */ 42122);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/slicedToArray.js */ 27424);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
/* harmony import */ var antd_es_input_style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! antd/es/input/style */ 69463);
|
|
|
/* harmony import */ var antd_es_input__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! antd/es/input */ 75008);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ 67294);
|
|
|
/* harmony import */ var _components_RenderHtml__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/components/RenderHtml */ 12768);
|
|
|
/* harmony import */ var _SeeAnswer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./SeeAnswer */ 18707);
|
|
|
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./index.less?modules */ 1446);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ 85893);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TextArea = antd_es_input__WEBPACK_IMPORTED_MODULE_8__/* ["default"].TextArea */ .Z.TextArea;
|
|
|
var Fill = function Fill(_ref) {
|
|
|
var item = _ref.item,
|
|
|
answerData = _ref.answerData,
|
|
|
changeScoreData = _ref.changeScoreData,
|
|
|
textValue = _ref.textValue,
|
|
|
_ref$textOnChange = _ref.textOnChange,
|
|
|
textOnChange = _ref$textOnChange === void 0 ? function () {} : _ref$textOnChange,
|
|
|
_ref$seeAnswerVisible = _ref.seeAnswerVisible,
|
|
|
seeAnswerVisible = _ref$seeAnswerVisible === void 0 ? true : _ref$seeAnswerVisible;
|
|
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_3__.useState)([]),
|
|
|
_useState2 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState, 2),
|
|
|
userAnswer = _useState2[0],
|
|
|
setUserAnswer = _useState2[1];
|
|
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(false),
|
|
|
_useState4 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState3, 2),
|
|
|
showEdit = _useState4[0],
|
|
|
setShowEdit = _useState4[1];
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_3__.useEffect)(function () {
|
|
|
if (changeScoreData !== null && changeScoreData !== void 0 && changeScoreData[item.q_position]) {
|
|
|
!showEdit && setShowEdit(true);
|
|
|
} else {
|
|
|
showEdit && setShowEdit(false);
|
|
|
}
|
|
|
}, [changeScoreData === null || changeScoreData === void 0 ? void 0 : changeScoreData[item === null || item === void 0 ? void 0 : item.q_position]]);
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_3__.useEffect)(function () {
|
|
|
var data = [];
|
|
|
var _loop = function _loop(i) {
|
|
|
var _item$user_answer;
|
|
|
var param = (item === null || item === void 0 ? 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(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, param));
|
|
|
};
|
|
|
for (var i = 0; i < (item === null || item === void 0 ? void 0 : item.multi_count); i++) {
|
|
|
_loop(i);
|
|
|
}
|
|
|
setUserAnswer(data);
|
|
|
}, [item === null || item === void 0 ? void 0 : item.user_answer]);
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div", {
|
|
|
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_6__/* ["default"].fillBg */ .Z.fillBg,
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("aside", {
|
|
|
className: "font14 c-light-primary mb5",
|
|
|
children: "\u5B66\u751F\u7B54\u9898"
|
|
|
}), userAnswer === null || userAnswer === void 0 ? void 0 : userAnswer.map(function (answer, index) {
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("span", {
|
|
|
children: ["\u7B54\u6848(\u586B\u7A7A", index + 1, "):"]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_components_RenderHtml__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
|
|
|
value: answer === null || answer === void 0 ? void 0 : answer.answer_text
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
}), seeAnswerVisible && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_SeeAnswer__WEBPACK_IMPORTED_MODULE_5__/* .SeeAnswer */ .u, {
|
|
|
data: item
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ __webpack_exports__["Z"] = (Fill);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 18707:
|
|
|
/*!****************************************************************************!*\
|
|
|
!*** ./src/pages/Classrooms/Lists/Exercise/Review/component/SeeAnswer.tsx ***!
|
|
|
\****************************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ "u": function() { return /* binding */ SeeAnswer; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var antd_es_row_style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/es/row/style */ 13062);
|
|
|
/* harmony import */ var antd_es_row__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! antd/es/row */ 71230);
|
|
|
/* harmony import */ var antd_es_col_style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/es/col/style */ 89032);
|
|
|
/* harmony import */ var antd_es_col__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd/es/col */ 15746);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/slicedToArray.js */ 27424);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ 67294);
|
|
|
/* harmony import */ var _components_RenderHtml__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/components/RenderHtml */ 12768);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ 85893);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var SeeAnswer = function SeeAnswer(_ref) {
|
|
|
var data = _ref.data;
|
|
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(false),
|
|
|
_useState2 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_2___default()(_useState, 2),
|
|
|
show = _useState2[0],
|
|
|
setShow = _useState2[1];
|
|
|
var renderDom = function renderDom() {
|
|
|
var _data$standard_answer, _data$standard_answer2;
|
|
|
switch (data.question_type) {
|
|
|
case 3:
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("aside", {
|
|
|
className: "mt20",
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("span", {
|
|
|
style: {
|
|
|
cursor: "pointer"
|
|
|
},
|
|
|
className: "font14 c-blue current",
|
|
|
onClick: function onClick() {
|
|
|
setShow(!show);
|
|
|
},
|
|
|
children: show ? "隐藏参考答案" : "查看参考答案"
|
|
|
}), show && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", {
|
|
|
children: data === null || data === void 0 ? void 0 : (_data$standard_answer = data.standard_answer) === null || _data$standard_answer === void 0 ? void 0 : _data$standard_answer.map(function (item, key) {
|
|
|
var _item$answer_text;
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(antd_es_row__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
|
|
|
style: {
|
|
|
alignItems: 'baseline'
|
|
|
},
|
|
|
className: "mr20",
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(antd_es_col__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, {
|
|
|
flex: "50px",
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("span", {
|
|
|
className: "mt10",
|
|
|
children: ["\u586B\u7A7A", item.choice_id, ":"]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(antd_es_col__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, {
|
|
|
flex: 1,
|
|
|
children: item === null || item === void 0 ? void 0 : (_item$answer_text = item.answer_text) === null || _item$answer_text === void 0 ? void 0 : _item$answer_text.map(function (val, key) {
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", {
|
|
|
children: val
|
|
|
});
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case 4:
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("aside", {
|
|
|
className: "mt20",
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("span", {
|
|
|
style: {
|
|
|
cursor: "pointer"
|
|
|
},
|
|
|
className: "font14 c-blue current",
|
|
|
onClick: function onClick() {
|
|
|
setShow(!show);
|
|
|
},
|
|
|
children: show ? "隐藏参考答案" : "查看参考答案"
|
|
|
}), show && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", {
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_components_RenderHtml__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
|
|
|
value: data === null || data === void 0 ? void 0 : (_data$standard_answer2 = data.standard_answer) === null || _data$standard_answer2 === void 0 ? void 0 : _data$standard_answer2.join(" ")
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
}
|
|
|
};
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("section", {
|
|
|
children: renderDom()
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 70960:
|
|
|
/*!***************************!*\
|
|
|
!*** ./src/utils/enum.ts ***!
|
|
|
\***************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ "c": function() { return /* binding */ QuestionType; }
|
|
|
/* harmony export */ });
|
|
|
/* unused harmony export PageType */
|
|
|
var PageType;
|
|
|
(function (PageType) {
|
|
|
PageType["FirstPage"] = "firstPage";
|
|
|
PageType["PrevPage"] = "prevPage";
|
|
|
PageType["NextPage"] = "nextPage";
|
|
|
})(PageType || (PageType = {}));
|
|
|
var QuestionType;
|
|
|
(function (QuestionType) {
|
|
|
QuestionType[QuestionType["Single"] = 0] = "Single";
|
|
|
QuestionType[QuestionType["Multiple"] = 1] = "Multiple";
|
|
|
QuestionType[QuestionType["Judge"] = 2] = "Judge";
|
|
|
QuestionType[QuestionType["Fill"] = 3] = "Fill";
|
|
|
QuestionType[QuestionType["Subjective"] = 4] = "Subjective";
|
|
|
QuestionType[QuestionType["Shixun"] = 5] = "Shixun";
|
|
|
QuestionType[QuestionType["Program"] = 6] = "Program";
|
|
|
QuestionType[QuestionType["Combine"] = 7] = "Combine";
|
|
|
})(QuestionType || (QuestionType = {}));
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 1446:
|
|
|
/*!*********************************************************************************!*\
|
|
|
!*** ./src/pages/Classrooms/Lists/Exercise/Review/component/index.less?modules ***!
|
|
|
\*********************************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__) {
|
|
|
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ __webpack_exports__["Z"] = ({"flex_box_center":"flex_box_center___VAUts","flex_space_between":"flex_space_between___gx5ZV","flex_box_vertical_center":"flex_box_vertical_center___HV_tL","flex_box_center_end":"flex_box_center_end___fVsIw","flex_box_column":"flex_box_column___F5DHk","shixunWrp":"shixunWrp___pinaF","s":"s___mtpV4","fillComment":"fillComment___WEgkI","commentContent":"commentContent___v_Ebo","commentText":"commentText___fyDle","simpleWrap":"simpleWrap___uwIie","fillBg":"fillBg___iyMsm","simpleBg":"simpleBg___UqElF","lookCode":"lookCode___xKifS"});
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 37729:
|
|
|
/*!***********************************************************************!*\
|
|
|
!*** ./src/pages/Classrooms/Lists/Exercise/Review/index.less?modules ***!
|
|
|
\***********************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__) {
|
|
|
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ __webpack_exports__["Z"] = ({"flex_box_center":"flex_box_center___D6Qly","flex_space_between":"flex_space_between___ZA98O","flex_box_vertical_center":"flex_box_vertical_center___aST6E","flex_box_center_end":"flex_box_center_end___kJ_eQ","flex_box_column":"flex_box_column___ZOkyZ","bg":"bg___rbSyL","circularBlue":"circularBlue___qvnla","circularRed":"circularRed___jo0FU","circularOrange":"circularOrange___GteY7","circularGreen":"circularGreen___PW_tz","circularGrey":"circularGrey___Nt7Wc","title":"title___Volf5","questionIcons":"questionIcons___MIxzq","grey":"grey___XquYB","green":"green___sjsXt","blue":"blue___Jwa9H","orange":"orange___cGfa7","red":"red___NensB","greenTip":"greenTip___lDmky","redTip":"redTip___Yp9nM","cccTip":"cccTip___Uzudc","orangeTip":"orangeTip___gA104","flexRow":"flexRow___GsOMs","simpleWrap":"simpleWrap___jppmP","userPhoto":"userPhoto___LUsoO","CCCIcons":"CCCIcons___STbxr","buttonFixed":"buttonFixed___aUnd3","typeTitle":"typeTitle___i1hJu","answerResult":"answerResult___kLknn","questionsInfo":"questionsInfo___spnx1","leftBar":"leftBar___AjrjB","greenBg":"greenBg___nlTOV","blueBg":"blueBg___nYACT","redBg":"redBg___WTgtT","orangeBg":"orangeBg___mMAXu","greyBg":"greyBg___eAdgQ","commentText":"commentText___smAVm","full":"full____Rgkm","answerInfo":"answerInfo___iSSvg","listType":"listType___fUHyn"});
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
}]); |