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.
NewEduCoderBuild/p__CaseLibrary__Detail__ind...

992 lines
47 KiB

"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[20257,89353],{
/***/ 93197:
/*!************************************************************!*\
!*** ./src/pages/CaseLibrary/Detail/index.tsx + 3 modules ***!
\************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ CaseLibrary_Detail; }
});
// 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/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);
// 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/message/index.js + 4 modules
var message = __webpack_require__(8591);
// 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/skeleton/index.js + 12 modules
var skeleton = __webpack_require__(78485);
;// CONCATENATED MODULE: ./src/pages/CaseLibrary/Detail/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var Detailmodules = ({"flex_box_center":"flex_box_center___o6PS7","flex_space_between":"flex_space_between___jFqYR","flex_box_vertical_center":"flex_box_vertical_center___bkCsE","flex_box_center_end":"flex_box_center_end___mOjnB","flex_box_column":"flex_box_column___XDXIy","con_warp":"con_warp___q8d5e","all_wrap":"all_wrap___z_EMH","top":"top___pg2nl","left_warp":"left_warp___V0WlV","right_warp":"right_warp___csDNh","right_top":"right_top___hIcQZ","right_center":"right_center___NaPUB","sc_type":"sc_type___hRc_d","sc_lable":"sc_lable___LXq9N","interaction_warp":"interaction_warp___w7H1E","discuss":"discuss___U6lDy","item_warp":"item_warp___YuCMs","user_img":"user_img___Rqz2R","message":"message___JXxin","user_header":"user_header___UmCKv","user_name":"user_name___R8LoK","time":"time___Gk1um","reply":"reply___u_W1X","del_icon":"del_icon___kgB3r","pl_icon":"pl_icon___uTltN"});
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
var env = __webpack_require__(19219);
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
var _umi_production_exports = __webpack_require__(3125);
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 10 modules
var markdown_editor = __webpack_require__(1387);
// EXTERNAL MODULE: ./src/service/rescoure.ts
var rescoure = __webpack_require__(14820);
// 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: ./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);
;// CONCATENATED MODULE: ./src/pages/CaseLibrary/Detail/Preview/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var Previewmodules = ({"wrp":"wrp___pCffY","bgBlack":"bgBlack___thUxV","monaco":"monaco___Ldorp","darkBlue":"darkBlue___U50In","close":"close___KlqKs","embed":"embed___Gw1Ga"});
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.5.2@@ant-design/icons/es/icons/ArrowDownOutlined.js + 1 modules
var ArrowDownOutlined = __webpack_require__(63093);
// EXTERNAL MODULE: ./src/components/monaco-editor/index.jsx + 3 modules
var monaco_editor = __webpack_require__(65395);
// EXTERNAL MODULE: ./src/utils/util.tsx
var util = __webpack_require__(65327);
// EXTERNAL MODULE: ./src/service/exercise.ts
var exercise = __webpack_require__(18846);
// EXTERNAL MODULE: ./src/components/NoData/index.tsx
var NoData = __webpack_require__(94398);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/pages/CaseLibrary/Detail/Preview/index.tsx
/* harmony default export */ var Preview = (function (_ref) {
var _data, _data2, _data3, _data4, _data5, _data6, _data7;
var _ref$editOffice = _ref.editOffice,
editOffice = _ref$editOffice === void 0 ? 'view' : _ref$editOffice,
data = _ref.data,
theme = _ref.theme,
type = _ref.type,
filename = _ref.filename,
monacoEditor = _ref.monacoEditor,
className = _ref.className,
style = _ref.style,
close = _ref.close,
onClose = _ref.onClose,
hasMask = _ref.hasMask,
disabledDownload = _ref.disabledDownload,
onImgDimensions = _ref.onImgDimensions,
showNodata = _ref.showNodata;
var _useState = (0,_react_17_0_2_react.useState)('https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt'),
_useState2 = slicedToArray_default()(_useState, 2),
src = _useState2[0],
setSrc = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(""),
_useState4 = slicedToArray_default()(_useState3, 2),
token = _useState4[0],
setToken = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)(),
_useState6 = slicedToArray_default()(_useState5, 2),
officeData = _useState6[0],
setOfficeData = _useState6[1];
var officePath = window.ENV === "build" ? "/react/build" : "";
var apiServer = location.host.startsWith("localhost") ? env/* default */.Z.PROXY_SERVER : env/* default */.Z.API_SERVER;
// let size;
console.log("disabledDownload---", disabledDownload);
var unit = 1024 * 1024;
var maxSize = 10 * unit;
var closeRef = (0,_react_17_0_2_react.useRef)();
if ((_data = data) !== null && _data !== void 0 && _data.startsWith("/api") && type !== "txt") {
data = env/* default */.Z.API_SERVER + data;
}
// if (type === "office") {
// size = parseUrl(data).filesize
// if (size > maxSize) {
// type = "other"
// }
// }
if (filename) monacoEditor.filename = filename;
(0,_react_17_0_2_react.useEffect)(function () {
var _document$cookie;
var cookies = (_document$cookie = document.cookie) === null || _document$cookie === void 0 || (_document$cookie = _document$cookie.replace(/\s/g, "")) === null || _document$cookie === void 0 ? void 0 : _document$cookie.split(";");
cookies === null || cookies === void 0 || cookies.map(function (item) {
var i = item.split("=");
if (i[0] === '_educoder_session') {
setToken(i[1]);
}
});
}, []);
(0,_react_17_0_2_react.useEffect)(function () {
if (type === "office") getData();
}, [type, data]);
var getData = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var _url, _id, res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
console.log("data:", data);
_url = data;
if (!data.startsWith("http")) {
_url = location.origin + _url;
}
_id = new URL(_url).pathname.split("/").pop();
_context.next = 6;
return (0,exercise/* setEcsAttachment */.gJ)({
attachment_id: _id
});
case 6:
res = _context.sent;
setOfficeData(res);
case 8:
case "end":
return _context.stop();
}
}, _callee);
}));
return function getData() {
return _ref2.apply(this, arguments);
};
}();
var handleClick = function handleClick() {
if (data.startsWith("http") || data.startsWith('blob:')) {
handleDown();
return;
}
(0,util/* downloadFile */.Sv)(filename || 'educoder', data, filename);
};
var handleDown = function handleDown() {
(0,util/* downLoadLink */.Nd)(filename || 'educoder', decodeURIComponent(data));
};
console.log(data, 'data');
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: objectSpread2_default()({}, style || {}),
className: "".concat(hasMask && Previewmodules.bgBlack, " ").concat(!!type ? Previewmodules.wrp : "hide"),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "".concat(Previewmodules[className], " ").concat(className, " ").concat(Previewmodules.monaco, " ").concat(type === "txt" ? "show" : "hide"),
children: type === "txt" && /*#__PURE__*/(0,jsx_runtime.jsx)(monaco_editor/* default */.ZP, objectSpread2_default()({}, monacoEditor))
}), type === "audio" && /*#__PURE__*/(0,jsx_runtime.jsx)("audio", {
src: ((_data2 = data) === null || _data2 === void 0 ? void 0 : _data2.indexOf("http")) > -1 || (_data3 = data) !== null && _data3 !== void 0 && _data3.startsWith("/api") ? data : "data:image/png;base64,".concat(data),
autoPlay: true
}), type === "video" && /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
children: ((_data4 = data) === null || _data4 === void 0 ? void 0 : _data4.indexOf("http")) > -1 || (_data5 = data) !== null && _data5 !== void 0 && _data5.startsWith("/api") ? /*#__PURE__*/(0,jsx_runtime.jsx)("video", {
controls: true,
src: "".concat(data),
autoPlay: true
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("video", {
controls: true,
src: "data:video/mp4;base64,".concat(data),
autoPlay: true
})
}), type === 'office' && officeData && /*#__PURE__*/(0,jsx_runtime.jsx)("iframe", {
src: "".concat(officePath, "/office.html?key=").concat(officeData.key, "&url=").concat(apiServer + officeData.url, "&callbackUrl=").concat(apiServer + officeData.callbackUrl, "&fileType=").concat(officeData.fileType, "&title=").concat(officeData.title, "&model=").concat(editOffice, "&officeServer=").concat(env/* default */.Z.ONLYOFFICE, "&disabledDownload=").concat(!!disabledDownload)
}), type === 'html' && /*#__PURE__*/(0,jsx_runtime.jsx)("iframe", {
src: data + '&disposition=inline'
}), type === 'pdf' && /*#__PURE__*/(0,jsx_runtime.jsx)("iframe", {
src: "".concat(officePath, "/js/pdfview/index.html?url=").concat(data, "&disabledDownload=").concat(!!disabledDownload)
}) //<embed className={styles.embed + "#toolbar=0"} src={data} />
, type === "image" && /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
src: ((_data6 = data) === null || _data6 === void 0 ? void 0 : _data6.indexOf("http")) > -1 || (_data7 = data) !== null && _data7 !== void 0 && _data7.startsWith("/api") ? data : "data:image/png;base64,".concat(data)
}), (type === "other" || type === "download") && /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
children: showNodata ? /*#__PURE__*/(0,jsx_runtime.jsx)(NoData/* default */.Z, {
customText: "\u5F53\u524D\u6587\u4EF6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u53EF\u70B9\u51FB\u4E0B\u8F7D\u67E5\u770B",
ButtonTwo: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
icon: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-xiazai4 font14"
}),
type: "primary",
size: 'middle',
onClick: handleClick,
children: "\u4E0B\u8F7D"
})
}) : /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.ZP, {
type: "primary",
size: 'middle',
onClick: handleDown,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ArrowDownOutlined/* default */.Z, {}), "\u70B9\u51FB\u4E0B\u8F7D"]
})
// handleClick
})]
});
});
;// CONCATENATED MODULE: ./src/pages/CaseLibrary/Detail/index.tsx
var Detail = function Detail(_ref) {
var _data$attachment, _data$attachment2, _data$resource_knowle, _data$political_point, _data$embodiment, _data$tags, _comments$list;
var globalSetting = _ref.globalSetting,
dispatch = _ref.dispatch,
user = _ref.user,
virtualSpaces = _ref.virtualSpaces;
var query = (0,_umi_production_exports.useParams)();
var _useState = (0,_react_17_0_2_react.useState)(null),
_useState2 = slicedToArray_default()(_useState, 2),
data = _useState2[0],
setData = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(false),
_useState4 = slicedToArray_default()(_useState3, 2),
showEditor = _useState4[0],
setShowEditor = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)(false),
_useState6 = slicedToArray_default()(_useState5, 2),
newEditor = _useState6[0],
setNewEditor = _useState6[1];
var _useState7 = (0,_react_17_0_2_react.useState)(false),
_useState8 = slicedToArray_default()(_useState7, 2),
loading = _useState8[0],
setLoading = _useState8[1];
var _useState9 = (0,_react_17_0_2_react.useState)({
list: [],
size: 0
}),
_useState10 = slicedToArray_default()(_useState9, 2),
comments = _useState10[0],
setComments = _useState10[1];
var _useState11 = (0,_react_17_0_2_react.useState)(''),
_useState12 = slicedToArray_default()(_useState11, 2),
publishCon = _useState12[0],
setPublishCon = _useState12[1];
var _useState13 = (0,_react_17_0_2_react.useState)(null),
_useState14 = slicedToArray_default()(_useState13, 2),
parentId = _useState14[0],
setParentId = _useState14[1];
var _useState15 = (0,_react_17_0_2_react.useState)(false),
_useState16 = slicedToArray_default()(_useState15, 2),
publishLoading = _useState16[0],
setPublishLoading = _useState16[1];
(0,_react_17_0_2_react.useEffect)(function () {
getDetail();
getCommentList();
}, [query.id]);
// 获取资源详情
var getDetail = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return (0,rescoure/* get_resource_detail */.Vs)(query.id);
case 2:
res = _context.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
setData(res === null || res === void 0 ? void 0 : res.data);
}
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
return function getDetail() {
return _ref2.apply(this, arguments);
};
}();
// 获取评论列表
var getCommentList = /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
var res;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
setLoading(true);
_context2.next = 3;
return (0,rescoure/* get_resource_comments */.ur)(query.id);
case 3:
res = _context2.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
setComments(res === null || res === void 0 ? void 0 : res.data);
}
setLoading(false);
case 6:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function getCommentList() {
return _ref3.apply(this, arguments);
};
}();
// 发布评论
var onPublish = /*#__PURE__*/function () {
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
var res;
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
setPublishLoading(true);
_context3.next = 3;
return (0,rescoure/* send_comments */.eP)({
id: query.id,
comment: publishCon,
parent_id: parentId
});
case 3:
res = _context3.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
getCommentList();
showEditor ? setShowEditor(false) : setNewEditor(false);
}
setPublishLoading(false);
case 6:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return function onPublish() {
return _ref4.apply(this, arguments);
};
}();
// 删除评论
var delComment = function delComment(params) {
modal/* default */.Z.confirm({
centered: true,
width: 480,
okText: '确定',
cancelText: '取消',
title: '提示',
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "tc font16",
children: "\u662F\u5426\u786E\u8BA4\u5220\u9664\u8BC4\u8BBA?"
}),
onOk: function () {
var _onOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
var res;
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
_context4.next = 2;
return (0,rescoure/* del_comment */.tr)(params);
case 2:
res = _context4.sent;
if ((res === null || res === void 0 ? void 0 : res.status) == 0) {
message/* default */.ZP.success('删除成功');
getCommentList();
}
case 4:
case "end":
return _context4.stop();
}
}, _callee4);
}));
function onOk() {
return _onOk.apply(this, arguments);
}
return onOk;
}()
});
};
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Detailmodules.con_warp,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Detailmodules.all_wrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Detailmodules.top,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
color: '#999',
cursor: 'pointer',
marginRight: 10
},
onClick: function onClick() {
return _umi_production_exports.history.push('/caselibrary');
},
children: ['<', "\u8FD4\u56DE"]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
color: '#333'
},
children: data === null || data === void 0 ? void 0 : data.name
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
minHeight: 735
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Detailmodules.left_warp,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(Preview, {
close: true,
data: data === null || data === void 0 || (_data$attachment = data.attachment) === null || _data$attachment === void 0 ? void 0 : _data$attachment.url,
type: data === null || data === void 0 || (_data$attachment2 = data.attachment) === null || _data$attachment2 === void 0 ? void 0 : _data$attachment2.file_type,
onClose: function onClose() {
return setData({
content: "",
type: ""
});
}
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Detailmodules.right_warp,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Detailmodules.right_top,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Detailmodules.sc_type,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u77E5\u8BC6\u70B9"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
maxWidth: 200
},
children: (data === null || data === void 0 || (_data$resource_knowle = data.resource_knowledge_point) === null || _data$resource_knowle === void 0 ? void 0 : _data$resource_knowle.name) || '--'
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Detailmodules.sc_type,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u601D\u653F\u70B9"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: (data === null || data === void 0 || (_data$political_point = data.political_point) === null || _data$political_point === void 0 ? void 0 : _data$political_point.name) || '--'
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Detailmodules.sc_type,
style: {
marginLeft: 20
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u5B9E\u65BD\u65B9\u5F0F"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: (data === null || data === void 0 || (_data$embodiment = data.embodiment) === null || _data$embodiment === void 0 ? void 0 : _data$embodiment.name) || '--'
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
display: 'flex',
flexWrap: 'wrap'
},
children: data === null || data === void 0 || (_data$tags = data.tags) === null || _data$tags === void 0 ? void 0 : _data$tags.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Detailmodules.sc_lable,
children: item === null || item === void 0 ? void 0 : item.name
}, index);
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Detailmodules.interaction_warp,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Detailmodules.interaction_item,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-dianzan7 mt5",
style: {
color: '#37AD83'
}
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: ["\u5DF2\u70B9\u8D5E\uFF08", data === null || data === void 0 ? void 0 : data.like_count, "\uFF09"]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Detailmodules.interaction_item,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-shoucang2 mt5",
style: {
color: '#FFB538'
}
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: ["\u5DF2\u6536\u85CF\uFF08", data === null || data === void 0 ? void 0 : data.collect_count, "\uFF09"]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Detailmodules.interaction_item,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-xiazai7 mt5",
style: {
color: '#666'
}
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: ["\u4E0B\u8F7D\uFF08", data === null || data === void 0 ? void 0 : data.download_count, "\uFF09"]
})]
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Detailmodules.right_center,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-hudongpinglunshu",
style: {
position: 'relative',
top: 1,
color: '#50DCB6',
fontSize: 20
}
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
margin: '0 10px 0 8px'
},
children: ["\u8BC4\u8BBA\uFF08", comments === null || comments === void 0 ? void 0 : comments.size, "\uFF09"]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.ZP, {
color: "primary",
style: {
borderColor: 'rgba(1,88,39,0.3)',
color: '#1B8565',
padding: '0 9px'
},
onClick: function onClick() {
setParentId(null);
setNewEditor(true);
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-bianji12",
style: {
fontSize: 14,
marginRight: 6
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u53D1\u5E03\u65B0\u8BC4\u8BBA"
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Detailmodules.discuss,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(skeleton/* default */.Z, {
loading: loading,
style: {
margin: '20px 0'
},
children: comments === null || comments === void 0 || (_comments$list = comments.list) === null || _comments$list === void 0 ? void 0 : _comments$list.map(function (item, index) {
var _item$user, _item$user2, _item$children, _item$children2;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Detailmodules.item_warp,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
src: "".concat(env/* default */.Z === null || env/* default */.Z === void 0 ? void 0 : env/* default */.Z.IMG_SERVER, "/images/").concat(item === null || item === void 0 || (_item$user = item.user) === null || _item$user === void 0 ? void 0 : _item$user.image_url),
className: Detailmodules.user_img
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
width: '100%'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Detailmodules.user_header,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Detailmodules.user_name,
children: item === null || item === void 0 || (_item$user2 = item.user) === null || _item$user2 === void 0 ? void 0 : _item$user2.name
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Detailmodules.time,
children: dayjs_min_default()(item === null || item === void 0 ? void 0 : item.created_at).format('YYYY-MM-DD HH:mm:ss')
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Detailmodules.message,
dangerouslySetInnerHTML: {
__html: item === null || item === void 0 ? void 0 : item.comment
}
}), (item === null || item === void 0 || (_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) > 0 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Detailmodules.reply,
children: item === null || item === void 0 || (_item$children2 = item.children) === null || _item$children2 === void 0 ? void 0 : _item$children2.map(function (child, childIndex) {
var _child$user, _item$children3;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Detailmodules.reply_item,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Detailmodules.user_header,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Detailmodules.user_name,
children: child === null || child === void 0 || (_child$user = child.user) === null || _child$user === void 0 ? void 0 : _child$user.name
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Detailmodules.time,
children: dayjs_min_default()(child === null || child === void 0 ? void 0 : child.created_at).format('YYYY-MM-DD HH:mm:ss')
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
dangerouslySetInnerHTML: {
__html: child === null || child === void 0 ? void 0 : child.comment
},
className: Detailmodules.message,
style: {
marginBottom: childIndex == (item === null || item === void 0 || (_item$children3 = item.children) === null || _item$children3 === void 0 ? void 0 : _item$children3.length) - 1 ? '0' : '8px'
}
})]
}, childIndex);
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
justifyContent: 'flex-end',
color: '#B2BACB'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-a-huifupinglun ".concat(Detailmodules === null || Detailmodules === void 0 ? void 0 : Detailmodules.pl_icon),
onClick: function onClick() {
setParentId(item === null || item === void 0 ? void 0 : item.id);
setShowEditor(true);
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-yishanchu ".concat(Detailmodules === null || Detailmodules === void 0 ? void 0 : Detailmodules.del_icon),
onClick: function onClick() {
delComment({
id: item === null || item === void 0 ? void 0 : item.id
});
}
})]
})]
})]
}, index);
})
})
})]
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
title: showEditor ? '发布评论' : '发布新评论',
open: showEditor || newEditor,
width: 700,
afterClose: function afterClose() {
setPublishCon('');
},
centered: true,
onOk: onPublish,
onCancel: function onCancel() {
showEditor ? setShowEditor(false) : setNewEditor(false);
},
okText: "\u53D1\u9001",
confirmLoading: publishLoading,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
defaultValue: publishCon,
onChange: function onChange(e) {
setPublishCon(e);
}
})
})]
});
};
/* harmony default export */ var CaseLibrary_Detail = ((0,_umi_production_exports.connect)(function (_ref5) {
var virtualSpaces = _ref5.virtualSpaces,
globalSetting = _ref5.globalSetting,
user = _ref5.user;
return {
globalSetting: globalSetting,
virtualSpaces: virtualSpaces,
user: user
};
})(Detail));
/***/ }),
/***/ 14820:
/*!*********************************!*\
!*** ./src/service/rescoure.ts ***!
\*********************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ FW: function() { return /* binding */ add_resource; },
/* harmony export */ Vs: function() { return /* binding */ get_resource_detail; },
/* harmony export */ _w: function() { return /* binding */ del_review; },
/* harmony export */ eP: function() { return /* binding */ send_comments; },
/* harmony export */ iq: function() { return /* binding */ get_resource_libraries; },
/* harmony export */ tr: function() { return /* binding */ del_comment; },
/* harmony export */ ur: function() { return /* binding */ get_resource_comments; }
/* harmony export */ });
/* unused harmony exports edit_resource, submit_review, pass_review, refuse_review, cancel_public */
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js */ 7557);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js */ 41498);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _utils_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/utils/fetch */ 52774);
// 知识点、思政点、实施方式数据列表
function get_resource_libraries() {
return _get_resource_libraries.apply(this, arguments);
}
// 创建资源库
function _get_resource_libraries() {
_get_resource_libraries = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee() {
return _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
return _context.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .ZP)('/api/resource_libraries/get_create_info.json', {
method: 'get'
}));
case 1:
case "end":
return _context.stop();
}
}, _callee);
}));
return _get_resource_libraries.apply(this, arguments);
}
function add_resource(_x) {
return _add_resource.apply(this, arguments);
}
// 修改资源库
function _add_resource() {
_add_resource = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee2(params) {
return _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
return _context2.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .ZP)('/api/resource_libraries.json', {
method: 'post',
body: params
}));
case 1:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _add_resource.apply(this, arguments);
}
function edit_resource(_x2) {
return _edit_resource.apply(this, arguments);
}
// 获取某个资源库
function _edit_resource() {
_edit_resource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
return _context3.abrupt("return", Fetch("/api/resource_libraries/".concat(params === null || params === void 0 ? void 0 : params.id, ".json"), {
method: 'put',
body: params
}));
case 1:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return _edit_resource.apply(this, arguments);
}
function get_resource_detail(_x3) {
return _get_resource_detail.apply(this, arguments);
}
// 获取评论区列表
function _get_resource_detail() {
_get_resource_detail = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee4(id) {
return _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
return _context4.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .ZP)("/api/resource_libraries/".concat(id, ".json"), {
method: 'get'
}));
case 1:
case "end":
return _context4.stop();
}
}, _callee4);
}));
return _get_resource_detail.apply(this, arguments);
}
function get_resource_comments(_x4) {
return _get_resource_comments.apply(this, arguments);
}
// 发送评论
function _get_resource_comments() {
_get_resource_comments = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee5(id) {
return _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
return _context5.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .ZP)("/api/resource_libraries/".concat(id, "/resource_comments.json"), {
method: 'get'
}));
case 1:
case "end":
return _context5.stop();
}
}, _callee5);
}));
return _get_resource_comments.apply(this, arguments);
}
function send_comments(_x5) {
return _send_comments.apply(this, arguments);
}
// 发送评论
function _send_comments() {
_send_comments = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee6(params) {
return _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee6$(_context6) {
while (1) switch (_context6.prev = _context6.next) {
case 0:
return _context6.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .ZP)("/api/resource_libraries/".concat(params === null || params === void 0 ? void 0 : params.id, "/send_comments"), {
method: 'post',
body: params
}));
case 1:
case "end":
return _context6.stop();
}
}, _callee6);
}));
return _send_comments.apply(this, arguments);
}
function del_comment(_x6) {
return _del_comment.apply(this, arguments);
}
// 提交审核
function _del_comment() {
_del_comment = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee7(params) {
return _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee7$(_context7) {
while (1) switch (_context7.prev = _context7.next) {
case 0:
return _context7.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .ZP)("/api/resource_libraries/destroy_comment.json", {
method: 'post',
body: params
}));
case 1:
case "end":
return _context7.stop();
}
}, _callee7);
}));
return _del_comment.apply(this, arguments);
}
function submit_review(_x7) {
return _submit_review.apply(this, arguments);
}
// 审核通过
function _submit_review() {
_submit_review = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
while (1) switch (_context8.prev = _context8.next) {
case 0:
return _context8.abrupt("return", Fetch("/api/resource_libraries/".concat(params === null || params === void 0 ? void 0 : params.id, "/submit_review.json"), {
method: 'post',
body: params
}));
case 1:
case "end":
return _context8.stop();
}
}, _callee8);
}));
return _submit_review.apply(this, arguments);
}
function pass_review(_x8) {
return _pass_review.apply(this, arguments);
}
// 拒绝通过
function _pass_review() {
_pass_review = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
while (1) switch (_context9.prev = _context9.next) {
case 0:
return _context9.abrupt("return", Fetch("/api/resource_libraries/".concat(params === null || params === void 0 ? void 0 : params.id, "/pass_review.json"), {
method: 'post',
body: params
}));
case 1:
case "end":
return _context9.stop();
}
}, _callee9);
}));
return _pass_review.apply(this, arguments);
}
function refuse_review(_x9) {
return _refuse_review.apply(this, arguments);
}
// 取消公开
function _refuse_review() {
_refuse_review = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
while (1) switch (_context10.prev = _context10.next) {
case 0:
return _context10.abrupt("return", Fetch("/api/resource_libraries/".concat(params === null || params === void 0 ? void 0 : params.id, "/refuse_review.json"), {
method: 'post',
body: params
}));
case 1:
case "end":
return _context10.stop();
}
}, _callee10);
}));
return _refuse_review.apply(this, arguments);
}
function cancel_public(_x10) {
return _cancel_public.apply(this, arguments);
}
// 删除某个资源
function _cancel_public() {
_cancel_public = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
while (1) switch (_context11.prev = _context11.next) {
case 0:
return _context11.abrupt("return", Fetch("/api/resource_libraries/".concat(params === null || params === void 0 ? void 0 : params.id, "/cancel_public.json"), {
method: 'post',
body: params
}));
case 1:
case "end":
return _context11.stop();
}
}, _callee11);
}));
return _cancel_public.apply(this, arguments);
}
function del_review(_x11) {
return _del_review.apply(this, arguments);
}
function _del_review() {
_del_review = _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().mark(function _callee12(params) {
return _root_workspace_ppte5yg23_local_v9_test3_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_0___default()().wrap(function _callee12$(_context12) {
while (1) switch (_context12.prev = _context12.next) {
case 0:
return _context12.abrupt("return", (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .ZP)("/api/resource_libraries/".concat(params === null || params === void 0 ? void 0 : params.id, ".json"), {
method: 'delete',
body: params
}));
case 1:
case "end":
return _context12.stop();
}
}, _callee12);
}));
return _del_review.apply(this, arguments);
}
/***/ })
}]);