|
|
|
|
@ -1,9 +1,338 @@
|
|
|
|
|
"use strict";
|
|
|
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[74705],{
|
|
|
|
|
|
|
|
|
|
/***/ 11294:
|
|
|
|
|
/***/ 47966:
|
|
|
|
|
/*!********************************************************************************************************!*\
|
|
|
|
|
!*** ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/DeleteOutlined.js + 1 modules ***!
|
|
|
|
|
\********************************************************************************************************/
|
|
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
|
|
Z: function() { return /* binding */ icons_DeleteOutlined; }
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/esm/extends.js
|
|
|
|
|
var esm_extends = __webpack_require__(38329);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.3.1@@ant-design/icons-svg/es/asn/DeleteOutlined.js
|
|
|
|
|
// This icon file is generated automatically.
|
|
|
|
|
var DeleteOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z" } }] }, "name": "delete", "theme": "outlined" };
|
|
|
|
|
/* harmony default export */ var asn_DeleteOutlined = (DeleteOutlined);
|
|
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/components/AntdIcon.js + 3 modules
|
|
|
|
|
var AntdIcon = __webpack_require__(91851);
|
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/DeleteOutlined.js
|
|
|
|
|
|
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
|
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var DeleteOutlined_DeleteOutlined = function DeleteOutlined(props, ref) {
|
|
|
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
|
|
|
|
|
ref: ref,
|
|
|
|
|
icon: asn_DeleteOutlined
|
|
|
|
|
}));
|
|
|
|
|
};
|
|
|
|
|
if (false) {}
|
|
|
|
|
/* harmony default export */ var icons_DeleteOutlined = (/*#__PURE__*/_react_17_0_2_react.forwardRef(DeleteOutlined_DeleteOutlined));
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 25637:
|
|
|
|
|
/*!*********************************************!*\
|
|
|
|
|
!*** ./src/components/WangEditor/index.tsx ***!
|
|
|
|
|
\*********************************************/
|
|
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
|
|
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js */ 10574);
|
|
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js */ 39343);
|
|
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js */ 11006);
|
|
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ 59301);
|
|
|
|
|
/* harmony import */ var _wangeditor_editor_for_react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wangeditor/editor-for-react */ 84686);
|
|
|
|
|
/* harmony import */ var _utils_fetch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/utils/fetch */ 15830);
|
|
|
|
|
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! umi */ 22211);
|
|
|
|
|
/* harmony import */ var _wangeditor_editor_dist_css_style_css__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wangeditor/editor/dist/css/style.css */ 72690);
|
|
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 引入 css
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var MyEditor = function MyEditor(_ref) {
|
|
|
|
|
var defaultvalue = _ref.defaultvalue,
|
|
|
|
|
onChange = _ref.onChange,
|
|
|
|
|
style = _ref.style,
|
|
|
|
|
user = _ref.user,
|
|
|
|
|
placeholder = _ref.placeholder;
|
|
|
|
|
//设置分片大小
|
|
|
|
|
var chunkSize = 1024 * 1024 * 2; // 2MB
|
|
|
|
|
var abortControllerRef = (0,react__WEBPACK_IMPORTED_MODULE_4__.useRef)(null);
|
|
|
|
|
var concurrency = 4;
|
|
|
|
|
// editor 实例
|
|
|
|
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_4__.useState)(null),
|
|
|
|
|
_useState2 = _root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState, 2),
|
|
|
|
|
editor = _useState2[0],
|
|
|
|
|
setEditor = _useState2[1]; // TS 语法
|
|
|
|
|
// const [editor, setEditor] = useState(null) // JS 语法
|
|
|
|
|
|
|
|
|
|
// 编辑器内容
|
|
|
|
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_4__.useState)(''),
|
|
|
|
|
_useState4 = _root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState3, 2),
|
|
|
|
|
html = _useState4[0],
|
|
|
|
|
setHtml = _useState4[1];
|
|
|
|
|
|
|
|
|
|
// 模拟 ajax 请求,异步设置 html
|
|
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_4__.useEffect)(function () {
|
|
|
|
|
setHtml(defaultvalue);
|
|
|
|
|
}, [defaultvalue]);
|
|
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_4__.useEffect)(function () {
|
|
|
|
|
onChange(html);
|
|
|
|
|
}, [html]);
|
|
|
|
|
|
|
|
|
|
// 工具栏配置
|
|
|
|
|
var toolbarConfig = {}; // TS 语法
|
|
|
|
|
// const toolbarConfig = { } // JS 语法
|
|
|
|
|
|
|
|
|
|
// 编辑器配置
|
|
|
|
|
var editorConfig = {
|
|
|
|
|
// TS 语法
|
|
|
|
|
// const editorConfig = { // JS 语法
|
|
|
|
|
placeholder: placeholder || '请输入内容...',
|
|
|
|
|
MENU_CONF: {}
|
|
|
|
|
};
|
|
|
|
|
editorConfig.MENU_CONF['uploadImage'] = {
|
|
|
|
|
customUpload: function customUpload(file, insertFn) {
|
|
|
|
|
return _root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee() {
|
|
|
|
|
var formData, res;
|
|
|
|
|
return _root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee$(_context) {
|
|
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
// TS 语法
|
|
|
|
|
// async customUpload(file, insertFn) { // JS 语法
|
|
|
|
|
// file 即选中的文件
|
|
|
|
|
// 自己实现上传,并得到图片 url alt href
|
|
|
|
|
// 最后插入图片
|
|
|
|
|
// insertFn(url, alt, href)
|
|
|
|
|
formData = new FormData();
|
|
|
|
|
formData.append('file', file);
|
|
|
|
|
_context.next = 4;
|
|
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .ZP)("/api/attachments.json", {
|
|
|
|
|
method: 'post',
|
|
|
|
|
body: formData
|
|
|
|
|
}, true);
|
|
|
|
|
case 4:
|
|
|
|
|
res = _context.sent;
|
|
|
|
|
insertFn(res === null || res === void 0 ? void 0 : res.url, '', '');
|
|
|
|
|
case 6:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context.stop();
|
|
|
|
|
}
|
|
|
|
|
}, _callee);
|
|
|
|
|
}))();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
editorConfig.MENU_CONF['uploadVideo'] = {
|
|
|
|
|
// 上传视频的配置
|
|
|
|
|
customUpload: function customUpload(file, insertFn) {
|
|
|
|
|
return _root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee2() {
|
|
|
|
|
var fileSize, totalChunks, _user$userInfo, _user$userInfo2, res, uploadId, promises, percent, _loop, i, completed, step, _promises$slice, subTasks, p, uploadRes;
|
|
|
|
|
return _root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee2$(_context3) {
|
|
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
// TS 语法
|
|
|
|
|
// async customUpload(file, insertFn) { // JS 语法
|
|
|
|
|
// file 即选中的文件
|
|
|
|
|
// 自己实现上传,并得到视频 url poster
|
|
|
|
|
fileSize = file.size;
|
|
|
|
|
totalChunks = Math.ceil(fileSize / chunkSize);
|
|
|
|
|
_context3.prev = 2;
|
|
|
|
|
_context3.next = 5;
|
|
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .ZP)("/api/attachments/multipart_upload_start", {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
body: {
|
|
|
|
|
fileName: file.name,
|
|
|
|
|
chunkCount: totalChunks,
|
|
|
|
|
user_id: user === null || user === void 0 || (_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.user_id
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
case 5:
|
|
|
|
|
res = _context3.sent;
|
|
|
|
|
if (!((res === null || res === void 0 ? void 0 : res.status) !== 0)) {
|
|
|
|
|
_context3.next = 8;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
throw new Error();
|
|
|
|
|
case 8:
|
|
|
|
|
uploadId = res.upload_id;
|
|
|
|
|
abortControllerRef.current = new AbortController();
|
|
|
|
|
promises = [];
|
|
|
|
|
percent = 0;
|
|
|
|
|
_loop = /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _loop() {
|
|
|
|
|
var start, end, chunk, formData;
|
|
|
|
|
return _root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _loop$(_context2) {
|
|
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
start = i * chunkSize;
|
|
|
|
|
end = Math.min(start + chunkSize, fileSize);
|
|
|
|
|
chunk = file.slice(start, end);
|
|
|
|
|
formData = new FormData();
|
|
|
|
|
formData.append('chunk', chunk);
|
|
|
|
|
formData.append('fileName', file.name);
|
|
|
|
|
formData.append('chunkIndex', (i + 1).toString());
|
|
|
|
|
formData.append('uploadId', uploadId);
|
|
|
|
|
|
|
|
|
|
// for (const key in options) {
|
|
|
|
|
// if (Object.prototype.hasOwnProperty.call(options, key)) {
|
|
|
|
|
// formData.append(key, options[key]);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
promises.push(function () {
|
|
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .ZP)("/api/attachments/multipart_upload", {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
body: formData,
|
|
|
|
|
signal: abortControllerRef.current.signal
|
|
|
|
|
}, true).then(function (res) {});
|
|
|
|
|
});
|
|
|
|
|
case 9:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context2.stop();
|
|
|
|
|
}
|
|
|
|
|
}, _loop);
|
|
|
|
|
});
|
|
|
|
|
i = 0;
|
|
|
|
|
case 14:
|
|
|
|
|
if (!(i < totalChunks)) {
|
|
|
|
|
_context3.next = 19;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return _context3.delegateYield(_loop(), "t0", 16);
|
|
|
|
|
case 16:
|
|
|
|
|
i++;
|
|
|
|
|
_context3.next = 14;
|
|
|
|
|
break;
|
|
|
|
|
case 19:
|
|
|
|
|
completed = 0;
|
|
|
|
|
step = concurrency;
|
|
|
|
|
console.log(promises, 'promises');
|
|
|
|
|
case 22:
|
|
|
|
|
if (!(completed < promises.length)) {
|
|
|
|
|
_context3.next = 31;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
subTasks = (_promises$slice = promises.slice(completed, completed + step)) === null || _promises$slice === void 0 ? void 0 : _promises$slice.map(function (t) {
|
|
|
|
|
return t();
|
|
|
|
|
});
|
|
|
|
|
if (!(subTasks.length > 0)) {
|
|
|
|
|
_context3.next = 29;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
_context3.next = 27;
|
|
|
|
|
return Promise.all(subTasks);
|
|
|
|
|
case 27:
|
|
|
|
|
p = _context3.sent;
|
|
|
|
|
completed += step;
|
|
|
|
|
case 29:
|
|
|
|
|
_context3.next = 22;
|
|
|
|
|
break;
|
|
|
|
|
case 31:
|
|
|
|
|
_context3.next = 33;
|
|
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .ZP)("/api/attachments/multipart_upload_end", {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
body: {
|
|
|
|
|
fileName: file.name,
|
|
|
|
|
chunkCount: totalChunks,
|
|
|
|
|
uploadId: uploadId,
|
|
|
|
|
user_id: user === null || user === void 0 || (_user$userInfo2 = user.userInfo) === null || _user$userInfo2 === void 0 ? void 0 : _user$userInfo2.user_id
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
case 33:
|
|
|
|
|
uploadRes = _context3.sent;
|
|
|
|
|
// 最后插入视频 参数1 视频地址 参数2 封面地址 选填
|
|
|
|
|
// debugger
|
|
|
|
|
insertFn(uploadRes === null || uploadRes === void 0 ? void 0 : uploadRes.object, '');
|
|
|
|
|
_context3.next = 39;
|
|
|
|
|
break;
|
|
|
|
|
case 37:
|
|
|
|
|
_context3.prev = 37;
|
|
|
|
|
_context3.t1 = _context3["catch"](2);
|
|
|
|
|
case 39:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context3.stop();
|
|
|
|
|
}
|
|
|
|
|
}, _callee2, null, [[2, 37]]);
|
|
|
|
|
}))();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 及时销毁 editor ,重要!
|
|
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_4__.useEffect)(function () {
|
|
|
|
|
return function () {
|
|
|
|
|
if (editor == null) return;
|
|
|
|
|
editor.destroy();
|
|
|
|
|
setEditor(null);
|
|
|
|
|
};
|
|
|
|
|
}, [editor]);
|
|
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.Fragment, {
|
|
|
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("div", {
|
|
|
|
|
style: {
|
|
|
|
|
border: '1px solid #ccc',
|
|
|
|
|
zIndex: 100
|
|
|
|
|
},
|
|
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_wangeditor_editor_for_react__WEBPACK_IMPORTED_MODULE_5__/* .Toolbar */ .o, {
|
|
|
|
|
editor: editor,
|
|
|
|
|
defaultConfig: toolbarConfig,
|
|
|
|
|
mode: "default",
|
|
|
|
|
style: {
|
|
|
|
|
borderBottom: '1px solid #ccc'
|
|
|
|
|
}
|
|
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_wangeditor_editor_for_react__WEBPACK_IMPORTED_MODULE_5__/* .Editor */ .M, {
|
|
|
|
|
defaultConfig: editorConfig,
|
|
|
|
|
value: html,
|
|
|
|
|
onCreated: setEditor,
|
|
|
|
|
onChange: function onChange(editor) {
|
|
|
|
|
return setHtml(editor.getHtml());
|
|
|
|
|
},
|
|
|
|
|
mode: "default",
|
|
|
|
|
style: _root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({
|
|
|
|
|
height: '500px',
|
|
|
|
|
overflowY: 'hidden'
|
|
|
|
|
}, style)
|
|
|
|
|
})]
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
/* harmony default export */ __webpack_exports__.Z = ((0,umi__WEBPACK_IMPORTED_MODULE_7__.connect)(function (_ref2) {
|
|
|
|
|
var user = _ref2.user;
|
|
|
|
|
return {
|
|
|
|
|
user: user
|
|
|
|
|
};
|
|
|
|
|
})(MyEditor));
|
|
|
|
|
|
|
|
|
|
// export default MyEditor
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 41558:
|
|
|
|
|
/*!**********************************************************************!*\
|
|
|
|
|
!*** ./src/pages/CoreCurriculum/Lists/Answers/index.tsx + 1 modules ***!
|
|
|
|
|
!*** ./src/pages/CoreCurriculum/Lists/Answers/index.tsx + 4 modules ***!
|
|
|
|
|
\**********************************************************************/
|
|
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
@ -15,41 +344,634 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
|
|
"default": function() { return /* binding */ Answers; }
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectDestructuringEmpty.js
|
|
|
|
|
var objectDestructuringEmpty = __webpack_require__(27223);
|
|
|
|
|
var objectDestructuringEmpty_default = /*#__PURE__*/__webpack_require__.n(objectDestructuringEmpty);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectWithoutProperties.js
|
|
|
|
|
var objectWithoutProperties = __webpack_require__(27161);
|
|
|
|
|
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
|
|
|
|
|
var _umi_production_exports = __webpack_require__(22211);
|
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/CoreCurriculum/Lists/Answers/imgs/ans.png
|
|
|
|
|
var ans_namespaceObject = __webpack_require__.p + "static/ans.9ad1f55a.png";
|
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/CoreCurriculum/Lists/Answers/index.less?modules
|
|
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
/* harmony default export */ var Answersmodules = ({"wrap":"wrap___T7XIB"});
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js
|
|
|
|
|
var regeneratorRuntime = __webpack_require__(10574);
|
|
|
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/toConsumableArray.js
|
|
|
|
|
var toConsumableArray = __webpack_require__(93923);
|
|
|
|
|
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js
|
|
|
|
|
var objectSpread2 = __webpack_require__(26801);
|
|
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js
|
|
|
|
|
var asyncToGenerator = __webpack_require__(39343);
|
|
|
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js
|
|
|
|
|
var slicedToArray = __webpack_require__(11006);
|
|
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
|
|
|
var env = __webpack_require__(67871);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_dayjs@1.11.10@dayjs/dayjs.min.js
|
|
|
|
|
var dayjs_min = __webpack_require__(9498);
|
|
|
|
|
var dayjs_min_default = /*#__PURE__*/__webpack_require__.n(dayjs_min);
|
|
|
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules
|
|
|
|
|
var RenderHtml = __webpack_require__(80416);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/row/index.js
|
|
|
|
|
var row = __webpack_require__(95237);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/col/index.js
|
|
|
|
|
var col = __webpack_require__(43604);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
|
|
|
var es_button = __webpack_require__(3113);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
|
|
|
|
|
var message = __webpack_require__(8591);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tooltip/index.js + 3 modules
|
|
|
|
|
var tooltip = __webpack_require__(6848);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
|
|
|
|
|
var modal = __webpack_require__(43418);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/DeleteOutlined.js + 1 modules
|
|
|
|
|
var DeleteOutlined = __webpack_require__(47966);
|
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/CoreCurriculum/Lists/Answers/Comment/index.less?modules
|
|
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
/* harmony default export */ var Commentmodules = ({"flex_box_center":"flex_box_center___fuHBt","flex_space_between":"flex_space_between___Xnp2O","flex_box_vertical_center":"flex_box_vertical_center___q5rSX","flex_box_center_end":"flex_box_center_end___RExAW","flex_box_column":"flex_box_column___tHC2J","reply":"reply___gfg_l","comment":"comment___az8EE","content":"content___LmvLM","commentItem":"commentItem___YoLrh"});
|
|
|
|
|
// EXTERNAL MODULE: ./src/service/forums.ts
|
|
|
|
|
var forums = __webpack_require__(10909);
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/CoreCurriculum/Lists/Answers/Comment/components/Second.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dayjs_min_default().locale("ZH-cn");
|
|
|
|
|
function second(_ref) {
|
|
|
|
|
var user = _ref.user,
|
|
|
|
|
_ref$vlist = _ref.vlist,
|
|
|
|
|
vlist = _ref$vlist === void 0 ? [] : _ref$vlist,
|
|
|
|
|
dispatch = _ref.dispatch,
|
|
|
|
|
params = _ref.params,
|
|
|
|
|
id = _ref.id,
|
|
|
|
|
memo_replies = _ref.memo_replies,
|
|
|
|
|
forumsDetail = _ref.forumsDetail;
|
|
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
|
|
|
className: Commentmodules.comment,
|
|
|
|
|
children: vlist.map(function (val, key) {
|
|
|
|
|
var _user$userInfo, _user$userInfo2;
|
|
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
|
|
className: Commentmodules.commentItem,
|
|
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
|
|
span: 24,
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
|
|
flex: "1",
|
|
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
|
|
href: "/users/".concat(val.user_login),
|
|
|
|
|
target: "_blank",
|
|
|
|
|
className: "c-light-black",
|
|
|
|
|
children: val === null || val === void 0 ? void 0 : val.username
|
|
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
|
|
className: "c-light-black ml10",
|
|
|
|
|
children: val.time
|
|
|
|
|
})]
|
|
|
|
|
}), (val.can_delete || val.user_id === ((_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.user_id) || val.user_login === ((_user$userInfo2 = user.userInfo) === null || _user$userInfo2 === void 0 ? void 0 : _user$userInfo2.login)) && /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
|
|
className: "forums-comment-delete",
|
|
|
|
|
style: {
|
|
|
|
|
display: 'none'
|
|
|
|
|
},
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
|
|
title: "\u5220\u9664",
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(DeleteOutlined/* default */.Z, {
|
|
|
|
|
className: "current",
|
|
|
|
|
onClick: function onClick() {
|
|
|
|
|
modal/* default */.Z.confirm({
|
|
|
|
|
centered: true,
|
|
|
|
|
width: 530,
|
|
|
|
|
okText: '确定',
|
|
|
|
|
cancelText: '取消',
|
|
|
|
|
title: '提示',
|
|
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
|
|
className: "font16 tc",
|
|
|
|
|
children: "\u786E\u5B9A\u8981\u5220\u9664\u8BE5\u6761\u56DE\u590D\u5417\uFF1F"
|
|
|
|
|
}),
|
|
|
|
|
onOk: function () {
|
|
|
|
|
var _onOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
|
|
var res, filterData;
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
_context.next = 2;
|
|
|
|
|
return (0,forums/* deleteForums */.sW)({
|
|
|
|
|
id: val.id
|
|
|
|
|
});
|
|
|
|
|
case 2:
|
|
|
|
|
res = _context.sent;
|
|
|
|
|
filterData = memo_replies.find(function (x) {
|
|
|
|
|
return x.id === id;
|
|
|
|
|
}).children.filter(function (y) {
|
|
|
|
|
return y.id !== val.id;
|
|
|
|
|
});
|
|
|
|
|
memo_replies.find(function (x) {
|
|
|
|
|
return x.id === id;
|
|
|
|
|
}).children = filterData;
|
|
|
|
|
dispatch({
|
|
|
|
|
type: 'forumsDetail/setForumsDetailData',
|
|
|
|
|
payload: objectSpread2_default()(objectSpread2_default()({}, forumsDetail.forumsDetailData), {}, {
|
|
|
|
|
memo_replies: toConsumableArray_default()(memo_replies)
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
case 6:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context.stop();
|
|
|
|
|
}
|
|
|
|
|
}, _callee);
|
|
|
|
|
}));
|
|
|
|
|
function onOk() {
|
|
|
|
|
return _onOk.apply(this, arguments);
|
|
|
|
|
}
|
|
|
|
|
return onOk;
|
|
|
|
|
}()
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})]
|
|
|
|
|
})
|
|
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
|
|
value: val.content
|
|
|
|
|
})
|
|
|
|
|
})]
|
|
|
|
|
}, key);
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
/* harmony default export */ var Second = (second);
|
|
|
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
|
|
|
var util = __webpack_require__(85578);
|
|
|
|
|
// EXTERNAL MODULE: ./src/components/WangEditor/index.tsx
|
|
|
|
|
var WangEditor = __webpack_require__(25637);
|
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/CoreCurriculum/Lists/Answers/Comment/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["user", "forumsDetail", "globalSetting", "loading", "dispatch", "handleClick"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dayjs_min_default().locale("ZH-cn");
|
|
|
|
|
var Comment = function Comment(_ref, ref) {
|
|
|
|
|
var user = _ref.user,
|
|
|
|
|
forumsDetail = _ref.forumsDetail,
|
|
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
|
|
loading = _ref.loading,
|
|
|
|
|
dispatch = _ref.dispatch,
|
|
|
|
|
handleClick = _ref.handleClick,
|
|
|
|
|
props = objectWithoutProperties_default()(_ref, _excluded);
|
|
|
|
|
var _ref2 = forumsDetail.forumsDetailData || {},
|
|
|
|
|
memo = _ref2.memo,
|
|
|
|
|
memo_replies = _ref2.memo_replies;
|
|
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(''),
|
|
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
|
|
value = _useState2[0],
|
|
|
|
|
setValue = _useState2[1];
|
|
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(''),
|
|
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
|
|
childValue = _useState4[0],
|
|
|
|
|
setChildValue = _useState4[1];
|
|
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(-1),
|
|
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
|
|
showItemReply = _useState6[0],
|
|
|
|
|
setShowItemReply = _useState6[1];
|
|
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)(false),
|
|
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
|
|
hasMore = _useState8[0],
|
|
|
|
|
setHasMore = _useState8[1];
|
|
|
|
|
var _useState9 = (0,_react_17_0_2_react.useState)(1),
|
|
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
|
|
page = _useState10[0],
|
|
|
|
|
setPage = _useState10[1];
|
|
|
|
|
var _useState11 = (0,_react_17_0_2_react.useState)(false),
|
|
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
|
|
isMdFouch = _useState12[0],
|
|
|
|
|
setIsMdFouch = _useState12[1];
|
|
|
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, function () {
|
|
|
|
|
return {
|
|
|
|
|
onMdFouch: handleMdFouch
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
|
|
setHasMore((memo === null || memo === void 0 ? void 0 : memo.replies_count) > 10);
|
|
|
|
|
}, [memo === null || memo === void 0 ? void 0 : memo.replies_count]);
|
|
|
|
|
var handeGetMoreData = /*#__PURE__*/function () {
|
|
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
|
|
var currentPage, res, _res$memo_replies;
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
currentPage = page + 1;
|
|
|
|
|
setPage(currentPage);
|
|
|
|
|
_context.next = 4;
|
|
|
|
|
return (0,forums/* getMoreReply */.z5)({
|
|
|
|
|
id: params.memoId,
|
|
|
|
|
page: currentPage
|
|
|
|
|
});
|
|
|
|
|
case 4:
|
|
|
|
|
res = _context.sent;
|
|
|
|
|
if (res !== null && res !== void 0 && res.memo_replies) {
|
|
|
|
|
dispatch({
|
|
|
|
|
type: 'forumsDetail/setForumsDetailData',
|
|
|
|
|
payload: objectSpread2_default()(objectSpread2_default()({}, forumsDetail.forumsDetailData), {}, {
|
|
|
|
|
memo_replies: [].concat(toConsumableArray_default()(memo_replies), toConsumableArray_default()(res.memo_replies))
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
setHasMore(((_res$memo_replies = res.memo_replies) === null || _res$memo_replies === void 0 ? void 0 : _res$memo_replies.length) === 10);
|
|
|
|
|
}
|
|
|
|
|
case 6:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context.stop();
|
|
|
|
|
}
|
|
|
|
|
}, _callee);
|
|
|
|
|
}));
|
|
|
|
|
return function handeGetMoreData() {
|
|
|
|
|
return _ref3.apply(this, arguments);
|
|
|
|
|
};
|
|
|
|
|
}();
|
|
|
|
|
var formatReplieData = function formatReplieData(data) {
|
|
|
|
|
var _user$userInfo, _user$userInfo2, _user$userInfo3, _user$userInfo4;
|
|
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, data), {}, {
|
|
|
|
|
image_url: (_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.image_url,
|
|
|
|
|
children: [],
|
|
|
|
|
user_id: (_user$userInfo2 = user.userInfo) === null || _user$userInfo2 === void 0 ? void 0 : _user$userInfo2.user_id,
|
|
|
|
|
user_login: (_user$userInfo3 = user.userInfo) === null || _user$userInfo3 === void 0 ? void 0 : _user$userInfo3.login,
|
|
|
|
|
username: (_user$userInfo4 = user.userInfo) === null || _user$userInfo4 === void 0 ? void 0 : _user$userInfo4.username,
|
|
|
|
|
time: "".concat((0,util/* toTimeFormat */.li)((new Date().getTime() - new Date(data.created_at).getTime()) / 1000), "\u524D")
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
var handleMdFouch = function handleMdFouch() {
|
|
|
|
|
setIsMdFouch(true);
|
|
|
|
|
};
|
|
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
|
|
className: Commentmodules.wrap,
|
|
|
|
|
children: [!!(memo_replies !== null && memo_replies !== void 0 && memo_replies.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
|
|
className: Commentmodules.content,
|
|
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
|
|
style: {
|
|
|
|
|
padding: '10px 15px 5px 15px',
|
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
|
display: 'flex'
|
|
|
|
|
},
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
|
|
children: ["\u5168\u90E8\u56DE\u590D\uFF08", memo === null || memo === void 0 ? void 0 : memo.replies_count, "\uFF09"]
|
|
|
|
|
})
|
|
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
|
|
|
className: Commentmodules.replyList,
|
|
|
|
|
children: memo_replies === null || memo_replies === void 0 ? void 0 : memo_replies.map(function (v, k) {
|
|
|
|
|
var _v$children;
|
|
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
|
|
gutter: [12, 12],
|
|
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
|
|
flex: "40px",
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
|
|
href: "/users/".concat(v.user_login),
|
|
|
|
|
target: "_blank",
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
|
|
alt: "\u7528\u6237\u5934\u50CF",
|
|
|
|
|
width: "50",
|
|
|
|
|
height: "50",
|
|
|
|
|
src: "".concat(env/* default */.Z.IMG_SERVER, "/images/").concat(v === null || v === void 0 ? void 0 : v.image_url)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
|
|
flex: "1",
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
|
|
align: "middle",
|
|
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
|
|
|
span: 24,
|
|
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
|
|
href: "/users/".concat(v.user_login),
|
|
|
|
|
target: "_blank",
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
|
|
className: "c-light-black",
|
|
|
|
|
children: v === null || v === void 0 ? void 0 : v.username
|
|
|
|
|
})
|
|
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
|
|
className: "c-light-black ml10",
|
|
|
|
|
children: v.time
|
|
|
|
|
})]
|
|
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
|
|
span: 24,
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
|
|
onClick: handleClick,
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
|
|
value: v.content
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}), !!(v !== null && v !== void 0 && (_v$children = v.children) !== null && _v$children !== void 0 && _v$children.length) && /*#__PURE__*/(0,jsx_runtime.jsx)(Second, {
|
|
|
|
|
user: user,
|
|
|
|
|
id: v === null || v === void 0 ? void 0 : v.id,
|
|
|
|
|
vlist: v === null || v === void 0 ? void 0 : v.children,
|
|
|
|
|
dispatch: dispatch,
|
|
|
|
|
params: params,
|
|
|
|
|
memo_replies: memo_replies,
|
|
|
|
|
forumsDetail: forumsDetail
|
|
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
|
|
span: 24,
|
|
|
|
|
className: "mt5 c-light-black",
|
|
|
|
|
children: showItemReply === k ? /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(WangEditor/* default */.Z, {
|
|
|
|
|
onChange: function onChange(v) {
|
|
|
|
|
setChildValue(v);
|
|
|
|
|
},
|
|
|
|
|
isFocus: true
|
|
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
|
|
span: 24,
|
|
|
|
|
className: "tr",
|
|
|
|
|
style: {
|
|
|
|
|
marginTop: 10
|
|
|
|
|
},
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
|
|
type: "primary",
|
|
|
|
|
size: 'middle',
|
|
|
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
|
|
var res;
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
if (!(childValue === '')) {
|
|
|
|
|
_context2.next = 4;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
message/* default */.ZP.error('请输入内容');
|
|
|
|
|
_context2.next = 9;
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
_context2.next = 6;
|
|
|
|
|
return (0,forums/* reply */.ts)({
|
|
|
|
|
parent_id: v === null || v === void 0 ? void 0 : v.id,
|
|
|
|
|
content: childValue
|
|
|
|
|
});
|
|
|
|
|
case 6:
|
|
|
|
|
res = _context2.sent;
|
|
|
|
|
setChildValue(null);
|
|
|
|
|
if (res) {
|
|
|
|
|
setShowItemReply(-1);
|
|
|
|
|
memo_replies.find(function (x) {
|
|
|
|
|
return x.id === res.parent_id;
|
|
|
|
|
}).children.push(formatReplieData(res));
|
|
|
|
|
dispatch({
|
|
|
|
|
type: 'forumsDetail/setForumsDetailData',
|
|
|
|
|
payload: objectSpread2_default()(objectSpread2_default()({}, forumsDetail.forumsDetailData), {}, {
|
|
|
|
|
memo: objectSpread2_default()(objectSpread2_default()({}, memo), {}, {
|
|
|
|
|
replies_count: (memo === null || memo === void 0 ? void 0 : memo.replies_count) + 1
|
|
|
|
|
}),
|
|
|
|
|
memo_replies: toConsumableArray_default()(memo_replies)
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
case 9:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context2.stop();
|
|
|
|
|
}
|
|
|
|
|
}, _callee2);
|
|
|
|
|
})),
|
|
|
|
|
children: "\u53D1\u9001"
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})]
|
|
|
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
|
|
className: "tr",
|
|
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
|
|
className: "iconfont icon-huifu1 mr15 ml30 current",
|
|
|
|
|
onClick: function onClick() {
|
|
|
|
|
return setShowItemReply(k);
|
|
|
|
|
}
|
|
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
|
|
title: v.user_praise ? "取消点赞" : "点赞",
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
|
|
className: v.user_praise ? "c-orange" : "c-gery-888",
|
|
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
|
|
className: "iconfont icon-dianzan mr3 current",
|
|
|
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
|
|
|
|
var res;
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
_context3.next = 2;
|
|
|
|
|
return (0,forums/* like */.vL)({
|
|
|
|
|
id: v.id,
|
|
|
|
|
container_type: 'Memo',
|
|
|
|
|
type: v.user_praise ? 0 : 1
|
|
|
|
|
});
|
|
|
|
|
case 2:
|
|
|
|
|
res = _context3.sent;
|
|
|
|
|
if ((res === null || res === void 0 ? void 0 : res.praise_count) >= 0) {
|
|
|
|
|
memo_replies.find(function (x) {
|
|
|
|
|
return x.id === v.id;
|
|
|
|
|
}).user_praise = !v.user_praise;
|
|
|
|
|
memo_replies.find(function (x) {
|
|
|
|
|
return x.id === v.id;
|
|
|
|
|
}).praise_count = res === null || res === void 0 ? void 0 : res.praise_count;
|
|
|
|
|
dispatch({
|
|
|
|
|
type: 'forumsDetail/setForumsDetailData',
|
|
|
|
|
payload: objectSpread2_default()(objectSpread2_default()({}, forumsDetail.forumsDetailData), {}, {
|
|
|
|
|
memo_replies: toConsumableArray_default()(memo_replies)
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
case 4:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context3.stop();
|
|
|
|
|
}
|
|
|
|
|
}, _callee3);
|
|
|
|
|
}))
|
|
|
|
|
}), v.praise_count > 0 ? v.praise_count : '']
|
|
|
|
|
})
|
|
|
|
|
})]
|
|
|
|
|
})
|
|
|
|
|
})]
|
|
|
|
|
})
|
|
|
|
|
})]
|
|
|
|
|
}, k);
|
|
|
|
|
})
|
|
|
|
|
})]
|
|
|
|
|
}), hasMore && /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
|
|
|
className: "bg-white pb20",
|
|
|
|
|
style: {
|
|
|
|
|
display: 'flex',
|
|
|
|
|
justifyContent: 'center'
|
|
|
|
|
},
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
|
|
justify: "space-between",
|
|
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
|
|
|
children: hasMore && /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
|
|
className: "c-black",
|
|
|
|
|
onClick: handeGetMoreData,
|
|
|
|
|
children: "\u67E5\u770B\u66F4\u591A\u8BC4\u8BBA"
|
|
|
|
|
})
|
|
|
|
|
})]
|
|
|
|
|
})
|
|
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
|
|
style: {
|
|
|
|
|
marginTop: '20px'
|
|
|
|
|
},
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(WangEditor/* default */.Z, {
|
|
|
|
|
onBlur: function onBlur() {
|
|
|
|
|
return setIsMdFouch(false);
|
|
|
|
|
},
|
|
|
|
|
isFocus: isMdFouch,
|
|
|
|
|
defaultValue: '',
|
|
|
|
|
id: "writeForumsReviewId",
|
|
|
|
|
onChange: function onChange(v) {
|
|
|
|
|
setValue(v);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
|
|
|
className: Commentmodules.reply,
|
|
|
|
|
children: /*#__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 */.ZP, {
|
|
|
|
|
type: "primary",
|
|
|
|
|
size: 'middle',
|
|
|
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
|
|
|
|
|
var res;
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
if (!(value === '')) {
|
|
|
|
|
_context4.next = 4;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
message/* default */.ZP.error('请输入内容');
|
|
|
|
|
_context4.next = 9;
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
_context4.next = 6;
|
|
|
|
|
return (0,forums/* reply */.ts)({
|
|
|
|
|
parent_id: memo === null || memo === void 0 ? void 0 : memo.id,
|
|
|
|
|
content: value
|
|
|
|
|
});
|
|
|
|
|
case 6:
|
|
|
|
|
res = _context4.sent;
|
|
|
|
|
setValue('');
|
|
|
|
|
if (res) {
|
|
|
|
|
dispatch({
|
|
|
|
|
type: 'forumsDetail/setForumsDetailData',
|
|
|
|
|
payload: objectSpread2_default()(objectSpread2_default()({}, forumsDetail.forumsDetailData), {}, {
|
|
|
|
|
memo: objectSpread2_default()(objectSpread2_default()({}, memo), {}, {
|
|
|
|
|
replies_count: (memo === null || memo === void 0 ? void 0 : memo.replies_count) + 1
|
|
|
|
|
}),
|
|
|
|
|
memo_replies: [formatReplieData(res)].concat(toConsumableArray_default()(memo_replies))
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
case 9:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context4.stop();
|
|
|
|
|
}
|
|
|
|
|
}, _callee4);
|
|
|
|
|
})),
|
|
|
|
|
children: "\u53D1\u9001"
|
|
|
|
|
})
|
|
|
|
|
})]
|
|
|
|
|
})
|
|
|
|
|
})]
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
/* harmony default export */ var Answers_Comment = ((0,_umi_production_exports.connect)(function (_ref7) {
|
|
|
|
|
var user = _ref7.user,
|
|
|
|
|
forumsDetail = _ref7.forumsDetail,
|
|
|
|
|
loading = _ref7.loading,
|
|
|
|
|
globalSetting = _ref7.globalSetting;
|
|
|
|
|
return {
|
|
|
|
|
user: user,
|
|
|
|
|
forumsDetail: forumsDetail,
|
|
|
|
|
globalSetting: globalSetting,
|
|
|
|
|
loading: loading.models.forumsDetail
|
|
|
|
|
};
|
|
|
|
|
}, null, null, {
|
|
|
|
|
forwardRef: true
|
|
|
|
|
})( /*#__PURE__*/(0,_react_17_0_2_react.forwardRef)(Comment)));
|
|
|
|
|
// EXTERNAL MODULE: ./src/components/mediator.js
|
|
|
|
|
var mediator = __webpack_require__(89472);
|
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/CoreCurriculum/Lists/Answers/index.tsx
|
|
|
|
|
|
|
|
|
|
var Answers_excluded = ["user", "forumsDetail", "globalSetting", "loading", "dispatch"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Page = function Page(_ref) {
|
|
|
|
|
objectDestructuringEmpty_default()(_ref);
|
|
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
|
|
|
|
|
align: "middle",
|
|
|
|
|
justify: "center",
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
|
|
src: ans_namespaceObject,
|
|
|
|
|
width: 1200
|
|
|
|
|
var Content = function Content(_ref) {
|
|
|
|
|
var user = _ref.user,
|
|
|
|
|
forumsDetail = _ref.forumsDetail,
|
|
|
|
|
globalSetting = _ref.globalSetting,
|
|
|
|
|
loading = _ref.loading,
|
|
|
|
|
dispatch = _ref.dispatch,
|
|
|
|
|
props = objectWithoutProperties_default()(_ref, Answers_excluded);
|
|
|
|
|
var commentRef = (0,_react_17_0_2_react.useRef)();
|
|
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
|
|
dispatch({
|
|
|
|
|
type: 'forumsDetail/getForumsDetailData',
|
|
|
|
|
payload: {
|
|
|
|
|
id: 1
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}, []);
|
|
|
|
|
var handleClick = function handleClick(e) {
|
|
|
|
|
var _e$target = e.target,
|
|
|
|
|
nodeName = _e$target.nodeName,
|
|
|
|
|
src = _e$target.src;
|
|
|
|
|
if (nodeName === 'IMG') {
|
|
|
|
|
mediator/* default */.Z.publish('preview-image', src);
|
|
|
|
|
console.log('src:', src);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
|
|
|
className: Answersmodules.wrap,
|
|
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(Answers_Comment, {
|
|
|
|
|
ref: commentRef,
|
|
|
|
|
handleClick: handleClick
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
/* harmony default export */ var Answers = ((0,_umi_production_exports.connect)(function (_ref2) {
|
|
|
|
|
objectDestructuringEmpty_default()(_ref2);
|
|
|
|
|
return {};
|
|
|
|
|
})(Page));
|
|
|
|
|
var user = _ref2.user,
|
|
|
|
|
forumsDetail = _ref2.forumsDetail,
|
|
|
|
|
loading = _ref2.loading,
|
|
|
|
|
globalSetting = _ref2.globalSetting;
|
|
|
|
|
return {
|
|
|
|
|
user: user,
|
|
|
|
|
forumsDetail: forumsDetail,
|
|
|
|
|
globalSetting: globalSetting,
|
|
|
|
|
loading: loading.effects
|
|
|
|
|
};
|
|
|
|
|
})(Content));
|
|
|
|
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
|
|
|
|
|