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__Video__Detail__id.async.js

1129 lines
50 KiB

"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[6444],{
/***/ 87526:
/*!*****************************************!*\
!*** ./src/components/NoData/index.tsx ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
/* harmony import */ var _assets_images_icons_nodata_png__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/assets/images/icons/nodata.png */ 93314);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! antd */ 3113);
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
const noData = ({
img,
buttonProps = {},
styles = {},
customText,
ButtonText,
ButtonClick,
Buttonclass,
ButtonTwo,
imgStyles,
loading = false
}) => {
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
"section",
{
className: "tc animated fadeIn",
style: __spreadValues(__spreadValues({}, { color: "#999", margin: "100px auto", visibility: loading ? "hidden" : "visible" }), styles)
},
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("img", { src: img || _assets_images_icons_nodata_png__WEBPACK_IMPORTED_MODULE_1__, style: __spreadProps(__spreadValues({}, imgStyles), { pointerEvents: "none", userSelect: "none" }) }),
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("p", { className: "mt20 font14" }, customText || "\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),
ButtonText && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(antd__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .ZP, __spreadValues({ className: Buttonclass, onClick: ButtonClick }, buttonProps), ButtonText),
ButtonTwo && ButtonTwo
);
};
/* harmony default export */ __webpack_exports__.Z = (noData);
/***/ }),
/***/ 90018:
/*!*********************************************************!*\
!*** ./src/components/PreviewAll/index.tsx + 1 modules ***!
\*********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ PreviewAll; }
});
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
;// CONCATENATED MODULE: ./src/components/PreviewAll/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var PreviewAllmodules = ({"wrp":"wrp___dq7YK","bgBlack":"bgBlack___ARIUV","monaco":"monaco___VnZC3","darkBlue":"darkBlue___UprA9","close":"close___LKoWu","embed":"embed___hvpEJ"});
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
var es_button = __webpack_require__(3113);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.7@@ant-design/icons/es/icons/ArrowDownOutlined.js + 1 modules
var ArrowDownOutlined = __webpack_require__(74516);
// EXTERNAL MODULE: ./src/components/monaco-editor/index.jsx + 4 modules
var monaco_editor = __webpack_require__(32150);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tooltip/index.js + 3 modules
var tooltip = __webpack_require__(6848);
// EXTERNAL MODULE: ./src/utils/util.tsx
var util = __webpack_require__(13462);
// EXTERNAL MODULE: ./src/service/exercise.ts
var exercise = __webpack_require__(41044);
// EXTERNAL MODULE: ./src/components/NoData/index.tsx
var NoData = __webpack_require__(87526);
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
var env = __webpack_require__(21873);
// EXTERNAL MODULE: ./src/service/attachment.ts
var attachment = __webpack_require__(4675);
;// CONCATENATED MODULE: ./src/components/PreviewAll/index.tsx
var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
/* harmony default export */ var PreviewAll = (({ editOffice = "view", data, theme, type, filename, monacoEditor, className, style, close, onClose, hasMask, disabledDownload, onImgDimensions, showNodata, recordInfo }) => {
const [src, setSrc] = (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");
const [token, setToken] = (0,_react_17_0_2_react.useState)("");
const [officeData, setOfficeData] = (0,_react_17_0_2_react.useState)();
const officePath = window.ENV === "build" ? "/react/build" : "";
const apiServer = location.host.startsWith("localhost") ? env/* default */.Z.PROXY_SERVER : env/* default */.Z.API_SERVER;
const unit = 1024 * 1024;
const maxSize = 10 * unit;
const closeRef = (0,_react_17_0_2_react.useRef)();
if ((data == null ? void 0 : data.startsWith("/api")) && type !== "txt") {
data = env/* default */.Z.API_SERVER + data;
}
const getFileExtension = (url) => {
const filename2 = url.substring(url.lastIndexOf("/") + 1);
const extension = filename2.split(".").pop();
return extension;
};
if (filename)
monacoEditor.filename = filename;
(0,_react_17_0_2_react.useEffect)(() => {
var _a, _b;
const cookies = (_b = (_a = document.cookie) == null ? void 0 : _a.replace(/\s/g, "")) == null ? void 0 : _b.split(";");
cookies == null ? void 0 : cookies.map((item) => {
let i = item.split("=");
if (i[0] === "_educoder_session") {
setToken(i[1]);
}
});
}, []);
(0,_react_17_0_2_react.useEffect)(() => {
if (type === "office") {
if (data.indexOf("bigfilescdn.") > -1 || data.indexOf("bigfiles1") > -1) {
setOfficeData({
url: data,
fileType: getFileExtension(data),
model: data.indexOf("model=edit") ? "edit" : "view"
});
} else {
getData();
}
}
}, [type, data]);
const getData = () => __async(void 0, null, function* () {
console.log("data:", data);
let _url = data;
if (!data.startsWith("http")) {
_url = location.origin + _url;
}
let _id = new URL(_url).pathname.split("/").pop();
const res = yield (0,exercise/* setEcsAttachment */.gJ)({ attachment_id: _id });
res.url = apiServer + res.url;
setOfficeData(res);
});
const handleClick = () => {
if (data.startsWith("http") || data.startsWith("blob:")) {
handleDown();
return;
}
(0,util/* downloadFile */.Sv)(filename || "educoder", data, filename);
};
const handleDown = () => {
if (recordInfo) {
(0,attachment/* add_file_quantity */.fc)({
id: recordInfo == null ? void 0 : recordInfo.id,
watch_type: 1,
course_id: recordInfo == null ? void 0 : recordInfo.course_id
});
}
(0,util/* downLoadLink */.Nd)(filename || "educoder", decodeURIComponent(data));
};
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: __spreadValues({}, style || {}), className: `${hasMask && PreviewAllmodules.bgBlack} ${!!type ? PreviewAllmodules.wrp : "hide"}` }, close && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: PreviewAllmodules.close, ref: closeRef }, !!onImgDimensions && /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8", getPopupContainer: () => closeRef.current }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { onClick: () => {
onClose();
onImgDimensions();
} }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "icon-yulanpizhu" }))), !disabledDownload && /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6", getPopupContainer: () => closeRef.current }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { onClick: handleDown }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "icon-quxiaozhiding" }))), /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u5173\u95ED", getPopupContainer: () => closeRef.current }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "", onClick: onClose }, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "icon-guanbi1" })))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: `${PreviewAllmodules[className]} ${className} ${PreviewAllmodules.monaco} ${type === "txt" ? "show" : "hide"}` }, type === "txt" && /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /* @__PURE__ */ _react_17_0_2_react.createElement(
monaco_editor/* default */.ZP,
__spreadValues({}, monacoEditor)
))), type === "audio" && /* @__PURE__ */ _react_17_0_2_react.createElement("audio", { src: `${(data == null ? void 0 : data.indexOf("http://")) > -1 || (data == null ? void 0 : data.indexOf("https://")) > -1 ? "" : "data:audio/mp3;base64,"}${data}`, autoPlay: true }), type === "video" && /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, (data == null ? void 0 : data.indexOf("http")) > -1 ? /* @__PURE__ */ _react_17_0_2_react.createElement("video", { controls: true, src: `${data}`, autoPlay: true }) : /* @__PURE__ */ _react_17_0_2_react.createElement("video", { controls: true, src: `data:video/mp4;base64,${data}`, autoPlay: true })), type === "office" && officeData && /* @__PURE__ */ _react_17_0_2_react.createElement("iframe", { src: `${officePath}/office.html?key=${officeData.key}&url=${btoa(officeData.url)}&callbackUrl=${apiServer + officeData.callbackUrl}&fileType=${officeData.fileType}&title=${officeData.title}&model=${editOffice}&officeServer=${env/* default */.Z.ONLYOFFICE}&disabledDownload=${!!disabledDownload}` }), type === "html" && /* @__PURE__ */ _react_17_0_2_react.createElement("iframe", { src: data + "&disposition=inline" }), type === "pdf" && /* @__PURE__ */ _react_17_0_2_react.createElement("iframe", { src: `${officePath}/js/pdfview/index.html?url=${data}&disabledDownload=${!!disabledDownload}` }), type === "image" && /* @__PURE__ */ _react_17_0_2_react.createElement("img", { src: `${(data == null ? void 0 : data.indexOf("http://")) > -1 || (data == null ? void 0 : data.indexOf("https://")) > -1 ? "" : "data:image/png;base64,"}${data}` }), (type === "other" || type === "download") && /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, showNodata ? /* @__PURE__ */ _react_17_0_2_react.createElement(NoData/* default */.Z, { customText: "\u5F53\u524D\u6587\u4EF6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u53EF\u70B9\u51FB\u4E0B\u8F7D\u67E5\u770B", ButtonTwo: /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { icon: /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: "iconfont icon-xiazai4 font14" }), type: "primary", size: "middle", onClick: handleClick }, "\u4E0B\u8F7D") }) : /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { type: "primary", size: "middle", onClick: handleClick }, /* @__PURE__ */ _react_17_0_2_react.createElement(ArrowDownOutlined/* default */.Z, null), "\u70B9\u51FB\u4E0B\u8F7D")));
});
/***/ }),
/***/ 75318:
/*!****************************************!*\
!*** ./src/components/useInterval.tsx ***!
\****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Z: function() { return /* binding */ useInterval; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
function useInterval(callback, delay) {
const savedCallback = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
savedCallback.current = callback;
});
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
function tick() {
savedCallback.current();
}
if (delay !== null) {
let id = setInterval(tick, delay);
return () => clearInterval(id);
}
}, [delay]);
}
/***/ }),
/***/ 32385:
/*!*****************************************************!*\
!*** ./src/pages/Video/Detail/[id].tsx + 5 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_; },
formatQuery: function() { return /* binding */ formatQuery; }
});
// 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 + 15 modules
var _umi_production_exports = __webpack_require__(67866);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/spin/index.js + 1 modules
var spin = __webpack_require__(71418);
;// CONCATENATED MODULE: ./src/pages/Video/Detail/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var Detailmodules = ({"bg":"bg___eq_Aq","container":"container___j770l","widthle":"widthle___ouh1T"});
// EXTERNAL MODULE: ./node_modules/_js-base64@2.6.4@js-base64/base64.js
var base64 = __webpack_require__(24334);
// EXTERNAL MODULE: ./src/components/Video/Play/index.jsx + 1 modules
var Play = __webpack_require__(97845);
// 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/rate/index.js + 8 modules
var rate = __webpack_require__(97022);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/switch/index.js + 2 modules
var es_switch = __webpack_require__(78673);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/empty/index.js + 3 modules
var empty = __webpack_require__(64165);
;// CONCATENATED MODULE: ./src/pages/Video/Detail/components/Content/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var Contentmodules = ({"contentWrap":"contentWrap___xMJQi","title":"title___z4t4P","footer":"footer___CLzrT","footer_left":"footer_left___N2sZZ","footer_bfcs":"footer_bfcs___UmvUE","footer_bfcs_value":"footer_bfcs_value___yiYga","pingfen":"pingfen___aEEMe","fenshu":"fenshu___I6HCo","radioGroup":"radioGroup___RT1dL","wrap":"wrap___QZGSJ","introName":"introName___m17tA","rating":"rating___MXLBr","modalRating":"modalRating___aluwj","zdbf":"zdbf___9PNEF"});
// EXTERNAL MODULE: ./src/components/useInterval.tsx
var useInterval = __webpack_require__(75318);
// EXTERNAL MODULE: ./src/service/video.ts
var video = __webpack_require__(65063);
// EXTERNAL MODULE: ./src/utils/util.tsx
var util = __webpack_require__(13462);
;// CONCATENATED MODULE: ./src/pages/Video/Detail/components/Content/index.tsx
/* provided dependency */ var React = __webpack_require__(/*! react */ 59301);
var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
const Content = (_a) => {
var _b = _a, { videoDetail, globalSetting, loading, dispatch } = _b, props = __objRest(_b, ["videoDetail", "globalSetting", "loading", "dispatch"]);
const { queryParams, selectParams, videoList } = videoDetail;
const { subject_id, videoId } = queryParams;
const { checkBoxValue, radioValue } = selectParams;
const params = { videoId };
const location = { query: queryParams };
const videoRef = (0,_react_17_0_2_react.useRef)();
const startVideoRef = (0,_react_17_0_2_react.useRef)();
const scoreRef = (0,_react_17_0_2_react.useRef)();
const timeRef = (0,_react_17_0_2_react.useRef)(5);
const { video_item } = videoDetail.detail || {};
(0,useInterval/* default */.Z)(() => __async(void 0, null, function* () {
if (startVideoRef.current) {
console.log("videoRef lastUpdatedTime: ", videoRef.current.getLastUpdatedTime());
console.log(videoRef.current);
yield handleViewVideo();
}
}), timeRef.current * 1e3);
const handleViewVideo = (isEnd = false) => {
const query = isEnd ? { is_f: 1 } : {};
return (0,video/* viewVideo */.DH)(__spreadValues(__spreadValues({}, query), {
id: params.videoId,
point: videoRef.current.getLastUpdatedTime(),
total: videoRef.current.getDuration()
}));
};
const handlLogWatchHistory = (query) => {
if (query.ed === "1") {
startVideoRef.current = false;
handleViewVideo(true);
}
if (!startVideoRef.current && !query.ed) {
startVideoRef.current = true;
timeRef.current = videoRef.current.getDuration() <= 5 ? 1 : 5;
handleViewVideo();
}
return dispatch({
type: "userDetail/logWatchHistory",
payload: query
});
};
const handlePause = () => {
startVideoRef.current = false;
};
const handlePlay = () => {
startVideoRef.current = true;
};
const handleChangeScore = () => {
scoreRef.current = 5;
modal["default"].confirm({
width: 600,
centered: true,
okText: "\u786E\u5B9A",
cancelText: "\u53D6\u6D88",
title: "\u8BF7\u7ED9\u672C\u89C6\u9891\u8BC4\u5206",
content: /* @__PURE__ */ React.createElement("div", { className: "tc font14" }, /* @__PURE__ */ React.createElement(
rate/* default */.Z,
{
defaultValue: scoreRef.current,
onChange: (value) => scoreRef.current = value,
className: Contentmodules.modalRating
}
)),
onOk: () => __async(void 0, null, function* () {
const res = yield (0,video/* starVideo */.jK)({ id: params.videoId, star: scoreRef.current });
if (res.status === 0) {
const { course_id } = (0,util/* getJsonFromUrl */.oP)();
dispatch({
type: "videoDetail/getVideoDetail",
payload: {
id: params.videoId,
videoId: params.videoId,
course_id,
subject_id
}
});
}
})
});
};
const handlePlayEnded = (el) => {
const newVideoList = window.filterVideoSign;
const currentVideoIndex = newVideoList.findIndex((v) => v.id === videoId);
const stopAutoPlay = currentVideoIndex === newVideoList.length - 1;
if (stopAutoPlay)
return;
const nextVideoId = newVideoList[currentVideoIndex + 1].id;
const isCanView = newVideoList[currentVideoIndex + 1].can_view;
const openLink = newVideoList[currentVideoIndex + 1].link;
const ispublic = newVideoList[currentVideoIndex + 1].is_public;
if (window.checkBoxValue) {
if (openLink) {
window.open(openLink);
return;
}
if (!isCanView) {
modal["default"].info({
centered: true,
width: 400,
okText: "\u77E5\u9053\u5566",
icon: null,
content: /* @__PURE__ */ React.createElement("div", { className: "tc font14" }, "\u4E0B\u4E00\u6761\u89C6\u9891\u4E3A\u521B\u5EFA\u8005\u6240\u5C5E\u5355\u4F4D\u5185\u90E8\u6559\u5B66\u8D44\u6599\uFF0C\u5916\u5355\u4F4D\u7528\u6237\u65E0\u89C2\u770B\u6743\u9650")
});
return;
}
if (!ispublic) {
modal["default"].info({
centered: true,
width: 400,
okText: "\u77E5\u9053\u5566",
icon: null,
content: /* @__PURE__ */ React.createElement("div", { className: "tc font14" }, "\u4E0B\u4E00\u6761\u89C6\u9891\u6682\u672A\u516C\u5F00\uFF0C\u656C\u8BF7\u671F\u5F85")
});
return;
}
dispatch({
type: "videoDetail/handleListItemClick",
payload: { videoId: nextVideoId }
});
window.videoTimer = setTimeout(() => {
el.current.play();
}, 2e3);
}
};
const onChange = (type, e) => {
if (type === "checkBox") {
const checked = e;
window.checkBoxValue = checked;
dispatch({
type: "videoDetail/setSelectValue",
payload: {
radioValue,
checkBoxValue: checked
}
});
return;
}
dispatch({
type: "videoDetail/setSelectValue",
payload: {
checkBoxValue,
radioValue: e.target.value
}
});
};
const stopNextVideo = () => {
const currentVideoIndex = videoList.findIndex((v) => v.id === videoId);
const stopAutoPlay = currentVideoIndex === videoList.length - 1;
return !stopAutoPlay ? /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
es_switch/* default */.Z,
{
onChange: (v) => {
onChange("checkBox", v);
},
defaultChecked: checkBoxValue,
size: "small"
}
), /* @__PURE__ */ React.createElement("span", { className: Contentmodules.zdbf }, "\u81EA\u52A8\u64AD\u653E\u4E0B\u4E00\u4E2A\u89C6\u9891")) : /* @__PURE__ */ React.createElement("div", null, "\u5F53\u524D\u5DF2\u662F\u6700\u540E\u4E00\u4E2A\u89C6\u9891");
};
return /* @__PURE__ */ React.createElement("aside", { className: Contentmodules.contentWrap }, /* @__PURE__ */ React.createElement("aside", { className: Contentmodules.wrap }, /* @__PURE__ */ React.createElement("header", null), /* @__PURE__ */ React.createElement("div", { className: Contentmodules.title }, video_item == null ? void 0 : video_item.name), !(video_item == null ? void 0 : video_item.can_edit) && !(video_item == null ? void 0 : video_item.is_public) ? /* @__PURE__ */ React.createElement(empty/* default */.Z, { description: "\u5F53\u524D\u89C6\u9891\u6682\u672A\u516C\u5F00\uFF0C\u656C\u8BF7\u671F\u5F85" }) : /* @__PURE__ */ React.createElement(
Play/* default */.Z,
{
ref: videoRef,
startTime: video_item == null ? void 0 : video_item.last_point,
src: (video_item == null ? void 0 : video_item.is_link) ? video_item == null ? void 0 : video_item.link : (video_item == null ? void 0 : video_item.play_url) && base64.Base64.decode(video_item == null ? void 0 : video_item.play_url),
videoId: video_item == null ? void 0 : video_item.video_id,
logWatchHistory: handlLogWatchHistory,
handlePause,
handlePlay,
allow_skip: video_item == null ? void 0 : video_item.allow_skip,
handlePlayEnded,
toLog: () => {
}
}
), /* @__PURE__ */ React.createElement("div", { className: Contentmodules.footer }, /* @__PURE__ */ React.createElement("div", { className: Contentmodules.footer_left }, /* @__PURE__ */ React.createElement("div", { className: Contentmodules.pingfen }, "\u8BC4\u5206"), /* @__PURE__ */ React.createElement(
rate/* default */.Z,
{
value: video_item == null ? void 0 : video_item.star,
disabled: true,
className: Contentmodules.rating,
style: { color: "#FFA100", fontSize: 12, marginLeft: 10 }
}
), /* @__PURE__ */ React.createElement("div", { className: Contentmodules.fenshu }, (video_item == null ? void 0 : video_item.star) || 0, "\u5206")), !(video_item == null ? void 0 : video_item.can_edit) && !(video_item == null ? void 0 : video_item.is_public) ? null : /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { className: Contentmodules.checkBox }, stopNextVideo()))), /* @__PURE__ */ React.createElement("div", { className: "mt10" }, (video_item == null ? void 0 : video_item.description) && /* @__PURE__ */ React.createElement("span", { className: Contentmodules.introName }, "\u7B80\u4ECB\uFF1A", video_item.description))));
};
/* harmony default export */ var components_Content = ((0,_umi_production_exports.connect)(({ videoDetail, loading, globalSetting }) => ({
videoDetail,
globalSetting,
loading
}))(Content));
// 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/tree/index.js + 8 modules
var tree = __webpack_require__(48209);
;// CONCATENATED MODULE: ./src/pages/Video/Detail/components/List/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var Listmodules = ({"flex_box_center":"flex_box_center___yWqSL","flex_space_between":"flex_space_between___LgFmv","flex_box_vertical_center":"flex_box_vertical_center____lt6U","flex_box_center_end":"flex_box_center_end___UqkaD","flex_box_column":"flex_box_column___V8XLF","list":"list___8tjfT","tree_style":"tree_style___ZzDvO","title":"title___IVfkQ","gray":"gray___RnyYk","brght":"brght___EWRNa","s1":"s1___dPBQg","s3":"s3___SRBBG","active":"active___hsNCX","tree_line":"tree_line___EGn30","tabs_style":"tabs_style___Nwkiq","tabs_item":"tabs_item___Vzu_U","tabs_item_active":"tabs_item_active___BcIwZ"});
// EXTERNAL MODULE: ./src/service/exercise.ts
var exercise = __webpack_require__(41044);
// EXTERNAL MODULE: ./src/service/shixuns.ts
var shixuns = __webpack_require__(30278);
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
var env = __webpack_require__(21873);
;// CONCATENATED MODULE: ./src/pages/Video/Detail/components/List/index.tsx
/* provided dependency */ var List_React = __webpack_require__(/*! react */ 59301);
var List_defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var List_getOwnPropSymbols = Object.getOwnPropertySymbols;
var List_hasOwnProp = Object.prototype.hasOwnProperty;
var List_propIsEnum = Object.prototype.propertyIsEnumerable;
var List_defNormalProp = (obj, key, value) => key in obj ? List_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var List_spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (List_hasOwnProp.call(b, prop))
List_defNormalProp(a, prop, b[prop]);
if (List_getOwnPropSymbols)
for (var prop of List_getOwnPropSymbols(b)) {
if (List_propIsEnum.call(b, prop))
List_defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var List_objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (List_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && List_getOwnPropSymbols)
for (var prop of List_getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && List_propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
var List_async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
const listType = [
{
name: "\u5B9E\u8DF5\u9879\u76EE",
type: "Shixun",
icon: /* @__PURE__ */ List_React.createElement("i", { className: "iconfont icon-shixun2 font20" }),
bq: /* @__PURE__ */ List_React.createElement("span", { style: { border: "1px solid #FF9D18", color: "#FF9D18" }, className: Listmodules.s1 }, "\u5B9E\u8BAD")
},
{
name: "\u89C6\u9891\u9879\u76EE",
type: "VideoItem",
icon: /* @__PURE__ */ List_React.createElement("i", { className: "iconfont icon-shipin font20" }),
bq: /* @__PURE__ */ List_React.createElement("span", { style: { border: "1px solid #9B18FF", color: "#9B18FF" }, className: Listmodules.s1 }, "\u89C6\u9891")
},
{
name: "\u6559\u5B66\u8BFE\u4EF6",
type: "Attachment",
icon: /* @__PURE__ */ List_React.createElement("i", { className: "iconfont icon-jiaoxueanli font20" }),
bq: /* @__PURE__ */ List_React.createElement("span", { style: { border: "1px solid #3061D0", color: "#3061D0" }, className: Listmodules.s1 }, "\u8D44\u6599")
},
{
name: "\u7A7A\u76EE\u5F55",
type: "StageCatalog",
icon: /* @__PURE__ */ List_React.createElement("i", { className: "iconfont icon-kongbai font20" }),
bq: /* @__PURE__ */ List_React.createElement("span", null)
}
];
const List = (_a) => {
var _b = _a, { dispatch, pathsDetail, videoDetail, user } = _b, props = List_objRest(_b, ["dispatch", "pathsDetail", "videoDetail", "user"]);
const { queryParams, stages, cust_seq, active } = videoDetail;
const { subject_id, course_id } = queryParams;
const params = (0,_umi_production_exports.useParams)();
const [searchParams] = (0,_umi_production_exports.useSearchParams)();
const [treeData, setTreeData] = (0,_react_17_0_2_react.useState)([]);
const [selectKeys, setSelectKeys] = (0,_react_17_0_2_react.useState)([(active == null ? void 0 : active.id) || Number(params.videoId)]);
const [tabs, settabes] = (0,_react_17_0_2_react.useState)("\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55");
const officeExtensions = [".PDF", ".DOC", ".DOCX", ".XLS", ".XLSX", ".PPT", ".PPTX"];
(0,_react_17_0_2_react.useEffect)(() => {
if (subject_id) {
dispatch({
type: "videoDetail/getStageData",
payload: {
subject_id,
page_type: "video"
}
});
} else {
dispatch({
type: "videoDetail/getCourseStageData",
payload: {
coursesId: course_id
}
});
}
}, []);
(0,_react_17_0_2_react.useEffect)(() => {
getTreeData();
}, [videoDetail == null ? void 0 : videoDetail.stages]);
const getTreeData = () => {
let arr = treeData;
stages.forEach((item, index) => {
arr.push({
title: /* @__PURE__ */ List_React.createElement("div", { title: item.stage_name, className: Listmodules.title }, item.stage_name),
value: item == null ? void 0 : item.stage_id,
key: item == null ? void 0 : item.stage_id,
icon: /* @__PURE__ */ List_React.createElement("i", { className: "iconfont icon-wenjianjia2 c-light-primary mr10", style: { lineHeight: "19px" } }),
children: transformTreeKey(item.items || [])
});
});
setTreeData(arr);
};
const transformTreeKey = (items) => {
function mapTree(org) {
var _a2;
const realChildren = org.children;
const haveChildren = Array.isArray(realChildren) && realChildren.length > 0;
const key = org == null ? void 0 : org.id;
const { name, item_type, id } = org;
const icon = (_a2 = listType.find((e) => e.type === item_type)) == null ? void 0 : _a2.bq;
const typeClassName = Listmodules.brght;
const activeClassName = active.id === id ? `${typeClassName} ${Listmodules.active}` : typeClassName;
return {
//分别将我们查询出来的值做出改变他的key
// title: <div title={org?.name} className={styles.s3} onClick={() => handleList(org)}>{org?.name}</div>,
title: /* @__PURE__ */ List_React.createElement("div", { onClick: () => handleList(org), className: typeClassName, title: name }, icon, /* @__PURE__ */ List_React.createElement("div", { className: Listmodules.s3 }, name)),
value: key,
key,
icon: /* @__PURE__ */ List_React.createElement("i", { className: "iconfont icon-wenjianjia2 c-light-primary mr10", style: { lineHeight: "19px" } }),
//判断它是否存在子集,若果存在就进行再次进行遍历操作,知道不存在子集便对其他的元素进行操作
children: haveChildren ? realChildren == null ? void 0 : realChildren.map((e) => mapTree(e)) : []
};
}
return items == null ? void 0 : items.map((org) => mapTree(org));
};
const toShixun = (id, is_jupyter) => List_async(void 0, null, function* () {
dispatch({
type: "globalSetting/setGlobalLoading",
payload: { show: true, text: "\u6B63\u5728\u8FDB\u5165\u5B9E\u8DF5\u9879\u76EE\uFF0C\u8BF7\u7A0D\u540E..." }
});
const execRes = is_jupyter ? yield (0,shixuns/* execJupyter */.BK)({ id }) : yield (0,shixuns/* execShixun */.Ir)({ id });
dispatch({
type: "globalSetting/setGlobalLoading",
payload: { show: false, text: "" }
});
if ((execRes == null ? void 0 : execRes.game_identifier) || (execRes == null ? void 0 : execRes.identifier)) {
(0,util/* openNewWindow */.xg)(
is_jupyter ? `/tasks/${execRes == null ? void 0 : execRes.identifier}/jupyter` : `/tasks/${execRes.game_identifier}`
);
return;
}
if ((execRes == null ? void 0 : execRes.status) === 2) {
handleResetGame(execRes == null ? void 0 : execRes.message);
} else if ((execRes == null ? void 0 : execRes.status) === 3) {
handleInBeta(execRes == null ? void 0 : execRes.message);
}
});
const handleInBeta = (message2) => {
modal["default"].confirm({
centered: true,
title: "\u63D0\u793A",
okText: "\u786E\u5B9A",
cancelText: "\u53D6\u6D88",
content: /* @__PURE__ */ List_React.createElement("div", { className: "tc font16" }, "\u76EE\u524D\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5C1A\u5728\u5185\u6D4B\u4E2D\uFF0C\u5C06\u4E8E", message2, "\u4E4B\u540E\u5F00\u653E\uFF0C\u8C22\u8C22\uFF01")
});
};
const handleResetGame = (url) => {
url = (url == null ? void 0 : url.includes(".json")) ? url : `${url}.json`;
modal["default"].confirm({
centered: true,
title: "\u63D0\u793A",
okText: "\u786E\u5B9A",
cancelText: "\u53D6\u6D88",
content: /* @__PURE__ */ List_React.createElement("div", { className: "tc font16" }, "\u5B9E\u8BAD\u5DF2\u7ECF\u66F4\u65B0\u4E86\uFF0C\u6B63\u5728\u4E3A\u60A8\u91CD\u7F6E!"),
onOk: () => List_async(void 0, null, function* () {
const res = yield (0,exercise/* resetMyGame */.$Q)({ url });
if (!res) {
return;
}
message/* default */.ZP.success("\u91CD\u7F6E\u6210\u529F\uFF0C\u6B63\u5728\u8FDB\u5165\u5B9E\u8DF5\u9879\u76EE\uFF01");
const execRes = yield (0,shixuns/* execShixun */.Ir)({ id: res.shixun_identifier });
if (execRes == null ? void 0 : execRes.game_identifier) {
(0,util/* openNewWindow */.xg)(`/tasks/${execRes.game_identifier}`);
return;
}
if ((execRes == null ? void 0 : execRes.status) === 2) {
handleResetGame(execRes == null ? void 0 : execRes.message);
} else if ((execRes == null ? void 0 : execRes.status) === 3) {
handleInBeta(execRes == null ? void 0 : execRes.message);
}
})
});
};
const handleList = (item) => {
var _a2, _b2, _c, _d, _e;
if ((item == null ? void 0 : item.item_type) === "StageCatalog") {
return;
}
clearTimeout(window.videoTimer);
const { id, item_type, identifier, is_jupyter, url, link } = item;
if (item_type === "VideoItem" && !link) {
if (!((_a2 = user.userInfo) == null ? void 0 : _a2.admin) && !((_b2 = user.userInfo) == null ? void 0 : _b2.business) && !item.can_view) {
modal["default"].info({
centered: true,
width: 400,
okText: "\u77E5\u9053\u5566",
icon: null,
content: /* @__PURE__ */ List_React.createElement("div", { className: "tc font14" }, "\u5F53\u524D\u89C6\u9891\u4E3A\u521B\u5EFA\u8005\u6240\u5C5E\u5355\u4F4D\u5185\u90E8\u6559\u5B66\u8D44\u6599\uFF0C\u5916\u5355\u4F4D\u7528\u6237\u65E0\u89C2\u770B\u6743\u9650")
});
return;
}
dispatch({
type: "videoDetail/handleListItemClick",
payload: { videoId: id }
});
dispatch({
type: "videoDetail/getVideoDetail",
payload: __spreadProps(List_spreadValues({
id
}, queryParams), {
videoId: id
}),
callback: (res) => {
if (res && res.video_item && !res.video_item.can_edit && !item.is_public) {
modal["default"].info({
centered: true,
width: 400,
okText: "\u77E5\u9053\u5566",
icon: null,
content: /* @__PURE__ */ List_React.createElement("div", { className: "tc font14" }, "\u5F53\u524D\u89C6\u9891\u6682\u672A\u516C\u5F00\uFF0C\u656C\u8BF7\u671F\u5F85")
});
return;
}
}
});
return;
}
if (item_type === "VideoItem" && !!link) {
if (item.link) {
(0,video/* viewVideo */.DH)({
is_f: 1,
id: item.id,
point: 0,
total: 0
});
}
window.open(link);
return;
}
if (item_type === "Shixun") {
toShixun(identifier, is_jupyter);
return;
}
if (item_type === "Attachment") {
if (link) {
(0,util/* openNewWindow */.xg)(link);
return;
}
let type = (_d = item == null ? void 0 : item.name) == null ? void 0 : _d.substr((_c = item == null ? void 0 : item.name) == null ? void 0 : _c.lastIndexOf("."));
if (!officeExtensions.includes(type.toUpperCase())) {
if (!((_e = pathsDetail.detail) == null ? void 0 : _e.allow_download)) {
message/* default */.ZP.info("\u6559\u5B66\u8BFE\u4EF6\u4E0D\u652F\u6301\u4E0B\u8F7D");
return;
}
(0,util/* downLoadFile */.FH)(item.name, env/* default */.Z.API_SERVER + item.url);
return;
} else {
dispatch({
type: "videoDetail/handleListItemClick",
payload: {
attachmentId: id
}
});
return;
}
}
window.open(env/* default */.Z.IMG_SERVER + url);
};
const toChinesNum = (num) => {
let changeNum = [
"\u96F6",
"\u4E00",
"\u4E8C",
"\u4E09",
"\u56DB",
"\u4E94",
"\u516D",
"\u4E03",
"\u516B",
"\u4E5D"
];
let unit = ["", "\u5341", "\u767E", "\u5343", "\u4E07"];
num = parseInt(num);
let getWan = (temp) => {
let strArr = temp.toString().split("").reverse();
let newNum = "";
for (var i = 0; i < strArr.length; i++) {
newNum = (i == 0 && strArr[i] == 0 ? "" : i > 0 && strArr[i] == 0 && strArr[i - 1] == 0 ? "" : changeNum[strArr[i]] + (strArr[i] == 0 ? unit[0] : unit[i])) + newNum;
}
return newNum;
};
let overWan = Math.floor(num / 1e4);
let noWan = num % 1e4;
if (noWan.toString().length < 4)
noWan = "0" + noWan;
return overWan ? getWan(overWan) + "\u4E07" + getWan(noWan) : getWan(num);
};
const renderLThreeItem = (item, itemIndex, eIndex, elIndex) => {
var _a2;
const { name, item_type, id } = item;
const serialNumber = `${itemIndex + 1}-${eIndex + 1}-${elIndex + 1}`;
const icon = (_a2 = listType.find((e) => e.type === item_type)) == null ? void 0 : _a2.icon;
const typeClassName = Listmodules.brght;
const activeClassName = active.id === id ? `${typeClassName} ${Listmodules.active}` : typeClassName;
return /* @__PURE__ */ List_React.createElement(
"div",
{
key: serialNumber,
onClick: () => handleList(item),
className: activeClassName,
style: { paddingLeft: 52 }
},
/* @__PURE__ */ List_React.createElement("span", { className: Listmodules.s1 }, icon),
!!cust_seq && /* @__PURE__ */ List_React.createElement("span", { className: Listmodules.s2 }, serialNumber),
/* @__PURE__ */ List_React.createElement("span", { className: Listmodules.s3 }, "\u203B ", name)
);
};
const renderListItem = (item, itemIndex, eIndex) => {
var _a2;
const { name, item_type, id, children } = item;
const serialNumber = `${itemIndex + 1}-${eIndex + 1}`;
const icon = (_a2 = listType.find((e) => e.type === item_type)) == null ? void 0 : _a2.icon;
const typeClassName = Listmodules.brght;
const activeClassName = active.id === id ? `${typeClassName} ${Listmodules.active}` : typeClassName;
return /* @__PURE__ */ List_React.createElement(_react_17_0_2_react.Fragment, { key: serialNumber }, /* @__PURE__ */ List_React.createElement("div", { onClick: () => handleList(item), className: activeClassName }, /* @__PURE__ */ List_React.createElement("span", { className: Listmodules.s1 }, icon), !!cust_seq && /* @__PURE__ */ List_React.createElement("span", { className: Listmodules.s2 }, serialNumber), /* @__PURE__ */ List_React.createElement("span", { className: Listmodules.s3 }, "\u203B ", name)), !!children.length && children.map(
(el, elIndex) => renderLThreeItem(el, itemIndex, eIndex, elIndex)
));
};
return /* @__PURE__ */ List_React.createElement("aside", { className: Listmodules.list }, /* @__PURE__ */ List_React.createElement("div", { className: Listmodules.tabs_style }, /* @__PURE__ */ List_React.createElement("div", { className: Listmodules.tabs_item, onClick: () => {
settabes("\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55");
} }, "\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55", tabs == "\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55" && /* @__PURE__ */ List_React.createElement("div", { className: Listmodules.tabs_item_active }))), /* @__PURE__ */ List_React.createElement("div", { className: Listmodules.tree_style }, (treeData == null ? void 0 : treeData.length) > 0 && /* @__PURE__ */ List_React.createElement(
tree["default"],
{
selectedKeys: selectKeys,
onSelect: (keys, e) => {
setSelectKeys([...keys]);
},
blockNode: true,
treeData,
defaultExpandAll: true,
className: Listmodules.tree_line
}
)));
};
/* harmony default export */ var components_List = ((0,_umi_production_exports.connect)(
({
user,
videoDetail,
loading,
globalSetting,
pathsDetail
}) => ({
user,
videoDetail,
globalSetting,
loading,
pathsDetail
})
)(List));
// EXTERNAL MODULE: ./src/components/PreviewAll/index.tsx + 1 modules
var PreviewAll = __webpack_require__(90018);
;// CONCATENATED MODULE: ./src/pages/Video/Detail/[id].tsx
var _id_defProp = Object.defineProperty;
var _id_defProps = Object.defineProperties;
var _id_getOwnPropDescs = Object.getOwnPropertyDescriptors;
var _id_getOwnPropSymbols = Object.getOwnPropertySymbols;
var _id_hasOwnProp = Object.prototype.hasOwnProperty;
var _id_propIsEnum = Object.prototype.propertyIsEnumerable;
var _id_defNormalProp = (obj, key, value) => key in obj ? _id_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var _id_spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (_id_hasOwnProp.call(b, prop))
_id_defNormalProp(a, prop, b[prop]);
if (_id_getOwnPropSymbols)
for (var prop of _id_getOwnPropSymbols(b)) {
if (_id_propIsEnum.call(b, prop))
_id_defNormalProp(a, prop, b[prop]);
}
return a;
};
var _id_spreadProps = (a, b) => _id_defProps(a, _id_getOwnPropDescs(b));
var _id_objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (_id_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && _id_getOwnPropSymbols)
for (var prop of _id_getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && _id_propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
var _id_async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
const formatQuery = (query) => {
const { subject_id } = query;
return {
subject_id,
course_id: subject_id
};
};
const VideoDetailPage = (_a) => {
var _b = _a, {
videoDetail,
globalSetting,
loading,
pathsDetail,
dispatch
} = _b, props = _id_objRest(_b, [
"videoDetail",
"globalSetting",
"loading",
"pathsDetail",
"dispatch"
]);
var _a2, _b2;
const { queryParams, videoList, attachmentList, active } = videoDetail;
const { subject_id, videoId } = queryParams;
const params = { videoId };
(0,_react_17_0_2_react.useEffect)(() => {
if (active) {
const { item_type, id } = active;
if (item_type === "VideoItem") {
dispatch({
type: "videoDetail/getVideoDetail",
payload: _id_spreadProps(_id_spreadValues({}, queryParams), {
id
})
});
}
}
}, [active.id]);
console.log("---", active);
(0,_react_17_0_2_react.useEffect)(() => {
if (subject_id)
getdata();
}, []);
function getdata() {
return _id_async(this, null, function* () {
const res = yield dispatch({
type: "pathsDetail/getPathsDetail",
payload: {
id: subject_id
}
});
});
}
(0,_react_17_0_2_react.useEffect)(() => {
var _a3, _b3;
(0,util/* setDocumentTitle */.Dk)((_b3 = (_a3 = videoDetail.detail) == null ? void 0 : _a3.video_item) == null ? void 0 : _b3.name);
}, [videoDetail]);
let style = {
width: 1200
};
if (active && active.item_type === "Attachment" && active.content_type === "application/pdf") {
style = {
// width: `calc(100vw - ((100vw - 1200px) / 2) - 15px)`,
width: 1250,
marginLeft: (document.body.clientWidth - 1200) / 2
};
}
return /* @__PURE__ */ _react_17_0_2_react.createElement(spin/* default */.Z, { spinning: false }, /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: Detailmodules.bg }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Detailmodules.container, style }, /* @__PURE__ */ _react_17_0_2_react.createElement(components_List, null), active && active.item_type === "VideoItem" && /* @__PURE__ */ _react_17_0_2_react.createElement(components_Content, null), active && active.item_type === "Attachment" && active.content_type === "application/pdf" && active.url && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Detailmodules.widthle }, /* @__PURE__ */ _react_17_0_2_react.createElement(
PreviewAll/* default */.Z,
{
disabledDownload: !((_a2 = pathsDetail.detail) == null ? void 0 : _a2.allow_download),
type: "pdf",
data: env/* default */.Z.API_SERVER + active.url,
style: { position: "absolute", zIndex: 1 }
}
)), active && active.item_type === "Attachment" && [
"application/msword",
"application/vnd.ms-excel",
"application/vnd.ms-powerpoint",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
].includes(active.content_type) && active.url && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Detailmodules.widthle }, /* @__PURE__ */ _react_17_0_2_react.createElement(
PreviewAll/* default */.Z,
{
disabledDownload: !((_b2 = pathsDetail.detail) == null ? void 0 : _b2.allow_download),
type: "office",
data: env/* default */.Z.API_SERVER + active.url,
style: { position: "absolute", zIndex: 1 }
}
)))));
};
/* harmony default export */ var _id_ = ((0,_umi_production_exports.connect)(
({
videoDetail,
loading,
globalSetting,
pathsDetail
}) => ({
videoDetail,
globalSetting,
loading,
pathsDetail
})
)(VideoDetailPage));
/***/ })
}]);