|
|
|
|
@ -917,37 +917,73 @@ var Journal = function Journal() {
|
|
|
|
|
data = _useState10[0],
|
|
|
|
|
setData = _useState10[1];
|
|
|
|
|
var _useState11 = (0,_react_17_0_2_react.useState)({
|
|
|
|
|
type: '',
|
|
|
|
|
content: ''
|
|
|
|
|
content: "",
|
|
|
|
|
type: ""
|
|
|
|
|
}),
|
|
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
|
|
previewData = _useState12[0],
|
|
|
|
|
setPreviewData = _useState12[1];
|
|
|
|
|
var getData = /*#__PURE__*/function () {
|
|
|
|
|
var _ref = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
|
|
var res, _res$data;
|
|
|
|
|
var monacoValueRef = (0,_react_17_0_2_react.useRef)();
|
|
|
|
|
var preview = /*#__PURE__*/function () {
|
|
|
|
|
var _ref = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(item) {
|
|
|
|
|
var res;
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
setLoading(true);
|
|
|
|
|
if (!((item === null || item === void 0 ? void 0 : item.file_type) === "txt")) {
|
|
|
|
|
_context.next = 5;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
_context.next = 3;
|
|
|
|
|
return (0,fetch/* default */.ZP)(item === null || item === void 0 ? void 0 : item.url, {
|
|
|
|
|
method: "get",
|
|
|
|
|
headers: {
|
|
|
|
|
"Content-Type": "application/xml"
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
case 3:
|
|
|
|
|
res = _context.sent;
|
|
|
|
|
monacoValueRef.current = res;
|
|
|
|
|
case 5:
|
|
|
|
|
setPreviewData({
|
|
|
|
|
type: item === null || item === void 0 ? void 0 : item.file_type,
|
|
|
|
|
content: item === null || item === void 0 ? void 0 : item.url
|
|
|
|
|
});
|
|
|
|
|
case 6:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context.stop();
|
|
|
|
|
}
|
|
|
|
|
}, _callee);
|
|
|
|
|
}));
|
|
|
|
|
return function preview(_x) {
|
|
|
|
|
return _ref.apply(this, arguments);
|
|
|
|
|
};
|
|
|
|
|
}();
|
|
|
|
|
var getData = /*#__PURE__*/function () {
|
|
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
|
|
var res, _res$data;
|
|
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
setLoading(true);
|
|
|
|
|
_context2.next = 3;
|
|
|
|
|
return (0,magazine/* getMagazinDetail */.lR)(objectSpread2_default()({
|
|
|
|
|
id: urlParams === null || urlParams === void 0 ? void 0 : urlParams.id
|
|
|
|
|
}, params));
|
|
|
|
|
case 3:
|
|
|
|
|
res = _context.sent;
|
|
|
|
|
res = _context2.sent;
|
|
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
|
|
setData(res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.categories);
|
|
|
|
|
}
|
|
|
|
|
setLoading(false);
|
|
|
|
|
case 6:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context.stop();
|
|
|
|
|
return _context2.stop();
|
|
|
|
|
}
|
|
|
|
|
}, _callee);
|
|
|
|
|
}, _callee2);
|
|
|
|
|
}));
|
|
|
|
|
return function getData() {
|
|
|
|
|
return _ref.apply(this, arguments);
|
|
|
|
|
return _ref2.apply(this, arguments);
|
|
|
|
|
};
|
|
|
|
|
}();
|
|
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
|
|
@ -1005,8 +1041,8 @@ var Journal = function Journal() {
|
|
|
|
|
year: activeKey[0]
|
|
|
|
|
}));
|
|
|
|
|
},
|
|
|
|
|
expandIcon: function expandIcon(_ref2) {
|
|
|
|
|
var isActive = _ref2.isActive;
|
|
|
|
|
expandIcon: function expandIcon(_ref3) {
|
|
|
|
|
var isActive = _ref3.isActive;
|
|
|
|
|
return isActive ? /*#__PURE__*/(0,jsx_runtime.jsx)(CaretDownOutlined/* default */.Z, {}) : /*#__PURE__*/(0,jsx_runtime.jsx)(CaretRightOutlined/* default */.Z, {});
|
|
|
|
|
},
|
|
|
|
|
activeKey: params.year,
|
|
|
|
|
@ -1048,7 +1084,8 @@ var Journal = function Journal() {
|
|
|
|
|
},
|
|
|
|
|
onClick: function onClick() {
|
|
|
|
|
if (article !== null && article !== void 0 && article.preview_url) {
|
|
|
|
|
(0,util/* openNewWindow */.xg)(article === null || article === void 0 ? void 0 : article.preview_url);
|
|
|
|
|
preview(item);
|
|
|
|
|
// openNewWindow(article?.preview_url)
|
|
|
|
|
// setPreviewData({
|
|
|
|
|
// type: article?.type,
|
|
|
|
|
// content: article?.preview_url,
|
|
|
|
|
@ -1079,13 +1116,25 @@ var Journal = function Journal() {
|
|
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(PreviewAll/* default */.Z, {
|
|
|
|
|
close: true,
|
|
|
|
|
data: previewData === null || previewData === void 0 ? void 0 : previewData.content,
|
|
|
|
|
type: previewData === null || previewData === void 0 ? void 0 : previewData.type
|
|
|
|
|
// style={{...stylesPrev}}
|
|
|
|
|
,
|
|
|
|
|
type: previewData === null || previewData === void 0 ? void 0 : previewData.type,
|
|
|
|
|
hasMask: true,
|
|
|
|
|
monacoEditor: {
|
|
|
|
|
value: monacoValueRef.current,
|
|
|
|
|
language: "txt",
|
|
|
|
|
onChange: function onChange() {},
|
|
|
|
|
options: {
|
|
|
|
|
readOnly: true,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
minimap: {
|
|
|
|
|
enabled: false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onImgDimensions: null,
|
|
|
|
|
onClose: function onClose() {
|
|
|
|
|
setPreviewData({
|
|
|
|
|
type: '',
|
|
|
|
|
content: ''
|
|
|
|
|
content: "",
|
|
|
|
|
type: ""
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})]
|