You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1356 lines
61 KiB
1356 lines
61 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[80508],{
|
|
|
|
/***/ 16854:
|
|
/*!************************************************************!*\
|
|
!*** ./src/components/image-preview/index.tsx + 1 modules ***!
|
|
\************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ image_preview; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
|
|
var slicedToArray = __webpack_require__(79800);
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
;// CONCATENATED MODULE: ./src/components/image-preview/index.less
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
// EXTERNAL MODULE: ./src/components/mediator.js
|
|
var mediator = __webpack_require__(1499);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
var es_button = __webpack_require__(3113);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/ReloadOutlined.js + 1 modules
|
|
var ReloadOutlined = __webpack_require__(32398);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/DownloadOutlined.js + 1 modules
|
|
var DownloadOutlined = __webpack_require__(41464);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/CloseOutlined.js + 1 modules
|
|
var CloseOutlined = __webpack_require__(99267);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
;// CONCATENATED MODULE: ./src/components/image-preview/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* harmony default export */ var image_preview = (function () {
|
|
var _useState = (0,_react_17_0_2_react.useState)(''),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
url = _useState2[0],
|
|
setUrl = _useState2[1];
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(0),
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
deg = _useState4[0],
|
|
setDeg = _useState4[1];
|
|
var saveUrl = (0,_react_17_0_2_react.useRef)('');
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
var unSub = mediator/* default */.Z.subscribe('preview-image', function (value) {
|
|
setUrl(value);
|
|
// window.document.body
|
|
// document.body.style.height='100%'
|
|
document.body.style.overflow = 'hidden';
|
|
});
|
|
return unSub;
|
|
}, []);
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
document.addEventListener('keydown', onViewEscClose);
|
|
return function () {
|
|
document.removeEventListener('keydown', onViewEscClose);
|
|
};
|
|
}, []);
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
saveUrl.current = url;
|
|
}, [url]);
|
|
function onViewEscClose(e) {
|
|
if (e.keyCode == 27 && saveUrl.current) {
|
|
onClose();
|
|
}
|
|
}
|
|
|
|
// https://data.educoder.net/api/attachments/1571649
|
|
function onClose() {
|
|
// document.body.style.height='100%'
|
|
document.body.style.overflow = 'auto';
|
|
setUrl('');
|
|
}
|
|
function onRotate() {
|
|
setDeg(deg + 90);
|
|
}
|
|
var maskRef = (0,_react_17_0_2_react.useRef)();
|
|
var previewWrapperRef = (0,_react_17_0_2_react.useRef)();
|
|
var handleMaskClick = function handleMaskClick(e) {
|
|
if (e.nativeEvent.target === maskRef.current || e.nativeEvent.target === previewWrapperRef.current) {
|
|
onClose();
|
|
}
|
|
};
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(_react_17_0_2_react.Fragment, {
|
|
children: !url ? null : /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "image-preview-container",
|
|
ref: maskRef,
|
|
onClick: handleMaskClick,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "button-group",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.ZP, {
|
|
onClick: onRotate,
|
|
children: ["\u65CB\u8F6C", /*#__PURE__*/(0,jsx_runtime.jsx)(ReloadOutlined/* default */.Z, {})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.ZP, {
|
|
href: url,
|
|
children: ["\u4E0B\u8F7D", /*#__PURE__*/(0,jsx_runtime.jsx)(DownloadOutlined/* default */.Z, {})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.ZP, {
|
|
onClick: onClose,
|
|
children: ["\u5173\u95ED", /*#__PURE__*/(0,jsx_runtime.jsx)(CloseOutlined/* default */.Z, {})]
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "preview-wrp-group",
|
|
ref: previewWrapperRef,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
className: "image-preview",
|
|
src: url,
|
|
alt: "\u9884\u89C8\u5927\u56FE",
|
|
style: {
|
|
transform: "rotate(".concat(deg, "deg)")
|
|
}
|
|
})
|
|
})]
|
|
})
|
|
});
|
|
});
|
|
|
|
/***/ }),
|
|
|
|
/***/ 32412:
|
|
/*!******************************************************!*\
|
|
!*** ./src/pages/Forums/Detail/[id].tsx + 8 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 */ _id_; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
|
|
var regeneratorRuntime = __webpack_require__(7557);
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
|
|
var asyncToGenerator = __webpack_require__(41498);
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectWithoutProperties.js
|
|
var objectWithoutProperties = __webpack_require__(39647);
|
|
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
|
|
var _umi_production_exports = __webpack_require__(80184);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__(82242);
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
var env = __webpack_require__(67390);
|
|
// 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);
|
|
;// CONCATENATED MODULE: ./src/pages/Forums/Detail/components/Right/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Rightmodules = ({"wrap":"wrap___oiJRJ","head":"head___zCLJu","recommendItem":"recommendItem___Z46_0","buttonWrap":"buttonWrap___Gol4S","privateMessage":"privateMessage___UCiuy","flex1":"flex1___FVk7y","mWidth147":"mWidth147___f_pcl"});
|
|
// EXTERNAL MODULE: ./src/service/forums.ts
|
|
var forums = __webpack_require__(11996);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
;// CONCATENATED MODULE: ./src/pages/Forums/Detail/components/Right/index.tsx
|
|
|
|
|
|
|
|
|
|
var _excluded = ["user", "forumsDetail", "globalSetting", "loading", "dispatch"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Right = function Right(_ref) {
|
|
var _user$userInfo, _user$userInfo2, _memo$tag, _memo$tag2;
|
|
var user = _ref.user,
|
|
forumsDetail = _ref.forumsDetail,
|
|
globalSetting = _ref.globalSetting,
|
|
loading = _ref.loading,
|
|
dispatch = _ref.dispatch,
|
|
props = objectWithoutProperties_default()(_ref, _excluded);
|
|
var _ref2 = forumsDetail.forumsDetailData || {},
|
|
author_info = _ref2.author_info,
|
|
memo = _ref2.memo,
|
|
recommend_shixuns = _ref2.recommend_shixuns;
|
|
var handleFollow = /*#__PURE__*/function () {
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
var res;
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
while (1) switch (_context.prev = _context.next) {
|
|
case 0:
|
|
if (!(author_info !== null && author_info !== void 0 && author_info.watched)) {
|
|
_context.next = 6;
|
|
break;
|
|
}
|
|
_context.next = 3;
|
|
return (0,forums/* cancelWatch */.Sr)({
|
|
user_id: author_info.user_id
|
|
});
|
|
case 3:
|
|
_context.t0 = _context.sent;
|
|
_context.next = 9;
|
|
break;
|
|
case 6:
|
|
_context.next = 8;
|
|
return (0,forums/* watch */.YP)({
|
|
user_id: author_info.user_id
|
|
});
|
|
case 8:
|
|
_context.t0 = _context.sent;
|
|
case 9:
|
|
res = _context.t0;
|
|
if (res) {
|
|
dispatch({
|
|
type: 'forumsDetail/setForumsDetailData',
|
|
payload: objectSpread2_default()(objectSpread2_default()({}, forumsDetail.forumsDetailData), {}, {
|
|
author_info: objectSpread2_default()(objectSpread2_default()({}, author_info), {}, {
|
|
watched: !(author_info !== null && author_info !== void 0 && author_info.watched)
|
|
})
|
|
})
|
|
});
|
|
}
|
|
case 11:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
}));
|
|
return function handleFollow() {
|
|
return _ref3.apply(this, arguments);
|
|
};
|
|
}();
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
className: Rightmodules.wrap,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
className: "ml20",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "bg-white pt40 pb40 pl20 pr20 ".concat(Rightmodules.head),
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
href: "/users/".concat(author_info === null || author_info === void 0 ? void 0 : author_info.login),
|
|
target: "_blank",
|
|
children: (author_info === null || author_info === void 0 ? void 0 : author_info.image_url) && /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
src: "".concat(env/* default */.Z.API_SERVER, "/images/").concat(author_info === null || author_info === void 0 ? void 0 : author_info.image_url)
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "tc font20",
|
|
children: author_info === null || author_info === void 0 ? void 0 : author_info.username
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "tc c-grey-999",
|
|
children: author_info === null || author_info === void 0 ? void 0 : author_info.identity
|
|
}), ((_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.user_id) !== (author_info === null || author_info === void 0 ? void 0 : author_info.user_id) && /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
justify: "center",
|
|
className: "mt30 ".concat(Rightmodules.buttonWrap),
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
type: "primary",
|
|
className: "mr10",
|
|
onClick: handleFollow,
|
|
children: author_info !== null && author_info !== void 0 && author_info.watched ? '取消关注' : '关注'
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP
|
|
// ghost
|
|
, {
|
|
className: Rightmodules.privateMessage,
|
|
href: "/messages/".concat((_user$userInfo2 = user.userInfo) === null || _user$userInfo2 === void 0 ? void 0 : _user$userInfo2.login, "/message_detail?target_ids=").concat(author_info === null || author_info === void 0 ? void 0 : author_info.user_id),
|
|
target: "_blank",
|
|
children: "\u79C1\u4FE1"
|
|
})
|
|
})]
|
|
})]
|
|
}), !!(memo !== null && memo !== void 0 && (_memo$tag = memo.tag) !== null && _memo$tag !== void 0 && _memo$tag.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "bg-white mt10 pt40 pb40 pl20 pr20",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "font16",
|
|
children: "\u8BDD\u9898\u6807\u7B7E"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "mt10 ".concat(Rightmodules.tag),
|
|
children: memo === null || memo === void 0 || (_memo$tag2 = memo.tag) === null || _memo$tag2 === void 0 ? void 0 : _memo$tag2.map(function (item, i) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: "c-light-primary mr10",
|
|
children: item
|
|
}, i);
|
|
})
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "pt10 pb10 pl10 pr10",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "font16 mb20",
|
|
children: "\u63A8\u8350\u5B9E\u8BAD"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Rightmodules.recommend,
|
|
children: recommend_shixuns === null || recommend_shixuns === void 0 ? void 0 : recommend_shixuns.map(function (item) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Rightmodules.recommendItem,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
href: "/shixuns/".concat(item.identifier, "/challenges"),
|
|
target: "_blank",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
alt: item.id,
|
|
src: "".concat(env/* default */.Z.API_SERVER, "/").concat(item.image_url)
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "".concat(Rightmodules.flex1, " ml10"),
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
href: "/shixuns/".concat(item.identifier, "/challenges"),
|
|
target: "_blank",
|
|
title: item.name,
|
|
className: "".concat(Rightmodules.mWidth147, " multi-llipsis1e c-grey-666 mb10"),
|
|
children: item.name
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "c-grey-999",
|
|
children: [item.myshixuns_count, " \u4EBA\u5B66\u4E60"]
|
|
})]
|
|
})]
|
|
});
|
|
})
|
|
})]
|
|
})]
|
|
})
|
|
});
|
|
};
|
|
/* harmony default export */ var components_Right = ((0,_umi_production_exports.connect)(function (_ref4) {
|
|
var user = _ref4.user,
|
|
forumsDetail = _ref4.forumsDetail,
|
|
loading = _ref4.loading,
|
|
globalSetting = _ref4.globalSetting;
|
|
return {
|
|
user: user,
|
|
forumsDetail: forumsDetail,
|
|
globalSetting: globalSetting,
|
|
loading: loading.models.forumsDetail
|
|
};
|
|
})(Right));
|
|
// EXTERNAL MODULE: ./node_modules/_dayjs@1.11.13@dayjs/dayjs.min.js
|
|
var dayjs_min = __webpack_require__(61186);
|
|
var dayjs_min_default = /*#__PURE__*/__webpack_require__.n(dayjs_min);
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules
|
|
var RenderHtml = __webpack_require__(36707);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
|
|
var message = __webpack_require__(8591);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
|
|
var modal = __webpack_require__(43418);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
|
|
var input = __webpack_require__(10249);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/menu/index.js + 11 modules
|
|
var es_menu = __webpack_require__(20834);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/breadcrumb/index.js + 6 modules
|
|
var breadcrumb = __webpack_require__(66104);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/dropdown/index.js + 1 modules
|
|
var dropdown = __webpack_require__(38854);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tooltip/index.js + 3 modules
|
|
var tooltip = __webpack_require__(6848);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/toConsumableArray.js
|
|
var toConsumableArray = __webpack_require__(37205);
|
|
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
|
|
var slicedToArray = __webpack_require__(79800);
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 10 modules
|
|
var markdown_editor = __webpack_require__(49731);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/DeleteOutlined.js + 1 modules
|
|
var DeleteOutlined = __webpack_require__(26227);
|
|
;// CONCATENATED MODULE: ./src/pages/Forums/Detail/components/Comment/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Commentmodules = ({"flex_box_center":"flex_box_center___nMc3G","flex_space_between":"flex_space_between___gTlaF","flex_box_vertical_center":"flex_box_vertical_center___GQv6O","flex_box_center_end":"flex_box_center_end___nrFEP","flex_box_column":"flex_box_column___Ls1oQ","reply":"reply___jb23w","replyList":"replyList___ryiUt","comment":"comment___QJ1eT","content":"content___X2UnY","commentItem":"commentItem___h_wnY"});
|
|
;// CONCATENATED MODULE: ./src/pages/Forums/Detail/components/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__(1079);
|
|
;// CONCATENATED MODULE: ./src/pages/Forums/Detail/components/Comment/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Comment_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, Comment_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.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)(markdown_editor/* default */.Z, {
|
|
onChange: function onChange(v) {
|
|
setChildValue(v);
|
|
},
|
|
height: 150,
|
|
isFocus: true,
|
|
placeholder: "\u6211\u8981\u56DE\u590D..."
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
span: 24,
|
|
className: "tr",
|
|
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.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.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.jsxs)("aside", {
|
|
className: Commentmodules.reply,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
onBlur: function onBlur() {
|
|
return setIsMdFouch(false);
|
|
},
|
|
isFocus: isMdFouch,
|
|
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 */.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.id,
|
|
content: value
|
|
});
|
|
case 6:
|
|
res = _context4.sent;
|
|
setValue(null);
|
|
if (res) {
|
|
dispatch({
|
|
type: 'forumsDetail/setForumsDetailData',
|
|
payload: objectSpread2_default()(objectSpread2_default()({}, forumsDetail.forumsDetailData), {}, {
|
|
memo: objectSpread2_default()(objectSpread2_default()({}, memo), {}, {
|
|
replies_count: 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 components_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)));
|
|
;// CONCATENATED MODULE: ./src/pages/Forums/Detail/components/Content/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Contentmodules = ({"wrap":"wrap___Soi3l","header":"header___vk3EC","title":"title___WJAyR","menu":"menu___yMPKF","top":"top___ZqzEM","line":"line___EQKlG","flexCenter":"flexCenter___Rcnhr","like":"like___uNtmq","canLike":"canLike___Lu04z","attachmentName":"attachmentName___nwdzp"});
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/ExclamationCircleOutlined.js + 1 modules
|
|
var ExclamationCircleOutlined = __webpack_require__(87169);
|
|
// EXTERNAL MODULE: ./src/components/image-preview/index.tsx + 1 modules
|
|
var image_preview = __webpack_require__(16854);
|
|
// EXTERNAL MODULE: ./src/components/mediator.js
|
|
var mediator = __webpack_require__(1499);
|
|
;// CONCATENATED MODULE: ./src/pages/Forums/Detail/components/Content/index.tsx
|
|
|
|
|
|
|
|
|
|
var Content_excluded = ["user", "forumsDetail", "globalSetting", "loading", "dispatch"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var typeMapping = {
|
|
5: '技术分享',
|
|
3: '操作指南',
|
|
16: '通知公告'
|
|
};
|
|
var Content = function Content(_ref) {
|
|
var _user$userInfo, _user$userInfo2, _user$userInfo3, _user$userInfo4;
|
|
var user = _ref.user,
|
|
forumsDetail = _ref.forumsDetail,
|
|
globalSetting = _ref.globalSetting,
|
|
loading = _ref.loading,
|
|
dispatch = _ref.dispatch,
|
|
props = objectWithoutProperties_default()(_ref, Content_excluded);
|
|
var _ref2 = forumsDetail.forumsDetailData || {},
|
|
author_info = _ref2.author_info,
|
|
memo = _ref2.memo,
|
|
attachments_list = _ref2.attachments_list;
|
|
var rewardRef = (0,_react_17_0_2_react.useRef)();
|
|
var commentRef = (0,_react_17_0_2_react.useRef)();
|
|
var handleTop = /*#__PURE__*/function () {
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
var query, res;
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
while (1) switch (_context.prev = _context.next) {
|
|
case 0:
|
|
query = {
|
|
id: memo.id,
|
|
sticky: memo.sticky ? 0 : 1
|
|
};
|
|
_context.next = 3;
|
|
return (0,forums/* stickyOrCancel */.B0)(query);
|
|
case 3:
|
|
res = _context.sent;
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
dispatch({
|
|
type: 'forumsDetail/setForumsDetailData',
|
|
payload: objectSpread2_default()(objectSpread2_default()({}, forumsDetail.forumsDetailData), {}, {
|
|
memo: objectSpread2_default()(objectSpread2_default()({}, memo), {}, {
|
|
sticky: !(memo !== null && memo !== void 0 && memo.sticky)
|
|
})
|
|
})
|
|
});
|
|
}
|
|
case 5:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
}));
|
|
return function handleTop() {
|
|
return _ref3.apply(this, arguments);
|
|
};
|
|
}();
|
|
var handleDelete = /*#__PURE__*/function () {
|
|
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
var res;
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
case 0:
|
|
_context2.next = 2;
|
|
return (0,forums/* deleteForums */.sW)({
|
|
id: memo === null || memo === void 0 ? void 0 : memo.id
|
|
});
|
|
case 2:
|
|
res = _context2.sent;
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
message/* default */.ZP.success('删除成功');
|
|
_umi_production_exports.history.push('/forums');
|
|
}
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === -1) {
|
|
_umi_production_exports.history.push('/forums');
|
|
}
|
|
case 5:
|
|
case "end":
|
|
return _context2.stop();
|
|
}
|
|
}, _callee2);
|
|
}));
|
|
return function handleDelete() {
|
|
return _ref4.apply(this, arguments);
|
|
};
|
|
}();
|
|
var handleReward = /*#__PURE__*/function () {
|
|
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
case 0:
|
|
modal/* default */.Z.confirm({
|
|
centered: true,
|
|
width: 530,
|
|
okText: '确定',
|
|
cancelText: '取消',
|
|
title: '奖励设置',
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "font14 tc",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
defaultValue: rewardRef.current,
|
|
onChange: function onChange(e) {
|
|
return rewardRef.current = e.target.value;
|
|
}
|
|
})
|
|
}),
|
|
onOk: function () {
|
|
var _onOk = 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/* rewardCode */.eh)({
|
|
id: memo === null || memo === void 0 ? void 0 : memo.id,
|
|
container_type: 'Memo',
|
|
score: rewardRef.current ? Number(rewardRef.current) : 0,
|
|
user_id: author_info === null || author_info === void 0 ? void 0 : author_info.user_id
|
|
});
|
|
case 2:
|
|
res = _context3.sent;
|
|
rewardRef.current = null;
|
|
if (!((res === null || res === void 0 ? void 0 : res.code) > 0)) {
|
|
_context3.next = 8;
|
|
break;
|
|
}
|
|
dispatch({
|
|
type: 'forumsDetail/setForumsDetailData',
|
|
payload: objectSpread2_default()(objectSpread2_default()({}, forumsDetail.forumsDetailData), {}, {
|
|
memo: objectSpread2_default()(objectSpread2_default()({}, memo), {}, {
|
|
reward: res === null || res === void 0 ? void 0 : res.code
|
|
})
|
|
})
|
|
});
|
|
message/* default */.ZP.success('奖励成功');
|
|
return _context3.abrupt("return");
|
|
case 8:
|
|
message/* default */.ZP.success('奖励失败,请联系系统管理员!');
|
|
case 9:
|
|
case "end":
|
|
return _context3.stop();
|
|
}
|
|
}, _callee3);
|
|
}));
|
|
function onOk() {
|
|
return _onOk.apply(this, arguments);
|
|
}
|
|
return onOk;
|
|
}()
|
|
});
|
|
case 1:
|
|
case "end":
|
|
return _context4.stop();
|
|
}
|
|
}, _callee4);
|
|
}));
|
|
return function handleReward() {
|
|
return _ref5.apply(this, arguments);
|
|
};
|
|
}();
|
|
var handleJumpToComment = function handleJumpToComment() {
|
|
commentRef.current.onMdFouch && commentRef.current.onMdFouch();
|
|
};
|
|
var handleLike = /*#__PURE__*/function () {
|
|
var _ref6 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5() {
|
|
var res;
|
|
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
|
|
while (1) switch (_context5.prev = _context5.next) {
|
|
case 0:
|
|
_context5.next = 2;
|
|
return (0,forums/* like */.vL)({
|
|
id: memo.id,
|
|
container_type: 'Memo',
|
|
type: 1
|
|
});
|
|
case 2:
|
|
res = _context5.sent;
|
|
if ((res === null || res === void 0 ? void 0 : res.praise_count) >= 0) {
|
|
dispatch({
|
|
type: 'forumsDetail/setForumsDetailData',
|
|
payload: objectSpread2_default()(objectSpread2_default()({}, forumsDetail.forumsDetailData), {}, {
|
|
memo: objectSpread2_default()(objectSpread2_default()({}, memo), {}, {
|
|
user_praise: !(memo !== null && memo !== void 0 && memo.user_praise),
|
|
memo_praise_count: res === null || res === void 0 ? void 0 : res.praise_count
|
|
})
|
|
})
|
|
});
|
|
}
|
|
case 4:
|
|
case "end":
|
|
return _context5.stop();
|
|
}
|
|
}, _callee5);
|
|
}));
|
|
return function handleLike() {
|
|
return _ref6.apply(this, arguments);
|
|
};
|
|
}();
|
|
var menu = /*#__PURE__*/(0,jsx_runtime.jsxs)(es_menu/* default */.Z, {
|
|
className: Contentmodules.menu,
|
|
children: [((_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.admin) && (memo === null || memo === void 0 ? void 0 : memo.sticky) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_menu/* default */.Z.Item, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
onClick: function onClick() {
|
|
return handleTop();
|
|
},
|
|
children: "\u53D6\u6D88\u7F6E\u9876"
|
|
})
|
|
}), ((_user$userInfo2 = user.userInfo) === null || _user$userInfo2 === void 0 ? void 0 : _user$userInfo2.admin) && !(memo !== null && memo !== void 0 && memo.sticky) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_menu/* default */.Z.Item, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
onClick: function onClick() {
|
|
return handleTop();
|
|
},
|
|
children: "\u7F6E\xA0\xA0\u9876"
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_menu/* default */.Z.Item, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
to: "/forums/".concat(memo === null || memo === void 0 ? void 0 : memo.id, "/edit"),
|
|
children: "\u7F16\xA0\xA0\u8F91"
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_menu/* default */.Z.Item, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
onClick: function onClick() {
|
|
modal/* default */.Z.confirm({
|
|
title: '提示',
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)(ExclamationCircleOutlined/* default */.Z, {}),
|
|
content: '帖子将被删除,无法恢复。是否确认删除?',
|
|
okText: '确认',
|
|
onOk: function onOk() {
|
|
handleDelete();
|
|
},
|
|
cancelText: '取消'
|
|
});
|
|
},
|
|
children: "\u5220\xA0\xA0\u9664"
|
|
})
|
|
})]
|
|
});
|
|
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);
|
|
}
|
|
};
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
// document.body.style.height='100%'
|
|
}, []);
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
className: Contentmodules.wrap,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(breadcrumb/* default */.Z, {
|
|
separator: "/",
|
|
className: "mb5",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
to: "/forums/categories/".concat(memo === null || memo === void 0 ? void 0 : memo.forum_id),
|
|
children: typeMapping[memo === null || memo === void 0 ? void 0 : memo.forum_id]
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, {
|
|
children: "\u8BE6\u60C5"
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("header", {
|
|
className: "bg-white pt40 pb40 pl30 pr30 ".concat(Contentmodules.header),
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
align: "middle",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
flex: 1,
|
|
className: "font24 mb5",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Contentmodules.title,
|
|
children: memo === null || memo === void 0 ? void 0 : memo.subject
|
|
}), (memo === null || memo === void 0 ? void 0 : memo.sticky) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Contentmodules.top,
|
|
children: "\u7F6E\u9876"
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
children: (((_user$userInfo3 = user.userInfo) === null || _user$userInfo3 === void 0 ? void 0 : _user$userInfo3.admin) || ((_user$userInfo4 = user.userInfo) === null || _user$userInfo4 === void 0 ? void 0 : _user$userInfo4.user_id) === (author_info === null || author_info === void 0 ? void 0 : author_info.user_id)) && /*#__PURE__*/(0,jsx_runtime.jsx)(dropdown/* default */.Z, {
|
|
dropdownRender: function dropdownRender() {
|
|
return menu;
|
|
},
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "fa fa-bars font-16 current c-grey-bcb"
|
|
})
|
|
})
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
align: "middle",
|
|
className: "font14",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
flex: 1,
|
|
className: "c-grey-999",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
children: [dayjs_min_default()(memo === null || memo === void 0 ? void 0 : memo.time).fromNow(), " \u66F4\u65B0"]
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
className: "c-grey-999",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
className: "pr10 pl10 ".concat(!!(memo !== null && memo !== void 0 && memo.replies_count) ? Contentmodules.line : ''),
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-liulanyan font18 mr5"
|
|
}), memo === null || memo === void 0 ? void 0 : memo.viewed_count]
|
|
}), !!(memo !== null && memo !== void 0 && memo.replies_count) && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
placement: "bottom",
|
|
title: "\u5199\u8BC4\u8BBA",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
className: "current pl10",
|
|
onClick: handleJumpToComment,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-huifu1 font18 mr5"
|
|
}), memo === null || memo === void 0 ? void 0 : memo.replies_count]
|
|
})
|
|
})]
|
|
})]
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("main", {
|
|
className: "bg-white pt40 pb40 pl40 pr40",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
onClick: handleClick,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
value: memo === null || memo === void 0 ? void 0 : memo.content
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "bg-white pl40 pr40 mt40",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "mt10 mb20 ".concat(Contentmodules.flexCenter),
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "".concat(Contentmodules.like, " ").concat(memo !== null && memo !== void 0 && memo.user_praise ? '' : Contentmodules.canLike),
|
|
onClick: handleLike,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-dianzan font18"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
children: memo === null || memo === void 0 ? void 0 : memo.memo_praise_count
|
|
})]
|
|
})
|
|
})
|
|
}), !!(attachments_list !== null && attachments_list !== void 0 && attachments_list.length) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "mt40",
|
|
children: attachments_list === null || attachments_list === void 0 ? void 0 : attachments_list.map(function (item) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "c-grey-888 ".concat(Contentmodules.flexCenter),
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-fujian mr10 font14 c-green-29b"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
href: item === null || item === void 0 ? void 0 : item.url,
|
|
title: item === null || item === void 0 ? void 0 : item.title,
|
|
className: "".concat(Contentmodules.attachmentName, " mr10"),
|
|
children: item === null || item === void 0 ? void 0 : item.title
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: "font12 c-grey-666 mt3",
|
|
children: item === null || item === void 0 ? void 0 : item.filesize
|
|
})]
|
|
});
|
|
})
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(components_Comment, {
|
|
ref: commentRef,
|
|
handleClick: handleClick
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(image_preview/* default */.Z, {})]
|
|
});
|
|
};
|
|
/* harmony default export */ var components_Content = ((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.effects
|
|
};
|
|
})(Content));
|
|
;// CONCATENATED MODULE: ./src/pages/Forums/Detail/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Detailmodules = ({"flex":"flex___fgmSn"});
|
|
;// CONCATENATED MODULE: ./src/pages/Forums/Detail/[id].tsx
|
|
|
|
|
|
|
|
var _id_excluded = ["forumsDetail", "globalSetting", "loading", "dispatch"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ForumsDetailPage = function ForumsDetailPage(_ref) {
|
|
var forumsDetail = _ref.forumsDetail,
|
|
globalSetting = _ref.globalSetting,
|
|
loading = _ref.loading,
|
|
dispatch = _ref.dispatch,
|
|
props = objectWithoutProperties_default()(_ref, _id_excluded);
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
handleGetData();
|
|
}, [params.memoId]);
|
|
var handleGetData = /*#__PURE__*/function () {
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
while (1) switch (_context.prev = _context.next) {
|
|
case 0:
|
|
dispatch({
|
|
type: 'forumsDetail/getForumsDetailData',
|
|
payload: {
|
|
id: params.memoId
|
|
}
|
|
});
|
|
case 1:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
}));
|
|
return function handleGetData() {
|
|
return _ref2.apply(this, arguments);
|
|
};
|
|
}();
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
className: "edu-container mb20 mt30 ".concat(Detailmodules.flex),
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(components_Content, {}), /*#__PURE__*/(0,jsx_runtime.jsx)(components_Right, {})]
|
|
});
|
|
};
|
|
/* harmony default export */ var _id_ = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
var forumsDetail = _ref3.forumsDetail,
|
|
loading = _ref3.loading,
|
|
globalSetting = _ref3.globalSetting;
|
|
return {
|
|
forumsDetail: forumsDetail,
|
|
globalSetting: globalSetting,
|
|
loading: loading.models.forumsDetail
|
|
};
|
|
})(ForumsDetailPage));
|
|
|
|
/***/ })
|
|
|
|
}]); |