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.
1175 lines
44 KiB
1175 lines
44 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[96444],{
|
|
|
|
/***/ 93802:
|
|
/*!****************************************!*\
|
|
!*** ./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) {
|
|
var savedCallback = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
|
|
// 保存新回调
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
savedCallback.current = callback;
|
|
});
|
|
|
|
// 建立 interval
|
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
function tick() {
|
|
savedCallback.current();
|
|
}
|
|
if (delay !== null) {
|
|
var id = setInterval(tick, delay);
|
|
return function () {
|
|
return clearInterval(id);
|
|
};
|
|
}
|
|
}, [delay]);
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 43940:
|
|
/*!*****************************************************!*\
|
|
!*** ./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/_@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/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__(82242);
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectWithoutProperties.js
|
|
var objectWithoutProperties = __webpack_require__(39647);
|
|
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
|
|
var _umi_production_exports = __webpack_require__(80184);
|
|
// EXTERNAL MODULE: ./node_modules/_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__(59158);
|
|
// 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__(13570);
|
|
// 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__(93802);
|
|
// EXTERNAL MODULE: ./src/service/video.ts
|
|
var video = __webpack_require__(73140);
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
var util = __webpack_require__(1079);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
;// CONCATENATED MODULE: ./src/pages/Video/Detail/components/Content/index.tsx
|
|
|
|
|
|
|
|
|
|
var _excluded = ["videoDetail", "globalSetting", "loading", "dispatch"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Content = function Content(_ref) {
|
|
var videoDetail = _ref.videoDetail,
|
|
globalSetting = _ref.globalSetting,
|
|
loading = _ref.loading,
|
|
dispatch = _ref.dispatch,
|
|
props = objectWithoutProperties_default()(_ref, _excluded);
|
|
// const params = useParams<any>();
|
|
// const location = useLocation() as any;
|
|
var queryParams = videoDetail.queryParams,
|
|
selectParams = videoDetail.selectParams,
|
|
videoList = videoDetail.videoList;
|
|
var subject_id = queryParams.subject_id,
|
|
videoId = queryParams.videoId;
|
|
var checkBoxValue = selectParams.checkBoxValue,
|
|
radioValue = selectParams.radioValue;
|
|
var params = {
|
|
videoId: videoId
|
|
};
|
|
var location = {
|
|
query: queryParams
|
|
};
|
|
var videoRef = (0,_react_17_0_2_react.useRef)();
|
|
var startVideoRef = (0,_react_17_0_2_react.useRef)();
|
|
var scoreRef = (0,_react_17_0_2_react.useRef)();
|
|
var timeRef = (0,_react_17_0_2_react.useRef)(5);
|
|
var _ref2 = videoDetail.detail || {},
|
|
video_item = _ref2.video_item;
|
|
(0,useInterval/* default */.Z)( /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
while (1) switch (_context.prev = _context.next) {
|
|
case 0:
|
|
if (!startVideoRef.current) {
|
|
_context.next = 5;
|
|
break;
|
|
}
|
|
console.log("videoRef lastUpdatedTime: ", videoRef.current.getLastUpdatedTime());
|
|
console.log(videoRef.current);
|
|
|
|
// 间隔3秒 记录播放时间
|
|
_context.next = 5;
|
|
return handleViewVideo();
|
|
case 5:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
})), timeRef.current * 1000);
|
|
var handleViewVideo = function handleViewVideo() {
|
|
var isEnd = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
var query = isEnd ? {
|
|
is_f: 1
|
|
} : {};
|
|
return (0,video/* viewVideo */.DH)(objectSpread2_default()(objectSpread2_default()({}, query), {
|
|
id: params.videoId,
|
|
point: videoRef.current.getLastUpdatedTime(),
|
|
total: videoRef.current.getDuration()
|
|
}));
|
|
};
|
|
var handlLogWatchHistory = function 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
|
|
});
|
|
};
|
|
var handlePause = function handlePause() {
|
|
startVideoRef.current = false;
|
|
};
|
|
var handlePlay = function handlePlay() {
|
|
// if () {
|
|
// Modal.info({
|
|
// centered: true,
|
|
// width: 400,
|
|
// okText: '知道啦',
|
|
// icon: null,
|
|
// content: <div className="tc font14">当前视频暂未公开,敬请期待</div>
|
|
// });
|
|
// return;
|
|
// }
|
|
startVideoRef.current = true;
|
|
};
|
|
var handleChangeScore = function handleChangeScore() {
|
|
scoreRef.current = 5;
|
|
modal/* default */.Z.confirm({
|
|
width: 600,
|
|
centered: true,
|
|
okText: '确定',
|
|
cancelText: '取消',
|
|
title: '请给本视频评分',
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "tc font14",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(rate/* default */.Z, {
|
|
defaultValue: scoreRef.current,
|
|
onChange: function onChange(value) {
|
|
return scoreRef.current = value;
|
|
},
|
|
className: Contentmodules.modalRating
|
|
})
|
|
}),
|
|
onOk: function () {
|
|
var _onOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
var res, _getJsonFromUrl, course_id;
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
case 0:
|
|
_context2.next = 2;
|
|
return (0,video/* starVideo */.jK)({
|
|
id: params.videoId,
|
|
star: scoreRef.current
|
|
});
|
|
case 2:
|
|
res = _context2.sent;
|
|
if (res.status === 0) {
|
|
_getJsonFromUrl = (0,util/* getJsonFromUrl */.oP)(), course_id = _getJsonFromUrl.course_id;
|
|
dispatch({
|
|
type: "videoDetail/getVideoDetail",
|
|
payload: {
|
|
id: params.videoId,
|
|
videoId: params.videoId,
|
|
course_id: course_id,
|
|
subject_id: subject_id
|
|
}
|
|
});
|
|
}
|
|
case 4:
|
|
case "end":
|
|
return _context2.stop();
|
|
}
|
|
}, _callee2);
|
|
}));
|
|
function onOk() {
|
|
return _onOk.apply(this, arguments);
|
|
}
|
|
return onOk;
|
|
}()
|
|
});
|
|
};
|
|
var handlePlayEnded = function handlePlayEnded(el) {
|
|
// const newVideoList=JSON.parse(JSON.stringify(videoList));
|
|
var newVideoList = window.filterVideoSign;
|
|
var currentVideoIndex = newVideoList.findIndex(function (v) {
|
|
return v.id === videoId;
|
|
});
|
|
var stopAutoPlay = currentVideoIndex === newVideoList.length - 1;
|
|
if (stopAutoPlay) return;
|
|
var nextVideoId = newVideoList[currentVideoIndex + 1].id;
|
|
var isCanView = newVideoList[currentVideoIndex + 1].can_view;
|
|
var openLink = newVideoList[currentVideoIndex + 1].link;
|
|
var ispublic = newVideoList[currentVideoIndex + 1].is_public;
|
|
if (window.checkBoxValue) {
|
|
if (openLink) {
|
|
window.open(openLink);
|
|
return;
|
|
}
|
|
if (!isCanView) {
|
|
modal/* default */.Z.info({
|
|
centered: true,
|
|
width: 400,
|
|
okText: '知道啦',
|
|
icon: null,
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "tc font14",
|
|
children: "\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 */.Z.info({
|
|
centered: true,
|
|
width: 400,
|
|
okText: '知道啦',
|
|
icon: null,
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "tc font14",
|
|
children: "\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(function () {
|
|
el.current.play();
|
|
}, 2000);
|
|
}
|
|
};
|
|
var _onChange = function onChange(type, e) {
|
|
if (type === 'checkBox') {
|
|
var checked = e;
|
|
window.checkBoxValue = checked; //全局标记使用,勿删
|
|
dispatch({
|
|
type: "videoDetail/setSelectValue",
|
|
payload: {
|
|
radioValue: radioValue,
|
|
checkBoxValue: checked
|
|
}
|
|
});
|
|
return;
|
|
}
|
|
dispatch({
|
|
type: "videoDetail/setSelectValue",
|
|
payload: {
|
|
checkBoxValue: checkBoxValue,
|
|
radioValue: e.target.value
|
|
}
|
|
});
|
|
};
|
|
var stopNextVideo = function stopNextVideo() {
|
|
var currentVideoIndex = videoList.findIndex(function (v) {
|
|
return v.id === videoId;
|
|
});
|
|
var stopAutoPlay = currentVideoIndex === videoList.length - 1;
|
|
return !stopAutoPlay ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_switch/* default */.Z, {
|
|
onChange: function onChange(v) {
|
|
_onChange('checkBox', v);
|
|
},
|
|
defaultChecked: checkBoxValue,
|
|
size: "small"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Contentmodules.zdbf,
|
|
children: "\u81EA\u52A8\u64AD\u653E\u4E0B\u4E00\u4E2A\u89C6\u9891"
|
|
})]
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
children: "\u5F53\u524D\u5DF2\u662F\u6700\u540E\u4E00\u4E2A\u89C6\u9891"
|
|
});
|
|
};
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
|
|
className: Contentmodules.contentWrap,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
className: Contentmodules.wrap,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("header", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Contentmodules.title,
|
|
children: video_item === null || video_item === void 0 ? void 0 : video_item.name
|
|
}), !(video_item !== null && video_item !== void 0 && video_item.can_edit) && !(video_item !== null && video_item !== void 0 && video_item.is_public) ? /*#__PURE__*/(0,jsx_runtime.jsx)(empty/* default */.Z, {
|
|
description: "\u5F53\u524D\u89C6\u9891\u6682\u672A\u516C\u5F00\uFF0C\u656C\u8BF7\u671F\u5F85"
|
|
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(Play/* default */.Z, {
|
|
ref: videoRef,
|
|
startTime: video_item === null || video_item === void 0 ? void 0 : video_item.last_point,
|
|
src: video_item !== null && video_item !== void 0 && video_item.is_link ? video_item === null || video_item === void 0 ? void 0 : video_item.link : (video_item === null || video_item === void 0 ? void 0 : video_item.play_url) && base64.Base64.decode(video_item === null || video_item === void 0 ? void 0 : video_item.play_url),
|
|
videoId: video_item === null || video_item === void 0 ? void 0 : video_item.video_id,
|
|
logWatchHistory: handlLogWatchHistory,
|
|
handlePause: handlePause,
|
|
handlePlay: handlePlay
|
|
// videoSpeed={radioValue}
|
|
,
|
|
allow_skip: video_item === null || video_item === void 0 ? void 0 : video_item.allow_skip,
|
|
handlePlayEnded: handlePlayEnded,
|
|
toLog: function toLog() {}
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Contentmodules.footer,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Contentmodules.footer_left,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Contentmodules.footer_bfcs,
|
|
children: "\u64AD\u653E\u6B21\u6570 "
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Contentmodules.footer_bfcs_value,
|
|
children: (video_item === null || video_item === void 0 ? void 0 : video_item.itemstudy_video_items_count) || 0
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Contentmodules.pingfen,
|
|
children: "\u8BC4\u5206"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(rate/* default */.Z, {
|
|
value: video_item === null || video_item === void 0 ? void 0 : video_item.star,
|
|
disabled: true,
|
|
className: Contentmodules.rating,
|
|
style: {
|
|
color: '#FFA100',
|
|
fontSize: 12,
|
|
marginLeft: 10
|
|
}
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Contentmodules.fenshu,
|
|
children: [(video_item === null || video_item === void 0 ? void 0 : video_item.star) || 0, "\u5206"]
|
|
})]
|
|
}), !(video_item !== null && video_item !== void 0 && video_item.can_edit) && !(video_item !== null && video_item !== void 0 && video_item.is_public) ? null : /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Contentmodules.checkBox,
|
|
children: stopNextVideo()
|
|
})
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "mt10",
|
|
children: (video_item === null || video_item === void 0 ? void 0 : video_item.description) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
className: Contentmodules.introName,
|
|
children: ["\u7B80\u4ECB\uFF1A", video_item.description]
|
|
})
|
|
})]
|
|
})
|
|
});
|
|
};
|
|
/* harmony default export */ var components_Content = ((0,_umi_production_exports.connect)(function (_ref4) {
|
|
var videoDetail = _ref4.videoDetail,
|
|
loading = _ref4.loading,
|
|
globalSetting = _ref4.globalSetting;
|
|
return {
|
|
videoDetail: videoDetail,
|
|
globalSetting: globalSetting,
|
|
loading: loading
|
|
};
|
|
})(Content));
|
|
// 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/_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__(41416);
|
|
;// 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__(26613);
|
|
// EXTERNAL MODULE: ./src/service/shixuns.ts
|
|
var shixuns = __webpack_require__(18240);
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
var env = __webpack_require__(67390);
|
|
;// CONCATENATED MODULE: ./src/pages/Video/Detail/components/List/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
var List_excluded = ["dispatch", "pathsDetail", "videoDetail", "user"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var listType = [{
|
|
name: '实践项目',
|
|
type: 'Shixun',
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-shixun2 font20"
|
|
}),
|
|
bq: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
style: {
|
|
border: '1px solid #FF9D18',
|
|
color: '#FF9D18'
|
|
},
|
|
className: Listmodules.s1,
|
|
children: "\u5B9E\u8BAD"
|
|
})
|
|
}, {
|
|
name: '视频项目',
|
|
type: 'VideoItem',
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-shipin font20"
|
|
}),
|
|
bq: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
style: {
|
|
border: '1px solid #9B18FF',
|
|
color: '#9B18FF'
|
|
},
|
|
className: Listmodules.s1,
|
|
children: "\u89C6\u9891"
|
|
})
|
|
}, {
|
|
name: '教学课件',
|
|
type: 'Attachment',
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-jiaoxueanli font20"
|
|
}),
|
|
bq: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
style: {
|
|
border: '1px solid #3061D0',
|
|
color: '#3061D0'
|
|
},
|
|
className: Listmodules.s1,
|
|
children: "\u8D44\u6599"
|
|
})
|
|
}, {
|
|
name: '空目录',
|
|
type: 'StageCatalog',
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-kongbai font20"
|
|
}),
|
|
bq: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {})
|
|
}];
|
|
var List = function List(_ref) {
|
|
var dispatch = _ref.dispatch,
|
|
pathsDetail = _ref.pathsDetail,
|
|
videoDetail = _ref.videoDetail,
|
|
user = _ref.user,
|
|
props = objectWithoutProperties_default()(_ref, List_excluded);
|
|
var queryParams = videoDetail.queryParams,
|
|
stages = videoDetail.stages,
|
|
cust_seq = videoDetail.cust_seq,
|
|
active = videoDetail.active;
|
|
var subject_id = queryParams.subject_id,
|
|
course_id = queryParams.course_id;
|
|
var _useSearchParams = (0,_umi_production_exports.useSearchParams)(),
|
|
_useSearchParams2 = slicedToArray_default()(_useSearchParams, 1),
|
|
searchParams = _useSearchParams2[0];
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
treeData = _useState2[0],
|
|
setTreeData = _useState2[1];
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(0),
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
activeid = _useState4[0],
|
|
setactiveid = _useState4[1];
|
|
var _useState5 = (0,_react_17_0_2_react.useState)('课程资源目录'),
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
tabs = _useState6[0],
|
|
settabes = _useState6[1];
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
if (subject_id) {
|
|
dispatch({
|
|
type: 'videoDetail/getStageData',
|
|
payload: {
|
|
subject_id: subject_id,
|
|
page_type: 'video'
|
|
}
|
|
});
|
|
} else {
|
|
dispatch({
|
|
type: 'videoDetail/getCourseStageData',
|
|
payload: {
|
|
coursesId: course_id
|
|
}
|
|
});
|
|
}
|
|
}, []);
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
console.log(activeid);
|
|
}, [activeid]);
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
console.log("2222", videoDetail);
|
|
if (stages) {
|
|
console.log('xxxx');
|
|
}
|
|
getTreeData();
|
|
}, [videoDetail === null || videoDetail === void 0 ? void 0 : videoDetail.stages]);
|
|
var getTreeData = function getTreeData() {
|
|
console.log(stages);
|
|
var arr = treeData;
|
|
stages.forEach(function (item, index) {
|
|
arr.push({
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
title: item.stage_name,
|
|
className: Listmodules.title,
|
|
children: item.stage_name
|
|
}),
|
|
value: item === null || item === void 0 ? void 0 : item.stage_id,
|
|
key: item === null || item === void 0 ? void 0 : item.stage_id,
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-wenjianjia2 c-light-primary mr10",
|
|
style: {
|
|
lineHeight: '19px'
|
|
}
|
|
}),
|
|
children: transformTreeKey(item.items || [])
|
|
});
|
|
});
|
|
console.log(arr);
|
|
setTreeData(arr);
|
|
};
|
|
var transformTreeKey = function transformTreeKey(items) {
|
|
function mapTree(org) {
|
|
var _listType$find;
|
|
var realChildren = org.children;
|
|
var haveChildren = Array.isArray(realChildren) && realChildren.length > 0;
|
|
var key = org === null || org === void 0 ? void 0 : org.id;
|
|
var name = org.name,
|
|
item_type = org.item_type,
|
|
id = org.id;
|
|
// if (item_type === 'StageCatalog') return;
|
|
|
|
var icon = (_listType$find = listType.find(function (e) {
|
|
return e.type === item_type;
|
|
})) === null || _listType$find === void 0 ? void 0 : _listType$find.bq;
|
|
// const typeClassName =
|
|
// item_type === 'VideoItem' ? styles.brght : styles.gray;
|
|
var typeClassName = Listmodules.brght;
|
|
var activeClassName = active.id === id ? "".concat(typeClassName, " ").concat(Listmodules.active) : typeClassName;
|
|
return {
|
|
//分别将我们查询出来的值做出改变他的key
|
|
// title: <div title={org?.name} className={styles.s3} onClick={() => handleList(org)}>{org?.name}</div>,
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
onClick: function onClick() {
|
|
return handleList(org);
|
|
},
|
|
className: typeClassName,
|
|
title: name,
|
|
children: [icon, /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Listmodules.s3,
|
|
children: name
|
|
})]
|
|
}),
|
|
value: key,
|
|
key: key,
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
className: "iconfont icon-wenjianjia2 c-light-primary mr10",
|
|
style: {
|
|
lineHeight: '19px'
|
|
}
|
|
}),
|
|
//判断它是否存在子集,若果存在就进行再次进行遍历操作,知道不存在子集便对其他的元素进行操作
|
|
children: haveChildren ? realChildren === null || realChildren === void 0 ? void 0 : realChildren.map(function (e) {
|
|
return mapTree(e);
|
|
}) : []
|
|
};
|
|
}
|
|
return items === null || items === void 0 ? void 0 : items.map(function (org) {
|
|
return mapTree(org);
|
|
});
|
|
};
|
|
|
|
//实训方法
|
|
var toShixun = /*#__PURE__*/function () {
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(id, is_jupyter) {
|
|
var execRes;
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
while (1) switch (_context.prev = _context.next) {
|
|
case 0:
|
|
dispatch({
|
|
type: 'globalSetting/setGlobalLoading',
|
|
payload: {
|
|
show: true,
|
|
text: '正在进入实践项目,请稍后...'
|
|
}
|
|
});
|
|
if (!is_jupyter) {
|
|
_context.next = 7;
|
|
break;
|
|
}
|
|
_context.next = 4;
|
|
return (0,shixuns/* execJupyter */.BK)({
|
|
id: id
|
|
});
|
|
case 4:
|
|
_context.t0 = _context.sent;
|
|
_context.next = 10;
|
|
break;
|
|
case 7:
|
|
_context.next = 9;
|
|
return (0,shixuns/* execShixun */.Ir)({
|
|
id: id
|
|
});
|
|
case 9:
|
|
_context.t0 = _context.sent;
|
|
case 10:
|
|
execRes = _context.t0;
|
|
dispatch({
|
|
type: 'globalSetting/setGlobalLoading',
|
|
payload: {
|
|
show: false,
|
|
text: ''
|
|
}
|
|
});
|
|
if (!(execRes !== null && execRes !== void 0 && execRes.game_identifier || execRes !== null && execRes !== void 0 && execRes.identifier)) {
|
|
_context.next = 15;
|
|
break;
|
|
}
|
|
(0,util/* openNewWindow */.xg)(is_jupyter ? "/tasks/".concat(execRes === null || execRes === void 0 ? void 0 : execRes.identifier, "/jupyter") : "/tasks/".concat(execRes.game_identifier));
|
|
return _context.abrupt("return");
|
|
case 15:
|
|
if ((execRes === null || execRes === void 0 ? void 0 : execRes.status) === 2) {
|
|
handleResetGame(execRes === null || execRes === void 0 ? void 0 : execRes.message);
|
|
} else if ((execRes === null || execRes === void 0 ? void 0 : execRes.status) === 3) {
|
|
handleInBeta(execRes === null || execRes === void 0 ? void 0 : execRes.message);
|
|
}
|
|
case 16:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
}));
|
|
return function toShixun(_x, _x2) {
|
|
return _ref2.apply(this, arguments);
|
|
};
|
|
}();
|
|
var handleInBeta = function handleInBeta(message) {
|
|
modal/* default */.Z.confirm({
|
|
centered: true,
|
|
title: '提示',
|
|
okText: '确定',
|
|
cancelText: '取消',
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "tc font16",
|
|
children: ["\u76EE\u524D\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5C1A\u5728\u5185\u6D4B\u4E2D\uFF0C\u5C06\u4E8E", message, "\u4E4B\u540E\u5F00\u653E\uFF0C\u8C22\u8C22\uFF01"]
|
|
})
|
|
});
|
|
};
|
|
var handleResetGame = function handleResetGame(url) {
|
|
var _url;
|
|
url = (_url = url) !== null && _url !== void 0 && _url.includes('.json') ? url : "".concat(url, ".json");
|
|
modal/* default */.Z.confirm({
|
|
centered: true,
|
|
title: '提示',
|
|
okText: '确定',
|
|
cancelText: '取消',
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "tc font16",
|
|
children: "\u5B9E\u8BAD\u5DF2\u7ECF\u66F4\u65B0\u4E86\uFF0C\u6B63\u5728\u4E3A\u60A8\u91CD\u7F6E!"
|
|
}),
|
|
onOk: function () {
|
|
var _onOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
var res, execRes;
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
case 0:
|
|
_context2.next = 2;
|
|
return (0,exercise/* resetMyGame */.$Q)({
|
|
url: url
|
|
});
|
|
case 2:
|
|
res = _context2.sent;
|
|
if (res) {
|
|
_context2.next = 5;
|
|
break;
|
|
}
|
|
return _context2.abrupt("return");
|
|
case 5:
|
|
message/* default */.ZP.success('重置成功,正在进入实践项目!');
|
|
_context2.next = 8;
|
|
return (0,shixuns/* execShixun */.Ir)({
|
|
id: res.shixun_identifier
|
|
});
|
|
case 8:
|
|
execRes = _context2.sent;
|
|
if (!(execRes !== null && execRes !== void 0 && execRes.game_identifier)) {
|
|
_context2.next = 12;
|
|
break;
|
|
}
|
|
(0,util/* openNewWindow */.xg)("/tasks/".concat(execRes.game_identifier));
|
|
return _context2.abrupt("return");
|
|
case 12:
|
|
if ((execRes === null || execRes === void 0 ? void 0 : execRes.status) === 2) {
|
|
handleResetGame(execRes === null || execRes === void 0 ? void 0 : execRes.message);
|
|
} else if ((execRes === null || execRes === void 0 ? void 0 : execRes.status) === 3) {
|
|
handleInBeta(execRes === null || execRes === void 0 ? void 0 : execRes.message);
|
|
}
|
|
case 13:
|
|
case "end":
|
|
return _context2.stop();
|
|
}
|
|
}, _callee2);
|
|
}));
|
|
function onOk() {
|
|
return _onOk.apply(this, arguments);
|
|
}
|
|
return onOk;
|
|
}()
|
|
});
|
|
};
|
|
|
|
//绑定点击事件
|
|
var handleList = function handleList(item) {
|
|
if ((item === null || item === void 0 ? void 0 : item.item_type) === 'StageCatalog') {
|
|
return;
|
|
}
|
|
clearTimeout(window.videoTimer);
|
|
var id = item.id,
|
|
item_type = item.item_type,
|
|
identifier = item.identifier,
|
|
is_jupyter = item.is_jupyter,
|
|
url = item.url,
|
|
link = item.link;
|
|
if (item_type === 'VideoItem' && !link) {
|
|
var _user$userInfo, _user$userInfo2;
|
|
if (!((_user$userInfo = user.userInfo) !== null && _user$userInfo !== void 0 && _user$userInfo.admin) && !((_user$userInfo2 = user.userInfo) !== null && _user$userInfo2 !== void 0 && _user$userInfo2.business) && !item.can_view) {
|
|
modal/* default */.Z.info({
|
|
centered: true,
|
|
width: 400,
|
|
okText: '知道啦',
|
|
icon: null,
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "tc font14",
|
|
children: "\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: objectSpread2_default()(objectSpread2_default()({
|
|
id: id
|
|
}, queryParams), {}, {
|
|
videoId: id
|
|
}),
|
|
callback: function callback(res) {
|
|
if (res && res.video_item && !res.video_item.can_edit && !item.is_public) {
|
|
modal/* default */.Z.info({
|
|
centered: true,
|
|
width: 400,
|
|
okText: '知道啦',
|
|
icon: null,
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "tc font14",
|
|
children: "\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') {
|
|
var _item$name, _item$name2;
|
|
var type = item === null || item === void 0 || (_item$name = item.name) === null || _item$name === void 0 ? void 0 : _item$name.substr(item === null || item === void 0 || (_item$name2 = item.name) === null || _item$name2 === void 0 ? void 0 : _item$name2.lastIndexOf('.'));
|
|
if (type.toUpperCase() === ".ZIP") {
|
|
var _pathsDetail$detail;
|
|
if (!((_pathsDetail$detail = pathsDetail.detail) !== null && _pathsDetail$detail !== void 0 && _pathsDetail$detail.allow_download)) {
|
|
message/* default */.ZP.info('教学课件不支持下载');
|
|
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);
|
|
};
|
|
|
|
//转换中文
|
|
var toChinesNum = function toChinesNum(num) {
|
|
var changeNum = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九']; //changeNum[0] = "零"
|
|
var unit = ['', '十', '百', '千', '万'];
|
|
num = parseInt(num);
|
|
var getWan = function getWan(temp) {
|
|
var strArr = temp.toString().split('').reverse();
|
|
var 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;
|
|
};
|
|
var overWan = Math.floor(num / 10000);
|
|
var noWan = num % 10000;
|
|
if (noWan.toString().length < 4) noWan = '0' + noWan;
|
|
return overWan ? getWan(overWan) + '万' + getWan(noWan) : getWan(num);
|
|
};
|
|
|
|
//渲染三级目录
|
|
var renderLThreeItem = function renderLThreeItem(item, itemIndex, eIndex, elIndex) {
|
|
var _listType$find2;
|
|
var name = item.name,
|
|
item_type = item.item_type,
|
|
id = item.id;
|
|
// if (item_type === 'StageCatalog') return;
|
|
var serialNumber = "".concat(itemIndex + 1, "-").concat(eIndex + 1, "-").concat(elIndex + 1);
|
|
var icon = (_listType$find2 = listType.find(function (e) {
|
|
return e.type === item_type;
|
|
})) === null || _listType$find2 === void 0 ? void 0 : _listType$find2.icon;
|
|
// const typeClassName =
|
|
// item_type === 'VideoItem' ? styles.brght : styles.gray;
|
|
var typeClassName = Listmodules.brght;
|
|
var activeClassName = active.id === id ? "".concat(typeClassName, " ").concat(Listmodules.active) : typeClassName;
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
onClick: function onClick() {
|
|
return handleList(item);
|
|
},
|
|
className: activeClassName,
|
|
style: {
|
|
paddingLeft: 52
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Listmodules.s1,
|
|
children: icon
|
|
}), !!cust_seq && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Listmodules.s2,
|
|
children: serialNumber
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
className: Listmodules.s3,
|
|
children: ["\u203B ", name]
|
|
})]
|
|
}, serialNumber);
|
|
};
|
|
|
|
//渲染列表
|
|
var renderListItem = function renderListItem(item, itemIndex, eIndex) {
|
|
var _listType$find3;
|
|
var name = item.name,
|
|
item_type = item.item_type,
|
|
id = item.id,
|
|
children = item.children;
|
|
// if (item_type === 'StageCatalog') return;
|
|
var serialNumber = "".concat(itemIndex + 1, "-").concat(eIndex + 1);
|
|
var icon = (_listType$find3 = listType.find(function (e) {
|
|
return e.type === item_type;
|
|
})) === null || _listType$find3 === void 0 ? void 0 : _listType$find3.icon;
|
|
// const typeClassName =
|
|
// item_type === 'VideoItem' ? styles.brght : styles.gray;
|
|
var typeClassName = Listmodules.brght;
|
|
var activeClassName = active.id === id ? "".concat(typeClassName, " ").concat(Listmodules.active) : typeClassName;
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
onClick: function onClick() {
|
|
return handleList(item);
|
|
},
|
|
className: activeClassName,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Listmodules.s1,
|
|
children: icon
|
|
}), !!cust_seq && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Listmodules.s2,
|
|
children: serialNumber
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
className: Listmodules.s3,
|
|
children: ["\u203B ", name]
|
|
})]
|
|
}), !!children.length && children.map(function (el, elIndex) {
|
|
return renderLThreeItem(el, itemIndex, eIndex, elIndex);
|
|
})]
|
|
}, serialNumber);
|
|
};
|
|
|
|
//组件
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
className: Listmodules.list,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Listmodules.tabs_style,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Listmodules.tabs_item,
|
|
onClick: function onClick() {
|
|
settabes('课程资源目录');
|
|
},
|
|
children: ["\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55", tabs == '课程资源目录' && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Listmodules.tabs_item_active
|
|
})]
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Listmodules.tree_style,
|
|
children: (treeData === null || treeData === void 0 ? void 0 : treeData.length) > 0 && /*#__PURE__*/(0,jsx_runtime.jsx)(tree/* default */.Z, {
|
|
blockNode: true,
|
|
treeData: treeData,
|
|
defaultExpandAll: true,
|
|
className: Listmodules.tree_line
|
|
})
|
|
})]
|
|
});
|
|
};
|
|
/* harmony default export */ var components_List = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
var user = _ref3.user,
|
|
videoDetail = _ref3.videoDetail,
|
|
loading = _ref3.loading,
|
|
globalSetting = _ref3.globalSetting,
|
|
pathsDetail = _ref3.pathsDetail;
|
|
return {
|
|
user: user,
|
|
videoDetail: videoDetail,
|
|
globalSetting: globalSetting,
|
|
loading: loading,
|
|
pathsDetail: pathsDetail
|
|
};
|
|
})(List));
|
|
// EXTERNAL MODULE: ./src/components/PreviewAll/index.tsx + 3 modules
|
|
var PreviewAll = __webpack_require__(31427);
|
|
;// CONCATENATED MODULE: ./src/pages/Video/Detail/[id].tsx
|
|
|
|
|
|
|
|
|
|
var _id_excluded = ["videoDetail", "globalSetting", "loading", "pathsDetail", "dispatch"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var formatQuery = function formatQuery(query) {
|
|
// if (query?.subject_id) {
|
|
// return { subject_id: query?.subject_id };
|
|
// }
|
|
|
|
// if (query?.course_id) {
|
|
// return { course_id: query.course_id };
|
|
// }
|
|
var subject_id = query.subject_id;
|
|
return {
|
|
subject_id: subject_id,
|
|
course_id: subject_id
|
|
};
|
|
};
|
|
var VideoDetailPage = function VideoDetailPage(_ref) {
|
|
var _pathsDetail$detail, _pathsDetail$detail2;
|
|
var videoDetail = _ref.videoDetail,
|
|
globalSetting = _ref.globalSetting,
|
|
loading = _ref.loading,
|
|
pathsDetail = _ref.pathsDetail,
|
|
dispatch = _ref.dispatch,
|
|
props = objectWithoutProperties_default()(_ref, _id_excluded);
|
|
// const params = useParams<any>();
|
|
// const location = useLocation() as any;
|
|
var queryParams = videoDetail.queryParams,
|
|
videoList = videoDetail.videoList,
|
|
attachmentList = videoDetail.attachmentList,
|
|
active = videoDetail.active;
|
|
var subject_id = queryParams.subject_id,
|
|
videoId = queryParams.videoId;
|
|
var params = {
|
|
videoId: videoId
|
|
};
|
|
// const location = { query: queryParams };
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
if (active) {
|
|
var item_type = active.item_type,
|
|
id = active.id;
|
|
if (item_type === 'VideoItem') {
|
|
dispatch({
|
|
type: 'videoDetail/getVideoDetail',
|
|
payload: objectSpread2_default()(objectSpread2_default()({}, queryParams), {}, {
|
|
id: id
|
|
})
|
|
});
|
|
}
|
|
}
|
|
}, [active.id]);
|
|
console.log('---', active);
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
if (subject_id) getdata();
|
|
}, []);
|
|
function getdata() {
|
|
return _getdata.apply(this, arguments);
|
|
}
|
|
function _getdata() {
|
|
_getdata = 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 dispatch({
|
|
type: 'pathsDetail/getPathsDetail',
|
|
payload: {
|
|
id: subject_id
|
|
}
|
|
});
|
|
case 2:
|
|
res = _context.sent;
|
|
case 3:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
}));
|
|
return _getdata.apply(this, arguments);
|
|
}
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
var _videoDetail$detail;
|
|
(0,util/* setDocumentTitle */.Dk)((_videoDetail$detail = videoDetail.detail) === null || _videoDetail$detail === void 0 || (_videoDetail$detail = _videoDetail$detail.video_item) === null || _videoDetail$detail === void 0 ? void 0 : _videoDetail$detail.name);
|
|
}, [videoDetail]);
|
|
var 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__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
|
|
spinning: false,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
className: Detailmodules.bg,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Detailmodules.container,
|
|
style: style,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(components_List, {}), active && active.item_type === 'VideoItem' && /*#__PURE__*/(0,jsx_runtime.jsx)(components_Content, {}), active && active.item_type === 'Attachment' && active.content_type === 'application/pdf' && active.url && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Detailmodules.widthle,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(PreviewAll/* default */.Z, {
|
|
disabledDownload: !((_pathsDetail$detail = pathsDetail.detail) !== null && _pathsDetail$detail !== void 0 && _pathsDetail$detail.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__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Detailmodules.widthle,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(PreviewAll/* default */.Z, {
|
|
disabledDownload: !((_pathsDetail$detail2 = pathsDetail.detail) !== null && _pathsDetail$detail2 !== void 0 && _pathsDetail$detail2.allow_download),
|
|
type: 'office',
|
|
data: env/* default */.Z.API_SERVER + active.url,
|
|
style: {
|
|
position: 'absolute',
|
|
zIndex: 1
|
|
}
|
|
})
|
|
})
|
|
|
|
// <Office url={active.url} />
|
|
]
|
|
})
|
|
})
|
|
});
|
|
};
|
|
/* harmony default export */ var _id_ = ((0,_umi_production_exports.connect)(function (_ref2) {
|
|
var videoDetail = _ref2.videoDetail,
|
|
loading = _ref2.loading,
|
|
globalSetting = _ref2.globalSetting,
|
|
pathsDetail = _ref2.pathsDetail;
|
|
return {
|
|
videoDetail: videoDetail,
|
|
globalSetting: globalSetting,
|
|
loading: loading,
|
|
pathsDetail: pathsDetail
|
|
};
|
|
})(VideoDetailPage));
|
|
|
|
/***/ })
|
|
|
|
}]); |