|
|
"use strict";
|
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[77460,12768,67570,8423],{
|
|
|
|
|
|
/***/ 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';
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 36579:
|
|
|
/*!*********************************************************!*\
|
|
|
!*** ./src/components/PreviewAll/index.tsx + 1 modules ***!
|
|
|
\*********************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"Z": function() { return /* binding */ PreviewAll; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/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/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: ./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/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/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/PreviewAll/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var PreviewAllmodules = ({"wrp":"wrp___dq7YK","bgBlack":"bgBlack___ARIUV","monaco":"monaco___VnZC3","darkBlue":"darkBlue___UprA9","close":"close___LKoWu","embed":"embed___hvpEJ"});
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/ArrowDownOutlined.js + 1 modules
|
|
|
var ArrowDownOutlined = __webpack_require__(77171);
|
|
|
// EXTERNAL MODULE: ./src/components/monaco-editor/index.jsx + 3 modules
|
|
|
var monaco_editor = __webpack_require__(8691);
|
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
|
var util = __webpack_require__(29427);
|
|
|
// EXTERNAL MODULE: ./src/service/exercise.ts
|
|
|
var exercise = __webpack_require__(51412);
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
|
var env = __webpack_require__(59758);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
|
;// CONCATENATED MODULE: ./src/components/PreviewAll/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* harmony default export */ var PreviewAll = (function (_ref) {
|
|
|
var _data, _data2, _data3, _data4, _data5, _data6;
|
|
|
var _ref$editOffice = _ref.editOffice,
|
|
|
editOffice = _ref$editOffice === void 0 ? 'view' : _ref$editOffice,
|
|
|
data = _ref.data,
|
|
|
theme = _ref.theme,
|
|
|
type = _ref.type,
|
|
|
filename = _ref.filename,
|
|
|
monacoEditor = _ref.monacoEditor,
|
|
|
className = _ref.className,
|
|
|
style = _ref.style,
|
|
|
close = _ref.close,
|
|
|
onClose = _ref.onClose,
|
|
|
hasMask = _ref.hasMask,
|
|
|
disabledDownload = _ref.disabledDownload,
|
|
|
onImgDimensions = _ref.onImgDimensions;
|
|
|
var _useState = (0,react.useState)('https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt'),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
src = _useState2[0],
|
|
|
setSrc = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)(""),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
token = _useState4[0],
|
|
|
setToken = _useState4[1];
|
|
|
var _useState5 = (0,react.useState)(),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
officeData = _useState6[0],
|
|
|
setOfficeData = _useState6[1];
|
|
|
var officePath = window.ENV === "build" ? "/react/build" : "";
|
|
|
var apiServer = location.host.startsWith("localhost") ? env/* default.PROXY_SERVER */.Z.PROXY_SERVER : env/* default.API_SERVER */.Z.API_SERVER;
|
|
|
var size;
|
|
|
var unit = 1024 * 1024;
|
|
|
var maxSize = 10 * unit;
|
|
|
var closeRef = (0,react.useRef)();
|
|
|
if ((_data = data) !== null && _data !== void 0 && _data.startsWith("/api") && type !== "txt") {
|
|
|
data = env/* default.API_SERVER */.Z.API_SERVER + data;
|
|
|
}
|
|
|
if (type === "office") {
|
|
|
size = (0,util/* parseUrl */.en)(data).filesize;
|
|
|
if (size > maxSize) {
|
|
|
type = "other";
|
|
|
}
|
|
|
}
|
|
|
if (filename) monacoEditor.filename = filename;
|
|
|
(0,react.useEffect)(function () {
|
|
|
var _document$cookie, _document$cookie$repl;
|
|
|
var cookies = (_document$cookie = document.cookie) === null || _document$cookie === void 0 ? void 0 : (_document$cookie$repl = _document$cookie.replace(/\s/g, "")) === null || _document$cookie$repl === void 0 ? void 0 : _document$cookie$repl.split(";");
|
|
|
cookies === null || cookies === void 0 ? void 0 : cookies.map(function (item) {
|
|
|
var i = item.split("=");
|
|
|
if (i[0] === '_educoder_session') {
|
|
|
setToken(i[1]);
|
|
|
}
|
|
|
});
|
|
|
}, []);
|
|
|
(0,react.useEffect)(function () {
|
|
|
if (type === "office") getData();
|
|
|
}, [type, data]);
|
|
|
var getData = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var _url, _id, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
console.log("data:", data);
|
|
|
_url = data;
|
|
|
if (!data.startsWith("http")) {
|
|
|
_url = location.origin + _url;
|
|
|
}
|
|
|
_id = new URL(_url).pathname.split("/").pop();
|
|
|
_context.next = 6;
|
|
|
return (0,exercise/* setEcsAttachment */.gJ)({
|
|
|
attachment_id: _id
|
|
|
});
|
|
|
case 6:
|
|
|
res = _context.sent;
|
|
|
setOfficeData(res);
|
|
|
case 8:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function getData() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleClick = function handleClick() {
|
|
|
if (data.startsWith("http") || data.startsWith('blob:')) {
|
|
|
handleDown();
|
|
|
return;
|
|
|
}
|
|
|
(0,util/* downloadFile */.Sv)(filename || 'educoder', data, filename);
|
|
|
};
|
|
|
var handleDown = function handleDown() {
|
|
|
(0,util/* downLoadLink */.Nd)(filename || 'educoder', decodeURIComponent(data));
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: objectSpread2_default()({}, style || {}),
|
|
|
className: "".concat(hasMask && PreviewAllmodules.bgBlack, " ").concat(!!type ? PreviewAllmodules.wrp : "hide"),
|
|
|
children: [close && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: PreviewAllmodules.close,
|
|
|
ref: closeRef,
|
|
|
children: [!!onImgDimensions && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",
|
|
|
getPopupContainer: function getPopupContainer() {
|
|
|
return closeRef.current;
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onClick: function onClick() {
|
|
|
onClose();
|
|
|
onImgDimensions();
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "icon-yulanpizhu"
|
|
|
})
|
|
|
})
|
|
|
}), !disabledDownload && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",
|
|
|
getPopupContainer: function getPopupContainer() {
|
|
|
return closeRef.current;
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
onClick: handleDown,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "icon-quxiaozhiding"
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u5173\u95ED",
|
|
|
getPopupContainer: function getPopupContainer() {
|
|
|
return closeRef.current;
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "",
|
|
|
onClick: onClose,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "icon-guanbi1"
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "".concat(PreviewAllmodules[className], " ").concat(className, " ").concat(PreviewAllmodules.monaco, " ").concat(type === "txt" ? "show" : "hide"),
|
|
|
children: type === "txt" && /*#__PURE__*/(0,jsx_runtime.jsx)(monaco_editor/* default */.ZP, objectSpread2_default()({}, monacoEditor))
|
|
|
}), type === "audio" && /*#__PURE__*/(0,jsx_runtime.jsx)("audio", {
|
|
|
src: "".concat(((_data2 = data) === null || _data2 === void 0 ? void 0 : _data2.indexOf("http://")) > -1 || ((_data3 = data) === null || _data3 === void 0 ? void 0 : _data3.indexOf("https://")) > -1 ? "" : "data:audio/mp3;base64,").concat(data),
|
|
|
autoPlay: true
|
|
|
}), type === "video" && /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: ((_data4 = data) === null || _data4 === void 0 ? void 0 : _data4.indexOf("http")) > -1 ? /*#__PURE__*/(0,jsx_runtime.jsx)("video", {
|
|
|
controls: true,
|
|
|
src: "".concat(data),
|
|
|
autoPlay: true
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("video", {
|
|
|
controls: true,
|
|
|
src: "data:video/mp4;base64,".concat(data),
|
|
|
autoPlay: true
|
|
|
})
|
|
|
}), type === 'office' && officeData && /*#__PURE__*/(0,jsx_runtime.jsx)("iframe", {
|
|
|
src: "".concat(officePath, "/office.html?key=").concat(officeData.key, "&url=").concat(apiServer + officeData.url, "&callbackUrl=").concat(apiServer + officeData.callbackUrl, "&fileType=").concat(officeData.fileType, "&title=").concat(officeData.title, "&model=").concat(editOffice, "&officeServer=").concat(env/* default.ONLYOFFICE */.Z.ONLYOFFICE, "&disabledDownload=").concat(!!disabledDownload)
|
|
|
}), type === 'html' && /*#__PURE__*/(0,jsx_runtime.jsx)("iframe", {
|
|
|
src: data + '&disposition=inline'
|
|
|
}), type === 'pdf' && /*#__PURE__*/(0,jsx_runtime.jsx)("iframe", {
|
|
|
src: "".concat(officePath, "/js/pdfview/index.html?url=").concat(data, "&disabledDownload=").concat(!!disabledDownload)
|
|
|
}) //<embed className={styles.embed + "#toolbar=0"} src={data} />
|
|
|
, type === "image" && /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: "".concat(((_data5 = data) === null || _data5 === void 0 ? void 0 : _data5.indexOf("http://")) > -1 || ((_data6 = data) === null || _data6 === void 0 ? void 0 : _data6.indexOf("https://")) > -1 ? "" : "data:image/png;base64,").concat(data)
|
|
|
}), type === "other" && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.Z, {
|
|
|
type: "primary",
|
|
|
size: "large",
|
|
|
onClick: handleClick,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ArrowDownOutlined/* default */.Z, {}), "\u70B9\u51FB\u4E0B\u8F7D"]
|
|
|
})
|
|
|
}), type === "download" && /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.Z, {
|
|
|
type: "primary",
|
|
|
size: "large",
|
|
|
onClick: handleClick,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ArrowDownOutlined/* default */.Z, {}), "\u70B9\u51FB\u4E0B\u8F7D"]
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 12768:
|
|
|
/*!*********************************************************!*\
|
|
|
!*** ./src/components/RenderHtml/index.tsx + 1 modules ***!
|
|
|
\*********************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"Z": function() { return /* binding */ RenderHtml; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/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: ./node_modules/katex/dist/katex.min.css
|
|
|
var katex_min = __webpack_require__(81897);
|
|
|
// EXTERNAL MODULE: ./node_modules/marked/lib/marked.js
|
|
|
var marked = __webpack_require__(47084);
|
|
|
var marked_default = /*#__PURE__*/__webpack_require__.n(marked);
|
|
|
// EXTERNAL MODULE: ./node_modules/marked/src/helpers.js
|
|
|
var helpers = __webpack_require__(90621);
|
|
|
;// CONCATENATED MODULE: ./src/utils/marked.ts
|
|
|
|
|
|
|
|
|
|
|
|
function indentCodeCompensation(raw, text) {
|
|
|
var matchIndentToCode = raw.match(/^(\s+)(?:```)/);
|
|
|
if (matchIndentToCode === null) {
|
|
|
return text;
|
|
|
}
|
|
|
var indentToCode = matchIndentToCode[1];
|
|
|
return text.split('\n').map(function (node) {
|
|
|
var matchIndentInNode = node.match(/^\s+/);
|
|
|
if (matchIndentInNode === null) {
|
|
|
return node;
|
|
|
}
|
|
|
var _matchIndentInNode = slicedToArray_default()(matchIndentInNode, 1),
|
|
|
indentInNode = _matchIndentInNode[0];
|
|
|
if (indentInNode.length >= indentToCode.length) {
|
|
|
return node.slice(indentToCode.length);
|
|
|
}
|
|
|
return node;
|
|
|
}).join('\n');
|
|
|
}
|
|
|
//兼容之前的 ##标题式写法
|
|
|
var toc = [];
|
|
|
var ctx = ["<ul>"];
|
|
|
var renderer = new (marked_default()).Renderer();
|
|
|
var headingRegex = /^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;
|
|
|
function cleanToc() {
|
|
|
toc.length = 0;
|
|
|
ctx = ["<ul>"];
|
|
|
}
|
|
|
var lines = {
|
|
|
overflow: "hidden",
|
|
|
WebkitBoxOrient: "vertical",
|
|
|
display: "-webkit-box",
|
|
|
WebkitLineClamp: 2
|
|
|
};
|
|
|
function buildToc(coll, k, level, ctx) {
|
|
|
if (k >= coll.length || coll[k].level <= level) {
|
|
|
return k;
|
|
|
}
|
|
|
var node = coll[k];
|
|
|
ctx.push("<li><a href='#" + node.anchor + "'>" + node.text + "</a>");
|
|
|
k++;
|
|
|
var childCtx = [];
|
|
|
k = buildToc(coll, k, node.level, childCtx);
|
|
|
if (childCtx.length > 0) {
|
|
|
ctx.push("<ul>");
|
|
|
childCtx.forEach(function (idm) {
|
|
|
ctx.push(idm);
|
|
|
});
|
|
|
ctx.push("</ul>");
|
|
|
}
|
|
|
ctx.push("</li>");
|
|
|
k = buildToc(coll, k, level, ctx);
|
|
|
return k;
|
|
|
}
|
|
|
function getTocContent() {
|
|
|
buildToc(toc, 0, 0, ctx);
|
|
|
ctx.push("</ul>");
|
|
|
return ctx.join("");
|
|
|
}
|
|
|
var tokenizer = {
|
|
|
heading: function heading(src) {
|
|
|
var cap = headingRegex.exec(src);
|
|
|
if (cap) {
|
|
|
return {
|
|
|
type: 'heading',
|
|
|
raw: cap[0],
|
|
|
depth: cap[1].length,
|
|
|
text: cap[2]
|
|
|
};
|
|
|
}
|
|
|
},
|
|
|
fences: function fences(src) {
|
|
|
var cap = this.rules.block.fences.exec(src);
|
|
|
if (cap) {
|
|
|
var raw = cap[0];
|
|
|
var text = indentCodeCompensation(raw, cap[3] || '');
|
|
|
var lang = cap[2] ? cap[2].trim() : cap[2];
|
|
|
if (['latex', 'katex', 'math'].indexOf(lang) >= 0) {
|
|
|
var id = next_id();
|
|
|
var expression = text;
|
|
|
text = id;
|
|
|
math_expressions[id] = {
|
|
|
type: 'block',
|
|
|
expression: expression
|
|
|
};
|
|
|
}
|
|
|
return {
|
|
|
type: 'code',
|
|
|
raw: raw,
|
|
|
lang: lang,
|
|
|
text: text
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
var latexRegex = /(?:\${2})([^\n`]+?)(?:\${2})/gi;
|
|
|
var katex_count = 0;
|
|
|
var next_id = function next_id() {
|
|
|
return "__special_katext_id_".concat(katex_count++, "__");
|
|
|
};
|
|
|
var math_expressions = {};
|
|
|
function getMathExpressions() {
|
|
|
return math_expressions;
|
|
|
}
|
|
|
function resetMathExpressions() {
|
|
|
katex_count = 0;
|
|
|
math_expressions = {};
|
|
|
}
|
|
|
function replace_math_with_ids(text) {
|
|
|
text = text.replace(latexRegex, function (_match, expression) {
|
|
|
var id = next_id();
|
|
|
math_expressions[id] = {
|
|
|
type: 'inline',
|
|
|
expression: expression
|
|
|
};
|
|
|
return id;
|
|
|
});
|
|
|
return text;
|
|
|
}
|
|
|
var original_listitem = renderer.listitem;
|
|
|
renderer.listitem = function (text) {
|
|
|
return original_listitem(replace_math_with_ids(text));
|
|
|
};
|
|
|
var original_paragraph = renderer.paragraph;
|
|
|
renderer.paragraph = function (text) {
|
|
|
return original_paragraph(replace_math_with_ids(text));
|
|
|
};
|
|
|
var original_tablecell = renderer.tablecell;
|
|
|
renderer.tablecell = function (content, flags) {
|
|
|
return original_tablecell(replace_math_with_ids(content), flags);
|
|
|
};
|
|
|
renderer.code = function (code, infostring, escaped) {
|
|
|
var lang = (infostring || '').match(/\S*/)[0];
|
|
|
if (!lang) {
|
|
|
return '<pre class="prettyprint linenums"><code>' + (escaped ? code : (0,helpers.escape)(code, true)) + '</code></pre>';
|
|
|
}
|
|
|
if (['latex', 'katex', 'math'].indexOf(lang) >= 0) {
|
|
|
return "<p class='editormd-tex'>".concat(code, "</p>");
|
|
|
} else {
|
|
|
return "<pre class=\"prettyprint linenums\"><code class=\"language-".concat(infostring, "\">").concat(escaped ? code : (0,helpers.escape)(code, true), "</code></pre>\n");
|
|
|
}
|
|
|
};
|
|
|
renderer.heading = function (text, level, raw) {
|
|
|
var anchor = this.options.headerPrefix + raw.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g, '-');
|
|
|
toc.push({
|
|
|
anchor: anchor,
|
|
|
level: level,
|
|
|
text: text
|
|
|
});
|
|
|
return '<h' + level + ' id="' + anchor + '">' + text + '</h' + level + '>';
|
|
|
};
|
|
|
marked_default().setOptions({
|
|
|
silent: true,
|
|
|
gfm: true,
|
|
|
pedantic: false
|
|
|
});
|
|
|
marked_default().use({
|
|
|
tokenizer: tokenizer,
|
|
|
renderer: renderer
|
|
|
});
|
|
|
/* harmony default export */ var utils_marked = ((marked_default()));
|
|
|
// EXTERNAL MODULE: ./node_modules/code-prettify/src/prettify.js
|
|
|
var prettify = __webpack_require__(11771);
|
|
|
// EXTERNAL MODULE: ./node_modules/hls.js/dist/hls.js
|
|
|
var dist_hls = __webpack_require__(67631);
|
|
|
var hls_default = /*#__PURE__*/__webpack_require__.n(dist_hls);
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
|
var env = __webpack_require__(59758);
|
|
|
// EXTERNAL MODULE: ./node_modules/katex/dist/katex.js
|
|
|
var katex = __webpack_require__(20527);
|
|
|
// EXTERNAL MODULE: ./node_modules/uuid/dist/esm-browser/v4.js + 4 modules
|
|
|
var v4 = __webpack_require__(25934);
|
|
|
// EXTERNAL MODULE: ./src/components/PreviewAll/index.tsx + 1 modules
|
|
|
var PreviewAll = __webpack_require__(36579);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
|
;// CONCATENATED MODULE: ./src/components/RenderHtml/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var preRegex = /<pre[^>]*>/g;
|
|
|
function _unescape(str) {
|
|
|
var div = document.createElement('div');
|
|
|
div.innerHTML = str;
|
|
|
return div.childNodes.length === 0 ? '' : div.childNodes[0].nodeValue;
|
|
|
}
|
|
|
/* harmony default export */ var RenderHtml = (function (_ref) {
|
|
|
var _ref$value = _ref.value,
|
|
|
value = _ref$value === void 0 ? '' : _ref$value,
|
|
|
className = _ref.className,
|
|
|
showTextOnly = _ref.showTextOnly,
|
|
|
showLines = _ref.showLines,
|
|
|
_ref$style = _ref.style,
|
|
|
style = _ref$style === void 0 ? {} : _ref$style,
|
|
|
_ref$stylesPrev = _ref.stylesPrev,
|
|
|
stylesPrev = _ref$stylesPrev === void 0 ? {} : _ref$stylesPrev;
|
|
|
var str = String(value);
|
|
|
console.log("value:", value);
|
|
|
var _useState = (0,react.useState)(""),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
data = _useState2[0],
|
|
|
setData = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)("office"),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
type = _useState4[0],
|
|
|
setType = _useState4[1];
|
|
|
var classNamesRef = (0,react.useRef)("a" + (0,v4/* default */.Z)());
|
|
|
var html = (0,react.useMemo)(function () {
|
|
|
try {
|
|
|
var reg = /\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g;
|
|
|
var reg2 = /\"\/api\/attachments\/|\"\/attachments\/download\//g;
|
|
|
var reg3 = /\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;
|
|
|
str = str.replace(reg, "(" + env/* default.API_SERVER */.Z.API_SERVER + "/api/attachments/").replace(reg2, '"' + env/* default.API_SERVER */.Z.API_SERVER + "/api/attachments/").replace(reg3, '"' + env/* default.API_SERVER */.Z.API_SERVER + "/files/uploads/").replaceAll("http://video.educoder", "https://video.educoder").replaceAll("http://www.educoder.net/api", "https://data.educoder.net/api").replaceAll("https://www.educoder.net/api", "https://data.educoder.net/api").replace(/\r\n/g, "\n");
|
|
|
// str = str.replace(new RegExp("(?<!\\n)\\n(?!\\n)", "g"), " \n")
|
|
|
} catch (e) {}
|
|
|
;
|
|
|
str = str.replace(/<style.*?>([\s\S]+?)<\/style>/gim, function (_, css) {
|
|
|
var _css = css.replace(/(\n|\r)/g, "").split("}");
|
|
|
var arr = [];
|
|
|
_css.map(function (item) {
|
|
|
if (item != '') {
|
|
|
arr.push(".".concat(classNamesRef.current, " ").concat(item));
|
|
|
}
|
|
|
});
|
|
|
return "<style>".concat(arr.join("}"), "</style>");
|
|
|
});
|
|
|
var rs = utils_marked(str);
|
|
|
var math_expressions = getMathExpressions();
|
|
|
if (str.match(/\[TOC\]/)) {
|
|
|
rs = rs.replace('<p>[TOC]</p>', getTocContent());
|
|
|
cleanToc();
|
|
|
}
|
|
|
rs = rs.replace(/(__special_katext_id_\d+__)/g, function (_match, capture) {
|
|
|
var _math_expressions$cap = math_expressions[capture],
|
|
|
type = _math_expressions$cap.type,
|
|
|
expression = _math_expressions$cap.expression;
|
|
|
return (0,katex.renderToString)(_unescape(expression) || '', {
|
|
|
displayMode: type === 'block',
|
|
|
throwOnError: false,
|
|
|
output: 'html'
|
|
|
});
|
|
|
});
|
|
|
rs = rs.replace(/▁/g, '▁▁▁');
|
|
|
resetMathExpressions();
|
|
|
// return dompurify.sanitize(rs)
|
|
|
var dom = document.createElement('div');
|
|
|
if (showTextOnly) {
|
|
|
dom.innerHTML = rs;
|
|
|
return dom.innerText;
|
|
|
}
|
|
|
dom.innerHTML = rs;
|
|
|
setTimeout(function () {
|
|
|
return onLoad();
|
|
|
}, 500);
|
|
|
return dom.innerHTML;
|
|
|
}, [str]);
|
|
|
var el = (0,react.useRef)();
|
|
|
lines.WebkitLineClamp = showLines;
|
|
|
if (showLines) {
|
|
|
style = objectSpread2_default()(objectSpread2_default()({}, style), lines);
|
|
|
}
|
|
|
function onAncherHandler(e) {
|
|
|
var target = e.target;
|
|
|
if (target.tagName.toUpperCase() === 'A') {
|
|
|
var ancher = target.getAttribute('href');
|
|
|
if (ancher.indexOf("office") > -1) {
|
|
|
e.preventDefault();
|
|
|
setData(ancher);
|
|
|
setType("office");
|
|
|
} else if (ancher.indexOf("application/pdf") > -1) {
|
|
|
e.preventDefault();
|
|
|
setData(ancher);
|
|
|
setType("pdf");
|
|
|
} else if (ancher.indexOf("text/html") > -1) {
|
|
|
e.preventDefault();
|
|
|
setData(ancher);
|
|
|
setType("html");
|
|
|
} else if (ancher.startsWith('#')) {
|
|
|
e.preventDefault();
|
|
|
var viewEl = document.getElementById(ancher.replace('#', ''));
|
|
|
if (viewEl) {
|
|
|
viewEl.scrollIntoView(true);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
var onLoad = function onLoad() {
|
|
|
var _el$current;
|
|
|
var videoElement = (_el$current = el.current) === null || _el$current === void 0 ? void 0 : _el$current.querySelectorAll('video');
|
|
|
videoElement === null || videoElement === void 0 ? void 0 : videoElement.forEach(function (item) {
|
|
|
item.oncontextmenu = function () {
|
|
|
return false;
|
|
|
};
|
|
|
if (item.src.indexOf('.m3u8') > -1) {
|
|
|
if (item.canPlayType('application/vnd.apple.mpegurl')) {} else if (hls_default().isSupported()) {
|
|
|
var hls = new (hls_default())();
|
|
|
hls.loadSource(item.src);
|
|
|
hls.attachMedia(item);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
(0,react.useEffect)(function () {
|
|
|
if (el.current && html) {
|
|
|
if (html.match(preRegex)) {
|
|
|
window.PR.prettyPrint();
|
|
|
}
|
|
|
}
|
|
|
if (el.current) {
|
|
|
el.current.addEventListener('click', onAncherHandler);
|
|
|
return function () {
|
|
|
var _el$current2;
|
|
|
(_el$current2 = el.current) === null || _el$current2 === void 0 ? void 0 : _el$current2.removeEventListener('click', onAncherHandler);
|
|
|
resetMathExpressions();
|
|
|
cleanToc();
|
|
|
};
|
|
|
}
|
|
|
}, [html, el.current, onAncherHandler]);
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
ref: el,
|
|
|
style: objectSpread2_default()({}, style),
|
|
|
className: "".concat(className ? className : '', " markdown-body ").concat(classNamesRef.current),
|
|
|
dangerouslySetInnerHTML: {
|
|
|
__html: html
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(PreviewAll/* default */.Z, {
|
|
|
close: true,
|
|
|
data: data,
|
|
|
type: !!(data !== null && data !== void 0 && data.length) ? type : "",
|
|
|
style: objectSpread2_default()({}, stylesPrev),
|
|
|
onClose: function onClose() {
|
|
|
return setData("");
|
|
|
}
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 8423:
|
|
|
/*!*********************************************************!*\
|
|
|
!*** ./src/components/Video/Play/index.jsx + 1 modules ***!
|
|
|
\*********************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"Z": function() { return /* binding */ Play; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/message/style/index.js + 1 modules
|
|
|
var 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/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/react/index.js
|
|
|
var react = __webpack_require__(67294);
|
|
|
// EXTERNAL MODULE: ./node_modules/flv.js/src/flv.js + 38 modules
|
|
|
var flv = __webpack_require__(99160);
|
|
|
// EXTERNAL MODULE: ./node_modules/hls.js/dist/hls.js
|
|
|
var dist_hls = __webpack_require__(67631);
|
|
|
var hls_default = /*#__PURE__*/__webpack_require__.n(dist_hls);
|
|
|
// EXTERNAL MODULE: ./src/utils/authority.ts
|
|
|
var authority = __webpack_require__(7);
|
|
|
// EXTERNAL MODULE: ./node_modules/react-copy-to-clipboard/lib/index.js
|
|
|
var lib = __webpack_require__(74855);
|
|
|
// EXTERNAL MODULE: ./src/utils/fullscreen.ts
|
|
|
var fullscreen = __webpack_require__(15994);
|
|
|
;// CONCATENATED MODULE: ./src/components/Video/Play/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var Playmodules = ({"watermark":"watermark___hNYlv","videovideo":"videovideo___ovOkV","animate__loop":"animate__loop___mvL6s","upDown":"upDown___SlgHv","container":"container___g1WYG","video-container":"video-container___XPkWR","video-controls":"video-controls___to0Zq","hide":"hide___NA3DV","video-progress":"video-progress___gqHsd","seek":"seek___iZHBm","seek-tooltip":"seek-tooltip___uWyXx","bottom-controls":"bottom-controls___uoIBm","left-controls":"left-controls___mBEx4","right-controls":"right-controls___e9L6r","volume-controls":"volume-controls___fa3mE","fullscreen-button":"fullscreen-button___ur0es","fullscreen-button1":"fullscreen-button1___rfaXm","pip-button":"pip-button___GFO8W","playback-animation":"playback-animation___ndURq","volume":"volume___OTmpP","hidden":"hidden___o7GkT"});
|
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
|
;// CONCATENATED MODULE: ./src/components/Video/Play/index.jsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function formatTime(timeInSeconds) {
|
|
|
if (isNaN(timeInSeconds)) {
|
|
|
return {
|
|
|
minutes: '00',
|
|
|
seconds: '00'
|
|
|
};
|
|
|
}
|
|
|
var result = new Date(timeInSeconds * 1000).toISOString().substr(11, 8);
|
|
|
return {
|
|
|
hour: result.substr(0, 2),
|
|
|
minutes: result.substr(3, 2),
|
|
|
seconds: result.substr(6, 2)
|
|
|
};
|
|
|
}
|
|
|
Object.defineProperty(HTMLMediaElement.prototype, 'playing', {
|
|
|
get: function get() {
|
|
|
return !!(this.currentTime > 0 && !this.paused && !this.ended && this.readyState > 2);
|
|
|
}
|
|
|
});
|
|
|
function compareNumbers(a, b) {
|
|
|
return a - b;
|
|
|
}
|
|
|
function getTotalEffectTime(pos) {
|
|
|
pos.sort(compareNumbers);
|
|
|
var sum = 0;
|
|
|
for (var i = 0; i < pos.length - 1; i++) {
|
|
|
var v = Math.abs(pos[i + 1] - pos[i]);
|
|
|
if (v < 21) {
|
|
|
sum += v;
|
|
|
}
|
|
|
}
|
|
|
return sum;
|
|
|
}
|
|
|
var regex = /(android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini)/i;
|
|
|
//接口文档 https://www.showdoc.cc/educoder?page_id=4029884447803706
|
|
|
/* harmony default export */ var Play = (/*#__PURE__*/(0,react.forwardRef)(function (_ref, ref) {
|
|
|
var _src, _src2, _src2$split;
|
|
|
var src = _ref.src,
|
|
|
toLog = _ref.toLog,
|
|
|
videoId = _ref.videoId,
|
|
|
logWatchHistory = _ref.logWatchHistory,
|
|
|
_ref$courseId = _ref.courseId,
|
|
|
courseId = _ref$courseId === void 0 ? null : _ref$courseId,
|
|
|
startTime = _ref.startTime,
|
|
|
_ref$handlePause = _ref.handlePause,
|
|
|
handlePause = _ref$handlePause === void 0 ? function () {} : _ref$handlePause,
|
|
|
_ref$handlePlay = _ref.handlePlay,
|
|
|
handlePlay = _ref$handlePlay === void 0 ? function () {} : _ref$handlePlay,
|
|
|
_ref$handlePlayEnded = _ref.handlePlayEnded,
|
|
|
handlePlayEnded = _ref$handlePlayEnded === void 0 ? function () {} : _ref$handlePlayEnded,
|
|
|
_ref$videoSpeed = _ref.videoSpeed,
|
|
|
videoSpeed = _ref$videoSpeed === void 0 ? 1 : _ref$videoSpeed;
|
|
|
src = (_src = src) === null || _src === void 0 ? void 0 : _src.replace('http://', 'https://');
|
|
|
var suf = (_src2 = src) === null || _src2 === void 0 ? void 0 : (_src2$split = _src2.split('.')) === null || _src2$split === void 0 ? void 0 : _src2$split.pop();
|
|
|
var isFlv = suf === 'flv';
|
|
|
var el = (0,react.useRef)();
|
|
|
var watermarkRef = (0,react.useRef)();
|
|
|
var warpEl = (0,react.useRef)();
|
|
|
var pauseIcon = (0,react.useRef)();
|
|
|
var playIcon = (0,react.useRef)();
|
|
|
var seekEl = (0,react.useRef)();
|
|
|
var progressBarEl = (0,react.useRef)();
|
|
|
var durationEl = (0,react.useRef)();
|
|
|
var timeElapsedEl = (0,react.useRef)();
|
|
|
var seekTooltipEl = (0,react.useRef)();
|
|
|
var noMuteVolEl = (0,react.useRef)();
|
|
|
var highVolEl = (0,react.useRef)();
|
|
|
var lowVolEl = (0,react.useRef)();
|
|
|
var volumeEl = (0,react.useRef)();
|
|
|
var deviceMatch = navigator.userAgent.toLowerCase().match(regex);
|
|
|
var device = deviceMatch ? deviceMatch[0] : 'pc';
|
|
|
var firstOnPlayFlag = (0,react.useRef)(false);
|
|
|
var user = (0,authority/* userInfo */.eY)();
|
|
|
var totalDuration = 0;
|
|
|
var sumTimePlayed = 0;
|
|
|
var lastUpdatedTime = 0;
|
|
|
var logId = null;
|
|
|
var initLog = false;
|
|
|
var timeTick = 20; //记录频率 默认20s
|
|
|
var logCount = 1;
|
|
|
var isLoging = false;
|
|
|
var isSeeking = false;
|
|
|
var pos = []; //播放时间点集
|
|
|
|
|
|
(0,react.useImperativeHandle)(ref, function () {
|
|
|
return {
|
|
|
getLastUpdatedTime: function getLastUpdatedTime() {
|
|
|
return el.current.currentTime;
|
|
|
},
|
|
|
getDuration: function getDuration() {
|
|
|
return el.current.duration;
|
|
|
}
|
|
|
};
|
|
|
});
|
|
|
var log = (0,react.useCallback)(function (callback) {
|
|
|
var isEnd = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
|
var params = {
|
|
|
point: el.current.currentTime
|
|
|
};
|
|
|
if (logId) {
|
|
|
params['log_id'] = logId;
|
|
|
params['watch_duration'] = getTotalEffectTime(pos); //当前观看视频时长,拖放进度条,重复的视频片段观看时,不会把重复的时长累积进来,最大时长是视频的总时长
|
|
|
params['total_duration'] = sumTimePlayed; //累计观看视频时长,拖放进度条,重复的视频片段观看时,重复观看时长要累积进来
|
|
|
} else {
|
|
|
if (courseId) {
|
|
|
params['video_id'] = parseInt(videoId, 10);
|
|
|
params['course_id'] = courseId;
|
|
|
} else {
|
|
|
params['video_id'] = videoId;
|
|
|
}
|
|
|
params['duration'] = totalDuration;
|
|
|
params['device'] = device;
|
|
|
}
|
|
|
if (isEnd) {
|
|
|
params['ed'] = '1';
|
|
|
}
|
|
|
function getLogId() {
|
|
|
return _getLogId.apply(this, arguments);
|
|
|
}
|
|
|
function _getLogId() {
|
|
|
_getLogId = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var id;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
isLoging = true;
|
|
|
_context.next = 3;
|
|
|
return logWatchHistory(params);
|
|
|
case 3:
|
|
|
id = _context.sent;
|
|
|
logId = id;
|
|
|
isLoging = false;
|
|
|
if (callback) {
|
|
|
callback();
|
|
|
}
|
|
|
case 7:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return _getLogId.apply(this, arguments);
|
|
|
}
|
|
|
getLogId();
|
|
|
}, [videoId, courseId]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
var _src3;
|
|
|
message/* default.destroy */.ZP.destroy();
|
|
|
var player = null;
|
|
|
if (flv/* default.isSupported */.Z.isSupported && isFlv && src && ((_src3 = src) === null || _src3 === void 0 ? void 0 : _src3.indexOf('.m3u8')) < 0) {
|
|
|
player = flv/* default.createPlayer */.Z.createPlayer({
|
|
|
type: 'flv',
|
|
|
volume: 0.8,
|
|
|
cors: true,
|
|
|
url: src,
|
|
|
muted: false
|
|
|
});
|
|
|
if (el.current) {
|
|
|
player.attachMediaElement(el.current);
|
|
|
player.load();
|
|
|
}
|
|
|
} else {
|
|
|
el.current.setAttribute('src', src);
|
|
|
}
|
|
|
updateVolumeIcon();
|
|
|
return function () {
|
|
|
if (player) {
|
|
|
player.unload();
|
|
|
player.pause();
|
|
|
player.destroy();
|
|
|
player = null;
|
|
|
}
|
|
|
};
|
|
|
}, [el, isFlv, src]);
|
|
|
function playIconStatus() {
|
|
|
if (el.current.paused) {
|
|
|
pauseIcon.current.style.display = 'none';
|
|
|
playIcon.current.style.display = 'block';
|
|
|
} else {
|
|
|
pauseIcon.current.style.display = 'block';
|
|
|
playIcon.current.style.display = 'none';
|
|
|
}
|
|
|
}
|
|
|
function updateVolumeIcon() {
|
|
|
noMuteVolEl.current.style.display = 'none';
|
|
|
lowVolEl.current.style.display = 'none';
|
|
|
highVolEl.current.style.display = 'none';
|
|
|
if (el.current.muted || el.current.volume === 0) {
|
|
|
noMuteVolEl.current.style.display = 'block';
|
|
|
} else if (el.current.volume > 0 && el.current.volume <= 0.5) {
|
|
|
lowVolEl.current.style.display = 'block';
|
|
|
} else {
|
|
|
highVolEl.current.style.display = 'block';
|
|
|
}
|
|
|
}
|
|
|
(0,react.useEffect)(function () {
|
|
|
var playButton = document.getElementById('play');
|
|
|
var playbackIcons = document.querySelectorAll('.playback-icons use');
|
|
|
function onPlay() {
|
|
|
handlePlay();
|
|
|
if (startTime && !firstOnPlayFlag.current) {
|
|
|
el.current.currentTime = startTime;
|
|
|
}
|
|
|
firstOnPlayFlag.current = true;
|
|
|
pos.push(el.current.currentTime);
|
|
|
if (!initLog) {
|
|
|
initLog = true;
|
|
|
if (toLog) {
|
|
|
log();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//循环播放, 累计时长不能清空
|
|
|
function onEnded() {
|
|
|
return _onEnded.apply(this, arguments);
|
|
|
}
|
|
|
function _onEnded() {
|
|
|
_onEnded = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
playIconStatus();
|
|
|
pos.push(el.current.currentTime);
|
|
|
if (toLog) {
|
|
|
log(function () {
|
|
|
logId = null;
|
|
|
lastUpdatedTime = 0;
|
|
|
initLog = false;
|
|
|
isLoging = false;
|
|
|
isSeeking = false;
|
|
|
pos = []; //有效时长重新累计,算新的一遍
|
|
|
sumTimePlayed = 0;
|
|
|
logCount = 1;
|
|
|
}, true);
|
|
|
}
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return _onEnded.apply(this, arguments);
|
|
|
}
|
|
|
function updateProgress() {
|
|
|
// seekEl.current.value = Math.floor(el.current.currentTime);
|
|
|
// progressBarEl.current.value = Math.floor(el.current.currentTime);
|
|
|
|
|
|
seekEl.current.value = Math.round(el.current.currentTime);
|
|
|
progressBarEl.current.value = Math.round(el.current.currentTime);
|
|
|
}
|
|
|
function updateTimeElapsed() {
|
|
|
var time = formatTime(Math.round(el.current.currentTime));
|
|
|
timeElapsedEl.current.innerText = "".concat(time.hour > 0 ? time.hour + ':' : '').concat(time.minutes, ":").concat(time.seconds);
|
|
|
timeElapsedEl.current.setAttribute('datetime', "".concat(time.hour > 0 ? ' ' + time.hour + ' ' : '').concat(time.minutes, "m ").concat(time.seconds, "s"));
|
|
|
}
|
|
|
function initializeVideo() {
|
|
|
var videoDuration = Math.round(el.current.duration);
|
|
|
seekEl.current.setAttribute('max', videoDuration);
|
|
|
progressBarEl.current.setAttribute('max', videoDuration);
|
|
|
var time = formatTime(videoDuration);
|
|
|
durationEl.current.innerText = "".concat(time.hour > 0 ? time.hour + ':' : '').concat(time.minutes, ":").concat(time.seconds);
|
|
|
durationEl.current.setAttribute('datetime', "".concat(time.hour > 0 ? ' ' + time.hour + ' ' : '').concat(time.minutes, "m ").concat(time.seconds, "s"));
|
|
|
}
|
|
|
function onTimeupdate() {
|
|
|
var videoDuration = Math.round(el.current.duration);
|
|
|
seekEl.current.setAttribute('max', videoDuration);
|
|
|
progressBarEl.current.setAttribute('max', videoDuration);
|
|
|
var time = formatTime(videoDuration);
|
|
|
durationEl.current.innerText = "".concat(time.hour > 0 ? time.hour + ':' : '').concat(time.minutes, ":").concat(time.seconds);
|
|
|
durationEl.current.setAttribute('datetime', "".concat(time.hour > 0 ? ' ' + time.hour + ' ' : '').concat(time.minutes, "m ").concat(time.seconds, "s"));
|
|
|
updateProgress();
|
|
|
updateTimeElapsed();
|
|
|
var _watermarkRef$current = watermarkRef.current.getBoundingClientRect(),
|
|
|
width = _watermarkRef$current.width,
|
|
|
height = _watermarkRef$current.height,
|
|
|
x = _watermarkRef$current.x,
|
|
|
y = _watermarkRef$current.y;
|
|
|
if (x < 0 || y < 0 || !width) {
|
|
|
// el.current.src = '';
|
|
|
// el.current.pause();
|
|
|
// message.warn({
|
|
|
// content: '当前操作非法,已禁止观看视频',
|
|
|
// key: 'watermarkRef',
|
|
|
// });
|
|
|
return;
|
|
|
}
|
|
|
if (!isSeeking) {
|
|
|
var newTime = el.current.currentTime;
|
|
|
var timeDiff = newTime - lastUpdatedTime;
|
|
|
//currenttime update before Seeking & Seeked fired
|
|
|
if (Math.abs(timeDiff) < 10) {
|
|
|
sumTimePlayed += Math.abs(timeDiff);
|
|
|
lastUpdatedTime = newTime;
|
|
|
if (!isLoging) {
|
|
|
if (sumTimePlayed - logCount * timeTick >= 0) {
|
|
|
logCount++;
|
|
|
pos.push(lastUpdatedTime);
|
|
|
if (toLog) {
|
|
|
log();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
lastUpdatedTime = newTime;
|
|
|
if (toLog) {
|
|
|
log();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
function onSeeking() {
|
|
|
isSeeking = true;
|
|
|
}
|
|
|
function onSeeked() {
|
|
|
if (el.current.playing) {
|
|
|
pos.push(el.current.currentTime, lastUpdatedTime);
|
|
|
}
|
|
|
lastUpdatedTime = el.current.currentTime;
|
|
|
isSeeking = false;
|
|
|
}
|
|
|
function onCanPlay() {
|
|
|
totalDuration = el.current.duration;
|
|
|
if (totalDuration <= 20) {
|
|
|
timeTick = totalDuration / 3;
|
|
|
}
|
|
|
el.current.addEventListener('play', onPlay);
|
|
|
}
|
|
|
function onFullscreenchange(e) {
|
|
|
e.preventDefault();
|
|
|
if ((0,fullscreen/* IsFull */.vp)()) {
|
|
|
el.current.style.width = '100%';
|
|
|
el.current.style.height = '100%';
|
|
|
} else {
|
|
|
el.current.style.cssText = '';
|
|
|
}
|
|
|
}
|
|
|
function onPause() {
|
|
|
handlePause();
|
|
|
}
|
|
|
function skipAhead(event) {
|
|
|
var skipTo = event.target.dataset.seek ? event.target.dataset.seek : event.target.value;
|
|
|
el.current.currentTime = skipTo;
|
|
|
progressBarEl.current.value = skipTo;
|
|
|
seekEl.current.value = skipTo;
|
|
|
}
|
|
|
function updateSeekTooltip(event) {
|
|
|
var skipTo = Math.round(event.offsetX / event.target.clientWidth * parseInt(event.target.getAttribute('max'), 10));
|
|
|
seekEl.current.setAttribute('data-seek', skipTo);
|
|
|
var t = formatTime(skipTo);
|
|
|
seekTooltipEl.current.textContent = "".concat(t.hour > 0 ? t.hour + ':' : '').concat(t.minutes, ":").concat(t.seconds);
|
|
|
var rect = el.current.getBoundingClientRect();
|
|
|
seekTooltipEl.current.style.left = "".concat(event.pageX - rect.left, "px");
|
|
|
}
|
|
|
warpEl.current.addEventListener((0,fullscreen/* fullscreenChange */.gH)(), onFullscreenchange);
|
|
|
el.current.addEventListener('canplay', onCanPlay);
|
|
|
el.current.addEventListener('ended', onEnded);
|
|
|
el.current.addEventListener('seeking', onSeeking);
|
|
|
el.current.addEventListener('seeked', onSeeked);
|
|
|
el.current.addEventListener('loadedmetadata', initializeVideo);
|
|
|
seekEl.current.addEventListener('mousemove', updateSeekTooltip);
|
|
|
seekEl.current.addEventListener('input', skipAhead);
|
|
|
el.current.addEventListener('timeupdate', onTimeupdate);
|
|
|
el.current.addEventListener('pause', onPause);
|
|
|
el.current.addEventListener('volumechange', updateVolumeIcon);
|
|
|
return function () {
|
|
|
var _el$current, _el$current2, _el$current3, _el$current4, _el$current5, _seekEl$current, _seekEl$current2, _el$current6, _el$current7, _el$current8, _el$current9, _el$current10;
|
|
|
(_el$current = el.current) === null || _el$current === void 0 ? void 0 : _el$current.removeEventListener('canplay', onCanPlay);
|
|
|
(_el$current2 = el.current) === null || _el$current2 === void 0 ? void 0 : _el$current2.removeEventListener('play', onPlay);
|
|
|
(_el$current3 = el.current) === null || _el$current3 === void 0 ? void 0 : _el$current3.removeEventListener('ended', onEnded);
|
|
|
(_el$current4 = el.current) === null || _el$current4 === void 0 ? void 0 : _el$current4.removeEventListener('seeking', onSeeking);
|
|
|
(_el$current5 = el.current) === null || _el$current5 === void 0 ? void 0 : _el$current5.removeEventListener('seeked', onSeeked);
|
|
|
(_seekEl$current = seekEl.current) === null || _seekEl$current === void 0 ? void 0 : _seekEl$current.removeEventListener('mousemove', updateSeekTooltip);
|
|
|
(_seekEl$current2 = seekEl.current) === null || _seekEl$current2 === void 0 ? void 0 : _seekEl$current2.removeEventListener('input', skipAhead);
|
|
|
(_el$current6 = el.current) === null || _el$current6 === void 0 ? void 0 : _el$current6.removeEventListener('timeupdate', onTimeupdate);
|
|
|
(_el$current7 = el.current) === null || _el$current7 === void 0 ? void 0 : _el$current7.removeEventListener('pause', onPause);
|
|
|
(_el$current8 = el.current) === null || _el$current8 === void 0 ? void 0 : _el$current8.removeEventListener('loadedmetadata', initializeVideo);
|
|
|
(_el$current9 = el.current) === null || _el$current9 === void 0 ? void 0 : _el$current9.removeEventListener('volumechange', updateVolumeIcon);
|
|
|
if ((_el$current10 = el.current) !== null && _el$current10 !== void 0 && _el$current10.playing) {
|
|
|
pos.push(lastUpdatedTime, el.current.currentTime);
|
|
|
if (toLog) {
|
|
|
log();
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
}, [el, src]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
var _src4;
|
|
|
el.current.onended = function () {
|
|
|
handlePlayEnded(el);
|
|
|
};
|
|
|
el.current.oncontextmenu = function () {
|
|
|
return false;
|
|
|
};
|
|
|
if (((_src4 = src) === null || _src4 === void 0 ? void 0 : _src4.indexOf('.m3u8')) > -1) {
|
|
|
if (el.current.canPlayType('application/vnd.apple.mpegurl')) {
|
|
|
el.current.src = src;
|
|
|
} else if (hls_default().isSupported()) {
|
|
|
var hls = new (hls_default())();
|
|
|
hls.loadSource(src);
|
|
|
hls.attachMedia(el.current);
|
|
|
}
|
|
|
}
|
|
|
}, [src]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
el.current.playbackRate = videoSpeed;
|
|
|
}, [videoSpeed]);
|
|
|
var togglePlay = function togglePlay() {
|
|
|
if (el.current.paused || el.current.ended) {
|
|
|
el.current.play();
|
|
|
} else {
|
|
|
el.current.pause();
|
|
|
}
|
|
|
playIconStatus();
|
|
|
};
|
|
|
function toggleMute() {
|
|
|
el.current.muted = !el.current.muted;
|
|
|
if (el.current.muted) {
|
|
|
volumeEl.current.setAttribute('data-volume', volume.value);
|
|
|
volumeEl.current.value = 0;
|
|
|
} else {
|
|
|
volumeEl.current.value = volumeEl.current.dataset.volume;
|
|
|
}
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
position: 'relative'
|
|
|
},
|
|
|
ref: warpEl,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
ref: watermarkRef,
|
|
|
className: "".concat(Playmodules.watermark, " animated_alternate animate__animated_10s animate__infinite animate__stepstart ").concat(Playmodules.animate__loop),
|
|
|
children: user ? user.login : ' '
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Playmodules.container,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Playmodules["video-container"],
|
|
|
id: "video-container",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Playmodules["playback-animation"],
|
|
|
id: "playback-animation",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("svg", {
|
|
|
className: Playmodules["playback-icons"],
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("use", {
|
|
|
className: "hidden",
|
|
|
href: "#play-icon"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("use", {
|
|
|
href: "#pause"
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("video", {
|
|
|
className: Playmodules.video,
|
|
|
id: "video",
|
|
|
preload: "auto",
|
|
|
disablePictureInPicture: true,
|
|
|
ref: el,
|
|
|
autoPlay: false
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "".concat(Playmodules["video-controls"], " "),
|
|
|
id: "video-controls",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Playmodules["bottom-controls"],
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Playmodules["left-controls"],
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("button", {
|
|
|
"data-title": "\u64AD\u653E/\u6682\u505C",
|
|
|
id: "play",
|
|
|
onClick: togglePlay,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("svg", {
|
|
|
className: Playmodules["playback-icons"],
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("use", {
|
|
|
ref: playIcon,
|
|
|
href: "#play-icon"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("use", {
|
|
|
ref: pauseIcon,
|
|
|
style: {
|
|
|
display: 'none'
|
|
|
},
|
|
|
href: "#pause"
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Playmodules.time,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("time", {
|
|
|
id: "time-elapsed",
|
|
|
ref: timeElapsedEl,
|
|
|
children: "00:00"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: " / "
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("time", {
|
|
|
id: "duration",
|
|
|
ref: durationEl,
|
|
|
children: "00:00"
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Playmodules["right-controls"],
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(lib.CopyToClipboard, {
|
|
|
text: src,
|
|
|
onCopy: function onCopy() {
|
|
|
return message/* default.success */.ZP.success('复制成功');
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("button", {
|
|
|
"data-title": '复制链接',
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "icon-lianjie2 iconfont",
|
|
|
style: {
|
|
|
fontSize: '12px',
|
|
|
color: 'white'
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Playmodules["volume-controls"],
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("button", {
|
|
|
"data-title": "\u5F00\u542F/\u5173\u95ED\u58F0\u97F3",
|
|
|
className: Playmodules["volume-button"],
|
|
|
id: "volume-button",
|
|
|
onClick: toggleMute,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
ref: noMuteVolEl,
|
|
|
className: "icon-a-bianzu8 iconfont",
|
|
|
style: {
|
|
|
fontSize: '14px',
|
|
|
color: 'white'
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
ref: lowVolEl,
|
|
|
className: "icon-shengyinkaibeifen iconfont",
|
|
|
style: {
|
|
|
fontSize: '14px',
|
|
|
color: 'white'
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
ref: highVolEl,
|
|
|
className: "icon-shengyinkai iconfont",
|
|
|
style: {
|
|
|
fontSize: '14px',
|
|
|
color: 'white'
|
|
|
}
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
className: Playmodules.volume,
|
|
|
id: "volume",
|
|
|
value: "1",
|
|
|
"data-mute": "0.5",
|
|
|
type: "range",
|
|
|
max: "1",
|
|
|
min: "0",
|
|
|
step: "0.01",
|
|
|
ref: volumeEl,
|
|
|
style: {
|
|
|
display: 'none'
|
|
|
},
|
|
|
onClick: updateVolumeIcon
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("button", {
|
|
|
"data-title": "\u5168\u5C4F/\u9000\u51FA\u5168\u5C4F",
|
|
|
className: Playmodules["fullscreen-button"],
|
|
|
onClick: function onClick() {
|
|
|
if ((0,fullscreen/* IsFull */.vp)()) {
|
|
|
(0,fullscreen/* exitFull */.BU)();
|
|
|
} else {
|
|
|
(0,fullscreen/* requestFullScreen */.Dj)(warpEl.current);
|
|
|
}
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "icon-fangda1 iconfont",
|
|
|
style: {
|
|
|
fontSize: '12px',
|
|
|
color: 'white'
|
|
|
}
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Playmodules["video-progress"],
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("progress", {
|
|
|
ref: progressBarEl,
|
|
|
value: "0",
|
|
|
min: "0"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
className: Playmodules.seek,
|
|
|
ref: seekEl,
|
|
|
value: "0",
|
|
|
min: "0",
|
|
|
type: "range",
|
|
|
step: "1"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Playmodules["seek-tooltip"],
|
|
|
ref: seekTooltipEl,
|
|
|
id: "seek-tooltip",
|
|
|
children: "00:00"
|
|
|
})]
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("svg", {
|
|
|
style: {
|
|
|
display: 'none'
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("defs", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("symbol", {
|
|
|
id: "pause",
|
|
|
viewBox: "0 0 24 24",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("path", {
|
|
|
d: "M14.016 5.016h3.984v13.969h-3.984v-13.969zM6 18.984v-13.969h3.984v13.969h-3.984z"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("symbol", {
|
|
|
id: "play-icon",
|
|
|
viewBox: "0 0 24 24",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("path", {
|
|
|
d: "M8.016 5.016l10.969 6.984-10.969 6.984v-13.969z"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("symbol", {
|
|
|
id: "volume-high",
|
|
|
viewBox: "0 0 24 24",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("path", {
|
|
|
d: "M14.016 3.234q3.047 0.656 5.016 3.117t1.969 5.648-1.969 5.648-5.016 3.117v-2.063q2.203-0.656 3.586-2.484t1.383-4.219-1.383-4.219-3.586-2.484v-2.063zM16.5 12q0 2.813-2.484 4.031v-8.063q1.031 0.516 1.758 1.688t0.727 2.344zM3 9h3.984l5.016-5.016v16.031l-5.016-5.016h-3.984v-6z"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("symbol", {
|
|
|
id: "volume-low",
|
|
|
viewBox: "0 0 24 24",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("path", {
|
|
|
d: "M5.016 9h3.984l5.016-5.016v16.031l-5.016-5.016h-3.984v-6zM18.516 12q0 2.766-2.531 4.031v-8.063q1.031 0.516 1.781 1.711t0.75 2.32z"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("symbol", {
|
|
|
id: "volume-mute",
|
|
|
viewBox: "0 0 24 24",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("path", {
|
|
|
d: "M12 3.984v4.219l-2.109-2.109zM4.266 3l16.734 16.734-1.266 1.266-2.063-2.063q-1.547 1.313-3.656 1.828v-2.063q1.172-0.328 2.25-1.172l-4.266-4.266v6.75l-5.016-5.016h-3.984v-6h4.734l-4.734-4.734zM18.984 12q0-2.391-1.383-4.219t-3.586-2.484v-2.063q3.047 0.656 5.016 3.117t1.969 5.648q0 2.203-1.031 4.172l-1.5-1.547q0.516-1.266 0.516-2.625zM16.5 12q0 0.422-0.047 0.609l-2.438-2.438v-2.203q1.031 0.516 1.758 1.688t0.727 2.344z"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("symbol", {
|
|
|
id: "fullscreen",
|
|
|
viewBox: "0 0 24 24",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("path", {
|
|
|
d: "M14.016 5.016h4.969v4.969h-1.969v-3h-3v-1.969zM17.016 17.016v-3h1.969v4.969h-4.969v-1.969h3zM5.016 9.984v-4.969h4.969v1.969h-3v3h-1.969zM6.984 14.016v3h3v1.969h-4.969v-4.969h1.969z"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("symbol", {
|
|
|
id: "fullscreen-exit",
|
|
|
viewBox: "0 0 24 24",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("path", {
|
|
|
d: "M15.984 8.016h3v1.969h-4.969v-4.969h1.969v3zM14.016 18.984v-4.969h4.969v1.969h-3v3h-1.969zM8.016 8.016v-3h1.969v4.969h-4.969v-1.969h3zM5.016 15.984v-1.969h4.969v4.969h-1.969v-3h-3z"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("symbol", {
|
|
|
id: "pip",
|
|
|
viewBox: "0 0 24 24",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("path", {
|
|
|
d: "M21 19.031v-14.063h-18v14.063h18zM23.016 18.984q0 0.797-0.609 1.406t-1.406 0.609h-18q-0.797 0-1.406-0.609t-0.609-1.406v-14.016q0-0.797 0.609-1.383t1.406-0.586h18q0.797 0 1.406 0.586t0.609 1.383v14.016zM18.984 11.016v6h-7.969v-6h7.969z"
|
|
|
})
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
}));
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 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 insert-blank",
|
|
|
className: "btn-null",
|
|
|
title: "\u589E\u52A0\u586B\u7A7A",
|
|
|
actionName: "add-null-ch",
|
|
|
onActionCallback: onActionCallback,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "fill-tip",
|
|
|
children: "\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"
|
|
|
})
|
|
|
})
|
|
|
}) : null, 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$disabled = _ref.disabled,
|
|
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
|
_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);
|
|
|
if (disabled) {
|
|
|
instance.on("beforeChange", function (instances, change) {
|
|
|
if (change.origin === "paste" || change.origin === "+input") {
|
|
|
change.cancel();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
setCm(instance);
|
|
|
return function () {
|
|
|
instance.off('paste', onPaste);
|
|
|
};
|
|
|
}
|
|
|
}, []);
|
|
|
var resizeEditorBodyHeight = (0,react.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]);
|
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 49102:
|
|
|
/*!**************************************************************************!*\
|
|
|
!*** ./src/pages/Question/OjProblem/TestCasePanel/index.tsx + 1 modules ***!
|
|
|
\**************************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"Im": function() { return /* binding */ ExecuteDict; },
|
|
|
"ZP": function() { return /* binding */ TestCasePanel; },
|
|
|
"gZ": function() { return /* binding */ getDetailCommitOut; }
|
|
|
});
|
|
|
|
|
|
// UNUSED EXPORTS: getCommitOut
|
|
|
|
|
|
// 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/@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/defineProperty.js
|
|
|
var defineProperty = __webpack_require__(38416);
|
|
|
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
|
|
|
// 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: ./node_modules/@ant-design/icons/es/icons/DownOutlined.js
|
|
|
var DownOutlined = __webpack_require__(34804);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/UpOutlined.js
|
|
|
var UpOutlined = __webpack_require__(64029);
|
|
|
// EXTERNAL MODULE: ./src/pages/Question/OjProblem/interface.ts
|
|
|
var OjProblem_interface = __webpack_require__(79192);
|
|
|
// EXTERNAL MODULE: ./node_modules/js-base64/base64.js
|
|
|
var base64 = __webpack_require__(19575);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/TestCasePanel/index.less
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
// EXTERNAL MODULE: ./src/components/Spinner/index.tsx + 1 modules
|
|
|
var Spinner = __webpack_require__(38054);
|
|
|
// 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/react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/TestCasePanel/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _ExecuteDict;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TextArea = input/* default.TextArea */.Z.TextArea;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var initialState = {
|
|
|
visible: false,
|
|
|
tabIndex: '0'
|
|
|
};
|
|
|
var ExecuteDict = (_ExecuteDict = {}, defineProperty_default()(_ExecuteDict, OjProblem_interface/* ExecuteStatus.NOMATCH */.h.NOMATCH, '测试用例结果不匹配'), defineProperty_default()(_ExecuteDict, OjProblem_interface/* ExecuteStatus.OK */.h.OK, '调试通过'), defineProperty_default()(_ExecuteDict, 2, '调试超时'), defineProperty_default()(_ExecuteDict, 3, '调试pod失败'), defineProperty_default()(_ExecuteDict, 4, '编译失败'), defineProperty_default()(_ExecuteDict, 5, '执行失败'), _ExecuteDict);
|
|
|
var Types;
|
|
|
(function (Types) {
|
|
|
Types[Types["SET_VISIBLE"] = 0] = "SET_VISIBLE";
|
|
|
Types[Types["SET_TABINDEX"] = 1] = "SET_TABINDEX";
|
|
|
})(Types || (Types = {}));
|
|
|
function Reducer(state, action) {
|
|
|
switch (action.type) {
|
|
|
case Types.SET_VISIBLE:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
visible: action.payload
|
|
|
});
|
|
|
case Types.SET_TABINDEX:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
tabIndex: action.payload
|
|
|
});
|
|
|
default:
|
|
|
throw new Error();
|
|
|
}
|
|
|
}
|
|
|
function getDetailCommitOut(debugResult) {
|
|
|
var status = debugResult.status,
|
|
|
error_msg = debugResult.error_msg,
|
|
|
output = debugResult.output,
|
|
|
input = debugResult.input,
|
|
|
expected_output = debugResult.expected_output,
|
|
|
is_file = debugResult.is_file,
|
|
|
input_file_url = debugResult.input_file_url,
|
|
|
output_file_url = debugResult.output_file_url,
|
|
|
expected_output_file_url = debugResult.expected_output_file_url;
|
|
|
var rs = null;
|
|
|
var mdStyle = {
|
|
|
minHeight: 150,
|
|
|
marginBottom: 10,
|
|
|
paddingLeft: 24,
|
|
|
background: '#070f19',
|
|
|
color: '#fff'
|
|
|
};
|
|
|
switch (status) {
|
|
|
case OjProblem_interface/* ExecuteStatus.NOMATCH */.h.NOMATCH:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "c-red",
|
|
|
children: "\u5B9E\u9645\u8F93\u5165\uFF1A"
|
|
|
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: input,
|
|
|
style: mdStyle
|
|
|
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: mdStyle,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
// href={input_file_url} style={{fontSize:'16px'}} download={expected_output} target="_blank"
|
|
|
onClick: function onClick() {
|
|
|
return (0,util/* download */.LR)(input_file_url, input);
|
|
|
},
|
|
|
children: input
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "c-red",
|
|
|
children: "\u5B9E\u9645\u8F93\u51FA\uFF1A"
|
|
|
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: output && base64.Base64.decode(output) || '',
|
|
|
style: mdStyle
|
|
|
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: mdStyle,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
// href={output_file_url} style={{fontSize:'16px'}} download={expected_output} target="_blank"
|
|
|
onClick: function onClick() {
|
|
|
return (0,util/* download */.LR)(output_file_url, output);
|
|
|
},
|
|
|
children: output
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "c-red",
|
|
|
children: "\u9884\u671F\u8F93\u51FA\uFF1A"
|
|
|
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: expected_output && base64.Base64.decode(expected_output) || '',
|
|
|
style: mdStyle
|
|
|
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: mdStyle,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
// href={expected_output_file_url} style={{fontSize:'16px'}} download={expected_output} target="_blank"
|
|
|
onClick: function onClick() {
|
|
|
return (0,util/* download */.LR)(expected_output_file_url, expected_output);
|
|
|
},
|
|
|
children: expected_output
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case OjProblem_interface/* ExecuteStatus.EXECUTEFAILURE */.h.EXECUTEFAILURE:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"
|
|
|
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: input,
|
|
|
style: mdStyle
|
|
|
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: mdStyle,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
// href={input_file_url} style={{fontSize:'16px'}} target="_blank"
|
|
|
onClick: function onClick() {
|
|
|
return (0,util/* download */.LR)(input_file_url, input);
|
|
|
},
|
|
|
children: input
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
className: "error",
|
|
|
children: base64.Base64.decode(error_msg)
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case OjProblem_interface/* ExecuteStatus.COMPILEFAILURE */.h.COMPILEFAILURE:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"
|
|
|
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: input,
|
|
|
style: mdStyle
|
|
|
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: mdStyle,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
// href={input_file_url} style={{fontSize:'16px'}} target="_blank"
|
|
|
onClick: function onClick() {
|
|
|
return (0,util/* download */.LR)(input_file_url, input);
|
|
|
},
|
|
|
children: input
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
className: "error",
|
|
|
children: base64.Base64.decode(error_msg)
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case OjProblem_interface/* ExecuteStatus.PODFAILURE */.h.PODFAILURE:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
|
|
|
});
|
|
|
break;
|
|
|
case OjProblem_interface/* ExecuteStatus.TIMEOUT */.h.TIMEOUT:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
|
|
|
});
|
|
|
break;
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [" ", rs, " "]
|
|
|
});
|
|
|
}
|
|
|
function getCommitOut(debugResult) {
|
|
|
var status = debugResult.status,
|
|
|
error_msg = debugResult.error_msg,
|
|
|
execute_time = debugResult.execute_time,
|
|
|
output = debugResult.output,
|
|
|
input = debugResult.input,
|
|
|
expected_output = debugResult.expected_output,
|
|
|
is_file = debugResult.is_file,
|
|
|
input_file_url = debugResult.input_file_url,
|
|
|
output_file_url = debugResult.output_file_url,
|
|
|
expected_output_file_url = debugResult.expected_output_file_url;
|
|
|
var rs = null;
|
|
|
switch (status) {
|
|
|
case OjProblem_interface/* ExecuteStatus.OK */.h.OK:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u6267\u884C\u7528\u65F6\uFF1A", execute_time]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u6267\u884C\u7ED3\u679C\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
children: base64.Base64.decode(output)
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case OjProblem_interface/* ExecuteStatus.NOMATCH */.h.NOMATCH:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u8F93\u5165\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
children: input
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u8F93\u51FA\uFF1A", output && base64.Base64.decode(output)]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u9884\u671F\u8F93\u51FA\uFF1A", expected_output && base64.Base64.decode(expected_output)]
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case OjProblem_interface/* ExecuteStatus.EXECUTEFAILURE */.h.EXECUTEFAILURE:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
children: input
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
className: "error",
|
|
|
children: base64.Base64.decode(error_msg)
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case OjProblem_interface/* ExecuteStatus.COMPILEFAILURE */.h.COMPILEFAILURE:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
children: input
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
|
|
|
className: "error",
|
|
|
children: base64.Base64.decode(error_msg)
|
|
|
})]
|
|
|
});
|
|
|
break;
|
|
|
case OjProblem_interface/* ExecuteStatus.PODFAILURE */.h.PODFAILURE:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
|
|
|
});
|
|
|
break;
|
|
|
case OjProblem_interface/* ExecuteStatus.TIMEOUT */.h.TIMEOUT:
|
|
|
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: "\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
|
|
|
});
|
|
|
break;
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [" ", rs, " "]
|
|
|
});
|
|
|
}
|
|
|
/* harmony default export */ var TestCasePanel = (function (_ref) {
|
|
|
var id = _ref.id,
|
|
|
input = _ref.input,
|
|
|
debuging = _ref.debuging,
|
|
|
submitting = _ref.submitting,
|
|
|
executingMessage = _ref.executingMessage,
|
|
|
debugResult = _ref.debugResult,
|
|
|
onChangeInput = _ref.onChangeInput,
|
|
|
onDebugCode = _ref.onDebugCode,
|
|
|
onSubmitCode = _ref.onSubmitCode;
|
|
|
var _useReducer = (0,react.useReducer)(Reducer, initialState),
|
|
|
_useReducer2 = slicedToArray_default()(_useReducer, 2),
|
|
|
state = _useReducer2[0],
|
|
|
dispatch = _useReducer2[1];
|
|
|
var visible = state.visible,
|
|
|
tabIndex = state.tabIndex;
|
|
|
(0,react.useEffect)(function () {
|
|
|
dispatch({
|
|
|
type: Types.SET_VISIBLE,
|
|
|
payload: false
|
|
|
});
|
|
|
}, [id]);
|
|
|
function onTabIndexChange(e) {
|
|
|
var id = e.target.id;
|
|
|
dispatch({
|
|
|
type: Types.SET_TABINDEX,
|
|
|
payload: id
|
|
|
});
|
|
|
}
|
|
|
function onTriggerCollapse() {
|
|
|
dispatch({
|
|
|
type: Types.SET_VISIBLE,
|
|
|
payload: !visible
|
|
|
});
|
|
|
}
|
|
|
var executeResult = (0,react.useMemo)(function () {
|
|
|
if (debugResult) {
|
|
|
var status = debugResult.status;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
|
children: getCommitOut(debugResult)
|
|
|
});
|
|
|
}
|
|
|
return null;
|
|
|
}, [debugResult]);
|
|
|
function onDebug() {
|
|
|
dispatch({
|
|
|
type: Types.SET_VISIBLE,
|
|
|
payload: true
|
|
|
});
|
|
|
dispatch({
|
|
|
type: Types.SET_TABINDEX,
|
|
|
payload: '1'
|
|
|
});
|
|
|
onDebugCode();
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "test-case-panel",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "test-case-panel-body ".concat(visible ? 'active' : ''),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
|
className: "s-navs",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
className: tabIndex === '0' ? 'active' : '',
|
|
|
id: "0",
|
|
|
onClick: onTabIndexChange,
|
|
|
children: "\u81EA\u5B9A\u4E49\u6D4B\u8BD5\u7528\u4F8B"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
className: tabIndex === '1' ? 'active' : '',
|
|
|
id: "1",
|
|
|
onClick: onTabIndexChange,
|
|
|
children: "\u4EE3\u7801\u6267\u884C\u7ED3\u679C"
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "tab-panel-body ".concat(tabIndex === '0' ? '' : 'hide'),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(TextArea, {
|
|
|
placeholder: "\u8BF7\u586B\u5199\u6D4B\u8BD5\u7528\u4F8B\u7684\u8F93\u5165\u503C\uFF0C\u70B9\u51FB\u201C\u8C03\u8BD5\u4EE3\u7801\u201D",
|
|
|
value: input,
|
|
|
onChange: onChangeInput
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "tab-panel-body ".concat(tabIndex === '1' ? '' : 'hide'),
|
|
|
children: debuging ? /*#__PURE__*/(0,jsx_runtime.jsx)(Spinner/* default */.Z, {
|
|
|
message: executingMessage
|
|
|
}) : debugResult ? /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
style: {
|
|
|
height: 200
|
|
|
},
|
|
|
children: [" ", executeResult, " "]
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "tip",
|
|
|
children: "\u8BF7\u586B\u5199\u6D4B\u8BD5\u7528\u4F8B\u7684\u8F93\u5165\u503C\uFF0C\u70B9\u51FB\u201C\u8C03\u8BD5\u4EE3\u7801\u201D"
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
className: "btn-collapse ".concat(visible ? 'up' : ''),
|
|
|
onClick: onTriggerCollapse,
|
|
|
children: visible ? /*#__PURE__*/(0,jsx_runtime.jsx)(DownOutlined/* default */.Z, {}) : /*#__PURE__*/(0,jsx_runtime.jsx)(UpOutlined/* default */.Z, {})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("footer", {
|
|
|
className: "footer",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
visibility: 'hidden'
|
|
|
},
|
|
|
children: "\u63A7\u5236\u53F0"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "flex-container",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
id: "oj-prev",
|
|
|
className: "btn-blue",
|
|
|
type: "ghost",
|
|
|
children: "\u4E0A\u4E00\u9898"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
id: "oj-next",
|
|
|
className: "btn-blue",
|
|
|
type: "ghost",
|
|
|
children: "\u4E0B\u4E00\u9898"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
className: "btn-green",
|
|
|
type: "ghost",
|
|
|
loading: debuging,
|
|
|
onClick: onDebug,
|
|
|
children: "\u8C03\u8BD5\u4EE3\u7801"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
type: "primary",
|
|
|
loading: submitting,
|
|
|
disabled: submitting,
|
|
|
onClick: function onClick() {
|
|
|
dispatch({
|
|
|
type: Types.SET_VISIBLE,
|
|
|
payload: false
|
|
|
});
|
|
|
// dispatch({
|
|
|
// type: Types.SET_TABINDEX,
|
|
|
// payload: '1'
|
|
|
// })
|
|
|
onSubmitCode();
|
|
|
},
|
|
|
children: "\u8BC4\u6D4B\u5E76\u63D0\u4EA4"
|
|
|
})]
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 98968:
|
|
|
/*!*************************************************************!*\
|
|
|
!*** ./src/pages/Question/OjProblem/index.tsx + 42 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 */ OjProblem; }
|
|
|
});
|
|
|
|
|
|
// 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/select/style/index.js + 1 modules
|
|
|
var style = __webpack_require__(95985);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/select/index.js
|
|
|
var es_select = __webpack_require__(34041);
|
|
|
// 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/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/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/@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/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(27424);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// 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/antd/es/statistic/style/index.js + 1 modules
|
|
|
var statistic_style = __webpack_require__(14558);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/statistic/index.js + 4 modules
|
|
|
var statistic = __webpack_require__(74763);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
|
var react = __webpack_require__(67294);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/FormOutlined.js + 1 modules
|
|
|
var FormOutlined = __webpack_require__(77123);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/PoweroffOutlined.js + 1 modules
|
|
|
var PoweroffOutlined = __webpack_require__(81088);
|
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 8 modules
|
|
|
var _umi_production_exports = __webpack_require__(89214);
|
|
|
// EXTERNAL MODULE: ./src/pages/Question/OjProblem/service.ts
|
|
|
var service = __webpack_require__(30029);
|
|
|
// EXTERNAL MODULE: ./src/components/SplitContainer/index.tsx + 1 modules
|
|
|
var SplitContainer = __webpack_require__(76695);
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
|
var env = __webpack_require__(59758);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/ExclamationCircleOutlined.js
|
|
|
var ExclamationCircleOutlined = __webpack_require__(87588);
|
|
|
// EXTERNAL MODULE: ./src/pages/Problems/OjForm/CodePanel/index.tsx + 1 modules
|
|
|
var CodePanel = __webpack_require__(20654);
|
|
|
// EXTERNAL MODULE: ./node_modules/js-base64/base64.js
|
|
|
var base64 = __webpack_require__(19575);
|
|
|
// EXTERNAL MODULE: ./src/pages/Problems/OjForm/index.less?modules
|
|
|
var OjFormmodules = __webpack_require__(77969);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/index.less
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
// EXTERNAL MODULE: ./src/pages/Question/OjProblem/TestCasePanel/index.tsx + 1 modules
|
|
|
var TestCasePanel = __webpack_require__(49102);
|
|
|
// 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);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(85893);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/NotesForm/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TextArea = input/* default.TextArea */.Z.TextArea;
|
|
|
var MaxNotCount = 5000;
|
|
|
/* harmony default export */ var NotesForm = (function (_ref) {
|
|
|
var callback = _ref.callback,
|
|
|
onCancel = _ref.onCancel,
|
|
|
notes = _ref.notes;
|
|
|
function onSubmit(values) {
|
|
|
callback(values);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
|
|
|
className: "note-form-panel",
|
|
|
onFinish: onSubmit,
|
|
|
initialValues: {
|
|
|
notes: notes
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
name: "notes",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入笔记内容'
|
|
|
}, {
|
|
|
max: MaxNotCount,
|
|
|
message: "\u7B14\u8BB0\u6700\u5927\u5B57\u6570\u4E3A".concat(MaxNotCount)
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(TextArea, {
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u7B14\u8BB0\u5185\u5BB9",
|
|
|
rows: 5
|
|
|
})
|
|
|
}), /*#__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: "ghost",
|
|
|
onClick: onCancel,
|
|
|
style: {
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: " \u53D6\u6D88 "
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
type: "primary",
|
|
|
htmlType: "submit",
|
|
|
children: " \u63D0\u4EA4 "
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var LeftPanelmodules = ({"left-panel":"left-panel___fP6Y3","tab-panel-body":"tab-panel-body___aLOJQ","b1":"b1___ELpwD","oj-mr":"oj-mr___SIQSw","oj-width-input":"oj-width-input___tR_Si","s-navs":"s-navs___iVrSH","bg-white":"bg-white___S0kiU","active":"active___D332c"});
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/pagination/style/index.js + 1 modules
|
|
|
var pagination_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/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);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/SubmitList/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var SubmitListmodules = ({"pagination":"pagination___npPu7","info":"info___aRH6C"});
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/LoadingOutlined.js
|
|
|
var LoadingOutlined = __webpack_require__(79090);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/CopyOutlined.js
|
|
|
var CopyOutlined = __webpack_require__(85175);
|
|
|
// EXTERNAL MODULE: ./src/pages/Question/OjProblem/interface.ts
|
|
|
var OjProblem_interface = __webpack_require__(79192);
|
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
|
var util = __webpack_require__(29427);
|
|
|
// EXTERNAL MODULE: ./node_modules/moment/moment.js
|
|
|
var moment = __webpack_require__(30381);
|
|
|
var moment_default = /*#__PURE__*/__webpack_require__.n(moment);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/SubmitList/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Column = table/* default.Column */.Z.Column;
|
|
|
/* harmony default export */ var SubmitList = (function (_ref) {
|
|
|
var submitResult = _ref.submitResult,
|
|
|
submitting = _ref.submitting,
|
|
|
submitRecords = _ref.submitRecords,
|
|
|
page = _ref.page,
|
|
|
onPageChange = _ref.onPageChange,
|
|
|
topicId = _ref.topicId;
|
|
|
var _ref2 = submitResult || {},
|
|
|
status = _ref2.status,
|
|
|
id = _ref2.id,
|
|
|
input = _ref2.input,
|
|
|
output = _ref2.output,
|
|
|
expected_output = _ref2.expected_output,
|
|
|
is_file = _ref2.is_file,
|
|
|
input_file_url = _ref2.input_file_url,
|
|
|
output_file_url = _ref2.output_file_url,
|
|
|
expected_output_file_url = _ref2.expected_output_file_url,
|
|
|
error_msg = _ref2.error_msg;
|
|
|
var _ref3 = submitRecords || {},
|
|
|
records = _ref3.records,
|
|
|
records_count = _ref3.records_count;
|
|
|
var urlParams = (0,_umi_production_exports.useParams)();
|
|
|
function onCopy() {
|
|
|
if (!is_file) {
|
|
|
navigator.clipboard.writeText(base64.Base64.decode(output)).then(function () {
|
|
|
message/* default.success */.ZP.success('复制错误信息成功');
|
|
|
});
|
|
|
} else {
|
|
|
navigator.clipboard.writeText(base64.Base64.decode(error_msg)).then(function () {
|
|
|
message/* default.success */.ZP.success('复制错误信息成功');
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(spin/* default */.Z, {
|
|
|
spinning: submitting,
|
|
|
tip: "\u8BC4\u6D4B\u4E2D...",
|
|
|
indicator: /*#__PURE__*/(0,jsx_runtime.jsx)(LoadingOutlined/* default */.Z, {
|
|
|
style: {
|
|
|
fontSize: 24
|
|
|
},
|
|
|
spin: true
|
|
|
}),
|
|
|
children: [id ? /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
|
className: SubmitListmodules.info,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: ["\u6267\u884C\u7ED3\u679C\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: status === OjProblem_interface/* ExecuteStatus.OK */.h.OK ? 'c-green' : 'c-red',
|
|
|
children: TestCasePanel/* ExecuteDict */.Im[status]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
className: SubmitListmodules.error,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
|
|
|
onClick: onCopy,
|
|
|
children: ["\u590D\u5236\u9519\u8BEF\u4FE1\u606F ", /*#__PURE__*/(0,jsx_runtime.jsx)(CopyOutlined/* default */.Z, {}), " "]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
|
to: "/problems/".concat(topicId, "/record-detail/").concat(id, "?backId=").concat(urlParams === null || urlParams === void 0 ? void 0 : urlParams.save_identifier),
|
|
|
children: "\u663E\u793A\u8BE6\u60C5 > "
|
|
|
})
|
|
|
})]
|
|
|
}), status !== OjProblem_interface/* ExecuteStatus.OK */.h.OK ? /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "c-red",
|
|
|
children: "\u5B9E\u9645\u8F93\u5165\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("pre", {
|
|
|
children: [!is_file && input, is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
// href={input_file_url}
|
|
|
style: {
|
|
|
fontSize: '16px'
|
|
|
},
|
|
|
onClick: function onClick() {
|
|
|
return (0,util/* download */.LR)(input_file_url, input);
|
|
|
}
|
|
|
// download={expected_output}
|
|
|
// target="_blank"
|
|
|
,
|
|
|
children: input
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "c-red",
|
|
|
children: "\u5B9E\u9645\u8F93\u51FA\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("pre", {
|
|
|
children: [(status === 4 || status === 5) && base64.Base64.decode(error_msg), status != 4 && status != 5 && (is_file ? /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
// href={output_file_url}
|
|
|
style: {
|
|
|
fontSize: '16px'
|
|
|
},
|
|
|
onClick: function onClick() {
|
|
|
return (0,util/* download */.LR)(output_file_url, output);
|
|
|
}
|
|
|
// download={expected_output} target="_blank"
|
|
|
,
|
|
|
children: output
|
|
|
}) : base64.Base64.decode(output))]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "c-red",
|
|
|
children: "\u9884\u671F\u8F93\u51FA\uFF1A"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("pre", {
|
|
|
children: [!is_file && base64.Base64.decode(expected_output), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
// href={expected_output_file_url}
|
|
|
style: {
|
|
|
fontSize: '16px'
|
|
|
},
|
|
|
onClick: function onClick() {
|
|
|
return (0,util/* download */.LR)(expected_output_file_url, expected_output);
|
|
|
}
|
|
|
// download={expected_output} target="_blank"
|
|
|
,
|
|
|
children: expected_output
|
|
|
})]
|
|
|
})]
|
|
|
}) : null]
|
|
|
}) : null, (records === null || records === void 0 ? void 0 : records.length) > 0 ? /*#__PURE__*/(0,jsx_runtime.jsxs)(table/* default */.Z, {
|
|
|
dataSource: records,
|
|
|
rowKey: "id",
|
|
|
pagination: false,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(Column, {
|
|
|
title: "\u63D0\u4EA4\u65F6\u95F4",
|
|
|
dataIndex: "created_at",
|
|
|
render: function render(text, record) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [" ", moment_default()(text).format('YYYY-MM-DD HH:mm:ss')]
|
|
|
});
|
|
|
}
|
|
|
}, "created_at"), /*#__PURE__*/(0,jsx_runtime.jsx)(Column, {
|
|
|
title: "\u63D0\u4EA4\u7ED3\u679C",
|
|
|
dataIndex: "status",
|
|
|
render: function render(text, record) {
|
|
|
var _ExecuteDict$text;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
|
className: text === 0 ? 'c-green' : 'c-red',
|
|
|
to: "/problems/".concat(topicId, "/record-detail/").concat(record.id, "?backId=").concat(urlParams === null || urlParams === void 0 ? void 0 : urlParams.save_identifier),
|
|
|
children: (_ExecuteDict$text = TestCasePanel/* ExecuteDict */.Im[text]) === null || _ExecuteDict$text === void 0 ? void 0 : _ExecuteDict$text.replace('调试', '评测')
|
|
|
});
|
|
|
}
|
|
|
}, "status"), /*#__PURE__*/(0,jsx_runtime.jsx)(Column, {
|
|
|
title: "\u6267\u884C\u7528\u65F6 (S)",
|
|
|
dataIndex: "execute_time"
|
|
|
}, "execute_time"), /*#__PURE__*/(0,jsx_runtime.jsx)(Column, {
|
|
|
title: "\u5185\u5B58\u6D88\u8017\uFF08MB\uFF09",
|
|
|
dataIndex: "execute_memory"
|
|
|
}, "execute_memory"), /*#__PURE__*/(0,jsx_runtime.jsx)(Column, {
|
|
|
title: "\u8BED\u8A00",
|
|
|
dataIndex: "language"
|
|
|
}, "language")]
|
|
|
}) : null, records_count > 15 ? /*#__PURE__*/(0,jsx_runtime.jsx)(pagination/* default */.Z, {
|
|
|
className: SubmitListmodules.pagination,
|
|
|
current: page,
|
|
|
pageSize: 15,
|
|
|
total: records_count,
|
|
|
onChange: onPageChange
|
|
|
}) : null]
|
|
|
});
|
|
|
});
|
|
|
// EXTERNAL MODULE: ./src/components/NoData/index.tsx
|
|
|
var NoData = __webpack_require__(82982);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/space/style/index.js + 1 modules
|
|
|
var space_style = __webpack_require__(6516);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/space/index.js + 1 modules
|
|
|
var space = __webpack_require__(26713);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/tag/style/index.js + 1 modules
|
|
|
var tag_style = __webpack_require__(71114);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/tag/index.js + 1 modules
|
|
|
var tag = __webpack_require__(20550);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/Description/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var Descriptionmodules = ({"desc":"desc___X8_hx","info":"info___C1DPv","commit-info":"commit-info____9yQm"});
|
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules
|
|
|
var RenderHtml = __webpack_require__(12768);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/Description/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var DifficultDesc = {
|
|
|
1: {
|
|
|
name: '简单',
|
|
|
color: '#52c41a'
|
|
|
},
|
|
|
2: {
|
|
|
name: '适中',
|
|
|
color: '#faad14'
|
|
|
},
|
|
|
3: {
|
|
|
name: '困难',
|
|
|
color: '#f5222d'
|
|
|
}
|
|
|
};
|
|
|
/* harmony default export */ var Description = (function (_ref) {
|
|
|
var hack = _ref.hack,
|
|
|
onTriggerPraise = _ref.onTriggerPraise,
|
|
|
toDiscuss = _ref.toDiscuss;
|
|
|
var language = hack.language,
|
|
|
difficulty = hack.difficulty,
|
|
|
time_limit = hack.time_limit,
|
|
|
username = hack.username,
|
|
|
user_path = hack.user_path,
|
|
|
user_praise = hack.user_praise,
|
|
|
comments_count = hack.comments_count,
|
|
|
praises_count = hack.praises_count,
|
|
|
description = hack.description,
|
|
|
pass_count = hack.pass_count,
|
|
|
submit_count = hack.submit_count;
|
|
|
var location = (0,_umi_production_exports.useLocation)();
|
|
|
console.log(hack.language, 'language');
|
|
|
var diffItem = DifficultDesc[difficulty];
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
|
className: Descriptionmodules.info,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: ["\u96BE\u5EA6\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)(tag/* default */.Z, {
|
|
|
color: diffItem.color,
|
|
|
children: diffItem.name
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: ["\u5355\u4E2A\u6D4B\u8BD5\u96C6\u8BC4\u6D4B\u65F6\u957F\u9650\u5236\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsxs)("b", {
|
|
|
children: [time_limit, "\u79D2"]
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: description,
|
|
|
className: Descriptionmodules.desc
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
|
className: Descriptionmodules["commit-info"],
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(space/* default */.Z, {
|
|
|
size: 4,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u901A\u8FC7\u6B21\u6570"
|
|
|
}), " ", /*#__PURE__*/(0,jsx_runtime.jsx)("b", {
|
|
|
children: pass_count
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(space/* default */.Z, {
|
|
|
size: 4,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u63D0\u4EA4\u6B21\u6570"
|
|
|
}), " ", /*#__PURE__*/(0,jsx_runtime.jsx)("b", {
|
|
|
children: submit_count
|
|
|
})]
|
|
|
}), " "]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
style: {
|
|
|
flex: '1 0 0'
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(space/* default */.Z, {
|
|
|
size: 4,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-huifu1",
|
|
|
onClick: toDiscuss
|
|
|
}), " ", /*#__PURE__*/(0,jsx_runtime.jsx)("b", {
|
|
|
children: comments_count
|
|
|
})]
|
|
|
}), " "]
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
// EXTERNAL MODULE: ./src/components/mediator.js
|
|
|
var mediator = __webpack_require__(91562);
|
|
|
;// CONCATENATED MODULE: ./src/assets/images/question/show.svg
|
|
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
|
var __defProp = Object.defineProperty;
|
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
var __defNormalProp = function __defNormalProp(obj, key, value) {
|
|
|
return key in obj ? __defProp(obj, key, {
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true,
|
|
|
value: value
|
|
|
}) : obj[key] = value;
|
|
|
};
|
|
|
var __spreadValues = function __spreadValues(a, b) {
|
|
|
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
|
if (__getOwnPropSymbols) {
|
|
|
var _iterator = _createForOfIteratorHelper(__getOwnPropSymbols(b)),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prop = _step.value;
|
|
|
if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
}
|
|
|
return a;
|
|
|
};
|
|
|
|
|
|
var SvgShow = function SvgShow(props) {
|
|
|
return /* @__PURE__ */React.createElement("svg", __spreadValues({
|
|
|
width: 40,
|
|
|
height: 40,
|
|
|
xmlns: "http://www.w3.org/2000/svg"
|
|
|
}, props), /* @__PURE__ */React.createElement("title", null, "\u5C55\u5F00\u9898\u76EE"), /* @__PURE__ */React.createElement("defs", null, /* @__PURE__ */React.createElement("linearGradient", {
|
|
|
x1: "0%",
|
|
|
y1: "0%",
|
|
|
x2: "100%",
|
|
|
y2: "100%",
|
|
|
id: "show_svg__a"
|
|
|
}, /* @__PURE__ */React.createElement("stop", {
|
|
|
stopColor: "#EEF7FF",
|
|
|
offset: "0%"
|
|
|
}), /* @__PURE__ */React.createElement("stop", {
|
|
|
stopColor: "#C1E2FF",
|
|
|
offset: "100%"
|
|
|
}))), /* @__PURE__ */React.createElement("g", {
|
|
|
fill: "none",
|
|
|
fillRule: "evenodd"
|
|
|
}, /* @__PURE__ */React.createElement("rect", {
|
|
|
fill: "url(#show_svg__a)",
|
|
|
width: 40,
|
|
|
height: 40,
|
|
|
rx: 8
|
|
|
}), /* @__PURE__ */React.createElement("g", {
|
|
|
fillRule: "nonzero"
|
|
|
}, /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M16.057 20.784H8.238A1.22 1.22 0 0 0 7 21.974v6.811a1.22 1.22 0 0 0 1.238 1.19h7.819a1.213 1.213 0 0 0 1.238-1.19v-6.811a1.213 1.213 0 0 0-.376-.847 1.203 1.203 0 0 0-.862-.332v-.01Zm-1.25 6.769H9.423V23.12h5.384v4.433Z",
|
|
|
fill: "#4CACFF"
|
|
|
}), /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M16.057 10.005a1.22 1.22 0 0 1 1.238 1.189v6.812a1.213 1.213 0 0 1-.376.846c-.232.222-.542.34-.862.332H8.238A1.213 1.213 0 0 1 7 18.005v-6.811a1.22 1.22 0 0 1 1.238-1.19Zm-1.239 2.41H9.434v4.401h5.384v-4.4Z",
|
|
|
fill: "#94CDFF"
|
|
|
}), /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M20.418 12.632h11.189a1.213 1.213 0 0 0 1.238-1.179 1.224 1.224 0 0 0-.371-.857 1.214 1.214 0 0 0-.867-.343H20.418a1.203 1.203 0 0 0-.866.336c-.233.223-.367.53-.372.854.005.323.14.63.372.854.232.223.544.344.866.335ZM31.575 16.027h-11.19a1.183 1.183 0 0 0-1.119.557c-.237.384-.237.87 0 1.254.238.384.672.6 1.12.557h11.189c.448.043.882-.173 1.119-.557.237-.384.237-.87 0-1.254a1.183 1.183 0 0 0-1.12-.557ZM31.575 21.595h-11.19a1.183 1.183 0 0 0-1.119.557c-.237.384-.237.87 0 1.254.238.384.672.6 1.12.557h11.189c.448.043.882-.173 1.119-.557.237-.384.237-.87 0-1.254a1.183 1.183 0 0 0-1.12-.557ZM31.575 27.163h-11.19a1.183 1.183 0 0 0-1.119.557c-.237.384-.237.87 0 1.254.238.384.672.6 1.12.557h11.189c.448.043.882-.173 1.119-.557.237-.384.237-.87 0-1.254a1.183 1.183 0 0 0-1.12-.557Z",
|
|
|
fill: "#1890FF"
|
|
|
}))));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ var show = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IHgxPSIwJSIgeTE9IjAlIiB4Mj0iMTAwJSIgeTI9IjEwMCUiIGlkPSJhIj48c3RvcCBzdG9wLWNvbG9yPSIjRUVGN0ZGIiBvZmZzZXQ9IjAlIi8+PHN0b3Agc3RvcC1jb2xvcj0iI0MxRTJGRiIgb2Zmc2V0PSIxMDAlIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cmVjdCBmaWxsPSJ1cmwoI2EpIiB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHJ4PSI4Ii8+PGcgZmlsbC1ydWxlPSJub256ZXJvIj48cGF0aCBkPSJNMTYuMDU3IDIwLjc4NEg4LjIzOEExLjIyIDEuMjIgMCAwIDAgNyAyMS45NzR2Ni44MTFhMS4yMiAxLjIyIDAgMCAwIDEuMjM4IDEuMTloNy44MTlhMS4yMTMgMS4yMTMgMCAwIDAgMS4yMzgtMS4xOXYtNi44MTFhMS4yMTMgMS4yMTMgMCAwIDAtLjM3Ni0uODQ3IDEuMjAzIDEuMjAzIDAgMCAwLS44NjItLjMzMnYtLjAxWm0tMS4yNSA2Ljc2OUg5LjQyM1YyMy4xMmg1LjM4NHY0LjQzM1oiIGZpbGw9IiM0Q0FDRkYiLz48cGF0aCBkPSJNMTYuMDU3IDEwLjAwNWExLjIyIDEuMjIgMCAwIDEgMS4yMzggMS4xODl2Ni44MTJhMS4yMTMgMS4yMTMgMCAwIDEtLjM3Ni44NDZjLS4yMzIuMjIyLS41NDIuMzQtLjg2Mi4zMzJIOC4yMzhBMS4yMTMgMS4yMTMgMCAwIDEgNyAxOC4wMDV2LTYuODExYTEuMjIgMS4yMiAwIDAgMSAxLjIzOC0xLjE5Wm0tMS4yMzkgMi40MUg5LjQzNHY0LjQwMWg1LjM4NHYtNC40WiIgZmlsbD0iIzk0Q0RGRiIvPjxwYXRoIGQ9Ik0yMC40MTggMTIuNjMyaDExLjE4OWExLjIxMyAxLjIxMyAwIDAgMCAxLjIzOC0xLjE3OSAxLjIyNCAxLjIyNCAwIDAgMC0uMzcxLS44NTcgMS4yMTQgMS4yMTQgMCAwIDAtLjg2Ny0uMzQzSDIwLjQxOGExLjIwMyAxLjIwMyAwIDAgMC0uODY2LjMzNmMtLjIzMy4yMjMtLjM2Ny41My0uMzcyLjg1NC4wMDUuMzIzLjE0LjYzLjM3Mi44NTQuMjMyLjIyMy41NDQuMzQ0Ljg2Ni4zMzVaTTMxLjU3NSAxNi4wMjdoLTExLjE5YTEuMTgzIDEuMTgzIDAgMCAwLTEuMTE5LjU1N2MtLjIzNy4zODQtLjIzNy44NyAwIDEuMjU0LjIzOC4zODQuNjcyLjYgMS4xMi41NTdoMTEuMTg5Yy40NDguMDQzLjg4Mi0uMTczIDEuMTE5LS41NTcuMjM3LS4zODQuMjM3LS44NyAwLTEuMjU0YTEuMTgzIDEuMTgzIDAgMCAwLTEuMTItLjU1N1pNMzEuNTc1IDIxLjU5NWgtMTEuMTlhMS4xODMgMS4xODMgMCAwIDAtMS4xMTkuNTU3Yy0uMjM3LjM4NC0uMjM3Ljg3IDAgMS4yNTQuMjM4LjM4NC42NzIuNiAxLjEyLjU1N2gxMS4xODljLjQ0OC4wNDMuODgyLS4xNzMgMS4xMTktLjU1Ny4yMzctLjM4NC4yMzctLjg3IDAtMS4yNTRhMS4xODMgMS4xODMgMCAwIDAtMS4xMi0uNTU3Wk0zMS41NzUgMjcuMTYzaC0xMS4xOWExLjE4MyAxLjE4MyAwIDAgMC0xLjExOS41NTdjLS4yMzcuMzg0LS4yMzcuODcgMCAxLjI1NC4yMzguMzg0LjY3Mi42IDEuMTIuNTU3aDExLjE4OWMuNDQ4LjA0My44ODItLjE3MyAxLjExOS0uNTU3LjIzNy0uMzg0LjIzNy0uODcgMC0xLjI1NGExLjE4MyAxLjE4MyAwIDAgMC0xLjEyLS41NTdaIiBmaWxsPSIjMTg5MEZGIi8+PC9nPjwvZz48L3N2Zz4=");
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/toConsumableArray.js
|
|
|
var toConsumableArray = __webpack_require__(861);
|
|
|
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
|
|
|
// EXTERNAL MODULE: ./src/components/modal.tsx
|
|
|
var components_modal = __webpack_require__(12264);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/Discuss/index.less
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
|
var fetch = __webpack_require__(84519);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/Discuss/service.ts
|
|
|
|
|
|
|
|
|
//
|
|
|
function getComments(params) {
|
|
|
return (0,fetch/* get */.U2)("comments.json", params);
|
|
|
}
|
|
|
function plusDiscuss(id) {
|
|
|
return (0,fetch/* post */.v_)("/discusses/".concat(id, "/plus.json"), {
|
|
|
container_type: "Discuss",
|
|
|
type: 1
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//
|
|
|
function replyDiscuss(params) {
|
|
|
return (0,fetch/* post */.v_)("comments/reply.json", params);
|
|
|
}
|
|
|
|
|
|
//
|
|
|
function createDiscuss(params) {
|
|
|
return (0,fetch/* post */.v_)("comments.json", params);
|
|
|
}
|
|
|
|
|
|
//
|
|
|
function hiddenDiscuss(params) {
|
|
|
return (0,fetch/* post */.v_)("comments/".concat(params === null || params === void 0 ? void 0 : params.id, "/hidden.json"), params);
|
|
|
}
|
|
|
function deleteDiscuss(params) {
|
|
|
return (0,fetch/* del */.IV)("comments/".concat(params === null || params === void 0 ? void 0 : params.id, ".json"));
|
|
|
}
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/Discuss/discuss-item/index.less
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
// EXTERNAL MODULE: ./src/pages/tasks/left-panel/discuss/discuss-editor/index.tsx + 1 modules
|
|
|
var discuss_editor = __webpack_require__(43486);
|
|
|
// EXTERNAL MODULE: ./src/utils/authority.ts
|
|
|
var authority = __webpack_require__(7);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/Discuss/discuss-item/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function UserPhoto(_ref) {
|
|
|
var author = _ref.author;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
href: "/users/".concat(author.login),
|
|
|
target: "_blank",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
alt: "\u7528\u6237\u5934\u50CF",
|
|
|
height: "50",
|
|
|
style: {
|
|
|
borderRadius: '50%'
|
|
|
},
|
|
|
src: "".concat(env/* default.IMG_SERVER */.Z.IMG_SERVER, "/images/").concat(author.image_url),
|
|
|
width: "50"
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
function SecondLevelDiscuss(_ref2) {
|
|
|
var data = _ref2.data,
|
|
|
index = _ref2.index,
|
|
|
parentDiscussIndex = _ref2.parentDiscussIndex,
|
|
|
user = _ref2.user,
|
|
|
onSetActionType = _ref2.onSetActionType;
|
|
|
var author = data.author,
|
|
|
can_delete = data.can_delete,
|
|
|
content = data.content,
|
|
|
id = data.id,
|
|
|
time = data.time;
|
|
|
function onDeleteDiscuss() {
|
|
|
onSetActionType({
|
|
|
id: id,
|
|
|
index: index,
|
|
|
type: 'delete-discuss',
|
|
|
parentDiscussIndex: parentDiscussIndex,
|
|
|
message: '确定要删除该条回复吗'
|
|
|
});
|
|
|
}
|
|
|
var canDelete = user.admin || can_delete || author.user_id === user.user_id;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "discuss-item-container second-discuss ",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(UserPhoto, {
|
|
|
author: author
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "discuss-info",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
href: "/users/".concat(author.login),
|
|
|
target: "_blank",
|
|
|
children: author.name
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "grey",
|
|
|
children: time
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "btn-group",
|
|
|
style: {
|
|
|
marginBottom: 0
|
|
|
},
|
|
|
children: canDelete ? /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
onClick: onDeleteDiscuss,
|
|
|
title: "\u5220\u9664",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-shanchu"
|
|
|
})
|
|
|
}) : null
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
className: "discuss-content",
|
|
|
value: content
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
/* harmony default export */ var discuss_item = (function (_ref3) {
|
|
|
var user = _ref3.user,
|
|
|
data = _ref3.data,
|
|
|
index = _ref3.index,
|
|
|
onPlusDiscuss = _ref3.onPlusDiscuss,
|
|
|
onSetActionType = _ref3.onSetActionType,
|
|
|
activeDiscussIndex = _ref3.activeDiscussIndex,
|
|
|
onReplyDiscuss = _ref3.onReplyDiscuss,
|
|
|
onSetActiveDiscussIndex = _ref3.onSetActiveDiscussIndex;
|
|
|
var content = data.content,
|
|
|
children = data.children,
|
|
|
hidden = data.hidden,
|
|
|
id = data.id,
|
|
|
praise_count = data.praise_count,
|
|
|
time = data.time,
|
|
|
user_praise = data.user_praise,
|
|
|
can_delete = data.can_delete,
|
|
|
author = data.author;
|
|
|
console.log(can_delete && (!children || children.length == 0), 'children22');
|
|
|
function onActiveDiscussIndex() {
|
|
|
onSetActiveDiscussIndex(id);
|
|
|
}
|
|
|
function onPlus() {
|
|
|
onPlusDiscuss(id, !user_praise, index);
|
|
|
}
|
|
|
function onDeleteDiscuss() {
|
|
|
onSetActionType({
|
|
|
id: id,
|
|
|
index: index,
|
|
|
type: 'delete-discuss',
|
|
|
message: '确定要删除该条回复吗'
|
|
|
});
|
|
|
}
|
|
|
function onHiddenDiscuss() {
|
|
|
onSetActionType({
|
|
|
id: id,
|
|
|
index: index,
|
|
|
params: {
|
|
|
hidden: !hidden ? '1' : '0'
|
|
|
},
|
|
|
type: 'hidden-discuss',
|
|
|
message: !hidden ? '确定要隐藏该条回复吗' : '确定要取消隐藏该条回复吗'
|
|
|
});
|
|
|
}
|
|
|
var adminOrOperator = user.admin || user.user_id === author.user_id;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "discuss-item-container",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(UserPhoto, {
|
|
|
author: author
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "discuss-info",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
|
|
|
href: "/users/".concat(author.login),
|
|
|
target: "_blank",
|
|
|
children: [" ", author.name, " "]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "grey",
|
|
|
children: time
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
className: "discuss-content",
|
|
|
value: content
|
|
|
}), children && children.length > 0 ? /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "reply-discuss-container",
|
|
|
children: children.map(function (item, i) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(SecondLevelDiscuss, {
|
|
|
data: item,
|
|
|
index: i,
|
|
|
user: user,
|
|
|
onSetActionType: onSetActionType,
|
|
|
parentDiscussIndex: index
|
|
|
}, item.id);
|
|
|
})
|
|
|
}) : null, /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "btn-group",
|
|
|
children: [(0,authority/* isSuperAdmins */.Ny)() ? /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
onClick: onHiddenDiscuss,
|
|
|
title: hidden ? '取消隐藏' : '隐藏评论',
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: hidden ? 'iconfont icon-yincangbiyan' : 'fa fa-eye'
|
|
|
})
|
|
|
}) : null, can_delete && (!children || children.length == 0) ? /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
onClick: onDeleteDiscuss,
|
|
|
title: "\u5220\u9664",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-shanchu"
|
|
|
})
|
|
|
}) : null, /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
|
|
|
onClick: onActiveDiscussIndex,
|
|
|
title: "\u56DE\u590D",
|
|
|
children: [" ", /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-huifu1"
|
|
|
}), " "]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
|
|
|
onClick: onPlus,
|
|
|
className: user_praise ? 'c-orange' : '',
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: user_praise ? 'iconfont icon-dianzan mr3' : 'iconfont icon-dianzan-xian mr3 '
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: praise_count ? praise_count : ''
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(discuss_editor/* default */.Z, {
|
|
|
id: id,
|
|
|
activeDiscussIndex: activeDiscussIndex,
|
|
|
onReplyDiscuss: onReplyDiscuss
|
|
|
})]
|
|
|
})]
|
|
|
}, id);
|
|
|
});
|
|
|
// EXTERNAL MODULE: ./src/components/image-preview/index.tsx + 1 modules
|
|
|
var image_preview = __webpack_require__(75490);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/Discuss/discuss-input-editor/index.less
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 10 modules
|
|
|
var markdown_editor = __webpack_require__(55373);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/Discuss/discuss-input-editor/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* harmony default export */ var discuss_input_editor = (function (_ref) {
|
|
|
var user_praise = _ref.user_praise,
|
|
|
praise_count = _ref.praise_count,
|
|
|
praisePlus = _ref.praisePlus,
|
|
|
onCreateDiscuss = _ref.onCreateDiscuss,
|
|
|
discuss_count = _ref.discuss_count;
|
|
|
var _useState = (0,react.useState)(false),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
showMd = _useState2[0],
|
|
|
setShowMd = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)(''),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
value = _useState4[0],
|
|
|
setValue = _useState4[1];
|
|
|
function onChangeHandler(v) {
|
|
|
setValue(v);
|
|
|
}
|
|
|
function onShowMd() {
|
|
|
setShowMd(true);
|
|
|
}
|
|
|
function onCancel() {
|
|
|
setShowMd(false);
|
|
|
}
|
|
|
function onCommit() {
|
|
|
return _onCommit.apply(this, arguments);
|
|
|
}
|
|
|
function _onCommit() {
|
|
|
_onCommit = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
onCreateDiscuss(value);
|
|
|
setValue('');
|
|
|
setShowMd(false);
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return _onCommit.apply(this, arguments);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "dis-input-editor-container ".concat(showMd ? 'active' : '', " "),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: showMd ? 'text-area hide' : 'text-area',
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
placeholder: "\u8BF4\u70B9\u4EC0\u4E48",
|
|
|
onClick: onShowMd
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
|
|
|
style: {
|
|
|
alignItems: "center"
|
|
|
},
|
|
|
children: [" ", /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-huifu1"
|
|
|
}), " \xA0 \xA0", discuss_count, " "]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
|
|
|
className: "c-light-black",
|
|
|
onClick: praisePlus,
|
|
|
style: {
|
|
|
alignItems: "center"
|
|
|
},
|
|
|
title: user_praise ? '取消点赞' : '点赞',
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "mr3 ".concat(user_praise ? 'iconfont icon-dianzan c-orange' : 'iconfont icon-dianzan-xian', " ")
|
|
|
}), praise_count ? /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: praise_count
|
|
|
}) : '']
|
|
|
})]
|
|
|
}), showMd ? /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "input-mask",
|
|
|
onClick: onCancel
|
|
|
}) : null, /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: showMd ? 'md-container' : 'md-container hide',
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
id: "discuss-input-editor",
|
|
|
miniToolbar: true,
|
|
|
watch: false,
|
|
|
noStorage: true,
|
|
|
defaultValue: value,
|
|
|
height: 240,
|
|
|
onChange: onChangeHandler
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "tip-container",
|
|
|
onClick: onCancel,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
className: "btn-send",
|
|
|
onClick: onCommit,
|
|
|
children: " \u53D1\u9001 "
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/Discuss/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var initialState = {
|
|
|
loading: false,
|
|
|
page: 1,
|
|
|
data: [],
|
|
|
count: 0,
|
|
|
actionType: null,
|
|
|
activeDiscussIndex: null
|
|
|
};
|
|
|
var Types;
|
|
|
(function (Types) {
|
|
|
Types[Types["GET_DISCUSSES"] = 0] = "GET_DISCUSSES";
|
|
|
Types[Types["TOP_OR_DOWN_DISCUSS"] = 1] = "TOP_OR_DOWN_DISCUSS";
|
|
|
Types[Types["ACTIVE_DISCUSS_INDEX"] = 2] = "ACTIVE_DISCUSS_INDEX";
|
|
|
Types[Types["PLUS_DISCUSS"] = 3] = "PLUS_DISCUSS";
|
|
|
Types[Types["SET_ACTION_TYPE"] = 4] = "SET_ACTION_TYPE";
|
|
|
Types[Types["SET_PAGE"] = 5] = "SET_PAGE";
|
|
|
Types[Types["SHOW_DISCUSSES_LOADING"] = 6] = "SHOW_DISCUSSES_LOADING";
|
|
|
})(Types || (Types = {}));
|
|
|
function reducer(state, action) {
|
|
|
switch (action.type) {
|
|
|
case Types.SHOW_DISCUSSES_LOADING:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
loading: true
|
|
|
});
|
|
|
case Types.GET_DISCUSSES:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), action.payload);
|
|
|
case Types.TOP_OR_DOWN_DISCUSS:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), action.payload);
|
|
|
case Types.SET_ACTION_TYPE:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), action.payload);
|
|
|
case Types.PLUS_DISCUSS:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), action.payload);
|
|
|
case Types.SET_PAGE:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
page: action.payload
|
|
|
});
|
|
|
case Types.ACTIVE_DISCUSS_INDEX:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), action.payload);
|
|
|
default:
|
|
|
throw new Error();
|
|
|
}
|
|
|
}
|
|
|
/* harmony default export */ var Discuss = (function (_ref) {
|
|
|
var user = _ref.user,
|
|
|
identifier = _ref.identifier,
|
|
|
hack = _ref.hack,
|
|
|
onTriggerPraise = _ref.onTriggerPraise,
|
|
|
setDiscussTotal = _ref.setDiscussTotal;
|
|
|
var _useReducer = (0,react.useReducer)(reducer, initialState),
|
|
|
_useReducer2 = slicedToArray_default()(_useReducer, 2),
|
|
|
state = _useReducer2[0],
|
|
|
dispatch = _useReducer2[1];
|
|
|
var loading = state.loading,
|
|
|
page = state.page,
|
|
|
data = state.data,
|
|
|
count = state.count,
|
|
|
actionType = state.actionType,
|
|
|
activeDiscussIndex = state.activeDiscussIndex;
|
|
|
var initData = (0,react.useCallback)( /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var response, comments, disscuss_count;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
dispatch({
|
|
|
type: Types.SHOW_DISCUSSES_LOADING
|
|
|
});
|
|
|
_context.next = 3;
|
|
|
return getComments({
|
|
|
container_type: 'Practice',
|
|
|
container_identifier: identifier,
|
|
|
limit: 10,
|
|
|
page: page
|
|
|
});
|
|
|
case 3:
|
|
|
response = _context.sent;
|
|
|
comments = response.comments, disscuss_count = response.disscuss_count;
|
|
|
dispatch({
|
|
|
type: Types.GET_DISCUSSES,
|
|
|
payload: {
|
|
|
data: comments,
|
|
|
count: disscuss_count,
|
|
|
loading: false
|
|
|
}
|
|
|
});
|
|
|
setDiscussTotal(disscuss_count);
|
|
|
case 7:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
})), [page, identifier]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
initData();
|
|
|
}, [identifier, page]);
|
|
|
function onPaginationChange(value) {
|
|
|
dispatch({
|
|
|
type: Types.SET_PAGE,
|
|
|
page: value
|
|
|
});
|
|
|
}
|
|
|
function onSetActionType(value) {
|
|
|
dispatch({
|
|
|
type: Types.SET_ACTION_TYPE,
|
|
|
payload: {
|
|
|
actionType: value
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
function onSetActiveDiscussIndex(value) {
|
|
|
if (activeDiscussIndex === value) {
|
|
|
dispatch({
|
|
|
type: Types.ACTIVE_DISCUSS_INDEX,
|
|
|
payload: {
|
|
|
activeDiscussIndex: null
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
dispatch({
|
|
|
type: Types.ACTIVE_DISCUSS_INDEX,
|
|
|
payload: {
|
|
|
activeDiscussIndex: value
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
function onPlusDiscuss(_x, _x2, _x3) {
|
|
|
return _onPlusDiscuss.apply(this, arguments);
|
|
|
}
|
|
|
function _onPlusDiscuss() {
|
|
|
_onPlusDiscuss = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(id, user_praise, index) {
|
|
|
var response;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.prev = 0;
|
|
|
_context2.next = 3;
|
|
|
return plusDiscuss(id);
|
|
|
case 3:
|
|
|
response = _context2.sent;
|
|
|
data[index].user_praise = user_praise;
|
|
|
data[index].praise_count = response.praise_count;
|
|
|
dispatch({
|
|
|
type: Types.PLUS_DISCUSS,
|
|
|
payload: {
|
|
|
data: toConsumableArray_default()(data)
|
|
|
}
|
|
|
});
|
|
|
_context2.next = 12;
|
|
|
break;
|
|
|
case 9:
|
|
|
_context2.prev = 9;
|
|
|
_context2.t0 = _context2["catch"](0);
|
|
|
console.log(_context2.t0);
|
|
|
case 12:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2, null, [[0, 9]]);
|
|
|
}));
|
|
|
return _onPlusDiscuss.apply(this, arguments);
|
|
|
}
|
|
|
function onProcessAction() {
|
|
|
return _onProcessAction.apply(this, arguments);
|
|
|
}
|
|
|
function _onProcessAction() {
|
|
|
_onProcessAction = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
|
|
var id, params, type, index, parentDiscussIndex;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
id = actionType.id, params = actionType.params, type = actionType.type, index = actionType.index, parentDiscussIndex = actionType.parentDiscussIndex;
|
|
|
if (!(type === 'hidden-discuss')) {
|
|
|
_context3.next = 7;
|
|
|
break;
|
|
|
}
|
|
|
console.log(params, 'params');
|
|
|
_context3.next = 5;
|
|
|
return hiddenDiscuss(objectSpread2_default()({
|
|
|
id: id,
|
|
|
container_type: 'Practice',
|
|
|
container_identifier: identifier
|
|
|
}, params));
|
|
|
case 5:
|
|
|
if (!parentDiscussIndex) {
|
|
|
data[index].hidden = params.hidden == 1 ? true : false;
|
|
|
} else {
|
|
|
data[parentDiscussIndex].children[index].hidden = params.hidden == 1 ? true : false;
|
|
|
}
|
|
|
dispatch({
|
|
|
type: Types.SET_ACTION_TYPE,
|
|
|
payload: {
|
|
|
actionType: null,
|
|
|
data: toConsumableArray_default()(data)
|
|
|
}
|
|
|
});
|
|
|
case 7:
|
|
|
if (!(type === 'delete-discuss')) {
|
|
|
_context3.next = 13;
|
|
|
break;
|
|
|
}
|
|
|
_context3.next = 10;
|
|
|
return deleteDiscuss({
|
|
|
id: id,
|
|
|
container_type: 'Practice',
|
|
|
container_identifier: identifier
|
|
|
});
|
|
|
case 10:
|
|
|
// if (parentDiscussIndex || parentDiscussIndex === 0) {
|
|
|
// let secondDicusses = data[parentDiscussIndex].children
|
|
|
// for (let i = secondDicusses.length - 1; i >= 0; i--) {
|
|
|
// if (secondDicusses[i].id === id) {
|
|
|
// secondDicusses.splice(i, 1)
|
|
|
// break
|
|
|
// }
|
|
|
// }
|
|
|
// data[parentDiscussIndex].children = secondDicusses
|
|
|
// } else {
|
|
|
// for (let i = data.length - 1; i >= 0; i--) {
|
|
|
// if (data[i].id === id) {
|
|
|
// data.splice(i, 1)
|
|
|
// break
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
dispatch({
|
|
|
type: Types.SET_ACTION_TYPE,
|
|
|
payload: {
|
|
|
actionType: null
|
|
|
// data: [...data],
|
|
|
}
|
|
|
});
|
|
|
_context3.next = 13;
|
|
|
return initData();
|
|
|
case 13:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return _onProcessAction.apply(this, arguments);
|
|
|
}
|
|
|
function onCancelAction() {
|
|
|
dispatch({
|
|
|
type: Types.SET_ACTION_TYPE,
|
|
|
payload: {
|
|
|
actionType: null
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
function onReplyDiscuss(_x4, _x5) {
|
|
|
return _onReplyDiscuss.apply(this, arguments);
|
|
|
}
|
|
|
function _onReplyDiscuss() {
|
|
|
_onReplyDiscuss = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4(id, value) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
_context4.prev = 0;
|
|
|
_context4.next = 3;
|
|
|
return replyDiscuss({
|
|
|
container_type: 'Practice',
|
|
|
container_identifier: identifier,
|
|
|
comments: {
|
|
|
content: value,
|
|
|
parent_id: id
|
|
|
}
|
|
|
});
|
|
|
case 3:
|
|
|
initData();
|
|
|
_context4.next = 9;
|
|
|
break;
|
|
|
case 6:
|
|
|
_context4.prev = 6;
|
|
|
_context4.t0 = _context4["catch"](0);
|
|
|
console.log(_context4.t0);
|
|
|
case 9:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4, null, [[0, 6]]);
|
|
|
}));
|
|
|
return _onReplyDiscuss.apply(this, arguments);
|
|
|
}
|
|
|
function onCreateDiscuss(_x6) {
|
|
|
return _onCreateDiscuss.apply(this, arguments);
|
|
|
}
|
|
|
function _onCreateDiscuss() {
|
|
|
_onCreateDiscuss = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5(value) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
|
|
|
while (1) switch (_context5.prev = _context5.next) {
|
|
|
case 0:
|
|
|
dispatch({
|
|
|
type: Types.SHOW_DISCUSSES_LOADING
|
|
|
});
|
|
|
_context5.next = 3;
|
|
|
return createDiscuss({
|
|
|
comments: {
|
|
|
content: value
|
|
|
},
|
|
|
container_type: 'Practice',
|
|
|
container_identifier: identifier
|
|
|
});
|
|
|
case 3:
|
|
|
initData();
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context5.stop();
|
|
|
}
|
|
|
}, _callee5);
|
|
|
}));
|
|
|
return _onCreateDiscuss.apply(this, arguments);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "discuss-panel",
|
|
|
children: [data.length === 0 ? /*#__PURE__*/(0,jsx_runtime.jsx)(NoData/* default */.Z, {}) : data.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(discuss_item, {
|
|
|
onReplyDiscuss: onReplyDiscuss,
|
|
|
onPlusDiscuss: onPlusDiscuss,
|
|
|
onSetActiveDiscussIndex: onSetActiveDiscussIndex,
|
|
|
onSetActionType: onSetActionType,
|
|
|
data: item,
|
|
|
index: index,
|
|
|
user: user,
|
|
|
activeDiscussIndex: activeDiscussIndex
|
|
|
});
|
|
|
}), count > 10 ? /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "pagination-container",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(pagination/* default */.Z, {
|
|
|
showQuickJumper: true,
|
|
|
onChange: onPaginationChange,
|
|
|
current: page,
|
|
|
total: count
|
|
|
})
|
|
|
}) : null]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(discuss_input_editor, {
|
|
|
user_praise: hack.user_praise,
|
|
|
praise_count: hack.praises_count,
|
|
|
praisePlus: onTriggerPraise,
|
|
|
discuss_count: hack.comments_count,
|
|
|
onCreateDiscuss: onCreateDiscuss
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(components_modal/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
centered: true,
|
|
|
title: "\u63D0\u793A",
|
|
|
open: !!actionType,
|
|
|
onOk: onProcessAction,
|
|
|
onCancel: onCancelAction,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
children: actionType ? actionType.message : ''
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(image_preview/* default */.Z, {})]
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var FilterListmodules = ({"flex_box_center":"flex_box_center___tosr6","flex_space_between":"flex_space_between___cQaTP","flex_box_vertical_center":"flex_box_vertical_center___uovxL","flex_box_center_end":"flex_box_center_end___b4gLY","flex_box_column":"flex_box_column___Umjm_","wrap":"wrap___sgoJE","head":"head___b9a9v","sort":"sort___L2Zw8","btn":"btn___khuE4","listWarp":"listWarp___zZj6C","pagination":"pagination___XlROP","fixedRight":"fixedRight___MuAXo","oj-width-input":"oj-width-input___RsZb6"});
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/List/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var Listmodules = ({"flex_box_center":"flex_box_center___EahWI","flex_space_between":"flex_space_between___zopS4","flex_box_vertical_center":"flex_box_vertical_center___w03mz","flex_box_center_end":"flex_box_center_end___lr0Fp","flex_box_column":"flex_box_column___KFHVi","active":"active___BczOO","line":"line___VC_Ry","list":"list___n9ABd","left":"left___LVHqw","mask":"mask___fP13z","right":"right___iLe52","name":"name___Oz_7h","title":"title___2Sess","a":"a___t7rIW","b":"b___Kb_45","des":"des___CjMBM","tag":"tag___V0PVb"});
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/List/img/b.svg
|
|
|
function b_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = b_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
function b_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return b_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return b_arrayLikeToArray(o, minLen); }
|
|
|
function b_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
|
var b_defProp = Object.defineProperty;
|
|
|
var b_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
var b_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
var b_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
var b_defNormalProp = function __defNormalProp(obj, key, value) {
|
|
|
return key in obj ? b_defProp(obj, key, {
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true,
|
|
|
value: value
|
|
|
}) : obj[key] = value;
|
|
|
};
|
|
|
var b_spreadValues = function __spreadValues(a, b) {
|
|
|
for (var prop in b || (b = {})) if (b_hasOwnProp.call(b, prop)) b_defNormalProp(a, prop, b[prop]);
|
|
|
if (b_getOwnPropSymbols) {
|
|
|
var _iterator = b_createForOfIteratorHelper(b_getOwnPropSymbols(b)),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prop = _step.value;
|
|
|
if (b_propIsEnum.call(b, prop)) b_defNormalProp(a, prop, b[prop]);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
}
|
|
|
return a;
|
|
|
};
|
|
|
|
|
|
var SvgB = function SvgB(props) {
|
|
|
return /* @__PURE__ */React.createElement("svg", b_spreadValues({
|
|
|
width: 12,
|
|
|
height: 10,
|
|
|
xmlns: "http://www.w3.org/2000/svg"
|
|
|
}, props), /* @__PURE__ */React.createElement("title", null, "\u89C2\u770B"), /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M11 0a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h10ZM4.4 2.4a.4.4 0 0 0-.4.4v4.4a.4.4 0 0 0 .64.32l2.72-2.04a.6.6 0 0 0 0-.96L4.64 2.48a.4.4 0 0 0-.24-.08Z",
|
|
|
fill: "#FFF",
|
|
|
fillRule: "evenodd"
|
|
|
}));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ var b = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTExIDBhMSAxIDAgMCAxIDEgMXY4YTEgMSAwIDAgMS0xIDFIMWExIDEgMCAwIDEtMS0xVjFhMSAxIDAgMCAxIDEtMWgxMFpNNC40IDIuNGEuNC40IDAgMCAwLS40LjR2NC40YS40LjQgMCAwIDAgLjY0LjMybDIuNzItMi4wNGEuNi42IDAgMCAwIDAtLjk2TDQuNjQgMi40OGEuNC40IDAgMCAwLS4yNC0uMDhaIiBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=");
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/List/img/c.svg
|
|
|
function c_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = c_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
function c_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return c_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return c_arrayLikeToArray(o, minLen); }
|
|
|
function c_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
|
var c_defProp = Object.defineProperty;
|
|
|
var c_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
var c_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
var c_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
var c_defNormalProp = function __defNormalProp(obj, key, value) {
|
|
|
return key in obj ? c_defProp(obj, key, {
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true,
|
|
|
value: value
|
|
|
}) : obj[key] = value;
|
|
|
};
|
|
|
var c_spreadValues = function __spreadValues(a, b) {
|
|
|
for (var prop in b || (b = {})) if (c_hasOwnProp.call(b, prop)) c_defNormalProp(a, prop, b[prop]);
|
|
|
if (c_getOwnPropSymbols) {
|
|
|
var _iterator = c_createForOfIteratorHelper(c_getOwnPropSymbols(b)),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prop = _step.value;
|
|
|
if (c_propIsEnum.call(b, prop)) c_defNormalProp(a, prop, b[prop]);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
}
|
|
|
return a;
|
|
|
};
|
|
|
|
|
|
var SvgC = function SvgC(props) {
|
|
|
return /* @__PURE__ */React.createElement("svg", c_spreadValues({
|
|
|
width: 16,
|
|
|
height: 14,
|
|
|
xmlns: "http://www.w3.org/2000/svg"
|
|
|
}, props), /* @__PURE__ */React.createElement("title", null, "\u70B9\u8D5E1"), /* @__PURE__ */React.createElement("g", {
|
|
|
fillRule: "nonzero",
|
|
|
fill: "none"
|
|
|
}, /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M2.593 13.356V5.694c0-.31-.231-.561-.516-.561H.976c-.532 0-.962.468-.962 1.047v6.69c0 .579.43 1.047.962 1.047h1.101c.285 0 .516-.251.516-.561Z",
|
|
|
fill: "#999"
|
|
|
}), /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M3.335 13.512V5.53c0-.184.136-.346.333-.391.695-.16 2.289-.735 2.967-2.694C7.048.73 7.495-.08 8.823.017c1.328.097 1.417 1.263 1.417 1.618v2.752s-.107.42.34.453c.45.033 3.947 0 3.947 0s1.919-.029 1.309 2.122c-.53 1.871-1.58 4.882-1.846 5.635a1.606 1.606 0 0 1-.235.438c-.257.338-.796.88-1.62.88H3.782c-.247.002-.447-.179-.447-.403Z",
|
|
|
fill: "#CCC"
|
|
|
})));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ var c = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbC1ydWxlPSJub256ZXJvIiBmaWxsPSJub25lIj48cGF0aCBkPSJNMi41OTMgMTMuMzU2VjUuNjk0YzAtLjMxLS4yMzEtLjU2MS0uNTE2LS41NjFILjk3NmMtLjUzMiAwLS45NjIuNDY4LS45NjIgMS4wNDd2Ni42OWMwIC41NzkuNDMgMS4wNDcuOTYyIDEuMDQ3aDEuMTAxYy4yODUgMCAuNTE2LS4yNTEuNTE2LS41NjFaIiBmaWxsPSIjOTk5Ii8+PHBhdGggZD0iTTMuMzM1IDEzLjUxMlY1LjUzYzAtLjE4NC4xMzYtLjM0Ni4zMzMtLjM5MS42OTUtLjE2IDIuMjg5LS43MzUgMi45NjctMi42OTRDNy4wNDguNzMgNy40OTUtLjA4IDguODIzLjAxN2MxLjMyOC4wOTcgMS40MTcgMS4yNjMgMS40MTcgMS42MTh2Mi43NTJzLS4xMDcuNDIuMzQuNDUzYy40NS4wMzMgMy45NDcgMCAzLjk0NyAwczEuOTE5LS4wMjkgMS4zMDkgMi4xMjJjLS41MyAxLjg3MS0xLjU4IDQuODgyLTEuODQ2IDUuNjM1YTEuNjA2IDEuNjA2IDAgMCAxLS4yMzUuNDM4Yy0uMjU3LjMzOC0uNzk2Ljg4LTEuNjIuODhIMy43ODJjLS4yNDcuMDAyLS40NDctLjE3OS0uNDQ3LS40MDNaIiBmaWxsPSIjQ0NDIi8+PC9nPjwvc3ZnPg==");
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/List/img/c1.svg
|
|
|
function c1_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = c1_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
function c1_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return c1_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return c1_arrayLikeToArray(o, minLen); }
|
|
|
function c1_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
|
var c1_defProp = Object.defineProperty;
|
|
|
var c1_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
var c1_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
var c1_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
var c1_defNormalProp = function __defNormalProp(obj, key, value) {
|
|
|
return key in obj ? c1_defProp(obj, key, {
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true,
|
|
|
value: value
|
|
|
}) : obj[key] = value;
|
|
|
};
|
|
|
var c1_spreadValues = function __spreadValues(a, b) {
|
|
|
for (var prop in b || (b = {})) if (c1_hasOwnProp.call(b, prop)) c1_defNormalProp(a, prop, b[prop]);
|
|
|
if (c1_getOwnPropSymbols) {
|
|
|
var _iterator = c1_createForOfIteratorHelper(c1_getOwnPropSymbols(b)),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prop = _step.value;
|
|
|
if (c1_propIsEnum.call(b, prop)) c1_defNormalProp(a, prop, b[prop]);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
}
|
|
|
return a;
|
|
|
};
|
|
|
|
|
|
var SvgC1 = function SvgC1(props) {
|
|
|
return /* @__PURE__ */React.createElement("svg", c1_spreadValues({
|
|
|
width: 16,
|
|
|
height: 14,
|
|
|
xmlns: "http://www.w3.org/2000/svg"
|
|
|
}, props), /* @__PURE__ */React.createElement("title", null, "\u70B9\u8D5E2"), /* @__PURE__ */React.createElement("g", {
|
|
|
fillRule: "nonzero",
|
|
|
fill: "none"
|
|
|
}, /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M2.593 13.356V5.694c0-.31-.231-.561-.516-.561H.976c-.532 0-.962.468-.962 1.047v6.69c0 .579.43 1.047.962 1.047h1.101c.285 0 .516-.251.516-.561Z",
|
|
|
fill: "#0152d9"
|
|
|
}), /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M3.335 13.512V5.53c0-.184.136-.346.333-.391.695-.16 2.289-.735 2.967-2.694C7.048.73 7.495-.08 8.823.017c1.328.097 1.417 1.263 1.417 1.618v2.752s-.107.42.34.453c.45.033 3.947 0 3.947 0s1.919-.029 1.309 2.122c-.53 1.871-1.58 4.882-1.846 5.635a1.606 1.606 0 0 1-.235.438c-.257.338-.796.88-1.62.88H3.782c-.247.002-.447-.179-.447-.403Z",
|
|
|
fill: "#B6D0FC"
|
|
|
})));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ var c1 = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbC1ydWxlPSJub256ZXJvIiBmaWxsPSJub25lIj48cGF0aCBkPSJNMi41OTMgMTMuMzU2VjUuNjk0YzAtLjMxLS4yMzEtLjU2MS0uNTE2LS41NjFILjk3NmMtLjUzMiAwLS45NjIuNDY4LS45NjIgMS4wNDd2Ni42OWMwIC41NzkuNDMgMS4wNDcuOTYyIDEuMDQ3aDEuMTAxYy4yODUgMCAuNTE2LS4yNTEuNTE2LS41NjFaIiBmaWxsPSIjMDE1MmQ5Ii8+PHBhdGggZD0iTTMuMzM1IDEzLjUxMlY1LjUzYzAtLjE4NC4xMzYtLjM0Ni4zMzMtLjM5MS42OTUtLjE2IDIuMjg5LS43MzUgMi45NjctMi42OTRDNy4wNDguNzMgNy40OTUtLjA4IDguODIzLjAxN2MxLjMyOC4wOTcgMS40MTcgMS4yNjMgMS40MTcgMS42MTh2Mi43NTJzLS4xMDcuNDIuMzQuNDUzYy40NS4wMzMgMy45NDcgMCAzLjk0NyAwczEuOTE5LS4wMjkgMS4zMDkgMi4xMjJjLS41MyAxLjg3MS0xLjU4IDQuODgyLTEuODQ2IDUuNjM1YTEuNjA2IDEuNjA2IDAgMCAxLS4yMzUuNDM4Yy0uMjU3LjMzOC0uNzk2Ljg4LTEuNjIuODhIMy43ODJjLS4yNDcuMDAyLS40NDctLjE3OS0uNDQ3LS40MDNaIiBmaWxsPSIjQjZEMEZDIi8+PC9nPjwvc3ZnPg==");
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/List/img/d.svg
|
|
|
function d_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = d_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
function d_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return d_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return d_arrayLikeToArray(o, minLen); }
|
|
|
function d_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
|
var d_defProp = Object.defineProperty;
|
|
|
var d_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
var d_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
var d_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
var d_defNormalProp = function __defNormalProp(obj, key, value) {
|
|
|
return key in obj ? d_defProp(obj, key, {
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true,
|
|
|
value: value
|
|
|
}) : obj[key] = value;
|
|
|
};
|
|
|
var d_spreadValues = function __spreadValues(a, b) {
|
|
|
for (var prop in b || (b = {})) if (d_hasOwnProp.call(b, prop)) d_defNormalProp(a, prop, b[prop]);
|
|
|
if (d_getOwnPropSymbols) {
|
|
|
var _iterator = d_createForOfIteratorHelper(d_getOwnPropSymbols(b)),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prop = _step.value;
|
|
|
if (d_propIsEnum.call(b, prop)) d_defNormalProp(a, prop, b[prop]);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
}
|
|
|
return a;
|
|
|
};
|
|
|
|
|
|
var SvgD = function SvgD(props) {
|
|
|
return /* @__PURE__ */React.createElement("svg", d_spreadValues({
|
|
|
width: 16,
|
|
|
height: 14,
|
|
|
xmlns: "http://www.w3.org/2000/svg"
|
|
|
}, props), /* @__PURE__ */React.createElement("title", null, "\u8BC4\u8BBA1"), /* @__PURE__ */React.createElement("g", {
|
|
|
fillRule: "nonzero",
|
|
|
fill: "none"
|
|
|
}, /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M4.717.01h8.84c1.571 0 2.357.777 2.357 2.332v5.25c0 1.556-.786 2.334-2.357 2.334h-8.84c-1.572 0-2.357-.778-2.357-2.334v-5.25C2.36.787 3.145.01 4.717.01Z",
|
|
|
fill: "#999"
|
|
|
}), /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M2.36 2.342h8.84a2.37 2.37 0 0 1 1.666.684c.442.437.69 1.03.69 1.65v5.25c0 1.288-1.055 2.333-2.357 2.333H7.94l-1.16 1.153-1.167-1.153H2.36a2.37 2.37 0 0 1-1.667-.683 2.321 2.321 0 0 1-.69-1.65v-5.25c0-.62.248-1.213.69-1.65a2.37 2.37 0 0 1 1.667-.684Z",
|
|
|
fill: "#B6D0FC"
|
|
|
}), /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M2.36 2.926h8.84c1.301 0 2.357 1.044 2.357 2.333v5.25c0 .619-.249 1.212-.69 1.65a2.37 2.37 0 0 1-1.668.683H7.94l-1.16 1.154-1.167-1.154H2.36a2.37 2.37 0 0 1-1.667-.683 2.321 2.321 0 0 1-.69-1.65V5.26c0-.619.248-1.212.69-1.65a2.37 2.37 0 0 1 1.667-.683Z",
|
|
|
fill: "#CCC"
|
|
|
}), /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M3.538 5.842h6.483c.393 0 .589.195.589.584 0 .389-.196.583-.59.583H3.539c-.393 0-.59-.194-.59-.583 0-.39.197-.584.59-.584ZM3.538 8.76h4.715c.393 0 .59.194.59.582 0 .39-.197.584-.59.584H3.538c-.393 0-.59-.195-.59-.584 0-.388.197-.583.59-.583Z",
|
|
|
fill: "#FFF"
|
|
|
})));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ var d = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbC1ydWxlPSJub256ZXJvIiBmaWxsPSJub25lIj48cGF0aCBkPSJNNC43MTcuMDFoOC44NGMxLjU3MSAwIDIuMzU3Ljc3NyAyLjM1NyAyLjMzMnY1LjI1YzAgMS41NTYtLjc4NiAyLjMzNC0yLjM1NyAyLjMzNGgtOC44NGMtMS41NzIgMC0yLjM1Ny0uNzc4LTIuMzU3LTIuMzM0di01LjI1QzIuMzYuNzg3IDMuMTQ1LjAxIDQuNzE3LjAxWiIgZmlsbD0iIzk5OSIvPjxwYXRoIGQ9Ik0yLjM2IDIuMzQyaDguODRhMi4zNyAyLjM3IDAgMCAxIDEuNjY2LjY4NGMuNDQyLjQzNy42OSAxLjAzLjY5IDEuNjV2NS4yNWMwIDEuMjg4LTEuMDU1IDIuMzMzLTIuMzU3IDIuMzMzSDcuOTRsLTEuMTYgMS4xNTMtMS4xNjctMS4xNTNIMi4zNmEyLjM3IDIuMzcgMCAwIDEtMS42NjctLjY4MyAyLjMyMSAyLjMyMSAwIDAgMS0uNjktMS42NXYtNS4yNWMwLS42Mi4yNDgtMS4yMTMuNjktMS42NWEyLjM3IDIuMzcgMCAwIDEgMS42NjctLjY4NFoiIGZpbGw9IiNCNkQwRkMiLz48cGF0aCBkPSJNMi4zNiAyLjkyNmg4Ljg0YzEuMzAxIDAgMi4zNTcgMS4wNDQgMi4zNTcgMi4zMzN2NS4yNWMwIC42MTktLjI0OSAxLjIxMi0uNjkgMS42NWEyLjM3IDIuMzcgMCAwIDEtMS42NjguNjgzSDcuOTRsLTEuMTYgMS4xNTQtMS4xNjctMS4xNTRIMi4zNmEyLjM3IDIuMzcgMCAwIDEtMS42NjctLjY4MyAyLjMyMSAyLjMyMSAwIDAgMS0uNjktMS42NVY1LjI2YzAtLjYxOS4yNDgtMS4yMTIuNjktMS42NWEyLjM3IDIuMzcgMCAwIDEgMS42NjctLjY4M1oiIGZpbGw9IiNDQ0MiLz48cGF0aCBkPSJNMy41MzggNS44NDJoNi40ODNjLjM5MyAwIC41ODkuMTk1LjU4OS41ODQgMCAuMzg5LS4xOTYuNTgzLS41OS41ODNIMy41MzljLS4zOTMgMC0uNTktLjE5NC0uNTktLjU4MyAwLS4zOS4xOTctLjU4NC41OS0uNTg0Wk0zLjUzOCA4Ljc2aDQuNzE1Yy4zOTMgMCAuNTkuMTk0LjU5LjU4MiAwIC4zOS0uMTk3LjU4NC0uNTkuNTg0SDMuNTM4Yy0uMzkzIDAtLjU5LS4xOTUtLjU5LS41ODQgMC0uMzg4LjE5Ny0uNTgzLjU5LS41ODNaIiBmaWxsPSIjRkZGIi8+PC9nPjwvc3ZnPg==");
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/List/img/e.svg
|
|
|
function e_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = e_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
function e_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return e_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return e_arrayLikeToArray(o, minLen); }
|
|
|
function e_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
|
var e_defProp = Object.defineProperty;
|
|
|
var e_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
var e_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
var e_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
var e_defNormalProp = function __defNormalProp(obj, key, value) {
|
|
|
return key in obj ? e_defProp(obj, key, {
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true,
|
|
|
value: value
|
|
|
}) : obj[key] = value;
|
|
|
};
|
|
|
var e_spreadValues = function __spreadValues(a, b) {
|
|
|
for (var prop in b || (b = {})) if (e_hasOwnProp.call(b, prop)) e_defNormalProp(a, prop, b[prop]);
|
|
|
if (e_getOwnPropSymbols) {
|
|
|
var _iterator = e_createForOfIteratorHelper(e_getOwnPropSymbols(b)),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prop = _step.value;
|
|
|
if (e_propIsEnum.call(b, prop)) e_defNormalProp(a, prop, b[prop]);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
}
|
|
|
return a;
|
|
|
};
|
|
|
|
|
|
var SvgE = function SvgE(props) {
|
|
|
return /* @__PURE__ */React.createElement("svg", e_spreadValues({
|
|
|
width: 16,
|
|
|
height: 12,
|
|
|
xmlns: "http://www.w3.org/2000/svg"
|
|
|
}, props), /* @__PURE__ */React.createElement("title", null, "\u67E5\u770B1"), /* @__PURE__ */React.createElement("g", {
|
|
|
fillRule: "nonzero",
|
|
|
fill: "none"
|
|
|
}, /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M7.965 11.961C2.593 11.961 0 6.926 0 5.981 0 5.035 2.623 0 7.965 0s7.965 4.984 7.965 5.98c0 .997-2.593 5.981-7.965 5.981Zm0-2.208c1.296 0 2.494-.72 3.142-1.886a3.902 3.902 0 0 0 0-3.773c-.648-1.167-1.846-1.886-3.142-1.886-2.004 0-3.629 1.69-3.629 3.773s1.625 3.772 3.629 3.772Z",
|
|
|
fill: "#CCC"
|
|
|
}), /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M7.965 8.28c-1.222 0-2.213-1.029-2.213-2.3 0-1.27.991-2.3 2.213-2.3s2.212 1.03 2.212 2.3c0 1.271-.99 2.3-2.212 2.3Z",
|
|
|
fill: "#999"
|
|
|
})));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ var e = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbC1ydWxlPSJub256ZXJvIiBmaWxsPSJub25lIj48cGF0aCBkPSJNNy45NjUgMTEuOTYxQzIuNTkzIDExLjk2MSAwIDYuOTI2IDAgNS45ODEgMCA1LjAzNSAyLjYyMyAwIDcuOTY1IDBzNy45NjUgNC45ODQgNy45NjUgNS45OGMwIC45OTctMi41OTMgNS45ODEtNy45NjUgNS45ODFabTAtMi4yMDhjMS4yOTYgMCAyLjQ5NC0uNzIgMy4xNDItMS44ODZhMy45MDIgMy45MDIgMCAwIDAgMC0zLjc3M2MtLjY0OC0xLjE2Ny0xLjg0Ni0xLjg4Ni0zLjE0Mi0xLjg4Ni0yLjAwNCAwLTMuNjI5IDEuNjktMy42MjkgMy43NzNzMS42MjUgMy43NzIgMy42MjkgMy43NzJaIiBmaWxsPSIjQ0NDIi8+PHBhdGggZD0iTTcuOTY1IDguMjhjLTEuMjIyIDAtMi4yMTMtMS4wMjktMi4yMTMtMi4zIDAtMS4yNy45OTEtMi4zIDIuMjEzLTIuM3MyLjIxMiAxLjAzIDIuMjEyIDIuM2MwIDEuMjcxLS45OSAyLjMtMi4yMTIgMi4zWiIgZmlsbD0iIzk5OSIvPjwvZz48L3N2Zz4=");
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/List/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var List = function List(_ref) {
|
|
|
var _ref$style = _ref.style,
|
|
|
style = _ref$style === void 0 ? {} : _ref$style,
|
|
|
_onClick = _ref.onClick,
|
|
|
onAssist = _ref.onAssist,
|
|
|
onHide = _ref.onHide,
|
|
|
data = _ref.data,
|
|
|
active = _ref.active,
|
|
|
showLine = _ref.showLine;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(react.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: active === (data === null || data === void 0 ? void 0 : data.id) ? "".concat(Listmodules.list, " ").concat(Listmodules.active) : Listmodules.list,
|
|
|
style: style,
|
|
|
onClick: function onClick() {
|
|
|
return _onClick(data);
|
|
|
},
|
|
|
children: [(data === null || data === void 0 ? void 0 : data.video) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Listmodules.left,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: data === null || data === void 0 ? void 0 : data.video_cover
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: b
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: data === null || data === void 0 ? void 0 : data.video_duration
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Listmodules.mask
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Listmodules.right,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Listmodules.name,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: env/* default.IMG_SERVER */.Z.IMG_SERVER + '/images/' + (data === null || data === void 0 ? void 0 : data.image_url),
|
|
|
width: 30,
|
|
|
height: 30
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
title: data === null || data === void 0 ? void 0 : data.name,
|
|
|
className: Listmodules.title,
|
|
|
children: data === null || data === void 0 ? void 0 : data.name
|
|
|
}), (data === null || data === void 0 ? void 0 : data.is_authority) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Listmodules.b,
|
|
|
children: "\u5B98\u65B9"
|
|
|
}), (data === null || data === void 0 ? void 0 : data.is_excellent) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Listmodules.a,
|
|
|
children: "\u7CBE\u9009"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Listmodules.des,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
showLines: 2,
|
|
|
showTextOnly: true,
|
|
|
value: (data === null || data === void 0 ? void 0 : data.content) || '暂无内容'
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Listmodules.tag,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "current",
|
|
|
onClick: function onClick(e) {
|
|
|
e.stopPropagation();
|
|
|
onAssist(data);
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: data !== null && data !== void 0 && data.user_liker ? c1 : c
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: data !== null && data !== void 0 && data.user_liker ? '#0152d9' : '#656f87'
|
|
|
},
|
|
|
children: data === null || data === void 0 ? void 0 : data.praises_count
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: d
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: data === null || data === void 0 ? void 0 : data.discusses_count
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: e
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: data === null || data === void 0 ? void 0 : data.viewed_count
|
|
|
})]
|
|
|
}), (0,authority/* isSuperAdmins */.Ny)() && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "current",
|
|
|
style: {
|
|
|
color: '#0152d9',
|
|
|
marginRight: 0,
|
|
|
userSelect: 'none'
|
|
|
},
|
|
|
onClick: function onClick(e) {
|
|
|
e.stopPropagation();
|
|
|
onHide(data);
|
|
|
},
|
|
|
children: data !== null && data !== void 0 && data.is_hidden ? '取消隐藏' : '隐藏'
|
|
|
})]
|
|
|
})]
|
|
|
})]
|
|
|
}), showLine && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Listmodules.line
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var FilterList_List = (List);
|
|
|
// 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);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/ListForm/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var ListFormmodules = ({"flex_box_center":"flex_box_center___C6sVF","flex_space_between":"flex_space_between___VEt8l","flex_box_vertical_center":"flex_box_vertical_center___qeD5F","flex_box_center_end":"flex_box_center_end___iYJd9","flex_box_column":"flex_box_column___iAKJf","listForm":"listForm___leDJL","scroll":"scroll___wtFaF","formWrap":"formWrap___p3W41","btns":"btns___Izl4q","main":"main___xTqlG","mainLoading":"mainLoading___QLa9s","tip":"tip___a0tbY","proWarp":"proWarp___BZhOt","pro":"pro___Yp1Rx","mainSucceed":"mainSucceed___HfaTf","del":"del___TXGhB"});
|
|
|
// EXTERNAL MODULE: ./src/utils/aliyunUpload.ts
|
|
|
var aliyunUpload = __webpack_require__(77320);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/ListForm/img/v.svg
|
|
|
function v_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = v_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
function v_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return v_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return v_arrayLikeToArray(o, minLen); }
|
|
|
function v_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
|
var v_defProp = Object.defineProperty;
|
|
|
var v_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
var v_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
var v_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
var v_defNormalProp = function __defNormalProp(obj, key, value) {
|
|
|
return key in obj ? v_defProp(obj, key, {
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true,
|
|
|
value: value
|
|
|
}) : obj[key] = value;
|
|
|
};
|
|
|
var v_spreadValues = function __spreadValues(a, b) {
|
|
|
for (var prop in b || (b = {})) if (v_hasOwnProp.call(b, prop)) v_defNormalProp(a, prop, b[prop]);
|
|
|
if (v_getOwnPropSymbols) {
|
|
|
var _iterator = v_createForOfIteratorHelper(v_getOwnPropSymbols(b)),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prop = _step.value;
|
|
|
if (v_propIsEnum.call(b, prop)) v_defNormalProp(a, prop, b[prop]);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
}
|
|
|
return a;
|
|
|
};
|
|
|
|
|
|
var SvgV = function SvgV(props) {
|
|
|
return /* @__PURE__ */React.createElement("svg", v_spreadValues({
|
|
|
width: 32,
|
|
|
height: 30,
|
|
|
xmlns: "http://www.w3.org/2000/svg"
|
|
|
}, props), /* @__PURE__ */React.createElement("title", null, "\u4E0A\u4F20\u89C6\u9891"), /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M1.6 0C1.175 0 .768.17.468.474A1.63 1.63 0 0 0 0 1.622v3.243h3.237L7.378 0H1.6Zm7.876 0L5.338 4.865h5.9L15.371 0H9.476Zm7.998 0-4.137 4.865h5.896L23.372 0h-5.898Zm8 0-4.138 4.865h6.66V1.622a1.629 1.629 0 0 0-.467-1.148A1.585 1.585 0 0 0 26.397 0h-.924ZM0 6.487v17.837c0 .43.167.844.468 1.148.3.305.707.475 1.132.474h18.61a6.515 6.515 0 0 1 1.652-6.218 6.31 6.31 0 0 1 6.134-1.675V6.487H0Zm11.998 5.675 6.4 4.056-6.4 4.055v-8.11Zm14.399 6.487c-3.092.002-5.597 2.544-5.595 5.678.001 3.134 2.508 5.674 5.6 5.673C29.494 30 32 27.458 32 24.324c0-1.506-.59-2.95-1.641-4.014a5.561 5.561 0 0 0-3.962-1.661Zm0 2.027c.22.003.428.1.574.266.663.6 1.327 1.352 1.99 2.002a.8.8 0 0 1 0 1.14.788.788 0 0 1-1.125 0l-.638-.646v3.724a.814.814 0 0 1-.392.724.79.79 0 0 1-.815 0 .814.814 0 0 1-.392-.724v-3.724l-.637.646a.79.79 0 0 1-.773.215.803.803 0 0 1-.567-.575.816.816 0 0 1 .212-.783c.651-.664 1.333-1.388 1.99-2.002a.778.778 0 0 1 .575-.266l-.002.003Z",
|
|
|
fill: "#0152d9",
|
|
|
fillRule: "nonzero"
|
|
|
}));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ var v = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNiAwQzEuMTc1IDAgLjc2OC4xNy40NjguNDc0QTEuNjMgMS42MyAwIDAgMCAwIDEuNjIydjMuMjQzaDMuMjM3TDcuMzc4IDBIMS42Wm03Ljg3NiAwTDUuMzM4IDQuODY1aDUuOUwxNS4zNzEgMEg5LjQ3NlptNy45OTggMC00LjEzNyA0Ljg2NWg1Ljg5NkwyMy4zNzIgMGgtNS44OThabTggMC00LjEzOCA0Ljg2NWg2LjY2VjEuNjIyYTEuNjI5IDEuNjI5IDAgMCAwLS40NjctMS4xNDhBMS41ODUgMS41ODUgMCAwIDAgMjYuMzk3IDBoLS45MjRaTTAgNi40ODd2MTcuODM3YzAgLjQzLjE2Ny44NDQuNDY4IDEuMTQ4LjMuMzA1LjcwNy40NzUgMS4xMzIuNDc0aDE4LjYxYTYuNTE1IDYuNTE1IDAgMCAxIDEuNjUyLTYuMjE4IDYuMzEgNi4zMSAwIDAgMSA2LjEzNC0xLjY3NVY2LjQ4N0gwWm0xMS45OTggNS42NzUgNi40IDQuMDU2LTYuNCA0LjA1NXYtOC4xMVptMTQuMzk5IDYuNDg3Yy0zLjA5Mi4wMDItNS41OTcgMi41NDQtNS41OTUgNS42NzguMDAxIDMuMTM0IDIuNTA4IDUuNjc0IDUuNiA1LjY3M0MyOS40OTQgMzAgMzIgMjcuNDU4IDMyIDI0LjMyNGMwLTEuNTA2LS41OS0yLjk1LTEuNjQxLTQuMDE0YTUuNTYxIDUuNTYxIDAgMCAwLTMuOTYyLTEuNjYxWm0wIDIuMDI3Yy4yMi4wMDMuNDI4LjEuNTc0LjI2Ni42NjMuNiAxLjMyNyAxLjM1MiAxLjk5IDIuMDAyYS44LjggMCAwIDEgMCAxLjE0Ljc4OC43ODggMCAwIDEtMS4xMjUgMGwtLjYzOC0uNjQ2djMuNzI0YS44MTQuODE0IDAgMCAxLS4zOTIuNzI0Ljc5Ljc5IDAgMCAxLS44MTUgMCAuODE0LjgxNCAwIDAgMS0uMzkyLS43MjR2LTMuNzI0bC0uNjM3LjY0NmEuNzkuNzkgMCAwIDEtLjc3My4yMTUuODAzLjgwMyAwIDAgMS0uNTY3LS41NzUuODE2LjgxNiAwIDAgMSAuMjEyLS43ODNjLjY1MS0uNjY0IDEuMzMzLTEuMzg4IDEuOTktMi4wMDJhLjc3OC43NzggMCAwIDEgLjU3NS0uMjY2bC0uMDAyLjAwM1oiIGZpbGw9IiMwMTUyZDkiIGZpbGwtcnVsZT0ibm9uemVybyIvPjwvc3ZnPg==");
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/ListForm/img/s.svg
|
|
|
function s_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = s_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
function s_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return s_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return s_arrayLikeToArray(o, minLen); }
|
|
|
function s_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
|
var s_defProp = Object.defineProperty;
|
|
|
var s_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
var s_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
var s_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
var s_defNormalProp = function __defNormalProp(obj, key, value) {
|
|
|
return key in obj ? s_defProp(obj, key, {
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true,
|
|
|
value: value
|
|
|
}) : obj[key] = value;
|
|
|
};
|
|
|
var s_spreadValues = function __spreadValues(a, b) {
|
|
|
for (var prop in b || (b = {})) if (s_hasOwnProp.call(b, prop)) s_defNormalProp(a, prop, b[prop]);
|
|
|
if (s_getOwnPropSymbols) {
|
|
|
var _iterator = s_createForOfIteratorHelper(s_getOwnPropSymbols(b)),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prop = _step.value;
|
|
|
if (s_propIsEnum.call(b, prop)) s_defNormalProp(a, prop, b[prop]);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
}
|
|
|
return a;
|
|
|
};
|
|
|
|
|
|
var SvgS = function SvgS(props) {
|
|
|
return /* @__PURE__ */React.createElement("svg", s_spreadValues({
|
|
|
width: 30,
|
|
|
height: 30,
|
|
|
xmlns: "http://www.w3.org/2000/svg"
|
|
|
}, props), /* @__PURE__ */React.createElement("title", null, "\u4E0A\u4F20\u6210\u529F"), /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M15 0c8.285 0 15 6.717 15 15 0 8.285-6.715 15-15 15-8.283 0-15-6.715-15-15C0 6.717 6.717 0 15 0Zm10.041 7.5v.01a47.934 47.934 0 0 0-11.232 9.386l-4.372-3.3v-.002L7.5 15.08l7.553 7.42A44.625 44.625 0 0 1 25.5 8.55l-.459-1.05Z",
|
|
|
fill: "#44D7B6",
|
|
|
fillRule: "nonzero"
|
|
|
}));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ var s = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAiIGhlaWdodD0iMzAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTE1IDBjOC4yODUgMCAxNSA2LjcxNyAxNSAxNSAwIDguMjg1LTYuNzE1IDE1LTE1IDE1LTguMjgzIDAtMTUtNi43MTUtMTUtMTVDMCA2LjcxNyA2LjcxNyAwIDE1IDBabTEwLjA0MSA3LjV2LjAxYTQ3LjkzNCA0Ny45MzQgMCAwIDAtMTEuMjMyIDkuMzg2bC00LjM3Mi0zLjN2LS4wMDJMNy41IDE1LjA4bDcuNTUzIDcuNDJBNDQuNjI1IDQ0LjYyNSAwIDAgMSAyNS41IDguNTVsLS40NTktMS4wNVoiIGZpbGw9IiM0NEQ3QjYiIGZpbGwtcnVsZT0ibm9uemVybyIvPjwvc3ZnPg==");
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/ListForm/img/t.svg
|
|
|
function t_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = t_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
function t_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return t_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return t_arrayLikeToArray(o, minLen); }
|
|
|
function t_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
|
var t_defProp = Object.defineProperty;
|
|
|
var t_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
var t_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
var t_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
var t_defNormalProp = function __defNormalProp(obj, key, value) {
|
|
|
return key in obj ? t_defProp(obj, key, {
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true,
|
|
|
value: value
|
|
|
}) : obj[key] = value;
|
|
|
};
|
|
|
var t_spreadValues = function __spreadValues(a, b) {
|
|
|
for (var prop in b || (b = {})) if (t_hasOwnProp.call(b, prop)) t_defNormalProp(a, prop, b[prop]);
|
|
|
if (t_getOwnPropSymbols) {
|
|
|
var _iterator = t_createForOfIteratorHelper(t_getOwnPropSymbols(b)),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prop = _step.value;
|
|
|
if (t_propIsEnum.call(b, prop)) t_defNormalProp(a, prop, b[prop]);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
}
|
|
|
return a;
|
|
|
};
|
|
|
|
|
|
var SvgT = function SvgT(props) {
|
|
|
return /* @__PURE__ */React.createElement("svg", t_spreadValues({
|
|
|
xmlns: "http://www.w3.org/2000/svg",
|
|
|
width: 20,
|
|
|
height: 20
|
|
|
}, props), /* @__PURE__ */React.createElement("path", {
|
|
|
fill: "#AFBACB",
|
|
|
d: "M9.99.02C4.482.02.02 4.482.02 9.99c0 5.506 4.463 9.97 9.97 9.97 5.506 0 9.97-4.464 9.97-9.97 0-5.507-4.464-9.97-9.97-9.97Zm1.636 13.69c-.744 1.19-1.488 2.083-2.827 2.083-.893-.149-1.19-.744-1.042-1.488l1.637-5.506c0-.149 0-.298-.149-.298-.148 0-.446 0-.595.298l-1.042 1.19v-.744c.745-1.19 1.935-2.083 2.828-2.083.744.149 1.19.744 1.042 1.488L9.84 14.305c0 .149 0 .298.148.298.15 0 .447-.15.596-.298l1.041-1.34v.745Zm-.297-7.292c-.596 0-1.19-.446-1.19-1.19 0-.745.446-1.191 1.19-1.191.595 0 1.19.446 1.19 1.19 0 .745-.595 1.191-1.19 1.191Z"
|
|
|
}));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ var t = ("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCI+PHBhdGggZmlsbD0iI0FGQkFDQiIgZD0iTTkuOTkuMDJDNC40ODIuMDIuMDIgNC40ODIuMDIgOS45OWMwIDUuNTA2IDQuNDYzIDkuOTcgOS45NyA5Ljk3IDUuNTA2IDAgOS45Ny00LjQ2NCA5Ljk3LTkuOTcgMC01LjUwNy00LjQ2NC05Ljk3LTkuOTctOS45N1ptMS42MzYgMTMuNjljLS43NDQgMS4xOS0xLjQ4OCAyLjA4My0yLjgyNyAyLjA4My0uODkzLS4xNDktMS4xOS0uNzQ0LTEuMDQyLTEuNDg4bDEuNjM3LTUuNTA2YzAtLjE0OSAwLS4yOTgtLjE0OS0uMjk4LS4xNDggMC0uNDQ2IDAtLjU5NS4yOThsLTEuMDQyIDEuMTl2LS43NDRjLjc0NS0xLjE5IDEuOTM1LTIuMDgzIDIuODI4LTIuMDgzLjc0NC4xNDkgMS4xOS43NDQgMS4wNDIgMS40ODhMOS44NCAxNC4zMDVjMCAuMTQ5IDAgLjI5OC4xNDguMjk4LjE1IDAgLjQ0Ny0uMTUuNTk2LS4yOThsMS4wNDEtMS4zNHYuNzQ1Wm0tLjI5Ny03LjI5MmMtLjU5NiAwLTEuMTktLjQ0Ni0xLjE5LTEuMTkgMC0uNzQ1LjQ0Ni0xLjE5MSAxLjE5LTEuMTkxLjU5NSAwIDEuMTkuNDQ2IDEuMTkgMS4xOSAwIC43NDUtLjU5NSAxLjE5MS0xLjE5IDEuMTkxWiIvPjwvc3ZnPg==");
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/ListForm/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var videoReducer = function videoReducer(state, action) {
|
|
|
var _state$videoList, _state$videoList2, _state$videoList3;
|
|
|
var _action$payload$uploa = action.payload.uploadInfo,
|
|
|
uploadInfo = _action$payload$uploa === void 0 ? {} : _action$payload$uploa;
|
|
|
switch (action.type) {
|
|
|
case 'addVideo':
|
|
|
return {
|
|
|
videoList: [].concat(toConsumableArray_default()(state.videoList), [{
|
|
|
name: uploadInfo.file.name,
|
|
|
size: uploadInfo.file.size,
|
|
|
type: uploadInfo.file.type,
|
|
|
fileHash: uploadInfo.fileHash,
|
|
|
state: uploadInfo.state,
|
|
|
video_id: uploadInfo.videoId,
|
|
|
attachment_id: '',
|
|
|
article_id: -1,
|
|
|
loaded: 0,
|
|
|
title: ''
|
|
|
}])
|
|
|
};
|
|
|
case 'removeVideo':
|
|
|
return {
|
|
|
videoList: state.videoList.filter(function (item) {
|
|
|
return item.name !== action.payload.name;
|
|
|
})
|
|
|
};
|
|
|
case 'replaceVideo':
|
|
|
return {
|
|
|
videoList: action.payload
|
|
|
};
|
|
|
case 'removeAll':
|
|
|
return [];
|
|
|
case 'updateProgress':
|
|
|
return {
|
|
|
videoList: state.videoList.map(function (item) {
|
|
|
if (item.name === action.payload.uploadInfo.file.name) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, item), {
|
|
|
loaded: action.payload.progressPercent,
|
|
|
video_id: uploadInfo.videoId,
|
|
|
fileHash: uploadInfo.fileHash
|
|
|
});
|
|
|
}
|
|
|
return item;
|
|
|
})
|
|
|
};
|
|
|
case 'updateTitle':
|
|
|
return {
|
|
|
videoList: (_state$videoList = state.videoList) === null || _state$videoList === void 0 ? void 0 : _state$videoList.map(function (video) {
|
|
|
if (video.name === action.payload.item.name) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, video), {
|
|
|
title: action.payload.title
|
|
|
});
|
|
|
}
|
|
|
return video;
|
|
|
})
|
|
|
};
|
|
|
case 'updateImg':
|
|
|
return {
|
|
|
videoList: (_state$videoList2 = state.videoList) === null || _state$videoList2 === void 0 ? void 0 : _state$videoList2.map(function (video) {
|
|
|
if (video.name === action.payload.item.name) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, video), {
|
|
|
attachment_id: action.payload.attachment_id
|
|
|
});
|
|
|
}
|
|
|
return video;
|
|
|
})
|
|
|
};
|
|
|
case 'updateImg':
|
|
|
return {
|
|
|
videoList: (_state$videoList3 = state.videoList) === null || _state$videoList3 === void 0 ? void 0 : _state$videoList3.map(function (video) {
|
|
|
if (video.name === action.payload.item.name) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, video), {
|
|
|
attachment_id: action.payload.attachment_id
|
|
|
});
|
|
|
}
|
|
|
return video;
|
|
|
})
|
|
|
};
|
|
|
default:
|
|
|
return [];
|
|
|
}
|
|
|
};
|
|
|
var ListForm_List = function List(_ref) {
|
|
|
var _state$videoList6, _formValue$name;
|
|
|
var onClose = _ref.onClose,
|
|
|
onOk = _ref.onOk,
|
|
|
identifier = _ref.identifier,
|
|
|
active = _ref.active;
|
|
|
var _Form$useForm = es_form/* default.useForm */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
var _useState = (0,react.useState)({}),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
formValue = _useState2[0],
|
|
|
setFormValue = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)(false),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
isLoading = _useState4[0],
|
|
|
setIsLoading = _useState4[1];
|
|
|
var _useState5 = (0,react.useState)(false),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
btnLoading = _useState6[0],
|
|
|
setBtnLoading = _useState6[1];
|
|
|
var _useReducer = (0,react.useReducer)(videoReducer, {
|
|
|
videoList: []
|
|
|
}),
|
|
|
_useReducer2 = slicedToArray_default()(_useReducer, 2),
|
|
|
state = _useReducer2[0],
|
|
|
stateDispatch = _useReducer2[1];
|
|
|
// const [data, setData] = useState<any>({});
|
|
|
var user = (0,authority/* userInfo */.eY)();
|
|
|
var urlParams = (0,_umi_production_exports.useParams)();
|
|
|
var uploader = (0,react.useRef)();
|
|
|
(0,react.useEffect)(function () {
|
|
|
if (active) {
|
|
|
getData();
|
|
|
}
|
|
|
}, [active]);
|
|
|
var getData = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var res, _res$data, _res$data2, _res$data3, _res$data3$videos, value, _res$data4, _res$data4$videos, _res$data4$videos$, _res$data5, _res$data5$videos, _res$data5$videos$;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return (0,service/* editArticlesDetails */.M3)(identifier, {
|
|
|
active: active
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context.sent;
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
value = {
|
|
|
name: res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.name,
|
|
|
content: res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.content
|
|
|
};
|
|
|
form.setFieldsValue(value);
|
|
|
setFormValue(value);
|
|
|
if (res !== null && res !== void 0 && (_res$data3 = res.data) !== null && _res$data3 !== void 0 && (_res$data3$videos = _res$data3.videos) !== null && _res$data3$videos !== void 0 && _res$data3$videos[0]) {
|
|
|
stateDispatch({
|
|
|
type: 'replaceVideo',
|
|
|
payload: [{
|
|
|
video_id: res === null || res === void 0 ? void 0 : (_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : (_res$data4$videos = _res$data4.videos) === null || _res$data4$videos === void 0 ? void 0 : (_res$data4$videos$ = _res$data4$videos[0]) === null || _res$data4$videos$ === void 0 ? void 0 : _res$data4$videos$.video_id,
|
|
|
name: res === null || res === void 0 ? void 0 : (_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : (_res$data5$videos = _res$data5.videos) === null || _res$data5$videos === void 0 ? void 0 : (_res$data5$videos$ = _res$data5$videos[0]) === null || _res$data5$videos$ === void 0 ? void 0 : _res$data5$videos$.title,
|
|
|
loaded: 100
|
|
|
}]
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function getData() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleValuesChange = function handleValuesChange(changeValues, values) {
|
|
|
setFormValue(objectSpread2_default()({}, values));
|
|
|
};
|
|
|
var handleFinish = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(values) {
|
|
|
var _res;
|
|
|
var sendData, res, _res2, _res3;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
sendData = {
|
|
|
videos: state.videoList,
|
|
|
articles: values
|
|
|
};
|
|
|
setBtnLoading(true);
|
|
|
if (!active) {
|
|
|
_context2.next = 9;
|
|
|
break;
|
|
|
}
|
|
|
sendData.active = active;
|
|
|
_context2.next = 6;
|
|
|
return (0,service/* editArticles */.gu)(identifier, sendData);
|
|
|
case 6:
|
|
|
res = _context2.sent;
|
|
|
_context2.next = 12;
|
|
|
break;
|
|
|
case 9:
|
|
|
_context2.next = 11;
|
|
|
return (0,service/* addArticles */.bx)(identifier, sendData);
|
|
|
case 11:
|
|
|
res = _context2.sent;
|
|
|
case 12:
|
|
|
if (((_res = res) === null || _res === void 0 ? void 0 : _res.status) === 0) {
|
|
|
console.log(active || ((_res2 = res) === null || _res2 === void 0 ? void 0 : _res2.id), 44);
|
|
|
onOk(active || ((_res3 = res) === null || _res3 === void 0 ? void 0 : _res3.id));
|
|
|
}
|
|
|
setBtnLoading(false);
|
|
|
case 14:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function handleFinish(_x) {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var clearInput = function clearInput() {
|
|
|
var input = document.getElementById('fileUpload');
|
|
|
input.value = '';
|
|
|
};
|
|
|
var handleUpload = function handleUpload(file) {
|
|
|
var userData = '{"Vod":{}}';
|
|
|
setIsLoading(true);
|
|
|
if (uploader.current) {
|
|
|
uploader.current.addFile(file, null, null, null, userData);
|
|
|
return;
|
|
|
}
|
|
|
(0,aliyunUpload/* getUploader */.o)(user === null || user === void 0 ? void 0 : user.login, '', {
|
|
|
create: !uploader,
|
|
|
addFileSuccess: function addFileSuccess(uploadInfo) {
|
|
|
stateDispatch({
|
|
|
type: 'addVideo',
|
|
|
payload: {
|
|
|
uploadInfo: uploadInfo
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
onUploadProgress: function onUploadProgress(uploadInfo, totalSize, progress) {
|
|
|
var progressPercent = Math.ceil(progress * 100);
|
|
|
stateDispatch({
|
|
|
type: 'updateProgress',
|
|
|
payload: {
|
|
|
uploadInfo: uploadInfo,
|
|
|
progressPercent: progressPercent
|
|
|
}
|
|
|
});
|
|
|
clearInput();
|
|
|
},
|
|
|
onUploadFailed: function onUploadFailed(uploadInfo) {
|
|
|
message/* default.info */.ZP.info('视频云服务出现异常,请重新上传。');
|
|
|
},
|
|
|
onUploadEnd: function onUploadEnd(uploadInfo) {
|
|
|
setIsLoading(false);
|
|
|
},
|
|
|
onUploadSucceed: function onUploadSucceed(uploadInfo) {
|
|
|
setIsLoading(false);
|
|
|
},
|
|
|
onUploadError: function onUploadError(uploadInfo) {
|
|
|
setIsLoading(false);
|
|
|
},
|
|
|
gotUploader: function gotUploader(_uploader) {
|
|
|
_uploader.addFile(file, null, null, null, userData);
|
|
|
uploader.current = _uploader;
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
var handleChangeUpload = function handleChangeUpload(e) {
|
|
|
var _state$videoList4;
|
|
|
var MAX_FILE_SIZE = 1024;
|
|
|
var file = e.target.files[0];
|
|
|
if (!file) {
|
|
|
clearInput();
|
|
|
return;
|
|
|
}
|
|
|
var name = file.name.toLowerCase();
|
|
|
if (name && name.indexOf('.avi') == -1 && name.indexOf('.flv') == -1 && name.indexOf('.f4v') == -1 && name.indexOf('.m4v') == -1 && name.indexOf('.mov') == -1 && name.indexOf('.mp4') == -1 && name.indexOf('.rmvb') == -1 && name.indexOf('.swf') == -1 && name.indexOf('.webm') == -1 && name.indexOf('.wmv') == -1) {
|
|
|
message/* default.info */.ZP.info("\u4E0D\u652F\u6301\u7684\u89C6\u9891\u683C\u5F0F");
|
|
|
clearInput();
|
|
|
return;
|
|
|
}
|
|
|
if (file.size > MAX_FILE_SIZE * 1024 * 1024) {
|
|
|
message/* default.info */.ZP.info("\u89C6\u9891\u5927\u5C0F\u8D85\u8FC7".concat(MAX_FILE_SIZE, "M"));
|
|
|
clearInput();
|
|
|
return;
|
|
|
}
|
|
|
if ((_state$videoList4 = state.videoList) !== null && _state$videoList4 !== void 0 && _state$videoList4.find(function (item) {
|
|
|
return item.name === file.name;
|
|
|
})) {
|
|
|
message/* default.info */.ZP.info("\u4F60\u4E0D\u80FD\u4E0A\u4F20\u540C\u4E00\u4E2A\u89C6\u9891\u6587\u4EF6\u540D\u79F0\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u3002");
|
|
|
clearInput();
|
|
|
return;
|
|
|
}
|
|
|
handleUpload(file);
|
|
|
};
|
|
|
var handleRemove = function handleRemove(name, isSuccess) {
|
|
|
modal/* default.confirm */.Z.confirm({
|
|
|
title: '提示',
|
|
|
centered: true,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "tc",
|
|
|
children: ["\u60A8\u786E\u8BA4\u8981", isSuccess ? '删除' : '取消上传', "\u8BE5\u89C6\u9891\u5417\uFF1F"]
|
|
|
}),
|
|
|
onOk: function onOk() {
|
|
|
clearInput();
|
|
|
stateDispatch({
|
|
|
type: 'removeVideo',
|
|
|
payload: {
|
|
|
name: name
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
var renderUpload = function renderUpload() {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("label", {
|
|
|
htmlFor: "fileUpload",
|
|
|
className: ListFormmodules.main,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: v,
|
|
|
alt: ""
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u4E0A\u4F20\u89C6\u9891"
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var renderUploadLoading = function renderUploadLoading(num) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ListFormmodules.mainLoading,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ListFormmodules.proWarp,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: ListFormmodules.pro,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
width: num
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [num || 0, "%"]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
|
children: "\u4E0A\u4F20\u4E2D"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: ListFormmodules.tip,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
getPopupContainer: function getPopupContainer(trigger) {
|
|
|
return trigger.parentNode;
|
|
|
},
|
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["1\u3001\u4E0A\u4F20\u89C6\u9891\uFF0C\u5373\u8868\u793A\u60A8\u5DF2\u540C\u610F", /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
className: "current c-light-primary",
|
|
|
target: "_blank",
|
|
|
href: "/users/innov/videos/protocol",
|
|
|
children: "\u4E0A\u4F20\u5185\u5BB9\u534F\u8BAE"
|
|
|
}), "\uFF0C\u4E0D\u5F97\u4E0A\u4F20\u672A\u7ECF\u4ED6\u4EBA\u6388\u6743\u7684\u4F5C\u54C1\uFF1B"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "2\u3001\u4E0D\u652F\u6301\u65AD\u70B9\u7EED\u4F20\uFF0C\u6587\u4EF6\u5927\u5C0F\u8BF7\u52FF\u8D85\u8FC71G\uFF1B"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "3\u3001\u652F\u6301\u6587\u4EF6\u683C\u5F0F\uFF1Aavi\u3001flv\u3001f4v\u3001m4v\u3001mov\u3001mp4\u3001rmvb\u3001swf\u3001webm\u3001wmv\uFF1B"
|
|
|
})]
|
|
|
}),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: t,
|
|
|
alt: ""
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var renderSucceed = function renderSucceed(item) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ListFormmodules.mainSucceed,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: s,
|
|
|
alt: ""
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u4E0A\u4F20\u6210\u529F"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: ListFormmodules.tip,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
getPopupContainer: function getPopupContainer(trigger) {
|
|
|
return trigger.parentNode;
|
|
|
},
|
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: ["1\u3001\u4E0A\u4F20\u89C6\u9891\uFF0C\u5373\u8868\u793A\u60A8\u5DF2\u540C\u610F", /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
className: "current c-light-primary",
|
|
|
target: "_blank",
|
|
|
href: "/users/innov/videos/protocol",
|
|
|
children: "\u4E0A\u4F20\u5185\u5BB9\u534F\u8BAE"
|
|
|
}), "\uFF0C\u4E0D\u5F97\u4E0A\u4F20\u672A\u7ECF\u4ED6\u4EBA\u6388\u6743\u7684\u4F5C\u54C1\uFF1B"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "2\u3001\u4E0D\u652F\u6301\u65AD\u70B9\u7EED\u4F20\uFF0C\u6587\u4EF6\u5927\u5C0F\u8BF7\u52FF\u8D85\u8FC71G\uFF1B"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "3\u3001\u652F\u6301\u6587\u4EF6\u683C\u5F0F\uFF1Aavi\u3001flv\u3001f4v\u3001m4v\u3001mov\u3001mp4\u3001rmvb\u3001swf\u3001webm\u3001wmv\uFF1B"
|
|
|
})]
|
|
|
}),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: t,
|
|
|
alt: ""
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ListFormmodules.del,
|
|
|
onClick: function onClick() {
|
|
|
return handleRemove(item.name, item.loaded == 100);
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-shanchu7 mr5"
|
|
|
}), "\u5220\u9664\u89C6\u9891"]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var renderFile = function renderFile() {
|
|
|
var _state$videoList5;
|
|
|
return (
|
|
|
/*#__PURE__*/
|
|
|
// <div className='ml30 mb30 mr40'>
|
|
|
// <Spin spinning={isLoading}>
|
|
|
// {
|
|
|
// state.videoList?.map((item: any, index: number) => {
|
|
|
// return <div>
|
|
|
// <div>{item.name}</div>
|
|
|
// <div>
|
|
|
// <Progress percent={item.loaded} status={item.loaded == 100 ? "normal" : 'active'} />
|
|
|
// <div>
|
|
|
// <Button type="primary" onClick={() => handleRemove(item.name, item.loaded == 100)}>{item.loaded === 100 ? '删除' : '取消上传'}</Button>
|
|
|
// </div>
|
|
|
// </div>
|
|
|
// </div>
|
|
|
// })
|
|
|
// }
|
|
|
// </Spin>
|
|
|
// </div>
|
|
|
(0,jsx_runtime.jsx)(react.Fragment, {
|
|
|
children: (_state$videoList5 = state.videoList) === null || _state$videoList5 === void 0 ? void 0 : _state$videoList5.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(react.Fragment, {
|
|
|
children: item.loaded == 100 ? renderSucceed(item) : renderUploadLoading(item.loaded)
|
|
|
}, index);
|
|
|
})
|
|
|
})
|
|
|
);
|
|
|
};
|
|
|
var handleClose = function handleClose() {
|
|
|
modal/* default.confirm */.Z.confirm({
|
|
|
centered: true,
|
|
|
width: 500,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
title: '注意',
|
|
|
icon: null,
|
|
|
className: 'custom-modal-divider',
|
|
|
content: '您正在编写题解,点击关闭后,您的题解内容将不会进行保存。',
|
|
|
onOk: onClose
|
|
|
});
|
|
|
};
|
|
|
var hasFile = (_state$videoList6 = state.videoList) === null || _state$videoList6 === void 0 ? void 0 : _state$videoList6.length;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ListFormmodules.listForm,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("header", {
|
|
|
children: [active ? '编辑' : '发布', "\u9898\u89E3"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: ListFormmodules.scroll,
|
|
|
id: "sss",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ListFormmodules.formWrap,
|
|
|
children: [" ", /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
|
|
|
form: form,
|
|
|
scrollToFirstError: true,
|
|
|
layout: "vertical",
|
|
|
onValuesChange: handleValuesChange,
|
|
|
onFinish: handleFinish,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
name: "name",
|
|
|
label: "\u6807\u9898:",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入名称'
|
|
|
}, {
|
|
|
max: 60,
|
|
|
message: '请输入名称,最大限制60个字符'
|
|
|
}, {
|
|
|
whitespace: true,
|
|
|
message: '请勿输入空格'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
bordered: false,
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26",
|
|
|
suffix: "".concat(((_formValue$name = formValue.name) === null || _formValue$name === void 0 ? void 0 : _formValue$name.length) || 0, "/60")
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
|
|
|
name: "content",
|
|
|
label: "\u5185\u5BB9:",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
defaultValue: formValue.content || '',
|
|
|
watch: true
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ListFormmodules.upload,
|
|
|
children: [hasFile ? renderFile() : renderUpload(), /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
|
|
|
type: "file",
|
|
|
id: "fileUpload",
|
|
|
style: {
|
|
|
display: 'none'
|
|
|
},
|
|
|
onChange: handleChangeUpload,
|
|
|
accept: ".mkv, .flv, .f4v, .rmvb, .swf, video/mp4,video/x-m4v,video/flv,video/f4v,video/rmvb,video/swf,video/*"
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ListFormmodules.btns,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
onClick: handleClose,
|
|
|
type: "primary",
|
|
|
ghost: true,
|
|
|
children: "\u5173\u95ED"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
loading: btnLoading,
|
|
|
disabled: isLoading,
|
|
|
onClick: function onClick() {
|
|
|
return form.submit();
|
|
|
},
|
|
|
type: "primary",
|
|
|
children: "\u53D1\u5E03\u9898\u89E3"
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var ListForm = (ListForm_List);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/skeleton/style/index.js + 1 modules
|
|
|
var skeleton_style = __webpack_require__(61099);
|
|
|
// EXTERNAL MODULE: ./node_modules/antd/es/skeleton/index.js + 11 modules
|
|
|
var skeleton = __webpack_require__(73481);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/ListDetails/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var ListDetailsmodules = ({"flex_box_center":"flex_box_center___Udvu8","flex_space_between":"flex_space_between___WNLp1","flex_box_vertical_center":"flex_box_vertical_center___ecch5","flex_box_center_end":"flex_box_center_end___cu_DJ","flex_box_column":"flex_box_column___zF2CU","listDetails":"listDetails___HpDwH","head":"head___wipEz","name":"name___qdH8S","title":"title___B0yUa","a":"a___LB6ZS","b":"b___yvOON","tag":"tag___bRCso","btn":"btn___akBxg","scroll":"scroll___JKC_q","video":"video___nEr4F","html":"html___GDNSx","g":"g___LSOhO","btns":"btns___Ci727"});
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/ListDetails/img/jx.svg
|
|
|
function jx_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = jx_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
function jx_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return jx_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return jx_arrayLikeToArray(o, minLen); }
|
|
|
function jx_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
|
var jx_defProp = Object.defineProperty;
|
|
|
var jx_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
var jx_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
var jx_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
var jx_defNormalProp = function __defNormalProp(obj, key, value) {
|
|
|
return key in obj ? jx_defProp(obj, key, {
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true,
|
|
|
value: value
|
|
|
}) : obj[key] = value;
|
|
|
};
|
|
|
var jx_spreadValues = function __spreadValues(a, b) {
|
|
|
for (var prop in b || (b = {})) if (jx_hasOwnProp.call(b, prop)) jx_defNormalProp(a, prop, b[prop]);
|
|
|
if (jx_getOwnPropSymbols) {
|
|
|
var _iterator = jx_createForOfIteratorHelper(jx_getOwnPropSymbols(b)),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prop = _step.value;
|
|
|
if (jx_propIsEnum.call(b, prop)) jx_defNormalProp(a, prop, b[prop]);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
}
|
|
|
return a;
|
|
|
};
|
|
|
|
|
|
var SvgJx = function SvgJx(props) {
|
|
|
return /* @__PURE__ */React.createElement("svg", jx_spreadValues({
|
|
|
xmlns: "http://www.w3.org/2000/svg",
|
|
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
|
width: 15,
|
|
|
height: 16
|
|
|
}, props), /* @__PURE__ */React.createElement("defs", null, /* @__PURE__ */React.createElement("path", {
|
|
|
id: "jx_svg__a",
|
|
|
d: "M6.385.257c.616-.343 1.616-.342 2.23 0l5.27 2.94C14.501 3.538 15 4.38 15 5.071v5.856c0 .692-.501 1.533-1.115 1.876l-5.27 2.939c-.616.343-1.616.342-2.23 0l-5.27-2.94C.499 12.462 0 11.622 0 10.929V5.072C0 4.38.501 3.54 1.115 3.196Zm1.423 3.817c-.169-.341-.446-.341-.615 0L6.38 5.717c-.169.341-.616.665-.994.72l-1.82.264c-.378.055-.464.317-.19.583l1.317 1.278c.273.266.444.79.38 1.165l-.31 1.806c-.066.376.158.538.496.36l1.628-.853c.338-.177.89-.177 1.23 0l1.627.853c.337.177.561.015.497-.36l-.31-1.806c-.065-.375.105-.899.379-1.165l1.316-1.278c.274-.266.188-.529-.19-.583l-1.819-.264c-.377-.054-.825-.378-.994-.72Z"
|
|
|
})), /* @__PURE__ */React.createElement("g", {
|
|
|
fill: "none",
|
|
|
fillRule: "evenodd"
|
|
|
}, /* @__PURE__ */React.createElement("mask", {
|
|
|
id: "jx_svg__b",
|
|
|
fill: "#fff"
|
|
|
}, /* @__PURE__ */React.createElement("use", {
|
|
|
xlinkHref: "#jx_svg__a"
|
|
|
})), /* @__PURE__ */React.createElement("use", {
|
|
|
fill: "#8DC9FF",
|
|
|
fillRule: "nonzero",
|
|
|
xlinkHref: "#jx_svg__a"
|
|
|
}), /* @__PURE__ */React.createElement("circle", {
|
|
|
cx: -1.5,
|
|
|
cy: -3.5,
|
|
|
r: 16.5,
|
|
|
fill: "#C1E2FF",
|
|
|
fillRule: "nonzero",
|
|
|
mask: "url(#jx_svg__b)"
|
|
|
}), /* @__PURE__ */React.createElement("circle", {
|
|
|
cx: -2.5,
|
|
|
cy: -4.5,
|
|
|
r: 12.5,
|
|
|
fill: "#EEF7FF",
|
|
|
fillRule: "nonzero",
|
|
|
mask: "url(#jx_svg__b)"
|
|
|
})));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ var jx = ("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMTUiIGhlaWdodD0iMTYiPjxkZWZzPjxwYXRoIGlkPSJhIiBkPSJNNi4zODUuMjU3Yy42MTYtLjM0MyAxLjYxNi0uMzQyIDIuMjMgMGw1LjI3IDIuOTRDMTQuNTAxIDMuNTM4IDE1IDQuMzggMTUgNS4wNzF2NS44NTZjMCAuNjkyLS41MDEgMS41MzMtMS4xMTUgMS44NzZsLTUuMjcgMi45MzljLS42MTYuMzQzLTEuNjE2LjM0Mi0yLjIzIDBsLTUuMjctMi45NEMuNDk5IDEyLjQ2MiAwIDExLjYyMiAwIDEwLjkyOVY1LjA3MkMwIDQuMzguNTAxIDMuNTQgMS4xMTUgMy4xOTZabTEuNDIzIDMuODE3Yy0uMTY5LS4zNDEtLjQ0Ni0uMzQxLS42MTUgMEw2LjM4IDUuNzE3Yy0uMTY5LjM0MS0uNjE2LjY2NS0uOTk0LjcybC0xLjgyLjI2NGMtLjM3OC4wNTUtLjQ2NC4zMTctLjE5LjU4M2wxLjMxNyAxLjI3OGMuMjczLjI2Ni40NDQuNzkuMzggMS4xNjVsLS4zMSAxLjgwNmMtLjA2Ni4zNzYuMTU4LjUzOC40OTYuMzZsMS42MjgtLjg1M2MuMzM4LS4xNzcuODktLjE3NyAxLjIzIDBsMS42MjcuODUzYy4zMzcuMTc3LjU2MS4wMTUuNDk3LS4zNmwtLjMxLTEuODA2Yy0uMDY1LS4zNzUuMTA1LS44OTkuMzc5LTEuMTY1bDEuMzE2LTEuMjc4Yy4yNzQtLjI2Ni4xODgtLjUyOS0uMTktLjU4M2wtMS44MTktLjI2NGMtLjM3Ny0uMDU0LS44MjUtLjM3OC0uOTk0LS43MloiLz48L2RlZnM+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48bWFzayBpZD0iYiIgZmlsbD0iI2ZmZiI+PHVzZSB4bGluazpocmVmPSIjYSIvPjwvbWFzaz48dXNlIGZpbGw9IiM4REM5RkYiIGZpbGwtcnVsZT0ibm9uemVybyIgeGxpbms6aHJlZj0iI2EiLz48Y2lyY2xlIGN4PSItMS41IiBjeT0iLTMuNSIgcj0iMTYuNSIgZmlsbD0iI0MxRTJGRiIgZmlsbC1ydWxlPSJub256ZXJvIiBtYXNrPSJ1cmwoI2IpIi8+PGNpcmNsZSBjeD0iLTIuNSIgY3k9Ii00LjUiIHI9IjEyLjUiIGZpbGw9IiNFRUY3RkYiIGZpbGwtcnVsZT0ibm9uemVybyIgbWFzaz0idXJsKCNiKSIvPjwvZz48L3N2Zz4=");
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/ListDetails/img/gf.svg
|
|
|
function gf_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = gf_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
function gf_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return gf_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return gf_arrayLikeToArray(o, minLen); }
|
|
|
function gf_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
|
var gf_defProp = Object.defineProperty;
|
|
|
var gf_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
var gf_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
var gf_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
var gf_defNormalProp = function __defNormalProp(obj, key, value) {
|
|
|
return key in obj ? gf_defProp(obj, key, {
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true,
|
|
|
value: value
|
|
|
}) : obj[key] = value;
|
|
|
};
|
|
|
var gf_spreadValues = function __spreadValues(a, b) {
|
|
|
for (var prop in b || (b = {})) if (gf_hasOwnProp.call(b, prop)) gf_defNormalProp(a, prop, b[prop]);
|
|
|
if (gf_getOwnPropSymbols) {
|
|
|
var _iterator = gf_createForOfIteratorHelper(gf_getOwnPropSymbols(b)),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prop = _step.value;
|
|
|
if (gf_propIsEnum.call(b, prop)) gf_defNormalProp(a, prop, b[prop]);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
}
|
|
|
return a;
|
|
|
};
|
|
|
|
|
|
var SvgGf = function SvgGf(props) {
|
|
|
return /* @__PURE__ */React.createElement("svg", gf_spreadValues({
|
|
|
xmlns: "http://www.w3.org/2000/svg",
|
|
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
|
width: 16,
|
|
|
height: 16
|
|
|
}, props), /* @__PURE__ */React.createElement("defs", null, /* @__PURE__ */React.createElement("path", {
|
|
|
id: "gf_svg__a",
|
|
|
d: "m8 0 1.857 1.073h2.146l1.071 1.854L14.931 4v2.144L16 8l-1.069 1.857V12l-1.858 1.072-1.071 1.856H9.857L8 16l-1.855-1.073H4l-1.072-1.856L1.072 12V9.857L0 8l1.072-1.856V4l1.857-1.073 1.072-1.854h2.145L8 0Zm2.91 6.385H4.796V12h1.246v-.451h4.026v.435h1.247V9.196H6.043v-.515h4.866V6.385Zm-.84 3.681v.613H6.042v-.613h4.026ZM9.705 7.24v.588H6.043v-.588h3.663ZM8.615 4l-1.48.137c.055.133.12.284.192.453l.076.175H4v1.426h1.195v-.483h5.61v.483H12V4.765H8.883c-.078-.23-.148-.43-.21-.602L8.616 4Z"
|
|
|
})), /* @__PURE__ */React.createElement("g", {
|
|
|
fill: "none",
|
|
|
fillRule: "evenodd"
|
|
|
}, /* @__PURE__ */React.createElement("mask", {
|
|
|
id: "gf_svg__b",
|
|
|
fill: "#fff"
|
|
|
}, /* @__PURE__ */React.createElement("use", {
|
|
|
xlinkHref: "#gf_svg__a"
|
|
|
})), /* @__PURE__ */React.createElement("use", {
|
|
|
fill: "#8DC9FF",
|
|
|
fillRule: "nonzero",
|
|
|
xlinkHref: "#gf_svg__a"
|
|
|
}), /* @__PURE__ */React.createElement("circle", {
|
|
|
cx: 0.5,
|
|
|
cy: -3.5,
|
|
|
r: 16.5,
|
|
|
fill: "#C1E2FF",
|
|
|
fillRule: "nonzero",
|
|
|
mask: "url(#gf_svg__b)"
|
|
|
}), /* @__PURE__ */React.createElement("circle", {
|
|
|
cx: -0.5,
|
|
|
cy: -4.5,
|
|
|
r: 12.5,
|
|
|
fill: "#EEF7FF",
|
|
|
fillRule: "nonzero",
|
|
|
mask: "url(#gf_svg__b)"
|
|
|
})));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ var gf = ("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMTYiIGhlaWdodD0iMTYiPjxkZWZzPjxwYXRoIGlkPSJhIiBkPSJtOCAwIDEuODU3IDEuMDczaDIuMTQ2bDEuMDcxIDEuODU0TDE0LjkzMSA0djIuMTQ0TDE2IDhsLTEuMDY5IDEuODU3VjEybC0xLjg1OCAxLjA3Mi0xLjA3MSAxLjg1Nkg5Ljg1N0w4IDE2bC0xLjg1NS0xLjA3M0g0bC0xLjA3Mi0xLjg1NkwxLjA3MiAxMlY5Ljg1N0wwIDhsMS4wNzItMS44NTZWNGwxLjg1Ny0xLjA3MyAxLjA3Mi0xLjg1NGgyLjE0NUw4IDBabTIuOTEgNi4zODVINC43OTZWMTJoMS4yNDZ2LS40NTFoNC4wMjZ2LjQzNWgxLjI0N1Y5LjE5Nkg2LjA0M3YtLjUxNWg0Ljg2NlY2LjM4NVptLS44NCAzLjY4MXYuNjEzSDYuMDQydi0uNjEzaDQuMDI2Wk05LjcwNSA3LjI0di41ODhINi4wNDN2LS41ODhoMy42NjNaTTguNjE1IDRsLTEuNDguMTM3Yy4wNTUuMTMzLjEyLjI4NC4xOTIuNDUzbC4wNzYuMTc1SDR2MS40MjZoMS4xOTV2LS40ODNoNS42MXYuNDgzSDEyVjQuNzY1SDguODgzYy0uMDc4LS4yMy0uMTQ4LS40My0uMjEtLjYwMkw4LjYxNiA0WiIvPjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxtYXNrIGlkPSJiIiBmaWxsPSIjZmZmIj48dXNlIHhsaW5rOmhyZWY9IiNhIi8+PC9tYXNrPjx1c2UgZmlsbD0iIzhEQzlGRiIgZmlsbC1ydWxlPSJub256ZXJvIiB4bGluazpocmVmPSIjYSIvPjxjaXJjbGUgY3g9Ii41IiBjeT0iLTMuNSIgcj0iMTYuNSIgZmlsbD0iI0MxRTJGRiIgZmlsbC1ydWxlPSJub256ZXJvIiBtYXNrPSJ1cmwoI2IpIi8+PGNpcmNsZSBjeD0iLS41IiBjeT0iLTQuNSIgcj0iMTIuNSIgZmlsbD0iI0VFRjdGRiIgZmlsbC1ydWxlPSJub256ZXJvIiBtYXNrPSJ1cmwoI2IpIi8+PC9nPjwvc3ZnPg==");
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/ListDetails/img/g.svg
|
|
|
function g_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = g_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
function g_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return g_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return g_arrayLikeToArray(o, minLen); }
|
|
|
function g_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
|
var g_defProp = Object.defineProperty;
|
|
|
var g_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
var g_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
var g_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
var g_defNormalProp = function __defNormalProp(obj, key, value) {
|
|
|
return key in obj ? g_defProp(obj, key, {
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true,
|
|
|
value: value
|
|
|
}) : obj[key] = value;
|
|
|
};
|
|
|
var g_spreadValues = function __spreadValues(a, b) {
|
|
|
for (var prop in b || (b = {})) if (g_hasOwnProp.call(b, prop)) g_defNormalProp(a, prop, b[prop]);
|
|
|
if (g_getOwnPropSymbols) {
|
|
|
var _iterator = g_createForOfIteratorHelper(g_getOwnPropSymbols(b)),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prop = _step.value;
|
|
|
if (g_propIsEnum.call(b, prop)) g_defNormalProp(a, prop, b[prop]);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
}
|
|
|
return a;
|
|
|
};
|
|
|
|
|
|
var SvgG = function SvgG(props) {
|
|
|
return /* @__PURE__ */React.createElement("svg", g_spreadValues({
|
|
|
width: 22,
|
|
|
height: 20,
|
|
|
xmlns: "http://www.w3.org/2000/svg"
|
|
|
}, props), /* @__PURE__ */React.createElement("title", null, "\u5927\u70B9\u8D5E"), /* @__PURE__ */React.createElement("g", {
|
|
|
fillRule: "nonzero",
|
|
|
fill: "none"
|
|
|
}, /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M3.566 19.08V8.134c0-.443-.318-.802-.71-.802H1.34c-.73 0-1.322.67-1.322 1.496v9.558c0 .827.593 1.496 1.322 1.496h1.515c.392 0 .71-.36.71-.802Z",
|
|
|
fill: "#A3D3FF"
|
|
|
}), /* @__PURE__ */React.createElement("path", {
|
|
|
d: "M4.585 19.303V7.9c0-.263.188-.495.459-.559.955-.229 3.147-1.049 4.08-3.848.567-2.451 1.182-3.607 3.008-3.469 1.826.139 1.948 1.804 1.948 2.312v3.93s-.148.602.468.649c.617.046 5.426 0 5.426 0s2.639-.042 1.8 3.031c-.73 2.673-2.173 6.974-2.537 8.05a2.324 2.324 0 0 1-.324.626c-.353.483-1.094 1.258-2.228 1.258H5.201c-.341.002-.616-.257-.616-.577Z",
|
|
|
fill: "#FFF"
|
|
|
})));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ var g = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjIiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbC1ydWxlPSJub256ZXJvIiBmaWxsPSJub25lIj48cGF0aCBkPSJNMy41NjYgMTkuMDhWOC4xMzRjMC0uNDQzLS4zMTgtLjgwMi0uNzEtLjgwMkgxLjM0Yy0uNzMgMC0xLjMyMi42Ny0xLjMyMiAxLjQ5NnY5LjU1OGMwIC44MjcuNTkzIDEuNDk2IDEuMzIyIDEuNDk2aDEuNTE1Yy4zOTIgMCAuNzEtLjM2LjcxLS44MDJaIiBmaWxsPSIjQTNEM0ZGIi8+PHBhdGggZD0iTTQuNTg1IDE5LjMwM1Y3LjljMC0uMjYzLjE4OC0uNDk1LjQ1OS0uNTU5Ljk1NS0uMjI5IDMuMTQ3LTEuMDQ5IDQuMDgtMy44NDguNTY3LTIuNDUxIDEuMTgyLTMuNjA3IDMuMDA4LTMuNDY5IDEuODI2LjEzOSAxLjk0OCAxLjgwNCAxLjk0OCAyLjMxMnYzLjkzcy0uMTQ4LjYwMi40NjguNjQ5Yy42MTcuMDQ2IDUuNDI2IDAgNS40MjYgMHMyLjYzOS0uMDQyIDEuOCAzLjAzMWMtLjczIDIuNjczLTIuMTczIDYuOTc0LTIuNTM3IDguMDVhMi4zMjQgMi4zMjQgMCAwIDEtLjMyNC42MjZjLS4zNTMuNDgzLTEuMDk0IDEuMjU4LTIuMjI4IDEuMjU4SDUuMjAxYy0uMzQxLjAwMi0uNjE2LS4yNTctLjYxNi0uNTc3WiIgZmlsbD0iI0ZGRiIvPjwvZz48L3N2Zz4=");
|
|
|
// 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);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/ListDetails/CustomDiscuss/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var CustomDiscussmodules = ({"flex_box_center":"flex_box_center___Fl60v","flex_space_between":"flex_space_between___bECvI","flex_box_vertical_center":"flex_box_vertical_center___NasnL","flex_box_center_end":"flex_box_center_end___llsAF","flex_box_column":"flex_box_column___KaTPF","discuss":"discuss___fk6PE","reply":"reply___pOmly","pagination":"pagination___qEsHX"});
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/ListDetails/CustomDiscuss/DiscussItem/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var DiscussItemmodules = ({"flex_box_center":"flex_box_center___qGmgZ","flex_space_between":"flex_space_between___PeDhE","flex_box_vertical_center":"flex_box_vertical_center___avs2o","flex_box_center_end":"flex_box_center_end___bpXQB","flex_box_column":"flex_box_column___bc5wd","discussItem":"discussItem___zcesj","wrap":"wrap___ezVW4","list":"list___EEOWp","btns":"btns___Niwl7","secondLevelDiscuss":"secondLevelDiscuss___TXG1b","line":"line___ejh2a","thirdlyLevelDiscuss":"thirdlyLevelDiscuss___HRI5Q"});
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/ListDetails/CustomDiscuss/DiscussItem/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Reply = function Reply(_ref) {
|
|
|
var id = _ref.id,
|
|
|
cb = _ref.cb;
|
|
|
var _useState = (0,react.useState)(''),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
value = _useState2[0],
|
|
|
setValue = _useState2[1];
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
className: "mt10",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
defaultValue: value,
|
|
|
id: "writeForumsReviewId",
|
|
|
onChange: function onChange(v) {
|
|
|
setValue(v);
|
|
|
},
|
|
|
placeholder: "\u6211\u8981\u56DE\u590D...",
|
|
|
height: 240
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "1"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
type: "primary",
|
|
|
size: "large",
|
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
if (value === '') {
|
|
|
message/* default.error */.ZP.error('请输入内容');
|
|
|
} else {
|
|
|
cb(id, value);
|
|
|
}
|
|
|
case 1:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
})),
|
|
|
children: "\u53D1\u9001"
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var ThirdlyLevelDiscuss = function ThirdlyLevelDiscuss(_ref3) {
|
|
|
var _data$author;
|
|
|
var data = _ref3.data;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: DiscussItemmodules.thirdlyLevelDiscuss,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "c-grey-333",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font 14 c-light-primary",
|
|
|
children: data === null || data === void 0 ? void 0 : (_data$author = data.author) === null || _data$author === void 0 ? void 0 : _data$author.name
|
|
|
}), "@", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font 14 c-light-primary",
|
|
|
children: data === null || data === void 0 ? void 0 : data.parent_name
|
|
|
}), ":"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: data === null || data === void 0 ? void 0 : data.content
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var DiscussItem_SecondLevelDiscuss = function SecondLevelDiscuss(_ref4) {
|
|
|
var _data$author2, _data$author3, _data$author4, _data$children;
|
|
|
var data = _ref4.data,
|
|
|
onReplyDiscuss = _ref4.onReplyDiscuss,
|
|
|
thirdlyReply = _ref4.thirdlyReply,
|
|
|
setThirdlyReply = _ref4.setThirdlyReply;
|
|
|
var user = (0,authority/* userInfo */.eY)();
|
|
|
console.log(user, 'user');
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: DiscussItemmodules.list,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: env/* default.IMG_SERVER */.Z.IMG_SERVER + '/images/' + (data === null || data === void 0 ? void 0 : (_data$author2 = data.author) === null || _data$author2 === void 0 ? void 0 : _data$author2.image_url)
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: DiscussItemmodules.wrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "font14",
|
|
|
style: {
|
|
|
marginBottom: 6
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-grey-333",
|
|
|
children: data === null || data === void 0 ? void 0 : (_data$author3 = data.author) === null || _data$author3 === void 0 ? void 0 : _data$author3.name
|
|
|
}), (user === null || user === void 0 ? void 0 : user.login) !== (data === null || data === void 0 ? void 0 : (_data$author4 = data.author) === null || _data$author4 === void 0 ? void 0 : _data$author4.login) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
onClick: function onClick() {
|
|
|
return setThirdlyReply(data === null || data === void 0 ? void 0 : data.id);
|
|
|
},
|
|
|
className: "c-grey-999 current",
|
|
|
style: {
|
|
|
"float": 'right'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-huifu3 mr3 font12"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u56DE\u590D"
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: data === null || data === void 0 ? void 0 : data.content
|
|
|
}), data === null || data === void 0 ? void 0 : (_data$children = data.children) === null || _data$children === void 0 ? void 0 : _data$children.map(function (e) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(ThirdlyLevelDiscuss, {
|
|
|
data: e
|
|
|
}, e.id);
|
|
|
}), thirdlyReply === (data === null || data === void 0 ? void 0 : data.id) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(Reply, {
|
|
|
id: data === null || data === void 0 ? void 0 : data.id,
|
|
|
cb: onReplyDiscuss
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
textAlign: 'end',
|
|
|
paddingTop: 20
|
|
|
},
|
|
|
onClick: function onClick() {
|
|
|
return setThirdlyReply(null);
|
|
|
},
|
|
|
className: "c-light-primary current",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
style: {
|
|
|
transform: 'scale(0.7)',
|
|
|
display: 'inline-block'
|
|
|
},
|
|
|
className: "iconfont icon-shouqi font12"
|
|
|
}), "\u6536\u8D77\u56DE\u590D"]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: DiscussItemmodules.line
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
var DiscussItem = function DiscussItem(_ref5) {
|
|
|
var _data$author5, _data$author6, _data$children3, _data$children4;
|
|
|
var data = _ref5.data,
|
|
|
onReplyDiscuss = _ref5.onReplyDiscuss,
|
|
|
secondReply = _ref5.secondReply,
|
|
|
setSecondReply = _ref5.setSecondReply,
|
|
|
thirdlyReply = _ref5.thirdlyReply,
|
|
|
setThirdlyReply = _ref5.setThirdlyReply,
|
|
|
onPlusDiscuss = _ref5.onPlusDiscuss;
|
|
|
var _useState3 = (0,react.useState)(false),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
remarkBool = _useState4[0],
|
|
|
setRemarkBool = _useState4[1];
|
|
|
console.log(data, 'data');
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: DiscussItemmodules.discussItem,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: DiscussItemmodules.list,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: env/* default.IMG_SERVER */.Z.IMG_SERVER + '/images/' + (data === null || data === void 0 ? void 0 : (_data$author5 = data.author) === null || _data$author5 === void 0 ? void 0 : _data$author5.image_url)
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: DiscussItemmodules.wrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "font14",
|
|
|
style: {
|
|
|
marginBottom: 6
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-grey-333 mr30",
|
|
|
children: data === null || data === void 0 ? void 0 : (_data$author6 = data.author) === null || _data$author6 === void 0 ? void 0 : _data$author6.name
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-grey-999",
|
|
|
children: data === null || data === void 0 ? void 0 : data.time
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: data === null || data === void 0 ? void 0 : data.content
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: DiscussItemmodules.btns,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
onClick: function onClick() {
|
|
|
return onPlusDiscuss(data === null || data === void 0 ? void 0 : data.id);
|
|
|
},
|
|
|
className: data !== null && data !== void 0 && data.user_praise ? 'c-light-primary' : 'c-grey-999',
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-xiaodianzan2 mr3"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: data === null || data === void 0 ? void 0 : data.praise_count
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
onClick: function onClick() {
|
|
|
var _data$children2;
|
|
|
if ((data === null || data === void 0 ? void 0 : (_data$children2 = data.children) === null || _data$children2 === void 0 ? void 0 : _data$children2.length) === 0) {
|
|
|
return;
|
|
|
}
|
|
|
setSecondReply(null);
|
|
|
setRemarkBool(!remarkBool);
|
|
|
},
|
|
|
style: {
|
|
|
color: remarkBool ? '#0152d9' : '#999999'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-xiaopinglun2 mr3"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: remarkBool ? '收起评论' : data === null || data === void 0 ? void 0 : (_data$children3 = data.children) === null || _data$children3 === void 0 ? void 0 : _data$children3.length
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
onClick: function onClick() {
|
|
|
setRemarkBool(false);
|
|
|
setSecondReply(secondReply === (data === null || data === void 0 ? void 0 : data.id) ? null : data === null || data === void 0 ? void 0 : data.id);
|
|
|
},
|
|
|
style: {
|
|
|
color: secondReply === (data === null || data === void 0 ? void 0 : data.id) ? '#0152d9' : '#999999'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-huifu3 mr3"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: secondReply === (data === null || data === void 0 ? void 0 : data.id) ? '收起回复' : '回复'
|
|
|
})]
|
|
|
})]
|
|
|
}), secondReply === (data === null || data === void 0 ? void 0 : data.id) && /*#__PURE__*/(0,jsx_runtime.jsx)(Reply, {
|
|
|
id: data === null || data === void 0 ? void 0 : data.id,
|
|
|
cb: function cb(id, value) {
|
|
|
onReplyDiscuss(id, value);
|
|
|
setRemarkBool(true);
|
|
|
}
|
|
|
}), remarkBool && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: DiscussItemmodules.secondLevelDiscuss,
|
|
|
children: data === null || data === void 0 ? void 0 : (_data$children4 = data.children) === null || _data$children4 === void 0 ? void 0 : _data$children4.map(function (e) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(DiscussItem_SecondLevelDiscuss, {
|
|
|
thirdlyReply: thirdlyReply,
|
|
|
setThirdlyReply: setThirdlyReply,
|
|
|
data: e,
|
|
|
onReplyDiscuss: onReplyDiscuss
|
|
|
}, e.id);
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var CustomDiscuss_DiscussItem = (DiscussItem);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/ListDetails/CustomDiscuss/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var CustomDiscuss_List = function List(_ref) {
|
|
|
var identifier = _ref.identifier,
|
|
|
active = _ref.active,
|
|
|
onOk = _ref.onOk;
|
|
|
var _useState = (0,react.useState)(''),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
value = _useState2[0],
|
|
|
setValue = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)(1),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
page = _useState4[0],
|
|
|
setPage = _useState4[1];
|
|
|
var _useState5 = (0,react.useState)([]),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
data = _useState6[0],
|
|
|
setData = _useState6[1];
|
|
|
var _useState7 = (0,react.useState)(0),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
total = _useState8[0],
|
|
|
setTotal = _useState8[1];
|
|
|
var _useState9 = (0,react.useState)(null),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
secondReply = _useState10[0],
|
|
|
setSecondReply = _useState10[1];
|
|
|
var _useState11 = (0,react.useState)(null),
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
thirdlyReply = _useState12[0],
|
|
|
setThirdlyReply = _useState12[1];
|
|
|
(0,react.useEffect)(function () {
|
|
|
getCommentsData(1);
|
|
|
setPage(1);
|
|
|
}, [active]);
|
|
|
var getCommentsData = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(page) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return getComments({
|
|
|
container_type: 'QuestionSolutionArticle',
|
|
|
container_identifier: active,
|
|
|
limit: 5,
|
|
|
page: page
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context.sent;
|
|
|
if (res !== null && res !== void 0 && res.comments) {
|
|
|
setData((res === null || res === void 0 ? void 0 : res.comments) || []);
|
|
|
setPage(page);
|
|
|
setTotal(res === null || res === void 0 ? void 0 : res.disscuss_count);
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function getCommentsData(_x) {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var onCreateDiscuss = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
if (!(value === '')) {
|
|
|
_context2.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
message/* default.error */.ZP.error('请输入内容');
|
|
|
return _context2.abrupt("return");
|
|
|
case 3:
|
|
|
_context2.next = 5;
|
|
|
return createDiscuss({
|
|
|
comments: {
|
|
|
content: value
|
|
|
},
|
|
|
container_type: 'QuestionSolutionArticle',
|
|
|
container_identifier: active
|
|
|
});
|
|
|
case 5:
|
|
|
res = _context2.sent;
|
|
|
if (res !== null && res !== void 0 && res.discuss) {
|
|
|
setValue('');
|
|
|
getCommentsData(page);
|
|
|
onOk();
|
|
|
}
|
|
|
case 7:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function onCreateDiscuss() {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var onReplyDiscuss = /*#__PURE__*/function () {
|
|
|
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(id, value, level) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
_context3.next = 2;
|
|
|
return replyDiscuss({
|
|
|
container_type: 'QuestionSolutionArticle',
|
|
|
container_identifier: active,
|
|
|
comments: {
|
|
|
content: value,
|
|
|
parent_id: id
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context3.sent;
|
|
|
setSecondReply(null);
|
|
|
setThirdlyReply(null);
|
|
|
getCommentsData(page);
|
|
|
case 6:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return function onReplyDiscuss(_x2, _x3, _x4) {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var onPlusDiscuss = /*#__PURE__*/function () {
|
|
|
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4(id) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
_context4.next = 2;
|
|
|
return plusDiscuss(id);
|
|
|
case 2:
|
|
|
res = _context4.sent;
|
|
|
getCommentsData(page);
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
return function onPlusDiscuss(_x5) {
|
|
|
return _ref5.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleChange = function handleChange(current) {
|
|
|
setPage(current);
|
|
|
getCommentsData(current);
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: CustomDiscussmodules.discuss,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
className: CustomDiscussmodules.reply,
|
|
|
style: {
|
|
|
borderWidth: total ? 1 : 0
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
defaultValue: value,
|
|
|
id: "writeForumsReviewId",
|
|
|
onChange: function onChange(v) {
|
|
|
setValue(v);
|
|
|
},
|
|
|
placeholder: "\u6211\u8981\u56DE\u590D...",
|
|
|
height: 240
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
flex: "1"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
type: "primary",
|
|
|
size: "large",
|
|
|
onClick: function onClick() {
|
|
|
return onCreateDiscuss();
|
|
|
},
|
|
|
children: "\u53D1\u9001"
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
}), data === null || data === void 0 ? void 0 : data.map(function (e) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(CustomDiscuss_DiscussItem, {
|
|
|
secondReply: secondReply,
|
|
|
setSecondReply: setSecondReply,
|
|
|
thirdlyReply: thirdlyReply,
|
|
|
setThirdlyReply: setThirdlyReply,
|
|
|
data: e,
|
|
|
onReplyDiscuss: onReplyDiscuss,
|
|
|
onPlusDiscuss: onPlusDiscuss
|
|
|
}, e.id);
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(pagination/* default */.Z, {
|
|
|
className: CustomDiscussmodules.pagination,
|
|
|
showTotal: function showTotal(total) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
style: {
|
|
|
color: '#656F87'
|
|
|
},
|
|
|
children: ["\u5171", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-light-primary",
|
|
|
children: total
|
|
|
}), "\u6761\u6570\u636E"]
|
|
|
});
|
|
|
},
|
|
|
current: page,
|
|
|
onChange: handleChange,
|
|
|
total: total,
|
|
|
showSizeChanger: false,
|
|
|
showQuickJumper: true,
|
|
|
hideOnSinglePage: true,
|
|
|
pageSize: 5
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var CustomDiscuss = (CustomDiscuss_List);
|
|
|
// EXTERNAL MODULE: ./src/components/Video/Play/index.jsx + 1 modules
|
|
|
var Play = __webpack_require__(8423);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/ListDetails/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ListDetails_List = function List(_ref) {
|
|
|
var _data$videos, _data$videos$, _data$videos2, _data$videos2$, _data$videos3, _data$videos3$, _data$videos4, _data$videos4$, _data$videos5, _data$videos5$;
|
|
|
var active = _ref.active,
|
|
|
identifier = _ref.identifier,
|
|
|
onAssist = _ref.onAssist,
|
|
|
onEdit = _ref.onEdit,
|
|
|
onArticlesSkip = _ref.onArticlesSkip,
|
|
|
onClose = _ref.onClose,
|
|
|
onOk = _ref.onOk,
|
|
|
onDelete = _ref.onDelete,
|
|
|
detailsIndex = _ref.detailsIndex,
|
|
|
btnShowStatus = _ref.btnShowStatus;
|
|
|
var _useState = (0,react.useState)(true),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
loading = _useState2[0],
|
|
|
setLoading = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)({}),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
data = _useState4[0],
|
|
|
setData = _useState4[1];
|
|
|
(0,react.useEffect)(function () {
|
|
|
if (!!active) {
|
|
|
getData();
|
|
|
}
|
|
|
}, [active, detailsIndex]);
|
|
|
var getData = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var bool,
|
|
|
res,
|
|
|
_args = arguments;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
bool = _args.length > 0 && _args[0] !== undefined ? _args[0] : true;
|
|
|
if (bool) {
|
|
|
setLoading(true);
|
|
|
}
|
|
|
_context.next = 4;
|
|
|
return (0,service/* articlesDetails */.wO)(identifier, {
|
|
|
active: active
|
|
|
});
|
|
|
case 4:
|
|
|
res = _context.sent;
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
setData((res === null || res === void 0 ? void 0 : res.data) || {});
|
|
|
}
|
|
|
setLoading(false);
|
|
|
case 7:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function getData() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleArticlesStatus = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(v) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.next = 2;
|
|
|
return (0,service/* articlesStatus */.qe)(identifier, objectSpread2_default()({
|
|
|
active: active
|
|
|
}, v));
|
|
|
case 2:
|
|
|
res = _context2.sent;
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
getData(false);
|
|
|
onOk();
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function handleArticlesStatus(_x) {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleAssist = /*#__PURE__*/function () {
|
|
|
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(v) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
_context3.next = 2;
|
|
|
return (0,service/* articlesAssist */.Rg)(identifier, {
|
|
|
active: v === null || v === void 0 ? void 0 : v.id
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context3.sent;
|
|
|
if (res.status === 0) {
|
|
|
getData(false);
|
|
|
onOk();
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return function handleAssist(_x2) {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleDelete = function handleDelete(v) {
|
|
|
modal/* default.confirm */.Z.confirm({
|
|
|
centered: true,
|
|
|
width: 500,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
title: '提示',
|
|
|
icon: null,
|
|
|
className: 'custom-modal-divider',
|
|
|
content: '确认要删除该题解吗?',
|
|
|
onOk: function onOk() {
|
|
|
return onDelete(v);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
var handleOk = function handleOk() {
|
|
|
getData(false);
|
|
|
onOk();
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: ListDetailsmodules.listDetails,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(skeleton/* default */.Z, {
|
|
|
className: "pt20 pl20 pr20",
|
|
|
loading: loading,
|
|
|
active: true,
|
|
|
paragraph: {
|
|
|
rows: 5
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ListDetailsmodules.head,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ListDetailsmodules.name,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
title: data === null || data === void 0 ? void 0 : data.name,
|
|
|
className: ListDetailsmodules.title,
|
|
|
children: data === null || data === void 0 ? void 0 : data.name
|
|
|
}), (data === null || data === void 0 ? void 0 : data.is_authority) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: ListDetailsmodules.b,
|
|
|
children: "\u5B98\u65B9"
|
|
|
}), (data === null || data === void 0 ? void 0 : data.is_excellent) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: ListDetailsmodules.a,
|
|
|
children: "\u7CBE\u9009"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ListDetailsmodules.tag,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: env/* default.IMG_SERVER */.Z.IMG_SERVER + '/images/' + (data === null || data === void 0 ? void 0 : data.image_url)
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "c-grey-333 ml5 mr20 font14",
|
|
|
children: data === null || data === void 0 ? void 0 : data.username
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
display: 'inline-block',
|
|
|
marginBottom: -2
|
|
|
},
|
|
|
className: "c-grey-999 mr20 font12",
|
|
|
children: ["\u53D1\u5E03\u4E8E", moment_default()(data === null || data === void 0 ? void 0 : data.created_at).format('YYYY-MM-DD')]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: c
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: data === null || data === void 0 ? void 0 : data.praises_count
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: d
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: data === null || data === void 0 ? void 0 : data.discusses_count
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: e
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: data === null || data === void 0 ? void 0 : data.viewed_count
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ListDetailsmodules.btn,
|
|
|
children: [((0,authority/* isSuperAdmins */.Ny)() || (data === null || data === void 0 ? void 0 : data.is_self)) && /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
onClick: function onClick() {
|
|
|
return handleDelete(data);
|
|
|
},
|
|
|
type: "primary",
|
|
|
ghost: true,
|
|
|
children: "\u5220\u9664"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
onClick: function onClick() {
|
|
|
return onEdit(data);
|
|
|
},
|
|
|
type: "primary",
|
|
|
ghost: true,
|
|
|
children: "\u7F16\u8F91"
|
|
|
})]
|
|
|
}), (0,authority/* isSuperAdmins */.Ny)() && /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.Z, {
|
|
|
onClick: function onClick() {
|
|
|
return handleArticlesStatus({
|
|
|
is_authority: !(data !== null && data !== void 0 && data.is_authority)
|
|
|
});
|
|
|
},
|
|
|
type: "primary",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: gf
|
|
|
}), data !== null && data !== void 0 && data.is_authority ? '取消' : '设为', "\u5B98\u65B9"]
|
|
|
}), (0,authority/* isSuperAdmins */.Ny)() && /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.Z, {
|
|
|
onClick: function onClick() {
|
|
|
return handleArticlesStatus({
|
|
|
is_excellent: !(data !== null && data !== void 0 && data.is_excellent)
|
|
|
});
|
|
|
},
|
|
|
type: "primary",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: jx
|
|
|
}), data !== null && data !== void 0 && data.is_excellent ? '取消' : '设为', "\u7CBE\u9009"]
|
|
|
})]
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ListDetailsmodules.scroll,
|
|
|
children: [(data === null || data === void 0 ? void 0 : (_data$videos = data.videos) === null || _data$videos === void 0 ? void 0 : (_data$videos$ = _data$videos[0]) === null || _data$videos$ === void 0 ? void 0 : _data$videos$.id) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: ListDetailsmodules.video,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
|
|
|
tip: "\u6B63\u5728\u8F6C\u7801\uFF0C\u8BF7\u7A0D\u7B49...",
|
|
|
spinning: !(data !== null && data !== void 0 && (_data$videos2 = data.videos) !== null && _data$videos2 !== void 0 && (_data$videos2$ = _data$videos2[0]) !== null && _data$videos2$ !== void 0 && _data$videos2$.transcoded),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(Play/* default */.Z, {
|
|
|
poster: data === null || data === void 0 ? void 0 : (_data$videos3 = data.videos) === null || _data$videos3 === void 0 ? void 0 : (_data$videos3$ = _data$videos3[0]) === null || _data$videos3$ === void 0 ? void 0 : _data$videos3$.cover_url,
|
|
|
src: (data === null || data === void 0 ? void 0 : (_data$videos4 = data.videos) === null || _data$videos4 === void 0 ? void 0 : (_data$videos4$ = _data$videos4[0]) === null || _data$videos4$ === void 0 ? void 0 : _data$videos4$.play_url) || '',
|
|
|
videoId: data === null || data === void 0 ? void 0 : (_data$videos5 = data.videos) === null || _data$videos5 === void 0 ? void 0 : (_data$videos5$ = _data$videos5[0]) === null || _data$videos5$ === void 0 ? void 0 : _data$videos5$.id,
|
|
|
logWatchHistory: function logWatchHistory() {}
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
className: ListDetailsmodules.html,
|
|
|
value: (data === null || data === void 0 ? void 0 : data.content) || ''
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
onClick: function onClick() {
|
|
|
return handleAssist(data);
|
|
|
},
|
|
|
className: ListDetailsmodules.g,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
className: "mr10",
|
|
|
src: data !== null && data !== void 0 && data.user_liker ? g : g
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: data === null || data === void 0 ? void 0 : data.praises_count
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(CustomDiscuss, {
|
|
|
onOk: handleOk,
|
|
|
active: active,
|
|
|
identifier: identifier
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: ListDetailsmodules.btns,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
onClick: function onClick() {
|
|
|
return onClose();
|
|
|
},
|
|
|
type: "primary",
|
|
|
ghost: true,
|
|
|
children: "\u5173\u95ED"
|
|
|
}), btnShowStatus[0] && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
onClick: function onClick(e) {
|
|
|
return onArticlesSkip(e, 'prev');
|
|
|
},
|
|
|
style: {
|
|
|
marginLeft: 20
|
|
|
},
|
|
|
type: "primary",
|
|
|
children: "\u4E0A\u4E00\u9898\u89E3"
|
|
|
}), btnShowStatus[1] && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
|
|
|
onClick: function onClick(e) {
|
|
|
return onArticlesSkip(e, 'next');
|
|
|
},
|
|
|
style: {
|
|
|
marginLeft: 20
|
|
|
},
|
|
|
type: "primary",
|
|
|
children: "\u4E0B\u4E00\u9898\u89E3"
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var ListDetails = (ListDetails_List);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/img/a.svg
|
|
|
function a_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = a_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
function a_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return a_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return a_arrayLikeToArray(o, minLen); }
|
|
|
function a_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
|
var a_defProp = Object.defineProperty;
|
|
|
var a_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
var a_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
var a_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
var a_defNormalProp = function __defNormalProp(obj, key, value) {
|
|
|
return key in obj ? a_defProp(obj, key, {
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true,
|
|
|
value: value
|
|
|
}) : obj[key] = value;
|
|
|
};
|
|
|
var a_spreadValues = function __spreadValues(a, b) {
|
|
|
for (var prop in b || (b = {})) if (a_hasOwnProp.call(b, prop)) a_defNormalProp(a, prop, b[prop]);
|
|
|
if (a_getOwnPropSymbols) {
|
|
|
var _iterator = a_createForOfIteratorHelper(a_getOwnPropSymbols(b)),
|
|
|
_step;
|
|
|
try {
|
|
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
|
var prop = _step.value;
|
|
|
if (a_propIsEnum.call(b, prop)) a_defNormalProp(a, prop, b[prop]);
|
|
|
}
|
|
|
} catch (err) {
|
|
|
_iterator.e(err);
|
|
|
} finally {
|
|
|
_iterator.f();
|
|
|
}
|
|
|
}
|
|
|
return a;
|
|
|
};
|
|
|
|
|
|
var SvgA = function SvgA(props) {
|
|
|
return /* @__PURE__ */React.createElement("svg", a_spreadValues({
|
|
|
xmlns: "http://www.w3.org/2000/svg",
|
|
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
|
width: 16,
|
|
|
height: 16
|
|
|
}, props), /* @__PURE__ */React.createElement("defs", null, /* @__PURE__ */React.createElement("path", {
|
|
|
id: "a_svg__a",
|
|
|
d: "M13.727 0C14.983 0 16 .895 16 2v12c0 1.105-1.017 2-2.273 2H2.273C1.017 16 0 15.105 0 14V2C0 .895 1.017 0 2.273 0h11.454ZM7.464 11H2.955c-.266 0-.513.19-.646.5s-.133.69 0 1c.133.31.38.5.646.5h4.509c.411 0 .745-.448.745-1s-.334-1-.745-1Zm4-3.5H2.955c-.411 0-.745.448-.745 1s.334 1 .745 1h8.509c.412 0 .746-.448.746-1s-.334-1-.746-1ZM3.71 2.75a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z"
|
|
|
})), /* @__PURE__ */React.createElement("g", {
|
|
|
fill: "none",
|
|
|
fillRule: "evenodd"
|
|
|
}, /* @__PURE__ */React.createElement("mask", {
|
|
|
id: "a_svg__b",
|
|
|
fill: "#fff"
|
|
|
}, /* @__PURE__ */React.createElement("use", {
|
|
|
xlinkHref: "#a_svg__a"
|
|
|
})), /* @__PURE__ */React.createElement("use", {
|
|
|
fill: "#7DC1FF",
|
|
|
fillRule: "nonzero",
|
|
|
xlinkHref: "#a_svg__a"
|
|
|
}), /* @__PURE__ */React.createElement("circle", {
|
|
|
cx: 1.5,
|
|
|
cy: 0.5,
|
|
|
r: 16.5,
|
|
|
fill: "#A3D3FF",
|
|
|
fillRule: "nonzero",
|
|
|
mask: "url(#a_svg__b)"
|
|
|
}), /* @__PURE__ */React.createElement("ellipse", {
|
|
|
cx: 1.5,
|
|
|
cy: -0.5,
|
|
|
fill: "#C1E2FF",
|
|
|
fillRule: "nonzero",
|
|
|
mask: "url(#a_svg__b)",
|
|
|
rx: 12.5,
|
|
|
ry: 12
|
|
|
}), /* @__PURE__ */React.createElement("ellipse", {
|
|
|
cx: -2.5,
|
|
|
cy: -4,
|
|
|
fill: "#EEF7FF",
|
|
|
fillRule: "nonzero",
|
|
|
mask: "url(#a_svg__b)",
|
|
|
rx: 12.5,
|
|
|
ry: 12
|
|
|
})));
|
|
|
};
|
|
|
|
|
|
/* harmony default export */ var a = ("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMTYiIGhlaWdodD0iMTYiPjxkZWZzPjxwYXRoIGlkPSJhIiBkPSJNMTMuNzI3IDBDMTQuOTgzIDAgMTYgLjg5NSAxNiAydjEyYzAgMS4xMDUtMS4wMTcgMi0yLjI3MyAySDIuMjczQzEuMDE3IDE2IDAgMTUuMTA1IDAgMTRWMkMwIC44OTUgMS4wMTcgMCAyLjI3MyAwaDExLjQ1NFpNNy40NjQgMTFIMi45NTVjLS4yNjYgMC0uNTEzLjE5LS42NDYuNXMtLjEzMy42OSAwIDFjLjEzMy4zMS4zOC41LjY0Ni41aDQuNTA5Yy40MTEgMCAuNzQ1LS40NDguNzQ1LTFzLS4zMzQtMS0uNzQ1LTFabTQtMy41SDIuOTU1Yy0uNDExIDAtLjc0NS40NDgtLjc0NSAxcy4zMzQgMSAuNzQ1IDFoOC41MDljLjQxMiAwIC43NDYtLjQ0OC43NDYtMXMtLjMzNC0xLS43NDYtMVpNMy43MSAyLjc1YTEuNSAxLjUgMCAxIDAgMCAzIDEuNSAxLjUgMCAwIDAgMC0zWiIvPjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxtYXNrIGlkPSJiIiBmaWxsPSIjZmZmIj48dXNlIHhsaW5rOmhyZWY9IiNhIi8+PC9tYXNrPjx1c2UgZmlsbD0iIzdEQzFGRiIgZmlsbC1ydWxlPSJub256ZXJvIiB4bGluazpocmVmPSIjYSIvPjxjaXJjbGUgY3g9IjEuNSIgY3k9Ii41IiByPSIxNi41IiBmaWxsPSIjQTNEM0ZGIiBmaWxsLXJ1bGU9Im5vbnplcm8iIG1hc2s9InVybCgjYikiLz48ZWxsaXBzZSBjeD0iMS41IiBjeT0iLS41IiBmaWxsPSIjQzFFMkZGIiBmaWxsLXJ1bGU9Im5vbnplcm8iIG1hc2s9InVybCgjYikiIHJ4PSIxMi41IiByeT0iMTIiLz48ZWxsaXBzZSBjeD0iLTIuNSIgY3k9Ii00IiBmaWxsPSIjRUVGN0ZGIiBmaWxsLXJ1bGU9Im5vbnplcm8iIG1hc2s9InVybCgjYikiIHJ4PSIxMi41IiByeT0iMTIiLz48L2c+PC9zdmc+");
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/CaretUpOutlined.js
|
|
|
var CaretUpOutlined = __webpack_require__(18121);
|
|
|
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/CaretDownOutlined.js
|
|
|
var CaretDownOutlined = __webpack_require__(95025);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/FilterList/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var FilterList = function FilterList(_ref) {
|
|
|
var identifier = _ref.identifier,
|
|
|
tabStatus = _ref.tabStatus,
|
|
|
setFilterListTotal = _ref.setFilterListTotal,
|
|
|
setListStatus = _ref.setListStatus;
|
|
|
var initParams = {
|
|
|
page: 1,
|
|
|
limit: 10,
|
|
|
total: 0,
|
|
|
search: '',
|
|
|
save_search: '',
|
|
|
sort_by: 'updated_at',
|
|
|
sort_direction: null
|
|
|
};
|
|
|
var _useState = (0,react.useState)(objectSpread2_default()({}, initParams)),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
params = _useState2[0],
|
|
|
setParams = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)(false),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
loading = _useState4[0],
|
|
|
setLoading = _useState4[1];
|
|
|
var _useState5 = (0,react.useState)(0),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
width = _useState6[0],
|
|
|
setWidth = _useState6[1];
|
|
|
var _useState7 = (0,react.useState)(1),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
detailsIndex = _useState8[0],
|
|
|
setDetailsIndex = _useState8[1];
|
|
|
var _useState9 = (0,react.useState)(null),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
active = _useState10[0],
|
|
|
setActive = _useState10[1];
|
|
|
var _useState11 = (0,react.useState)([]),
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
data = _useState12[0],
|
|
|
setData = _useState12[1];
|
|
|
var _useState13 = (0,react.useState)([true, true]),
|
|
|
_useState14 = slicedToArray_default()(_useState13, 2),
|
|
|
btnShowStatus = _useState14[0],
|
|
|
setBtnShowStatus = _useState14[1];
|
|
|
var _useState15 = (0,react.useState)(0),
|
|
|
_useState16 = slicedToArray_default()(_useState15, 2),
|
|
|
status = _useState16[0],
|
|
|
setStatus = _useState16[1]; //1新增 2编辑 3详情
|
|
|
var leftWarp = (0,react.useRef)(null);
|
|
|
(0,react.useEffect)(function () {
|
|
|
handleClose();
|
|
|
}, [tabStatus]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
dealBtnShowStatus();
|
|
|
}, [active]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
getData(objectSpread2_default()({}, initParams));
|
|
|
handleClose();
|
|
|
}, [identifier]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
window.addEventListener('resize', handleResize);
|
|
|
setListStatus(status);
|
|
|
return function () {
|
|
|
window.removeEventListener('resize', handleResize);
|
|
|
};
|
|
|
}, [status]);
|
|
|
var dealBtnShowStatus = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var item, activeIndex;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
if (active) {
|
|
|
_context.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
setBtnShowStatus([true, true]);
|
|
|
return _context.abrupt("return");
|
|
|
case 3:
|
|
|
item = [true, true];
|
|
|
activeIndex = data === null || data === void 0 ? void 0 : data.findIndex(function (v) {
|
|
|
return v.id === active;
|
|
|
});
|
|
|
if (activeIndex === 0 && params.page === 1) {
|
|
|
item[0] = false;
|
|
|
}
|
|
|
if ((params.page - 1) * params.limit + (activeIndex + 1) === params.total) {
|
|
|
item[1] = false;
|
|
|
}
|
|
|
setBtnShowStatus(item);
|
|
|
case 8:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function dealBtnShowStatus() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleResize = function handleResize() {
|
|
|
if (status) {
|
|
|
var _leftWarp$current;
|
|
|
var rightWidth = window.innerWidth - ((_leftWarp$current = leftWarp.current) === null || _leftWarp$current === void 0 ? void 0 : _leftWarp$current.clientWidth);
|
|
|
setWidth(rightWidth);
|
|
|
}
|
|
|
};
|
|
|
var getData = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(record) {
|
|
|
var res, _res$data, _res$data2, _res$data3;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
setLoading(true);
|
|
|
_context2.next = 3;
|
|
|
return (0,service/* articlesList */.WH)(identifier, record);
|
|
|
case 3:
|
|
|
res = _context2.sent;
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
setData((res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.articles) || []);
|
|
|
setParams(objectSpread2_default()(objectSpread2_default()({}, record), {}, {
|
|
|
total: res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.articles_count
|
|
|
}));
|
|
|
setFilterListTotal(res === null || res === void 0 ? void 0 : (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.articles_count);
|
|
|
}
|
|
|
setLoading(false);
|
|
|
return _context2.abrupt("return", res);
|
|
|
case 7:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function getData(_x) {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleSorter = function handleSorter() {
|
|
|
if ((params === null || params === void 0 ? void 0 : params.sort_direction) === null) {
|
|
|
params.sort_direction = 'asc';
|
|
|
} else if ((params === null || params === void 0 ? void 0 : params.sort_direction) === 'asc') {
|
|
|
params.sort_direction = 'desc';
|
|
|
} else if ((params === null || params === void 0 ? void 0 : params.sort_direction) === 'desc') {
|
|
|
params.sort_direction = null;
|
|
|
}
|
|
|
params.page = 1;
|
|
|
handleClose();
|
|
|
setParams(objectSpread2_default()({}, params));
|
|
|
getData(params);
|
|
|
};
|
|
|
var handleSearch = function handleSearch() {
|
|
|
params.page = 1;
|
|
|
params.search = params === null || params === void 0 ? void 0 : params.save_search;
|
|
|
handleClose();
|
|
|
setParams(objectSpread2_default()({}, params));
|
|
|
getData(params);
|
|
|
};
|
|
|
var sign = function sign() {
|
|
|
var _leftWarp$current2;
|
|
|
var dom = document.getElementsByClassName('btn-resize');
|
|
|
dom[0].style.visibility = 'hidden';
|
|
|
var rightWidth = window.innerWidth - ((_leftWarp$current2 = leftWarp.current) === null || _leftWarp$current2 === void 0 ? void 0 : _leftWarp$current2.clientWidth);
|
|
|
setWidth(rightWidth);
|
|
|
};
|
|
|
var addProblems = function addProblems() {
|
|
|
sign();
|
|
|
setStatus(1);
|
|
|
};
|
|
|
var handleDetails = function handleDetails(v) {
|
|
|
sign();
|
|
|
setActive(v === null || v === void 0 ? void 0 : v.id);
|
|
|
setStatus(3);
|
|
|
};
|
|
|
var handleEdit = function handleEdit(v) {
|
|
|
sign();
|
|
|
setActive(v === null || v === void 0 ? void 0 : v.id);
|
|
|
setStatus(2);
|
|
|
};
|
|
|
var handleClose = function handleClose() {
|
|
|
var dom = document.getElementsByClassName('btn-resize');
|
|
|
dom[0].style.visibility = 'visible';
|
|
|
setWidth(0);
|
|
|
setStatus(0);
|
|
|
setActive(null);
|
|
|
};
|
|
|
var handleOk = function handleOk(id) {
|
|
|
setStatus(3);
|
|
|
setActive(id);
|
|
|
params.page = 1;
|
|
|
setParams(objectSpread2_default()({}, params));
|
|
|
getData(params);
|
|
|
};
|
|
|
var handleEditOk = function handleEditOk(id) {
|
|
|
setStatus(3);
|
|
|
setActive(id);
|
|
|
setParams(objectSpread2_default()({}, params));
|
|
|
getData(params);
|
|
|
};
|
|
|
var handleDetailsOk = function handleDetailsOk(id) {
|
|
|
setParams(objectSpread2_default()({}, params));
|
|
|
getData(params);
|
|
|
};
|
|
|
var handleAssist = /*#__PURE__*/function () {
|
|
|
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(v) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
_context3.next = 2;
|
|
|
return (0,service/* articlesAssist */.Rg)(identifier, {
|
|
|
active: v === null || v === void 0 ? void 0 : v.id
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context3.sent;
|
|
|
if (res.status === 0) {
|
|
|
getData(params);
|
|
|
setDetailsIndex(detailsIndex + 1);
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return function handleAssist(_x2) {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleHide = /*#__PURE__*/function () {
|
|
|
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4(v) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
_context4.next = 2;
|
|
|
return (0,service/* articlesHide */.rL)(identifier, {
|
|
|
active: v === null || v === void 0 ? void 0 : v.id
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context4.sent;
|
|
|
if (res.status === 0) {
|
|
|
getData(params);
|
|
|
setDetailsIndex(detailsIndex + 1);
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
return function handleHide(_x3) {
|
|
|
return _ref5.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleDelete = /*#__PURE__*/function () {
|
|
|
var _ref6 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5(v) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
|
|
|
while (1) switch (_context5.prev = _context5.next) {
|
|
|
case 0:
|
|
|
_context5.next = 2;
|
|
|
return (0,service/* deleteArticles */.de)(identifier, {
|
|
|
active: v === null || v === void 0 ? void 0 : v.id
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context5.sent;
|
|
|
if (res.status === 0) {
|
|
|
handleClose();
|
|
|
getData(params);
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context5.stop();
|
|
|
}
|
|
|
}, _callee5);
|
|
|
}));
|
|
|
return function handleDelete(_x4) {
|
|
|
return _ref6.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleChange = function handleChange(current) {
|
|
|
params.page = current;
|
|
|
setParams(objectSpread2_default()({}, params));
|
|
|
getData(params);
|
|
|
};
|
|
|
var handleArticlesSkip = /*#__PURE__*/function () {
|
|
|
var _ref7 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6(e, type) {
|
|
|
var activeIndex, res, _res$data4, _res$data5, _res$data5$articles, param, _param, _res, _res$data6, _param2, _param3;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee6$(_context6) {
|
|
|
while (1) switch (_context6.prev = _context6.next) {
|
|
|
case 0:
|
|
|
activeIndex = data === null || data === void 0 ? void 0 : data.findIndex(function (v) {
|
|
|
return v.id === active;
|
|
|
});
|
|
|
console.log(activeIndex, type, 22);
|
|
|
if (!(type === 'prev')) {
|
|
|
_context6.next = 21;
|
|
|
break;
|
|
|
}
|
|
|
if (!(activeIndex === undefined)) {
|
|
|
_context6.next = 6;
|
|
|
break;
|
|
|
}
|
|
|
message/* default.warn */.ZP.warn('上一题解不存在');
|
|
|
return _context6.abrupt("return");
|
|
|
case 6:
|
|
|
if (!(activeIndex === 0)) {
|
|
|
_context6.next = 19;
|
|
|
break;
|
|
|
}
|
|
|
if (!(params.page === 1)) {
|
|
|
_context6.next = 10;
|
|
|
break;
|
|
|
}
|
|
|
message/* default.warn */.ZP.warn('上一题解不存在');
|
|
|
return _context6.abrupt("return");
|
|
|
case 10:
|
|
|
if (!(params.page !== 1)) {
|
|
|
_context6.next = 17;
|
|
|
break;
|
|
|
}
|
|
|
params.page = params.page - 1;
|
|
|
setParams(objectSpread2_default()({}, params));
|
|
|
_context6.next = 15;
|
|
|
return getData(params);
|
|
|
case 15:
|
|
|
res = _context6.sent;
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
param = res === null || res === void 0 ? void 0 : (_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : _res$data4.articles[(res === null || res === void 0 ? void 0 : (_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : (_res$data5$articles = _res$data5.articles) === null || _res$data5$articles === void 0 ? void 0 : _res$data5$articles.length) - 1];
|
|
|
setActive(param === null || param === void 0 ? void 0 : param.id);
|
|
|
console.log(e.target, 555);
|
|
|
}
|
|
|
case 17:
|
|
|
_context6.next = 21;
|
|
|
break;
|
|
|
case 19:
|
|
|
_param = data[activeIndex - 1];
|
|
|
setActive(_param === null || _param === void 0 ? void 0 : _param.id);
|
|
|
case 21:
|
|
|
if (!(type === 'next')) {
|
|
|
_context6.next = 39;
|
|
|
break;
|
|
|
}
|
|
|
if (!(activeIndex === undefined)) {
|
|
|
_context6.next = 25;
|
|
|
break;
|
|
|
}
|
|
|
message/* default.warn */.ZP.warn('下一题解不存在');
|
|
|
return _context6.abrupt("return");
|
|
|
case 25:
|
|
|
if (!((params.page - 1) * params.limit + (activeIndex + 1) === params.total)) {
|
|
|
_context6.next = 28;
|
|
|
break;
|
|
|
}
|
|
|
message/* default.warn */.ZP.warn('下一题解不存在');
|
|
|
return _context6.abrupt("return");
|
|
|
case 28:
|
|
|
if (!(activeIndex + 1 === params.limit)) {
|
|
|
_context6.next = 37;
|
|
|
break;
|
|
|
}
|
|
|
params.page = params.page + 1;
|
|
|
setParams(objectSpread2_default()({}, params));
|
|
|
_context6.next = 33;
|
|
|
return getData(params);
|
|
|
case 33:
|
|
|
_res = _context6.sent;
|
|
|
if ((_res === null || _res === void 0 ? void 0 : _res.status) === 0) {
|
|
|
_param2 = _res === null || _res === void 0 ? void 0 : (_res$data6 = _res.data) === null || _res$data6 === void 0 ? void 0 : _res$data6.articles[0];
|
|
|
setActive(_param2 === null || _param2 === void 0 ? void 0 : _param2.id);
|
|
|
}
|
|
|
_context6.next = 39;
|
|
|
break;
|
|
|
case 37:
|
|
|
//页码中间
|
|
|
_param3 = data[activeIndex + 1];
|
|
|
setActive(_param3 === null || _param3 === void 0 ? void 0 : _param3.id);
|
|
|
case 39:
|
|
|
case "end":
|
|
|
return _context6.stop();
|
|
|
}
|
|
|
}, _callee6);
|
|
|
}));
|
|
|
return function handleArticlesSkip(_x5, _x6) {
|
|
|
return _ref7.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: FilterListmodules.wrap,
|
|
|
ref: leftWarp,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: FilterListmodules.head,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: FilterListmodules.sort,
|
|
|
onClick: handleSorter,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u6700\u65B0"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(CaretUpOutlined/* default */.Z, {
|
|
|
style: {
|
|
|
color: (params === null || params === void 0 ? void 0 : params.sort_direction) === 'asc' ? '#0152d9' : '#bfbfbf'
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(CaretDownOutlined/* default */.Z, {
|
|
|
style: {
|
|
|
color: (params === null || params === void 0 ? void 0 : params.sort_direction) === 'desc' ? '#0152d9' : '#bfbfbf'
|
|
|
}
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default.Search */.Z.Search, {
|
|
|
value: params.save_search,
|
|
|
className: FilterListmodules["oj-width-input"],
|
|
|
placeholder: "\u641C\u7D22\u9898\u89E3",
|
|
|
onChange: function onChange(e) {
|
|
|
params.save_search = e.target.value;
|
|
|
setParams(objectSpread2_default()({}, params));
|
|
|
},
|
|
|
onSearch: handleSearch
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
onClick: addProblems,
|
|
|
className: FilterListmodules.btn,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: a
|
|
|
}), "\u5199\u9898\u89E3"]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: FilterListmodules.listWarp,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(spin/* default */.Z, {
|
|
|
spinning: loading,
|
|
|
className: "mt20",
|
|
|
children: [data === null || data === void 0 ? void 0 : data.map(function (e, i) {
|
|
|
var showLine = true;
|
|
|
if (i + 1 === data.length && i !== 0) {
|
|
|
showLine = false;
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(FilterList_List, {
|
|
|
active: active,
|
|
|
data: e,
|
|
|
showLine: showLine,
|
|
|
onClick: handleDetails,
|
|
|
onAssist: handleAssist,
|
|
|
onHide: handleHide
|
|
|
}, e.id);
|
|
|
}), (data === null || data === void 0 ? void 0 : data.length) === 0 && /*#__PURE__*/(0,jsx_runtime.jsx)(NoData/* default */.Z, {
|
|
|
customText: "\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(pagination/* default */.Z, {
|
|
|
className: FilterListmodules.pagination,
|
|
|
showTotal: function showTotal(total) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
style: {
|
|
|
color: '#656F87'
|
|
|
},
|
|
|
children: ["\u5171", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-light-primary",
|
|
|
children: total
|
|
|
}), "\u6761\u6570\u636E"]
|
|
|
});
|
|
|
},
|
|
|
total: params.total,
|
|
|
showSizeChanger: false,
|
|
|
current: params === null || params === void 0 ? void 0 : params.page,
|
|
|
onChange: handleChange,
|
|
|
hideOnSinglePage: true,
|
|
|
showQuickJumper: true
|
|
|
}), status > 0 && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: FilterListmodules.fixedRight,
|
|
|
style: {
|
|
|
width: width
|
|
|
},
|
|
|
children: [status === 1 && /*#__PURE__*/(0,jsx_runtime.jsx)(ListForm, {
|
|
|
identifier: identifier,
|
|
|
onClose: handleClose,
|
|
|
onOk: handleOk
|
|
|
}), status === 2 && /*#__PURE__*/(0,jsx_runtime.jsx)(ListForm, {
|
|
|
active: active,
|
|
|
identifier: identifier,
|
|
|
onClose: handleClose,
|
|
|
onOk: handleEditOk
|
|
|
}), status === 3 && /*#__PURE__*/(0,jsx_runtime.jsx)(ListDetails, {
|
|
|
btnShowStatus: btnShowStatus,
|
|
|
onArticlesSkip: handleArticlesSkip,
|
|
|
detailsIndex: detailsIndex,
|
|
|
active: active,
|
|
|
identifier: identifier,
|
|
|
onClose: handleClose,
|
|
|
onOk: handleDetailsOk,
|
|
|
onEdit: handleEdit,
|
|
|
onAssist: handleAssist,
|
|
|
onDelete: handleDelete
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var LeftPanel_FilterList = (FilterList);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/Drawer/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var Drawermodules = ({"flex_box_center":"flex_box_center___BbEkt","flex_space_between":"flex_space_between___v3cDl","flex_box_vertical_center":"flex_box_vertical_center___wUFLn","flex_box_center_end":"flex_box_center_end___Tdr08","flex_box_column":"flex_box_column___fYHlj","wrap":"wrap___UAZFM","head":"head___Nl6hk","title":"title___Ir573","content":"content___xUewa","list":"list___oi2ig","footer":"footer___V3bwQ"});
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/Drawer/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Drawer = function Drawer(_ref) {
|
|
|
var _tableData;
|
|
|
var visible = _ref.visible,
|
|
|
onVisible = _ref.onVisible,
|
|
|
value = _ref.value,
|
|
|
onChange = _ref.onChange,
|
|
|
setIndex = _ref.setIndex;
|
|
|
var initParams = {
|
|
|
page: 1,
|
|
|
per_page: 30,
|
|
|
total: 0,
|
|
|
tag_discipline_id: [],
|
|
|
//知识点
|
|
|
search: '',
|
|
|
save_search: '',
|
|
|
difficulty: null
|
|
|
};
|
|
|
var _useState = (0,react.useState)(initParams),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
params = _useState2[0],
|
|
|
setParams = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)([]),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
pointData = _useState4[0],
|
|
|
setPointData = _useState4[1];
|
|
|
var _useState5 = (0,react.useState)([]),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
tableData = _useState6[0],
|
|
|
setTableData = _useState6[1];
|
|
|
var _useState7 = (0,react.useState)(false),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
loading = _useState8[0],
|
|
|
setLoading = _useState8[1];
|
|
|
var data = (0,react.useRef)([]);
|
|
|
var timer = (0,react.useRef)(null);
|
|
|
var urlParams = (0,_umi_production_exports.useParams)();
|
|
|
|
|
|
//30秒发一次记录
|
|
|
(0,react.useEffect)(function () {
|
|
|
if (urlParams !== null && urlParams !== void 0 && urlParams.id) {
|
|
|
timer.current = setInterval(function () {
|
|
|
setTime(30);
|
|
|
}, 30000);
|
|
|
}
|
|
|
return function () {
|
|
|
clearInterval(timer.current);
|
|
|
};
|
|
|
}, []);
|
|
|
var setTime = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(num) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return (0,service/* setLogTime */.uc)(urlParams === null || urlParams === void 0 ? void 0 : urlParams.id, {
|
|
|
practice_time: num
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context.sent;
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function setTime(_x) {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
(0,react.useEffect)(function () {
|
|
|
getData(params);
|
|
|
getPointData();
|
|
|
}, []);
|
|
|
(0,react.useEffect)(function () {
|
|
|
window.addEventListener('click', handleSkip);
|
|
|
return function () {
|
|
|
window.removeEventListener('click', handleSkip);
|
|
|
};
|
|
|
}, [urlParams === null || urlParams === void 0 ? void 0 : urlParams.save_identifier, visible]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
var paramIndex = data.current.findIndex(function (e) {
|
|
|
return e.identifier === (urlParams === null || urlParams === void 0 ? void 0 : urlParams.save_identifier);
|
|
|
});
|
|
|
var paramPrev = data.current[paramIndex - 1];
|
|
|
var paramNext = data.current[paramIndex + 1];
|
|
|
var prev = document.getElementById('oj-prev');
|
|
|
var next = document.getElementById('oj-next');
|
|
|
if (paramPrev) {
|
|
|
prev.style.display = 'block';
|
|
|
} else {
|
|
|
prev.style.display = 'none';
|
|
|
}
|
|
|
if (paramNext) {
|
|
|
next.style.display = 'block';
|
|
|
} else {
|
|
|
next.style.display = 'none';
|
|
|
}
|
|
|
}, [urlParams === null || urlParams === void 0 ? void 0 : urlParams.save_identifier, data.current]);
|
|
|
|
|
|
//父级找元素
|
|
|
var parentIndexOf = function parentIndexOf(node, parent) {
|
|
|
if (node.id === parent) {
|
|
|
return node;
|
|
|
}
|
|
|
for (var i = 0, n = node; n = n.parentNode; i++) {
|
|
|
if (n.id === parent) {
|
|
|
return n;
|
|
|
}
|
|
|
if (n == document.documentElement) {
|
|
|
return false;
|
|
|
} //找不到目标父节点,防止死循环
|
|
|
}
|
|
|
};
|
|
|
|
|
|
var handleSkip = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(e) {
|
|
|
var paramIndex, paramPrev, paramNext;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
if (!parentIndexOf(e.target, 'oj-drawer') && visible) {
|
|
|
onVisible(false);
|
|
|
}
|
|
|
paramIndex = data.current.findIndex(function (e) {
|
|
|
return e.identifier === (urlParams === null || urlParams === void 0 ? void 0 : urlParams.save_identifier);
|
|
|
});
|
|
|
paramPrev = data.current[paramIndex - 1];
|
|
|
paramNext = data.current[paramIndex + 1];
|
|
|
if (!(e.target.id === 'oj-prev')) {
|
|
|
_context2.next = 14;
|
|
|
break;
|
|
|
}
|
|
|
if (!(!paramPrev || paramIndex === -1)) {
|
|
|
_context2.next = 8;
|
|
|
break;
|
|
|
}
|
|
|
message/* default.warn */.ZP.warn('上一题不存在');
|
|
|
return _context2.abrupt("return");
|
|
|
case 8:
|
|
|
e.target.style.pointerEvents = 'none';
|
|
|
e.target.style.cursor = 'not-allowed';
|
|
|
_context2.next = 12;
|
|
|
return skip(paramPrev === null || paramPrev === void 0 ? void 0 : paramPrev.identifier);
|
|
|
case 12:
|
|
|
setIndex('0');
|
|
|
setTimeout(function () {
|
|
|
e.target.style.pointerEvents = 'auto';
|
|
|
e.target.style.cursor = 'pointer';
|
|
|
}, 400);
|
|
|
case 14:
|
|
|
if (!(e.target.id === 'oj-next' || e.target.id === 'oj-modal-next')) {
|
|
|
_context2.next = 24;
|
|
|
break;
|
|
|
}
|
|
|
if (!(!paramNext || paramIndex === -1)) {
|
|
|
_context2.next = 18;
|
|
|
break;
|
|
|
}
|
|
|
message/* default.warn */.ZP.warn('下一题不存在');
|
|
|
return _context2.abrupt("return");
|
|
|
case 18:
|
|
|
e.target.style.pointerEvents = 'none';
|
|
|
e.target.style.cursor = 'not-allowed';
|
|
|
_context2.next = 22;
|
|
|
return skip(paramNext === null || paramNext === void 0 ? void 0 : paramNext.identifier);
|
|
|
case 22:
|
|
|
setIndex('0');
|
|
|
setTimeout(function () {
|
|
|
e.target.style.pointerEvents = 'auto';
|
|
|
e.target.style.cursor = 'pointer';
|
|
|
}, 400);
|
|
|
case 24:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function handleSkip(_x2) {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
(0,react.useEffect)(function () {
|
|
|
onChange(urlParams === null || urlParams === void 0 ? void 0 : urlParams.save_identifier);
|
|
|
var page = tableData.findIndex(function (e) {
|
|
|
return e.some(function (r) {
|
|
|
return r.identifier === (urlParams === null || urlParams === void 0 ? void 0 : urlParams.save_identifier);
|
|
|
});
|
|
|
});
|
|
|
if (page === -1) {
|
|
|
setParams(objectSpread2_default()(objectSpread2_default()({}, params), {}, {
|
|
|
page: 1
|
|
|
}));
|
|
|
} else {
|
|
|
setParams(objectSpread2_default()(objectSpread2_default()({}, params), {}, {
|
|
|
page: page + 1
|
|
|
}));
|
|
|
}
|
|
|
}, [urlParams === null || urlParams === void 0 ? void 0 : urlParams.save_identifier, tableData]);
|
|
|
var handlePoint = function handlePoint(v) {
|
|
|
params.page = 1;
|
|
|
params.tag_discipline_id = v;
|
|
|
setParams(objectSpread2_default()({}, params));
|
|
|
getData(params);
|
|
|
};
|
|
|
var getPointData = /*#__PURE__*/function () {
|
|
|
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
_context3.next = 2;
|
|
|
return (0,fetch/* default */.ZP)("/api/tag_disciplines.json", {
|
|
|
method: 'get',
|
|
|
params: {
|
|
|
target: 'practice',
|
|
|
position: 'index'
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context3.sent;
|
|
|
setPointData(res.tag_disciplines || []);
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return function getPointData() {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleSelect = function handleSelect(v) {
|
|
|
params.page = 1;
|
|
|
params.difficulty = typeof v === 'number' ? v : null;
|
|
|
setParams(objectSpread2_default()({}, params));
|
|
|
getData(params);
|
|
|
};
|
|
|
var getData = /*#__PURE__*/function () {
|
|
|
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4(record) {
|
|
|
var res, _res$practices_list, arr_length, newArr, i, _res$practices_list2;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
setLoading(true);
|
|
|
_context4.next = 3;
|
|
|
return (0,service/* practicesList */.KC)(record);
|
|
|
case 3:
|
|
|
res = _context4.sent;
|
|
|
if (res !== null && res !== void 0 && res.practices_list) {
|
|
|
arr_length = res === null || res === void 0 ? void 0 : (_res$practices_list = res.practices_list) === null || _res$practices_list === void 0 ? void 0 : _res$practices_list.length;
|
|
|
newArr = [];
|
|
|
for (i = 0; i < arr_length; i += params === null || params === void 0 ? void 0 : params.per_page) {
|
|
|
newArr.push(res === null || res === void 0 ? void 0 : (_res$practices_list2 = res.practices_list) === null || _res$practices_list2 === void 0 ? void 0 : _res$practices_list2.slice(i, i + (params === null || params === void 0 ? void 0 : params.per_page)));
|
|
|
}
|
|
|
setParams(objectSpread2_default()(objectSpread2_default()({}, params), {}, {
|
|
|
total: res === null || res === void 0 ? void 0 : res.practices_count
|
|
|
}));
|
|
|
data.current = (res === null || res === void 0 ? void 0 : res.practices_list) || [];
|
|
|
setTableData(newArr);
|
|
|
}
|
|
|
setLoading(false);
|
|
|
case 6:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
return function getData(_x3) {
|
|
|
return _ref5.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var skip = /*#__PURE__*/function () {
|
|
|
var _ref6 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5(v, e) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
|
|
|
while (1) switch (_context5.prev = _context5.next) {
|
|
|
case 0:
|
|
|
_context5.next = 2;
|
|
|
return (0,fetch/* default */.ZP)("/api/practices/".concat(v, "/start"), {
|
|
|
method: 'get'
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context5.sent;
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
_umi_production_exports.history.push("/problems/".concat(res === null || res === void 0 ? void 0 : res.identifier, "/oj/").concat(v));
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context5.stop();
|
|
|
}
|
|
|
}, _callee5);
|
|
|
}));
|
|
|
return function skip(_x4, _x5) {
|
|
|
return _ref6.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleChange = function handleChange(current) {
|
|
|
params.page = current;
|
|
|
setParams(objectSpread2_default()({}, params));
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Drawermodules.wrap,
|
|
|
id: "oj-drawer",
|
|
|
style: {
|
|
|
left: visible ? 0 : -700
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Drawermodules.head,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Drawermodules.title,
|
|
|
children: "\u9898\u76EE\u5217\u8868"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default.Search */.Z.Search, {
|
|
|
value: params === null || params === void 0 ? void 0 : params.save_search,
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u9898\u76EE\u540D\u79F0\u641C\u7D22",
|
|
|
style: {
|
|
|
width: 178,
|
|
|
marginLeft: 'auto',
|
|
|
marginRight: 10
|
|
|
},
|
|
|
onChange: function onChange(e) {
|
|
|
params.save_search = e.target.value;
|
|
|
setParams(objectSpread2_default()({}, params));
|
|
|
},
|
|
|
onSearch: function onSearch() {
|
|
|
params.page = 1;
|
|
|
params.search = params.save_search;
|
|
|
setParams(objectSpread2_default()({}, params));
|
|
|
getData(params);
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_select/* default */.Z, {
|
|
|
value: params === null || params === void 0 ? void 0 : params.tag_discipline_id,
|
|
|
style: {
|
|
|
width: 210
|
|
|
},
|
|
|
mode: "multiple",
|
|
|
placeholder: "\u9009\u62E9\u77E5\u8BC6\u70B9",
|
|
|
showSearch: false,
|
|
|
showArrow: true,
|
|
|
getPopupContainer: function getPopupContainer(trigger) {
|
|
|
return trigger.parentNode;
|
|
|
},
|
|
|
maxTagTextLength: 2,
|
|
|
maxTagCount: 2,
|
|
|
onChange: handlePoint,
|
|
|
children: pointData.map(function (e) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_select/* default.Option */.Z.Option, {
|
|
|
value: e.id,
|
|
|
children: e.name
|
|
|
}, e.id);
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_select/* default */.Z, {
|
|
|
style: {
|
|
|
width: 70,
|
|
|
marginLeft: 10
|
|
|
},
|
|
|
allowClear: true,
|
|
|
placeholder: "\u96BE\u5EA6",
|
|
|
getPopupContainer: function getPopupContainer(trigger) {
|
|
|
return trigger.parentNode;
|
|
|
},
|
|
|
value: params === null || params === void 0 ? void 0 : params.difficulty,
|
|
|
onChange: handleSelect,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_select/* default.Option */.Z.Option, {
|
|
|
value: 1,
|
|
|
children: "\u7B80\u5355"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_select/* default.Option */.Z.Option, {
|
|
|
value: 2,
|
|
|
children: "\u9002\u4E2D"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_select/* default.Option */.Z.Option, {
|
|
|
value: 3,
|
|
|
children: "\u56F0\u96BE"
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Drawermodules.content,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
|
|
|
spinning: loading,
|
|
|
children: tableData === null || tableData === void 0 ? void 0 : (_tableData = tableData[params.page - 1]) === null || _tableData === void 0 ? void 0 : _tableData.map(function (e) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Drawermodules.list,
|
|
|
onClick: function onClick(target) {
|
|
|
return skip(e.identifier, target);
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
style: {
|
|
|
visibility: value === e.identifier ? 'visible' : 'hidden'
|
|
|
},
|
|
|
className: "iconfont icon-wancheng1 c-green-29b"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
fontWeight: value === e.identifier ? 'bold' : 400,
|
|
|
color: value === e.identifier ? '#ffffff' : '#bac4cd'
|
|
|
},
|
|
|
title: e === null || e === void 0 ? void 0 : e.name,
|
|
|
children: e.name
|
|
|
}), (e === null || e === void 0 ? void 0 : e.difficulty) === 1 && /*#__PURE__*/(0,jsx_runtime.jsx)("b", {
|
|
|
style: {
|
|
|
color: '#2FA34F'
|
|
|
},
|
|
|
children: "\u7B80\u5355"
|
|
|
}), (e === null || e === void 0 ? void 0 : e.difficulty) === 2 && /*#__PURE__*/(0,jsx_runtime.jsx)("b", {
|
|
|
style: {
|
|
|
color: '#0152d9'
|
|
|
},
|
|
|
children: "\u9002\u4E2D"
|
|
|
}), (e === null || e === void 0 ? void 0 : e.difficulty) === 3 && /*#__PURE__*/(0,jsx_runtime.jsx)("b", {
|
|
|
style: {
|
|
|
color: '#FA6400'
|
|
|
},
|
|
|
children: "\u56F0\u96BE"
|
|
|
})]
|
|
|
}, e.identifier);
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: Drawermodules.footer,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(pagination/* default */.Z, {
|
|
|
showTotal: function showTotal(total) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
style: {
|
|
|
color: '#656F87'
|
|
|
},
|
|
|
children: ["\u5171", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-light-primary",
|
|
|
children: total
|
|
|
}), "\u6761\u6570\u636E"]
|
|
|
});
|
|
|
},
|
|
|
total: params.total,
|
|
|
pageSize: params === null || params === void 0 ? void 0 : params.per_page,
|
|
|
current: params === null || params === void 0 ? void 0 : params.page,
|
|
|
showSizeChanger: false,
|
|
|
onChange: handleChange,
|
|
|
showQuickJumper: true,
|
|
|
hideOnSinglePage: true
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var LeftPanel_Drawer = (Drawer);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/LeftPanel/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* harmony default export */ var LeftPanel = (function (_ref) {
|
|
|
var hack = _ref.hack,
|
|
|
onTriggerPraise = _ref.onTriggerPraise,
|
|
|
topicId = _ref.topicId,
|
|
|
page = _ref.page,
|
|
|
onPageChange = _ref.onPageChange,
|
|
|
user = _ref.user,
|
|
|
submitRecords = _ref.submitRecords,
|
|
|
submitting = _ref.submitting,
|
|
|
submitResult = _ref.submitResult;
|
|
|
var _useSearchParams = (0,_umi_production_exports.useSearchParams)(),
|
|
|
_useSearchParams2 = slicedToArray_default()(_useSearchParams, 1),
|
|
|
searchParams = _useSearchParams2[0];
|
|
|
var location = (0,_umi_production_exports.useLocation)();
|
|
|
var _useState = (0,react.useState)(searchParams.get("tab") || '0'),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
index = _useState2[0],
|
|
|
setIndex = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)(0),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
discussTotal = _useState4[0],
|
|
|
setDiscussTotal = _useState4[1];
|
|
|
var _useState5 = (0,react.useState)(0),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
listStatus = _useState6[0],
|
|
|
setListStatus = _useState6[1];
|
|
|
var _useState7 = (0,react.useState)(0),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
filterListTotal = _useState8[0],
|
|
|
setFilterListTotal = _useState8[1];
|
|
|
var _useState9 = (0,react.useState)(),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
questionValue = _useState10[0],
|
|
|
setQuestionValue = _useState10[1];
|
|
|
var _useState11 = (0,react.useState)(false),
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
visible = _useState12[0],
|
|
|
setVisible = _useState12[1];
|
|
|
function onTabIndexChange(e) {
|
|
|
var id = e.target.id;
|
|
|
if (index === '3' && id !== index && (listStatus === 1 || listStatus === 2)) {
|
|
|
modal/* default.confirm */.Z.confirm({
|
|
|
centered: true,
|
|
|
width: 500,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
title: '注意',
|
|
|
icon: null,
|
|
|
className: 'custom-modal-divider',
|
|
|
content: '您正在编写题解,点击关闭后,您的题解内容将不会进行保存。',
|
|
|
onOk: function onOk() {
|
|
|
setIndex(id);
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
setIndex(id);
|
|
|
}
|
|
|
(0,react.useEffect)(function () {
|
|
|
var unSub = mediator/* default.subscribe */.Z.subscribe('to-commit-info', function () {
|
|
|
setIndex('1');
|
|
|
});
|
|
|
return unSub;
|
|
|
}, []);
|
|
|
function toDiscuss() {
|
|
|
setIndex('2');
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: LeftPanelmodules["left-panel"],
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
|
|
|
className: "".concat(LeftPanelmodules["s-navs"], " ").concat(LeftPanelmodules["bg-white"], " ").concat(LeftPanelmodules.b1),
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
className: "mr40 current",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
onClick: function onClick() {
|
|
|
return setVisible(true);
|
|
|
},
|
|
|
src: show
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
className: LeftPanelmodules["oj-mr"],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
className: index === '0' ? LeftPanelmodules.active : '',
|
|
|
id: "0",
|
|
|
onClick: onTabIndexChange,
|
|
|
children: "\u4EFB\u52A1\u63CF\u8FF0"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
className: LeftPanelmodules["oj-mr"],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
|
|
|
className: index === '3' ? LeftPanelmodules.active : '',
|
|
|
id: "3",
|
|
|
onClick: onTabIndexChange,
|
|
|
children: ["\u9898\u89E3", filterListTotal ? "(".concat(filterListTotal, ")") : '']
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
className: LeftPanelmodules["oj-mr"],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
|
|
|
className: index === '2' ? LeftPanelmodules.active : '',
|
|
|
id: "2",
|
|
|
onClick: onTabIndexChange,
|
|
|
children: ["\u8BC4\u8BBA", discussTotal ? "(".concat(discussTotal, ")") : '']
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
className: index === '1' ? LeftPanelmodules.active : '',
|
|
|
id: "1",
|
|
|
onClick: onTabIndexChange,
|
|
|
children: "\u63D0\u4EA4\u8BB0\u5F55"
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "".concat(LeftPanelmodules["tab-panel-body"], " ").concat(index === '0' ? '' : 'hide'),
|
|
|
style: {
|
|
|
padding: '0 0 0 16px'
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(Description, {
|
|
|
hack: hack,
|
|
|
onTriggerPraise: onTriggerPraise,
|
|
|
toDiscuss: toDiscuss
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "".concat(LeftPanelmodules["tab-panel-body"], " ").concat(index === '1' ? '' : 'hide'),
|
|
|
children: !!(submitRecords !== null && submitRecords !== void 0 && submitRecords.records_count) ? /*#__PURE__*/(0,jsx_runtime.jsx)(SubmitList, {
|
|
|
page: page,
|
|
|
onPageChange: onPageChange,
|
|
|
topicId: topicId,
|
|
|
submitting: submitting,
|
|
|
submitRecords: submitRecords,
|
|
|
submitResult: submitResult
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(NoData/* default */.Z, {})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "".concat(LeftPanelmodules["tab-panel-body"], " ").concat(index === '2' ? '' : 'hide'),
|
|
|
style: {
|
|
|
padding: 0
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(Discuss, {
|
|
|
setDiscussTotal: setDiscussTotal,
|
|
|
user: user,
|
|
|
identifier: hack.identifier,
|
|
|
hack: hack,
|
|
|
onTriggerPraise: onTriggerPraise
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "".concat(LeftPanelmodules["tab-panel-body"], " ").concat(index === '3' ? '' : 'hide'),
|
|
|
style: {
|
|
|
padding: 0
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(LeftPanel_FilterList, {
|
|
|
setListStatus: setListStatus,
|
|
|
setFilterListTotal: setFilterListTotal,
|
|
|
tabStatus: index,
|
|
|
identifier: hack.identifier
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(LeftPanel_Drawer, {
|
|
|
visible: visible,
|
|
|
setIndex: setIndex,
|
|
|
onVisible: function onVisible(v) {
|
|
|
return setVisible(v);
|
|
|
},
|
|
|
value: questionValue,
|
|
|
onChange: function onChange(v) {
|
|
|
return setQuestionValue(v);
|
|
|
}
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
// EXTERNAL MODULE: ./src/components/Timepiece/index.tsx
|
|
|
var Timepiece = __webpack_require__(44635);
|
|
|
// EXTERNAL MODULE: ./src/assets/images/question/internal.png
|
|
|
var internal = __webpack_require__(62522);
|
|
|
// EXTERNAL MODULE: ./src/assets/images/question/time.svg
|
|
|
var time = __webpack_require__(39022);
|
|
|
// EXTERNAL MODULE: ./src/assets/images/question/title.svg
|
|
|
var title = __webpack_require__(38508);
|
|
|
// EXTERNAL MODULE: ./node_modules/lodash/lodash.js
|
|
|
var lodash = __webpack_require__(96486);
|
|
|
var lodash_default = /*#__PURE__*/__webpack_require__.n(lodash);
|
|
|
// EXTERNAL MODULE: ./node_modules/react-copy-to-clipboard/lib/index.js
|
|
|
var lib = __webpack_require__(74855);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Question/OjProblem/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["id", "input", "showNote", "onShowNote", "notes", "onCancelNote", "onAddNote", "debugResult", "language", "debuging", "submitting", "executingMessage", "code", "onSubmitCode", "onDebugCode", "onChangeCode", "onChangeInput", "onUpdateCode"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Countdown = statistic/* default.Countdown */.Z.Countdown;
|
|
|
var LanguageSuf = {
|
|
|
'Java': 'java',
|
|
|
'C': 'c',
|
|
|
'Python': 'py',
|
|
|
'C++': 'c'
|
|
|
};
|
|
|
var OjProblem_Types;
|
|
|
(function (Types) {
|
|
|
Types[Types["SET_LOADING"] = 0] = "SET_LOADING";
|
|
|
Types[Types["GET_DATA"] = 1] = "GET_DATA";
|
|
|
Types[Types["GET_SUBMIT_RECORDS"] = 2] = "GET_SUBMIT_RECORDS";
|
|
|
Types[Types["SET_DATA"] = 3] = "SET_DATA";
|
|
|
Types[Types["SET_DEBUGING"] = 4] = "SET_DEBUGING";
|
|
|
Types[Types["SET_SUBMITING"] = 5] = "SET_SUBMITING";
|
|
|
Types[Types["SET_EXECUTE_MESSAGE"] = 6] = "SET_EXECUTE_MESSAGE";
|
|
|
Types[Types["SET_EXECUTE_RESULT"] = 7] = "SET_EXECUTE_RESULT";
|
|
|
Types[Types["SET_SUBMIT_RESULT"] = 8] = "SET_SUBMIT_RESULT";
|
|
|
Types[Types["SET_SHOW_NOTE"] = 9] = "SET_SHOW_NOTE";
|
|
|
Types[Types["SET_PAGE"] = 10] = "SET_PAGE";
|
|
|
Types[Types["GET_LANGUAGE"] = 11] = "GET_LANGUAGE";
|
|
|
Types[Types["GET_DRAWER"] = 12] = "GET_DRAWER";
|
|
|
})(OjProblem_Types || (OjProblem_Types = {}));
|
|
|
function getTimeStamp() {
|
|
|
return new Date().getTime();
|
|
|
}
|
|
|
var initalilState = {
|
|
|
loading: true,
|
|
|
data: undefined,
|
|
|
showNote: false,
|
|
|
debugResult: undefined,
|
|
|
submitResult: undefined,
|
|
|
debuging: false,
|
|
|
submitting: false,
|
|
|
submitRecords: undefined,
|
|
|
submitRecordPage: 1,
|
|
|
executingMessage: '',
|
|
|
languageValue: '',
|
|
|
languageList: [],
|
|
|
drawerData: []
|
|
|
};
|
|
|
function OjProblem_reducer(state, action) {
|
|
|
switch (action.type) {
|
|
|
case OjProblem_Types.GET_DATA:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), action.payload);
|
|
|
case OjProblem_Types.SET_DATA:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
data: action.payload
|
|
|
});
|
|
|
case OjProblem_Types.SET_LOADING:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
loading: action.payload
|
|
|
});
|
|
|
case OjProblem_Types.GET_LANGUAGE:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
languageList: action.payload
|
|
|
});
|
|
|
case OjProblem_Types.GET_DRAWER:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
drawerData: action.payload
|
|
|
});
|
|
|
case OjProblem_Types.SET_SHOW_NOTE:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
showNote: action.payload
|
|
|
});
|
|
|
case OjProblem_Types.SET_DEBUGING:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
debuging: action.payload
|
|
|
});
|
|
|
case OjProblem_Types.SET_SUBMITING:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
submitting: action.payload
|
|
|
});
|
|
|
case OjProblem_Types.GET_SUBMIT_RECORDS:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
submitRecords: action.payload
|
|
|
});
|
|
|
case OjProblem_Types.SET_PAGE:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
submitRecordPage: action.payload
|
|
|
});
|
|
|
case OjProblem_Types.SET_EXECUTE_MESSAGE:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
executingMessage: action.payload
|
|
|
});
|
|
|
case OjProblem_Types.SET_EXECUTE_RESULT:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), action.payload);
|
|
|
case OjProblem_Types.SET_SUBMIT_RESULT:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), action.payload);
|
|
|
default:
|
|
|
throw new Error();
|
|
|
}
|
|
|
}
|
|
|
/* harmony default export */ var OjProblem = (function (_ref) {
|
|
|
var _data$test_case, _window$location;
|
|
|
var children = _ref.children;
|
|
|
var _useReducer = (0,react.useReducer)(OjProblem_reducer, initalilState),
|
|
|
_useReducer2 = slicedToArray_default()(_useReducer, 2),
|
|
|
state = _useReducer2[0],
|
|
|
dispatch = _useReducer2[1];
|
|
|
var _useParams = (0,_umi_production_exports.useParams)(),
|
|
|
id = _useParams.id;
|
|
|
var location = (0,_umi_production_exports.useLocation)();
|
|
|
var _useSearchParams = (0,_umi_production_exports.useSearchParams)(),
|
|
|
_useSearchParams2 = slicedToArray_default()(_useSearchParams, 1),
|
|
|
searchParams = _useSearchParams2[0];
|
|
|
var languageValue = state.languageValue,
|
|
|
languageList = state.languageList,
|
|
|
loading = state.loading,
|
|
|
data = state.data,
|
|
|
debugResult = state.debugResult,
|
|
|
submitResult = state.submitResult,
|
|
|
submitRecords = state.submitRecords,
|
|
|
submitRecordPage = state.submitRecordPage,
|
|
|
showNote = state.showNote,
|
|
|
debuging = state.debuging,
|
|
|
submitting = state.submitting,
|
|
|
executingMessage = state.executingMessage;
|
|
|
var _useState = (0,react.useState)("#FFF"),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
countDownColor = _useState2[0],
|
|
|
setCountDownColor = _useState2[1];
|
|
|
var _useState3 = (0,react.useState)(null),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
countDownTime = _useState4[0],
|
|
|
setCountDownTime = _useState4[1];
|
|
|
var _useState5 = (0,react.useState)({}),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
exerciseData = _useState6[0],
|
|
|
setExerciseData = _useState6[1];
|
|
|
var _useState7 = (0,react.useState)(false),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
passModalData = _useState8[0],
|
|
|
setPassModalData = _useState8[1];
|
|
|
var timer = (0,react.useRef)(null);
|
|
|
var saveData = (0,react.useRef)(null);
|
|
|
var user = data === null || data === void 0 ? void 0 : data.user;
|
|
|
var hack = data === null || data === void 0 ? void 0 : data.hack;
|
|
|
(0,react.useEffect)(function () {
|
|
|
(0,_umi_production_exports.getDvaApp)()._store.dispatch({
|
|
|
type: 'globalSetting/headerFooterToggle',
|
|
|
payload: false
|
|
|
});
|
|
|
(0,_umi_production_exports.getDvaApp)()._store.dispatch({
|
|
|
type: 'globalSetting/onlyShowBackTopToggle',
|
|
|
payload: true
|
|
|
});
|
|
|
return function () {
|
|
|
(0,_umi_production_exports.getDvaApp)()._store.dispatch({
|
|
|
type: 'globalSetting/headerFooterToggle',
|
|
|
payload: true
|
|
|
});
|
|
|
(0,_umi_production_exports.getDvaApp)()._store.dispatch({
|
|
|
type: 'globalSetting/onlyShowBackTopToggle',
|
|
|
payload: false
|
|
|
});
|
|
|
};
|
|
|
}, []);
|
|
|
(0,react.useEffect)(function () {
|
|
|
setTimeout(function () {
|
|
|
document.title = "在线刷题";
|
|
|
}, 400);
|
|
|
});
|
|
|
(0,react.useEffect)(function () {
|
|
|
if (passModalData) {
|
|
|
var _next$style;
|
|
|
var next = document.getElementById('oj-next');
|
|
|
var modalNext = document.getElementById('oj-modal-next');
|
|
|
if ((next === null || next === void 0 ? void 0 : (_next$style = next.style) === null || _next$style === void 0 ? void 0 : _next$style.display) === 'none') {
|
|
|
modalNext.style.display = 'none';
|
|
|
} else {
|
|
|
modalNext.style.display = 'block';
|
|
|
}
|
|
|
}
|
|
|
}, [passModalData]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
function init() {
|
|
|
return _init.apply(this, arguments);
|
|
|
}
|
|
|
function _init() {
|
|
|
_init = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var response, _response$hack, _response$hack2, _response$hack3, recordStr;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return (0,service/* getProgrammingTopic */.fu)(id);
|
|
|
case 2:
|
|
|
response = _context.sent;
|
|
|
if (response.status === 401) {
|
|
|
document.location.href = '/user/login';
|
|
|
// history.replace('/user/login', { from: location.pathname })
|
|
|
} else {
|
|
|
response.hack = response.practice;
|
|
|
response.hack.code = base64.Base64.decode(response === null || response === void 0 ? void 0 : (_response$hack = response.hack) === null || _response$hack === void 0 ? void 0 : _response$hack.code);
|
|
|
recordStr = "".concat(user === null || user === void 0 ? void 0 : user.login, "-language");
|
|
|
if (localStorage.getItem(recordStr)) {
|
|
|
response.hack.language = localStorage.getItem(recordStr);
|
|
|
}
|
|
|
saveData.current = lodash_default().cloneDeep(response);
|
|
|
saveData.current.language = response === null || response === void 0 ? void 0 : (_response$hack2 = response.hack) === null || _response$hack2 === void 0 ? void 0 : _response$hack2.language;
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.GET_DATA,
|
|
|
payload: {
|
|
|
loading: false,
|
|
|
data: response
|
|
|
}
|
|
|
});
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_SUBMIT_RESULT,
|
|
|
payload: {
|
|
|
languageValue: response === null || response === void 0 ? void 0 : (_response$hack3 = response.hack) === null || _response$hack3 === void 0 ? void 0 : _response$hack3.language
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return _init.apply(this, arguments);
|
|
|
}
|
|
|
if (id) {
|
|
|
init();
|
|
|
}
|
|
|
}, [id]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_SUBMIT_RESULT,
|
|
|
payload: {
|
|
|
debugResult: undefined
|
|
|
}
|
|
|
});
|
|
|
getLanguageData();
|
|
|
setPassModalData(false);
|
|
|
}, [id]);
|
|
|
|
|
|
//清除代码保存定时器
|
|
|
(0,react.useEffect)(function () {
|
|
|
clearTimeout(timer.current);
|
|
|
}, [id]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
getSubmitRecordsData();
|
|
|
}, [id, submitRecordPage]);
|
|
|
var backExercise = function backExercise() {
|
|
|
window.parent.postMessage('backExercise', '*');
|
|
|
// history.push(`/classrooms/${searchParams.get("coursesId")}/exercise/${searchParams.get("exercisesId")}/users/${searchParams.get("login")}`)
|
|
|
};
|
|
|
function getSubmitRecordsData() {
|
|
|
return _getSubmitRecordsData.apply(this, arguments);
|
|
|
}
|
|
|
function _getSubmitRecordsData() {
|
|
|
_getSubmitRecordsData = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
|
|
|
var response;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
_context4.prev = 0;
|
|
|
_context4.next = 3;
|
|
|
return (0,service/* getSubmitRecords */.zO)(id, {
|
|
|
limit: 15,
|
|
|
page: submitRecordPage
|
|
|
});
|
|
|
case 3:
|
|
|
response = _context4.sent;
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.GET_SUBMIT_RECORDS,
|
|
|
payload: response
|
|
|
});
|
|
|
_context4.next = 10;
|
|
|
break;
|
|
|
case 7:
|
|
|
_context4.prev = 7;
|
|
|
_context4.t0 = _context4["catch"](0);
|
|
|
console.log(_context4.t0);
|
|
|
case 10:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4, null, [[0, 7]]);
|
|
|
}));
|
|
|
return _getSubmitRecordsData.apply(this, arguments);
|
|
|
}
|
|
|
function getLanguageData() {
|
|
|
return _getLanguageData.apply(this, arguments);
|
|
|
}
|
|
|
function _getLanguageData() {
|
|
|
_getLanguageData = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5() {
|
|
|
var response;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
|
|
|
while (1) switch (_context5.prev = _context5.next) {
|
|
|
case 0:
|
|
|
_context5.prev = 0;
|
|
|
_context5.next = 3;
|
|
|
return (0,service/* updateLanguageCode */.dd)(id);
|
|
|
case 3:
|
|
|
response = _context5.sent;
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.GET_LANGUAGE,
|
|
|
payload: response === null || response === void 0 ? void 0 : response.data
|
|
|
});
|
|
|
_context5.next = 10;
|
|
|
break;
|
|
|
case 7:
|
|
|
_context5.prev = 7;
|
|
|
_context5.t0 = _context5["catch"](0);
|
|
|
console.log(_context5.t0);
|
|
|
case 10:
|
|
|
case "end":
|
|
|
return _context5.stop();
|
|
|
}
|
|
|
}, _callee5, null, [[0, 7]]);
|
|
|
}));
|
|
|
return _getLanguageData.apply(this, arguments);
|
|
|
}
|
|
|
function onPageChange(value) {
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_PAGE,
|
|
|
payload: value
|
|
|
});
|
|
|
}
|
|
|
function onUpdateCode(_x) {
|
|
|
return _onUpdateCode.apply(this, arguments);
|
|
|
}
|
|
|
function _onUpdateCode() {
|
|
|
_onUpdateCode = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6(re) {
|
|
|
var _window, _window$location2, _window$location2$pat, _window$location2$pat2;
|
|
|
var relId, response;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee6$(_context6) {
|
|
|
while (1) switch (_context6.prev = _context6.next) {
|
|
|
case 0:
|
|
|
relId = ((_window = window) === null || _window === void 0 ? void 0 : (_window$location2 = _window.location) === null || _window$location2 === void 0 ? void 0 : (_window$location2$pat = _window$location2.pathname) === null || _window$location2$pat === void 0 ? void 0 : (_window$location2$pat2 = _window$location2$pat.split('/')) === null || _window$location2$pat2 === void 0 ? void 0 : _window$location2$pat2[2]) || id;
|
|
|
_context6.next = 3;
|
|
|
return (0,service/* updateCode */.n4)(relId, re ? re : {
|
|
|
code: base64.Base64.encode(hack.code),
|
|
|
language: languageValue
|
|
|
});
|
|
|
case 3:
|
|
|
response = _context6.sent;
|
|
|
return _context6.abrupt("return", response);
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context6.stop();
|
|
|
}
|
|
|
}, _callee6);
|
|
|
}));
|
|
|
return _onUpdateCode.apply(this, arguments);
|
|
|
}
|
|
|
function onSubmitCode() {
|
|
|
return _onSubmitCode.apply(this, arguments);
|
|
|
}
|
|
|
function _onSubmitCode() {
|
|
|
_onSubmitCode = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee8() {
|
|
|
var response, executeCode, submitCodeParams, res, time_limit, test_case_size, startTime;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee8$(_context8) {
|
|
|
while (1) switch (_context8.prev = _context8.next) {
|
|
|
case 0:
|
|
|
if (!submitting) {
|
|
|
_context8.next = 2;
|
|
|
break;
|
|
|
}
|
|
|
return _context8.abrupt("return");
|
|
|
case 2:
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_SUBMITING,
|
|
|
payload: true
|
|
|
});
|
|
|
_context8.prev = 3;
|
|
|
mediator/* default.publish */.Z.publish('to-commit-info');
|
|
|
_context8.next = 7;
|
|
|
return onUpdateCode();
|
|
|
case 7:
|
|
|
response = _context8.sent;
|
|
|
if (!(response.status === 0)) {
|
|
|
_context8.next = 20;
|
|
|
break;
|
|
|
}
|
|
|
executeCode = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee7() {
|
|
|
var _yield$getOperationRe, status, data, executeTime, isTimeOut, submitResponse;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee7$(_context7) {
|
|
|
while (1) switch (_context7.prev = _context7.next) {
|
|
|
case 0:
|
|
|
_context7.next = 2;
|
|
|
return (0,service/* getOperationResult */.rX)(id, 'submit');
|
|
|
case 2:
|
|
|
_yield$getOperationRe = _context7.sent;
|
|
|
status = _yield$getOperationRe.status;
|
|
|
data = _yield$getOperationRe.data;
|
|
|
executeTime = getTimeStamp();
|
|
|
isTimeOut = executeTime - startTime > (time_limit * test_case_size + 3) * 1000;
|
|
|
if (status !== 0 && !isTimeOut) {
|
|
|
setTimeout(executeCode, 1000);
|
|
|
}
|
|
|
if (!isTimeOut) {
|
|
|
_context7.next = 12;
|
|
|
break;
|
|
|
}
|
|
|
modal/* default.error */.Z.error({
|
|
|
centered: true,
|
|
|
okText: '知道啦',
|
|
|
content: '评测代码超时'
|
|
|
});
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_SUBMITING,
|
|
|
payload: false
|
|
|
});
|
|
|
return _context7.abrupt("return");
|
|
|
case 12:
|
|
|
if (!(status === 0)) {
|
|
|
_context7.next = 19;
|
|
|
break;
|
|
|
}
|
|
|
if (data.status === 2) {
|
|
|
modal/* default.error */.Z.error({
|
|
|
centered: true,
|
|
|
okText: '知道啦',
|
|
|
content: '评测代码超时'
|
|
|
});
|
|
|
}
|
|
|
_context7.next = 16;
|
|
|
return (0,service/* getSubmitRecords */.zO)(id, {
|
|
|
limit: 15,
|
|
|
page: submitRecordPage
|
|
|
});
|
|
|
case 16:
|
|
|
submitResponse = _context7.sent;
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_SUBMIT_RESULT,
|
|
|
payload: objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
submitResult: data,
|
|
|
// debugResult: data,
|
|
|
submitting: false,
|
|
|
submitRecords: submitResponse
|
|
|
})
|
|
|
});
|
|
|
if ((data === null || data === void 0 ? void 0 : data.status) === 0) {
|
|
|
setPassModalData(true);
|
|
|
}
|
|
|
case 19:
|
|
|
case "end":
|
|
|
return _context7.stop();
|
|
|
}
|
|
|
}, _callee7);
|
|
|
}));
|
|
|
return function executeCode() {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
submitCodeParams = {};
|
|
|
_context8.next = 13;
|
|
|
return (0,service/* sumbitCode */.bM)(id, submitCodeParams);
|
|
|
case 13:
|
|
|
res = _context8.sent;
|
|
|
if (!(res.status === -1)) {
|
|
|
_context8.next = 17;
|
|
|
break;
|
|
|
}
|
|
|
window.parent.location.href = "/classrooms/".concat(searchParams.get("coursesId"), "/exercise/").concat(searchParams.get("exercisesId"), "/detail");
|
|
|
return _context8.abrupt("return");
|
|
|
case 17:
|
|
|
time_limit = hack.time_limit, test_case_size = hack.test_case_size;
|
|
|
startTime = getTimeStamp();
|
|
|
executeCode();
|
|
|
case 20:
|
|
|
_context8.next = 25;
|
|
|
break;
|
|
|
case 22:
|
|
|
_context8.prev = 22;
|
|
|
_context8.t0 = _context8["catch"](3);
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_SUBMITING,
|
|
|
payload: false
|
|
|
});
|
|
|
case 25:
|
|
|
case "end":
|
|
|
return _context8.stop();
|
|
|
}
|
|
|
}, _callee8, null, [[3, 22]]);
|
|
|
}));
|
|
|
return _onSubmitCode.apply(this, arguments);
|
|
|
}
|
|
|
function onDebugCode() {
|
|
|
return _onDebugCode.apply(this, arguments);
|
|
|
}
|
|
|
function _onDebugCode() {
|
|
|
_onDebugCode = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee10() {
|
|
|
var response, executeCode, time_limit, submitCodeParams, res, startTime;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee10$(_context10) {
|
|
|
while (1) switch (_context10.prev = _context10.next) {
|
|
|
case 0:
|
|
|
state.debuging = true;
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_DEBUGING,
|
|
|
payload: true
|
|
|
});
|
|
|
_context10.prev = 2;
|
|
|
_context10.next = 5;
|
|
|
return onUpdateCode();
|
|
|
case 5:
|
|
|
response = _context10.sent;
|
|
|
if (!(response.status === 0)) {
|
|
|
_context10.next = 20;
|
|
|
break;
|
|
|
}
|
|
|
executeCode = /*#__PURE__*/function () {
|
|
|
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee9() {
|
|
|
var _yield$getOperationRe2, status, message, data, executeTime, isTimeOut;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee9$(_context9) {
|
|
|
while (1) switch (_context9.prev = _context9.next) {
|
|
|
case 0:
|
|
|
_context9.next = 2;
|
|
|
return (0,service/* getOperationResult */.rX)(id, 'debug');
|
|
|
case 2:
|
|
|
_yield$getOperationRe2 = _context9.sent;
|
|
|
status = _yield$getOperationRe2.status;
|
|
|
message = _yield$getOperationRe2.message;
|
|
|
data = _yield$getOperationRe2.data;
|
|
|
executeTime = getTimeStamp();
|
|
|
isTimeOut = executeTime - startTime > (time_limit + 3) * 1000;
|
|
|
if (status !== 0 && !isTimeOut) {
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_EXECUTE_MESSAGE,
|
|
|
payload: message
|
|
|
});
|
|
|
setTimeout(executeCode, 1000);
|
|
|
}
|
|
|
if (!isTimeOut) {
|
|
|
_context9.next = 13;
|
|
|
break;
|
|
|
}
|
|
|
modal/* default.error */.Z.error({
|
|
|
centered: true,
|
|
|
okText: '知道啦',
|
|
|
content: '调试代码超时'
|
|
|
});
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_DEBUGING,
|
|
|
payload: false
|
|
|
});
|
|
|
return _context9.abrupt("return");
|
|
|
case 13:
|
|
|
if (status === 0) {
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_DEBUGING,
|
|
|
payload: false
|
|
|
});
|
|
|
if (data.status === 2) {
|
|
|
modal/* default.error */.Z.error({
|
|
|
centered: true,
|
|
|
okText: '知道啦',
|
|
|
content: '调试代码超时'
|
|
|
});
|
|
|
}
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_EXECUTE_RESULT,
|
|
|
payload: objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
debugResult: data,
|
|
|
debuging: false
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
case 14:
|
|
|
case "end":
|
|
|
return _context9.stop();
|
|
|
}
|
|
|
}, _callee9);
|
|
|
}));
|
|
|
return function executeCode() {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
time_limit = hack.time_limit;
|
|
|
submitCodeParams = {
|
|
|
input: encodeURIComponent(data.test_case.input)
|
|
|
};
|
|
|
_context10.next = 12;
|
|
|
return (0,service/* debugCode */.MU)(id, submitCodeParams);
|
|
|
case 12:
|
|
|
res = _context10.sent;
|
|
|
if (!(res.status === -1)) {
|
|
|
_context10.next = 16;
|
|
|
break;
|
|
|
}
|
|
|
window.parent.location.href = "/classrooms/".concat(searchParams.get("coursesId"), "/exercise/").concat(searchParams.get("exercisesId"), "/detail");
|
|
|
return _context10.abrupt("return");
|
|
|
case 16:
|
|
|
startTime = getTimeStamp();
|
|
|
executeCode();
|
|
|
_context10.next = 21;
|
|
|
break;
|
|
|
case 20:
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_DEBUGING,
|
|
|
payload: false
|
|
|
});
|
|
|
case 21:
|
|
|
_context10.next = 26;
|
|
|
break;
|
|
|
case 23:
|
|
|
_context10.prev = 23;
|
|
|
_context10.t0 = _context10["catch"](2);
|
|
|
console.log(_context10.t0);
|
|
|
case 26:
|
|
|
_context10.prev = 26;
|
|
|
return _context10.finish(26);
|
|
|
case 28:
|
|
|
case "end":
|
|
|
return _context10.stop();
|
|
|
}
|
|
|
}, _callee10, null, [[2, 23, 26, 28]]);
|
|
|
}));
|
|
|
return _onDebugCode.apply(this, arguments);
|
|
|
}
|
|
|
function onChangeCode(value) {
|
|
|
var _saveData$current2;
|
|
|
clearTimeout(timer.current);
|
|
|
timer.current = setTimeout(function () {
|
|
|
var _saveData$current;
|
|
|
onUpdateCode({
|
|
|
code: base64.Base64.encode(value),
|
|
|
language: saveData === null || saveData === void 0 ? void 0 : (_saveData$current = saveData.current) === null || _saveData$current === void 0 ? void 0 : _saveData$current.language
|
|
|
});
|
|
|
}, 2000);
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_DATA,
|
|
|
payload: objectSpread2_default()(objectSpread2_default()({}, saveData === null || saveData === void 0 ? void 0 : saveData.current), {}, {
|
|
|
hack: objectSpread2_default()(objectSpread2_default()({}, saveData === null || saveData === void 0 ? void 0 : (_saveData$current2 = saveData.current) === null || _saveData$current2 === void 0 ? void 0 : _saveData$current2.hack), {}, {
|
|
|
code: value
|
|
|
})
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
function onChangeInput(e) {
|
|
|
var input = e.target.value;
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_DATA,
|
|
|
payload: objectSpread2_default()(objectSpread2_default()({}, data), {}, {
|
|
|
test_case: {
|
|
|
input: input
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
var onChangeLanguage = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(v) {
|
|
|
var res, recordStr, response, _response$data, param;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_LOADING,
|
|
|
payload: true
|
|
|
});
|
|
|
_context2.next = 3;
|
|
|
return onUpdateCode();
|
|
|
case 3:
|
|
|
res = _context2.sent;
|
|
|
if (!(res.status === 0)) {
|
|
|
_context2.next = 14;
|
|
|
break;
|
|
|
}
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_SUBMIT_RESULT,
|
|
|
payload: {
|
|
|
languageValue: v
|
|
|
}
|
|
|
});
|
|
|
saveData.current.language = v;
|
|
|
recordStr = "".concat(user === null || user === void 0 ? void 0 : user.login, "-language");
|
|
|
localStorage.setItem(recordStr, v);
|
|
|
_context2.next = 11;
|
|
|
return (0,service/* updateLanguageCode */.dd)(id);
|
|
|
case 11:
|
|
|
response = _context2.sent;
|
|
|
if (response.status === 0) {
|
|
|
param = response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.find(function (e) {
|
|
|
return e.language === v;
|
|
|
});
|
|
|
onChangeCode(base64.Base64.decode(param.code));
|
|
|
}
|
|
|
setTimeout(function () {
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_LOADING,
|
|
|
payload: false
|
|
|
});
|
|
|
}, 300);
|
|
|
case 14:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function onChangeLanguage(_x2) {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
function onResetCode() {
|
|
|
return _onResetCode.apply(this, arguments);
|
|
|
}
|
|
|
function _onResetCode() {
|
|
|
_onResetCode = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee11() {
|
|
|
var response;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee11$(_context11) {
|
|
|
while (1) switch (_context11.prev = _context11.next) {
|
|
|
case 0:
|
|
|
_context11.prev = 0;
|
|
|
_context11.next = 3;
|
|
|
return (0,service/* resetCode */.H7)(id, {
|
|
|
language: languageValue
|
|
|
});
|
|
|
case 3:
|
|
|
response = _context11.sent;
|
|
|
if (response.status === 401) {
|
|
|
_umi_production_exports.history.replace('/login', {
|
|
|
from: location.pathname
|
|
|
});
|
|
|
} else {
|
|
|
onChangeCode(base64.Base64.decode(response.code));
|
|
|
getLanguageData();
|
|
|
}
|
|
|
_context11.next = 10;
|
|
|
break;
|
|
|
case 7:
|
|
|
_context11.prev = 7;
|
|
|
_context11.t0 = _context11["catch"](0);
|
|
|
console.log(_context11.t0);
|
|
|
case 10:
|
|
|
case "end":
|
|
|
return _context11.stop();
|
|
|
}
|
|
|
}, _callee11, null, [[0, 7]]);
|
|
|
}));
|
|
|
return _onResetCode.apply(this, arguments);
|
|
|
}
|
|
|
function onSyncCode() {
|
|
|
modal/* default.confirm */.Z.confirm({
|
|
|
centered: true,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
title: '提示',
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u521D\u59CB\u4EE3\u7801\u6709\u4FEE\u6539\uFF0C\u66F4\u65B0\u540E\u5C06\u8986\u76D6\u73B0\u6709\u4EE3\u7801\u54E6~ ", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u8BF7\u5C06\u60A8\u7F16\u8F91\u7684\u4EE3\u7801\u4FDD\u5B58\u81F3\u672C\u5730\uFF0C\u4EE5\u9632\u4E22\u5931"]
|
|
|
}),
|
|
|
onOk: function onOk() {
|
|
|
return asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
|
|
var response;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
_context3.next = 2;
|
|
|
return (0,service/* syncCode */.fi)(id, {
|
|
|
language: languageValue
|
|
|
});
|
|
|
case 2:
|
|
|
response = _context3.sent;
|
|
|
if (response.status === 401) {
|
|
|
_umi_production_exports.history.replace('/login', {
|
|
|
from: location.pathname
|
|
|
});
|
|
|
} else {
|
|
|
onChangeCode(base64.Base64.decode(response.code));
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}))();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
function onShowNote() {
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_SHOW_NOTE,
|
|
|
payload: true
|
|
|
});
|
|
|
}
|
|
|
function onCancelNote() {
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_SHOW_NOTE,
|
|
|
payload: false
|
|
|
});
|
|
|
}
|
|
|
function onAddNote(_x3) {
|
|
|
return _onAddNote.apply(this, arguments);
|
|
|
}
|
|
|
function _onAddNote() {
|
|
|
_onAddNote = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee12(values) {
|
|
|
return regeneratorRuntime_default()().wrap(function _callee12$(_context12) {
|
|
|
while (1) switch (_context12.prev = _context12.next) {
|
|
|
case 0:
|
|
|
_context12.next = 2;
|
|
|
return (0,service/* addNotes */.MK)(id, values);
|
|
|
case 2:
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.GET_DATA,
|
|
|
payload: {
|
|
|
showNote: false,
|
|
|
data: objectSpread2_default()(objectSpread2_default()({}, data), {}, {
|
|
|
hack: objectSpread2_default()(objectSpread2_default()({}, hack), {}, {
|
|
|
notes: values.notes
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context12.stop();
|
|
|
}
|
|
|
}, _callee12);
|
|
|
}));
|
|
|
return _onAddNote.apply(this, arguments);
|
|
|
}
|
|
|
var rightPanelOption = {
|
|
|
input: data === null || data === void 0 ? void 0 : (_data$test_case = data.test_case) === null || _data$test_case === void 0 ? void 0 : _data$test_case.input,
|
|
|
language: hack === null || hack === void 0 ? void 0 : hack.language,
|
|
|
code: hack === null || hack === void 0 ? void 0 : hack.code,
|
|
|
title: 'main.' + LanguageSuf[hack === null || hack === void 0 ? void 0 : hack.language],
|
|
|
modify_code: hack === null || hack === void 0 ? void 0 : hack.modify_code,
|
|
|
notes: hack === null || hack === void 0 ? void 0 : hack.notes,
|
|
|
debugResult: debugResult,
|
|
|
debuging: debuging,
|
|
|
submitting: submitting,
|
|
|
executingMessage: executingMessage,
|
|
|
id: id,
|
|
|
languageValue: languageValue,
|
|
|
languageList: languageList,
|
|
|
onChangeLanguage: onChangeLanguage,
|
|
|
onCancelNote: onCancelNote,
|
|
|
onAddNote: onAddNote,
|
|
|
showNote: showNote,
|
|
|
onShowNote: onShowNote,
|
|
|
onSubmitCode: onSubmitCode,
|
|
|
onChangeCode: onChangeCode,
|
|
|
onChangeInput: onChangeInput,
|
|
|
onDebugCode: onDebugCode,
|
|
|
onResetCode: onResetCode,
|
|
|
onSyncCode: onSyncCode,
|
|
|
onUpdateCode: onUpdateCode
|
|
|
};
|
|
|
function onTriggerPraise() {
|
|
|
return _onTriggerPraise.apply(this, arguments);
|
|
|
}
|
|
|
function _onTriggerPraise() {
|
|
|
_onTriggerPraise = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee13() {
|
|
|
var _yield$triggerPlus, praise_count, rs;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee13$(_context13) {
|
|
|
while (1) switch (_context13.prev = _context13.next) {
|
|
|
case 0:
|
|
|
_context13.next = 2;
|
|
|
return (0,service/* triggerPlus */.vl)(hack.id, {
|
|
|
container_type: 'Hack',
|
|
|
type: 1
|
|
|
});
|
|
|
case 2:
|
|
|
_yield$triggerPlus = _context13.sent;
|
|
|
praise_count = _yield$triggerPlus.praise_count;
|
|
|
rs = objectSpread2_default()(objectSpread2_default()({}, data), {}, {
|
|
|
hack: objectSpread2_default()(objectSpread2_default()({}, hack), {}, {
|
|
|
praises_count: praise_count,
|
|
|
user_praise: !hack.user_praise
|
|
|
})
|
|
|
});
|
|
|
dispatch({
|
|
|
type: OjProblem_Types.SET_DATA,
|
|
|
payload: rs
|
|
|
});
|
|
|
case 6:
|
|
|
case "end":
|
|
|
return _context13.stop();
|
|
|
}
|
|
|
}, _callee13);
|
|
|
}));
|
|
|
return _onTriggerPraise.apply(this, arguments);
|
|
|
}
|
|
|
var leftPanelOption = {
|
|
|
topicId: id,
|
|
|
submitResult: submitResult,
|
|
|
submitRecords: submitRecords,
|
|
|
submitting: submitting,
|
|
|
page: submitRecordPage,
|
|
|
onPageChange: onPageChange,
|
|
|
hack: hack,
|
|
|
user: data === null || data === void 0 ? void 0 : data.user,
|
|
|
onTriggerPraise: onTriggerPraise
|
|
|
};
|
|
|
console.log(data, saveData === null || saveData === void 0 ? void 0 : saveData.current, 'data--------');
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
|
|
|
className: 'oj-custom-large-spin',
|
|
|
size: "large",
|
|
|
spinning: loading,
|
|
|
children: !data ? null : /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: 'oj-custom-warp',
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("header", {
|
|
|
className: OjFormmodules/* default.header */.Z.header,
|
|
|
style: {
|
|
|
minWidth: 1200
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: "".concat(env/* default.IMG_SERVER */.Z.IMG_SERVER, "/images/").concat(user.image_url),
|
|
|
alt: "user",
|
|
|
width: 30
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: user.name
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("h2", {
|
|
|
className: "flex-wrp flex_box_column flex_box_center",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: hack.name
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Timepiece/* default */.Z, {
|
|
|
onChange: function onChange(v) {},
|
|
|
className: "font12 c-grey-999"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(lib.CopyToClipboard, {
|
|
|
text: "".concat((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.origin, "/problems/").concat(hack.identifier, "/share"),
|
|
|
onCopy: function onCopy() {
|
|
|
return message/* default.success */.ZP.success('复制题目链接成功');
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: OjFormmodules/* default.btn_back */.Z.btn_back,
|
|
|
style: {
|
|
|
marginRight: 10,
|
|
|
cursor: 'pointer'
|
|
|
},
|
|
|
children: [" ", /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-fenxiang1 font14 mr5"
|
|
|
}), "\u5206\u4EAB\u9898\u76EE"]
|
|
|
})
|
|
|
}), hack.edit_privilege ? /*#__PURE__*/(0,jsx_runtime.jsxs)(_umi_production_exports.Link, {
|
|
|
className: OjFormmodules/* default.btn_back */.Z.btn_back,
|
|
|
to: "/problems/".concat(hack.identifier, "/ojedit"),
|
|
|
style: {
|
|
|
marginRight: 10
|
|
|
},
|
|
|
children: [" ", /*#__PURE__*/(0,jsx_runtime.jsx)(FormOutlined/* default */.Z, {}), " \u7F16\u8F91"]
|
|
|
}) : null, /*#__PURE__*/(0,jsx_runtime.jsxs)(_umi_production_exports.Link, {
|
|
|
className: OjFormmodules/* default.btn_back */.Z.btn_back,
|
|
|
onClick: function onClick() {
|
|
|
111;
|
|
|
},
|
|
|
to: "/problems",
|
|
|
children: [" ", /*#__PURE__*/(0,jsx_runtime.jsx)(PoweroffOutlined/* default */.Z, {}), "\u9000\u51FA"]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(SplitContainer/* default */.Z, {
|
|
|
hideResize: true,
|
|
|
className: "my-problems oj-problems"
|
|
|
// defaultX={"40%"}
|
|
|
// hideResize={true}
|
|
|
,
|
|
|
leftChild: /*#__PURE__*/(0,jsx_runtime.jsx)(LeftPanel, objectSpread2_default()({}, leftPanelOption)),
|
|
|
rightChild: /*#__PURE__*/(0,jsx_runtime.jsx)(RightPanel, objectSpread2_default()({}, rightPanelOption))
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
centered: true,
|
|
|
closable: false,
|
|
|
width: 680,
|
|
|
footer: null,
|
|
|
open: passModalData,
|
|
|
className: "oj-modal",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: "oj-modal-content",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "oj-modal-head",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: internal,
|
|
|
alt: ""
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
onClick: function onClick() {
|
|
|
return setPassModalData(false);
|
|
|
},
|
|
|
className: "iconfont icon-guanbi1"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
className: "mr30",
|
|
|
src: title/* default */.Z
|
|
|
}), "\u8FD0\u884C\u65F6\u95F4:\xA0", /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
style: {
|
|
|
color: '#75d6ba',
|
|
|
marginRight: 100
|
|
|
},
|
|
|
children: [submitResult === null || submitResult === void 0 ? void 0 : submitResult.execute_time, "s"]
|
|
|
}), "\u4F18\u4E8E", /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
style: {
|
|
|
color: '#f3b087',
|
|
|
margin: "0 5px"
|
|
|
},
|
|
|
children: [(submitResult === null || submitResult === void 0 ? void 0 : submitResult.time_better_than) || 100, "%"]
|
|
|
}), "\u7684\u7528\u6237"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
className: "mb50",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: time/* default */.Z,
|
|
|
className: "mr30"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "oj-modal-tt",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u5360\u7528\u5185\u5B58:\xA0"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "c-light-primary",
|
|
|
children: [submitResult === null || submitResult === void 0 ? void 0 : submitResult.execute_memory, "mb"]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {})
|
|
|
})]
|
|
|
}), "\u4F18\u4E8E", /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
style: {
|
|
|
color: '#f3b087',
|
|
|
margin: "0 5px"
|
|
|
},
|
|
|
children: [(submitResult === null || submitResult === void 0 ? void 0 : submitResult.memory_better_than) || 100, "%"]
|
|
|
}), "\u7684\u7528\u6237"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
id: "oj-modal-next",
|
|
|
className: "oj-modal-btn",
|
|
|
children: "\u8FDB\u5165\u4E0B\u4E00\u9898"
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
function ActionBar(_ref5) {
|
|
|
var languageValue = _ref5.languageValue,
|
|
|
languageList = _ref5.languageList,
|
|
|
onChangeLanguage = _ref5.onChangeLanguage,
|
|
|
title = _ref5.title,
|
|
|
modify_code = _ref5.modify_code,
|
|
|
onSyncCode = _ref5.onSyncCode,
|
|
|
onShowCodeSetting = _ref5.onShowCodeSetting,
|
|
|
onResetCode = _ref5.onResetCode;
|
|
|
var location = (0,_umi_production_exports.useLocation)();
|
|
|
var opneModal = function opneModal() {
|
|
|
modal/* default.confirm */.Z.confirm({
|
|
|
title: '恢复初始代码',
|
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)(ExclamationCircleOutlined/* default */.Z, {}),
|
|
|
content: '你在本文件中修改的内容将丢失,是否确定重新加载初始代码?',
|
|
|
centered: true,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
onOk: onResetCode
|
|
|
});
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "action-bar",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_select/* default */.Z, {
|
|
|
className: "oj-select",
|
|
|
value: languageValue,
|
|
|
style: {
|
|
|
width: 100
|
|
|
},
|
|
|
placeholder: "\u9009\u62E9\u8BED\u8A00",
|
|
|
onChange: onChangeLanguage,
|
|
|
children: languageList === null || languageList === void 0 ? void 0 : languageList.map(function (e) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_select/* default.Option */.Z.Option, {
|
|
|
value: e.language,
|
|
|
children: e.language
|
|
|
}, e.language);
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
title: "\u6062\u590D\u521D\u59CB\u4EE3\u7801",
|
|
|
onClick: opneModal,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-zhongzhi font-20 "
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
onClick: onShowCodeSetting,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
className: "iconfont icon-shezhi"
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
function RightPanel(_ref6) {
|
|
|
var id = _ref6.id,
|
|
|
input = _ref6.input,
|
|
|
showNote = _ref6.showNote,
|
|
|
onShowNote = _ref6.onShowNote,
|
|
|
notes = _ref6.notes,
|
|
|
onCancelNote = _ref6.onCancelNote,
|
|
|
onAddNote = _ref6.onAddNote,
|
|
|
debugResult = _ref6.debugResult,
|
|
|
language = _ref6.language,
|
|
|
debuging = _ref6.debuging,
|
|
|
submitting = _ref6.submitting,
|
|
|
executingMessage = _ref6.executingMessage,
|
|
|
code = _ref6.code,
|
|
|
onSubmitCode = _ref6.onSubmitCode,
|
|
|
onDebugCode = _ref6.onDebugCode,
|
|
|
onChangeCode = _ref6.onChangeCode,
|
|
|
onChangeInput = _ref6.onChangeInput,
|
|
|
onUpdateCode = _ref6.onUpdateCode,
|
|
|
actionBarOpation = objectWithoutProperties_default()(_ref6, _excluded);
|
|
|
function ActionBarEL(onShowCodeSetting) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(ActionBar, objectSpread2_default()(objectSpread2_default()({}, actionBarOpation), {}, {
|
|
|
onShowCodeSetting: onShowCodeSetting
|
|
|
}));
|
|
|
}
|
|
|
var testCasePanelOption = {
|
|
|
id: id,
|
|
|
input: input,
|
|
|
debugResult: debugResult,
|
|
|
debuging: debuging,
|
|
|
submitting: submitting,
|
|
|
executingMessage: executingMessage,
|
|
|
onDebugCode: onDebugCode,
|
|
|
onChangeCode: onChangeCode,
|
|
|
onSubmitCode: onSubmitCode,
|
|
|
onChangeInput: onChangeInput
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "right-panel",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(CodePanel/* default */.Z, {
|
|
|
language: language,
|
|
|
value: code,
|
|
|
onChange: onChangeCode,
|
|
|
ActionBarRender: ActionBarEL
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "note-form-area ".concat(showNote ? 'active' : ''),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(NotesForm, {
|
|
|
onCancel: onCancelNote,
|
|
|
notes: notes,
|
|
|
callback: onAddNote
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(TestCasePanel/* default */.ZP, objectSpread2_default()({}, testCasePanelOption))]
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 79192:
|
|
|
/*!***************************************************!*\
|
|
|
!*** ./src/pages/Question/OjProblem/interface.ts ***!
|
|
|
\***************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ "h": function() { return /* binding */ ExecuteStatus; }
|
|
|
/* harmony export */ });
|
|
|
// created_at: "2020-07-09T19:53:54.000+08:00"
|
|
|
// execute_memory: null
|
|
|
// execute_time: 0.269
|
|
|
// id: 872
|
|
|
// language: "C"
|
|
|
// status: 4
|
|
|
|
|
|
var ExecuteStatus;
|
|
|
|
|
|
// "id": "1",
|
|
|
// "status": 2, # -1测试用例结果不匹配; 0: 评测通过; ;2 评测超时;3 创建pod失败; 4 编译失败;5 执行失败
|
|
|
// "error_line": 3, # 错误行数
|
|
|
// "error_msg": "error line 7 input.." , # 报错信息
|
|
|
// "input": "3 4", # 输入
|
|
|
// "output": "7", # 输出
|
|
|
// "execute_time": 3, #执行时间
|
|
|
// "execute_memory": 300, #消耗内存
|
|
|
// "expected_output": "7" # 如果提交模式 会多这个参数
|
|
|
(function (ExecuteStatus) {
|
|
|
ExecuteStatus[ExecuteStatus["NOMATCH"] = -1] = "NOMATCH";
|
|
|
ExecuteStatus[ExecuteStatus["OK"] = 0] = "OK";
|
|
|
ExecuteStatus[ExecuteStatus["TIMEOUT"] = 2] = "TIMEOUT";
|
|
|
ExecuteStatus[ExecuteStatus["PODFAILURE"] = 3] = "PODFAILURE";
|
|
|
ExecuteStatus[ExecuteStatus["COMPILEFAILURE"] = 4] = "COMPILEFAILURE";
|
|
|
ExecuteStatus[ExecuteStatus["EXECUTEFAILURE"] = 5] = "EXECUTEFAILURE";
|
|
|
})(ExecuteStatus || (ExecuteStatus = {}));
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 30029:
|
|
|
/*!*************************************************!*\
|
|
|
!*** ./src/pages/Question/OjProblem/service.ts ***!
|
|
|
\*************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ "H7": function() { return /* binding */ resetCode; },
|
|
|
/* harmony export */ "KC": function() { return /* binding */ practicesList; },
|
|
|
/* harmony export */ "M3": function() { return /* binding */ editArticlesDetails; },
|
|
|
/* harmony export */ "MK": function() { return /* binding */ addNotes; },
|
|
|
/* harmony export */ "MU": function() { return /* binding */ debugCode; },
|
|
|
/* harmony export */ "Rg": function() { return /* binding */ articlesAssist; },
|
|
|
/* harmony export */ "WH": function() { return /* binding */ articlesList; },
|
|
|
/* harmony export */ "X6": function() { return /* binding */ getRecordDetail; },
|
|
|
/* harmony export */ "bM": function() { return /* binding */ sumbitCode; },
|
|
|
/* harmony export */ "bx": function() { return /* binding */ addArticles; },
|
|
|
/* harmony export */ "dd": function() { return /* binding */ updateLanguageCode; },
|
|
|
/* harmony export */ "de": function() { return /* binding */ deleteArticles; },
|
|
|
/* harmony export */ "fi": function() { return /* binding */ syncCode; },
|
|
|
/* harmony export */ "fu": function() { return /* binding */ getProgrammingTopic; },
|
|
|
/* harmony export */ "gu": function() { return /* binding */ editArticles; },
|
|
|
/* harmony export */ "n4": function() { return /* binding */ updateCode; },
|
|
|
/* harmony export */ "qe": function() { return /* binding */ articlesStatus; },
|
|
|
/* harmony export */ "rL": function() { return /* binding */ articlesHide; },
|
|
|
/* harmony export */ "rX": function() { return /* binding */ getOperationResult; },
|
|
|
/* harmony export */ "uc": function() { return /* binding */ setLogTime; },
|
|
|
/* harmony export */ "vl": function() { return /* binding */ triggerPlus; },
|
|
|
/* harmony export */ "wO": function() { return /* binding */ articlesDetails; },
|
|
|
/* harmony export */ "zO": function() { return /* binding */ getSubmitRecords; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _utils_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/utils/fetch */ 84519);
|
|
|
|
|
|
function getProgrammingTopic(id) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .get */ .U2)("mypractices/".concat(id, ".json"), {
|
|
|
hidePopLogin: true
|
|
|
});
|
|
|
}
|
|
|
function sumbitCode(id, params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)("mypractices/".concat(id, "/code_submit.json"), params);
|
|
|
}
|
|
|
function debugCode(id, params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)("mypractices/".concat(id, "/code_debug.json"), params);
|
|
|
}
|
|
|
function getSubmitRecords(id, params) {
|
|
|
if (params.language) {
|
|
|
params.language = encodeURIComponent(params.language);
|
|
|
}
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .get */ .U2)("mypractices/".concat(id, "/submit_records.json"), params);
|
|
|
}
|
|
|
function getRecordDetail(id) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .get */ .U2)("mypractices/record_detail.json", {
|
|
|
id: id
|
|
|
});
|
|
|
}
|
|
|
function getOperationResult(id, mode) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .get */ .U2)("mypractices/".concat(id, "/result.json"), {
|
|
|
mode: mode
|
|
|
});
|
|
|
}
|
|
|
function addNotes(id, params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)("mypractices/".concat(id, "/add_notes.json"), params);
|
|
|
}
|
|
|
function resetCode(id, params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)("mypractices/".concat(id, "/restore_initial_code.json"), params);
|
|
|
}
|
|
|
function syncCode(id, params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)("mypractices/".concat(id, "/sync_code.json"), params);
|
|
|
}
|
|
|
function updateCode(id, params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)("mypractices/".concat(id, "/update_code.json"), params);
|
|
|
}
|
|
|
function updateLanguageCode(id) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)("mypractices/".concat(id, "/initial_codes.json"));
|
|
|
}
|
|
|
function triggerPlus(id, params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)("discusses/".concat(id, "/plus.json"), params);
|
|
|
}
|
|
|
function practicesList(params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .get */ .U2)("practices/practices_list.json", params);
|
|
|
}
|
|
|
function articlesList(id, params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .get */ .U2)("practices/".concat(id, "/question_solution_articles"), params);
|
|
|
}
|
|
|
function addArticles(id, params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)("practices/".concat(id, "/question_solution_articles"), params);
|
|
|
}
|
|
|
function editArticles(id, params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .put */ .gz)("practices/".concat(id, "/question_solution_articles/").concat(params === null || params === void 0 ? void 0 : params.active), params);
|
|
|
}
|
|
|
function editArticlesDetails(id, params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .get */ .U2)("practices/".concat(id, "/question_solution_articles/").concat(params === null || params === void 0 ? void 0 : params.active, "/edit"), params);
|
|
|
}
|
|
|
function articlesDetails(id, params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .get */ .U2)("practices/".concat(id, "/question_solution_articles/").concat(params === null || params === void 0 ? void 0 : params.active), params);
|
|
|
}
|
|
|
function articlesStatus(id, params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)("practices/".concat(id, "/question_solution_articles/").concat(params === null || params === void 0 ? void 0 : params.active, "/set_authority_or_excellent"), params);
|
|
|
}
|
|
|
function articlesAssist(id, params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)("practices/".concat(id, "/question_solution_articles/").concat(params === null || params === void 0 ? void 0 : params.active, "/praise_or_treads"), params);
|
|
|
}
|
|
|
function articlesHide(id, params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)("practices/".concat(id, "/question_solution_articles/").concat(params === null || params === void 0 ? void 0 : params.active, "/hide"));
|
|
|
}
|
|
|
function deleteArticles(id, params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .del */ .IV)("practices/".concat(id, "/question_solution_articles/").concat(params === null || params === void 0 ? void 0 : params.active), params);
|
|
|
}
|
|
|
function setLogTime(id, params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)("mypractices/".concat(id, "/update_practice_time_sum"), params);
|
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 77320:
|
|
|
/*!***********************************!*\
|
|
|
!*** ./src/utils/aliyunUpload.ts ***!
|
|
|
\***********************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ "o": function() { return /* binding */ getUploader; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var _utils_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/utils/fetch */ 84519);
|
|
|
/* harmony import */ var aliyun_vod_upload_ll__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! aliyun-vod-upload-ll */ 69548);
|
|
|
/* harmony import */ var aliyun_vod_upload_ll__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(aliyun_vod_upload_ll__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
|
|
|
|
|
|
var login = '';
|
|
|
var uploader;
|
|
|
var virtual_classroom_id = '';
|
|
|
function createUploader(options) {
|
|
|
doCreateUploader(options);
|
|
|
}
|
|
|
function doCreateUploader(options) {
|
|
|
uploader = new (aliyun_vod_upload_ll__WEBPACK_IMPORTED_MODULE_1___default().Vod)({
|
|
|
timeout: 60000,
|
|
|
partSize: 1048576,
|
|
|
parallel: 5,
|
|
|
retryCount: 3,
|
|
|
retryDuration: 2,
|
|
|
region: 'ap-southeast-1',
|
|
|
userId: 1829848226361863,
|
|
|
enableUploadProgress: false,
|
|
|
addFileSuccess: function addFileSuccess(uploadInfo) {
|
|
|
console.log("addFileSuccess: " + uploadInfo.file.name);
|
|
|
options.addFileSuccess && options.addFileSuccess(uploadInfo);
|
|
|
uploader.startUpload();
|
|
|
},
|
|
|
// 开始上传
|
|
|
onUploadstarted: function onUploadstarted(uploadInfo) {
|
|
|
var fileName = uploadInfo.file.name;
|
|
|
if (!uploadInfo.videoId) {
|
|
|
var createUrl = "/api/users/".concat(login, "/video_auths.json");
|
|
|
var _random = ''; // Math.random().toString().substring(3, 6)+'-'
|
|
|
(0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .ZP)(createUrl, {
|
|
|
method: 'Post',
|
|
|
body: {
|
|
|
title: _random + fileName,
|
|
|
file_name: _random + fileName,
|
|
|
virtual_classroom_id: virtual_classroom_id
|
|
|
}
|
|
|
}).then(function (response) {
|
|
|
if (response) {
|
|
|
var data = response.data;
|
|
|
var uploadAuth = data.UploadAuth;
|
|
|
var uploadAddress = data.UploadAddress;
|
|
|
var videoId = data.VideoId;
|
|
|
uploader.setUploadAuthAndAddress(uploadInfo, uploadAuth, uploadAddress, videoId);
|
|
|
}
|
|
|
})["catch"](function (error) {
|
|
|
uploader.deleteFile(uploader._curIndex);
|
|
|
uploader.nextUpload();
|
|
|
console.log(error);
|
|
|
});
|
|
|
console.log('文件开始上传...');
|
|
|
} else {
|
|
|
// 如果videoId有值,根据videoId刷新上传凭证
|
|
|
var refreshUrl = "/api/users/".concat(login, "/video_auths.json");
|
|
|
(0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .ZP)(refreshUrl, {
|
|
|
method: 'put',
|
|
|
body: {
|
|
|
video_id: uploadInfo.videoId,
|
|
|
title: fileName,
|
|
|
file_name: fileName,
|
|
|
virtual_classroom_id: virtual_classroom_id
|
|
|
}
|
|
|
}).then(function (response) {
|
|
|
if (response.status == -1) {
|
|
|
options.onUploadError && options.onUploadError(uploadInfo);
|
|
|
return;
|
|
|
}
|
|
|
var data = response.data;
|
|
|
var uploadAuth = data.UploadAuth;
|
|
|
var uploadAddress = data.UploadAddress;
|
|
|
var videoId = data.VideoId;
|
|
|
uploader.setUploadAuthAndAddress(uploadInfo, uploadAuth, uploadAddress);
|
|
|
})["catch"](function (error) {
|
|
|
uploader.deleteFile(uploader._curIndex);
|
|
|
uploader.nextUpload();
|
|
|
console.log(error);
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
// 文件上传成功
|
|
|
onUploadSucceed: function onUploadSucceed(uploadInfo) {
|
|
|
options.onUploadSucceed && options.onUploadSucceed(uploadInfo);
|
|
|
console.log('文件上传成功!');
|
|
|
},
|
|
|
// 文件上传失败
|
|
|
onUploadFailed: function onUploadFailed(uploadInfo, code, message) {
|
|
|
options.onUploadFailed && options.onUploadFailed(uploadInfo);
|
|
|
console.log('文件上传失败!');
|
|
|
},
|
|
|
// 取消文件上传
|
|
|
onUploadCanceled: function onUploadCanceled(uploadInfo, code, message) {
|
|
|
console.log('文件上传已暂停!');
|
|
|
},
|
|
|
// 文件上传进度,单位:字节, 可以在这个函数中拿到上传进度并显示在页面上
|
|
|
onUploadProgress: function onUploadProgress(uploadInfo, totalSize, progress) {
|
|
|
options.onUploadProgress && options.onUploadProgress(uploadInfo, totalSize, progress);
|
|
|
var progressPercent = Math.ceil(progress * 100);
|
|
|
console.log('文件上传中...');
|
|
|
},
|
|
|
// 上传凭证超时
|
|
|
onUploadTokenExpired: function onUploadTokenExpired(uploadInfo) {
|
|
|
console.log('文件上传超时!');
|
|
|
var refreshUrl = "/api/users/".concat(login, "/video_auths.json");
|
|
|
(0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .ZP)(refreshUrl, {
|
|
|
method: 'put',
|
|
|
body: {
|
|
|
video_id: uploadInfo.videoId
|
|
|
}
|
|
|
}).then(function (response) {
|
|
|
var data = response.data;
|
|
|
var uploadAuth = data.UploadAuth;
|
|
|
uploader.resumeUploadWithAuth(uploadAuth);
|
|
|
})["catch"](function (error) {
|
|
|
console.log(error);
|
|
|
});
|
|
|
},
|
|
|
// 全部文件上传结束
|
|
|
onUploadEnd: function onUploadEnd(uploadInfo) {
|
|
|
options.onUploadEnd && options.onUploadEnd(uploadInfo);
|
|
|
console.log("onUploadEnd: uploaded all the files");
|
|
|
}
|
|
|
});
|
|
|
if (options.gotUploader) {
|
|
|
options.gotUploader(uploader);
|
|
|
}
|
|
|
}
|
|
|
function getUploader(_login, _virtual_classroom_id, options) {
|
|
|
_login && (login = _login);
|
|
|
_virtual_classroom_id && (virtual_classroom_id = _virtual_classroom_id);
|
|
|
// if (!uploader || options.create == true) {
|
|
|
createUploader(options);
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 15994:
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/utils/fullscreen.ts ***!
|
|
|
\*********************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ "BU": function() { return /* binding */ exitFull; },
|
|
|
/* harmony export */ "Dj": function() { return /* binding */ requestFullScreen; },
|
|
|
/* harmony export */ "gH": function() { return /* binding */ fullscreenChange; },
|
|
|
/* harmony export */ "vp": function() { return /* binding */ IsFull; }
|
|
|
/* harmony export */ });
|
|
|
function requestFullScreen(element) {
|
|
|
try {
|
|
|
if (element.mozRequestFullScreen) {
|
|
|
element.mozRequestFullScreen();
|
|
|
} else if (element.webkitRequestFullScreen) {
|
|
|
element.webkitRequestFullScreen();
|
|
|
}
|
|
|
} catch (e) {
|
|
|
console.log(e, ":e");
|
|
|
}
|
|
|
}
|
|
|
function exitFull() {
|
|
|
if (window.top.document.webkitExitFullscreen) {
|
|
|
window.top.document.webkitExitFullscreen();
|
|
|
} else if (document.exitFullscreen) {
|
|
|
window.top.document.exitFullscreen();
|
|
|
} else if (document.msExitFullscreen) {
|
|
|
window.top.document.msExitFullscreen();
|
|
|
} else if (document.mozCancelFullScreen) {
|
|
|
window.top.document.mozCancelFullScreen();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// esliint disabled
|
|
|
var fullscreenChange = function fullscreenChange() {
|
|
|
//['fullscreenchange','msfullscreenchange','webkitfullscreenchange', 'mozfullscreenchange']
|
|
|
if (document.webkitExitFullscreen) {
|
|
|
// document.webkitExitFullscreen()
|
|
|
return 'webkitfullscreenchange';
|
|
|
} else if (document.exitFullscreen) {
|
|
|
// document.exitFullscreen()
|
|
|
return 'fullscreenchange';
|
|
|
} else if (document.msExitFullscreen) {
|
|
|
// document.msExitFullscreen()
|
|
|
return 'msfullscreenchange';
|
|
|
} else if (document.mozCancelFullScreen) {
|
|
|
// document.mozCancelFullScreen()
|
|
|
return 'mozfullscreenchange';
|
|
|
}
|
|
|
};
|
|
|
|
|
|
//判断是否全屏
|
|
|
function IsFull() {
|
|
|
var fullscreenElement = window.top.document.fullscreenElement || window.top.document.mozFullscreenElement || window.top.document.webkitFullscreenElement;
|
|
|
var fullscreenEnabled = document.fullscreenEnabled || document.mozFullscreenEnabled || document.webkitFullscreenEnabled;
|
|
|
console.log("fullscreenElement", fullscreenElement);
|
|
|
if (fullscreenElement == null) {
|
|
|
return false;
|
|
|
} else {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// document.addEventListener("mozfullscreenchange", function (event) {
|
|
|
// console.log("mozfullscreenchange ", event);
|
|
|
// if (IsFull()) {
|
|
|
// console.log('进入全屏')
|
|
|
// $("#closescreen").show();
|
|
|
// $("#openscreen").hide();
|
|
|
// } else {
|
|
|
// console.log('退出全屏')
|
|
|
// $("#closescreen").hide();
|
|
|
// $("#openscreen").show();
|
|
|
// }
|
|
|
// });
|
|
|
// document.addEventListener("webkitfullscreenchange", function (event) {
|
|
|
// console.log("webkitfullscreenchange", event);
|
|
|
// if (IsFull()) {
|
|
|
// console.log('进入全屏')
|
|
|
// $("#closescreen").show();
|
|
|
// $("#openscreen").hide();
|
|
|
// } else {
|
|
|
// console.log('退出全屏')
|
|
|
// $("#closescreen").hide();
|
|
|
// $("#openscreen").show();
|
|
|
// }
|
|
|
// });
|
|
|
// document.addEventListener("msfullscreenchange", function (event) {
|
|
|
// console.log("msfullscreenchange", event);
|
|
|
// if (IsFull()) {
|
|
|
// console.log('进入全屏')
|
|
|
// $("#closescreen").show();
|
|
|
// $("#openscreen").hide();
|
|
|
// } else {
|
|
|
// console.log('退出全屏')
|
|
|
// $("#closescreen").hide();
|
|
|
// $("#openscreen").show();
|
|
|
// }
|
|
|
// });
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
}]); |