mirror of
https://github.com/PlayEdu/frontend.git
synced 2025-06-08 17:44:31 +08:00
commit
d922bb1b0b
@ -291,9 +291,13 @@ h1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#meedu-player-container {
|
#meedu-player-container {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: 100%;
|
||||||
position: relative;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-tree-switcher {
|
.ant-tree-switcher {
|
||||||
@ -375,3 +379,7 @@ h1 {
|
|||||||
.ant-popover-inner {
|
.ant-popover-inner {
|
||||||
padding: 8px 0px !important;
|
padding: 8px 0px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dplayer-notice {
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
@ -22,17 +22,46 @@ const CoursePalyPage = () => {
|
|||||||
const [loading, setLoading] = useState<Boolean>(false);
|
const [loading, setLoading] = useState<Boolean>(false);
|
||||||
const [isLastpage, setIsLastpage] = useState<Boolean>(false);
|
const [isLastpage, setIsLastpage] = useState<Boolean>(false);
|
||||||
const [totalHours, setTotalHours] = useState<any>([]);
|
const [totalHours, setTotalHours] = useState<any>([]);
|
||||||
|
const [playingTime, setPlayingTime] = useState(0);
|
||||||
|
const [watchedSeconds, setWatchedSeconds] = useState(0);
|
||||||
const myRef = useRef(0);
|
const myRef = useRef(0);
|
||||||
|
const playRef = useRef(0);
|
||||||
|
const watchRef = useRef(0);
|
||||||
|
const totalRef = useRef(0);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getCourse();
|
getCourse();
|
||||||
getDetail();
|
getDetail();
|
||||||
|
document.oncontextmenu = function (e) {
|
||||||
|
/*屏蔽浏览器默认右键事件*/
|
||||||
|
e = e || window.event;
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
return () => {
|
||||||
|
document.oncontextmenu = function (e) {
|
||||||
|
/*恢复浏览器默认右键事件*/
|
||||||
|
e = e || window.event;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
};
|
||||||
}, [params.courseId, params.hourId]);
|
}, [params.courseId, params.hourId]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
myRef.current = playDuration;
|
myRef.current = playDuration;
|
||||||
}, [playDuration]);
|
}, [playDuration]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
playRef.current = playingTime;
|
||||||
|
}, [playingTime]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
watchRef.current = watchedSeconds;
|
||||||
|
}, [watchedSeconds]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
totalRef.current = hour.duration;
|
||||||
|
}, [hour]);
|
||||||
|
|
||||||
const getCourse = () => {
|
const getCourse = () => {
|
||||||
Course.detail(Number(params.courseId)).then((res: any) => {
|
Course.detail(Number(params.courseId)).then((res: any) => {
|
||||||
let totalHours: any = [];
|
let totalHours: any = [];
|
||||||
@ -77,6 +106,9 @@ const CoursePalyPage = () => {
|
|||||||
};
|
};
|
||||||
setLastSeeValue(params);
|
setLastSeeValue(params);
|
||||||
setLastSeeValue(params);
|
setLastSeeValue(params);
|
||||||
|
setWatchedSeconds(record.finished_duration);
|
||||||
|
} else if (record && record.is_finished === 1) {
|
||||||
|
setWatchedSeconds(res.data.hour.duration);
|
||||||
}
|
}
|
||||||
getVideoUrl(params);
|
getVideoUrl(params);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
@ -96,6 +128,10 @@ const CoursePalyPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const initDPlayer = (playUrl: string, isTrySee: number, params: any) => {
|
const initDPlayer = (playUrl: string, isTrySee: number, params: any) => {
|
||||||
|
let banDrag =
|
||||||
|
systemConfig.playerIsDisabledDrag &&
|
||||||
|
watchRef.current < totalRef.current &&
|
||||||
|
watchRef.current === 0;
|
||||||
window.player = new window.DPlayer({
|
window.player = new window.DPlayer({
|
||||||
container: document.getElementById("meedu-player-container"),
|
container: document.getElementById("meedu-player-container"),
|
||||||
autoplay: false,
|
autoplay: false,
|
||||||
@ -114,14 +150,35 @@ const CoursePalyPage = () => {
|
|||||||
color: systemConfig.playerBulletSecretColor || "red",
|
color: systemConfig.playerBulletSecretColor || "red",
|
||||||
opacity: Number(systemConfig.playerBulletSecretOpacity),
|
opacity: Number(systemConfig.playerBulletSecretOpacity),
|
||||||
},
|
},
|
||||||
ban_drag: false,
|
ban_drag: banDrag,
|
||||||
last_see_pos: params,
|
last_see_pos: params,
|
||||||
});
|
});
|
||||||
// 监听播放进度更新evt
|
// 监听播放进度更新evt
|
||||||
window.player.on("timeupdate", () => {
|
window.player.on("timeupdate", () => {
|
||||||
|
let currentTime = parseInt(window.player.video.currentTime);
|
||||||
|
if (
|
||||||
|
systemConfig.playerIsDisabledDrag &&
|
||||||
|
watchRef.current < totalRef.current &&
|
||||||
|
currentTime - playRef.current >= 2 &&
|
||||||
|
currentTime > watchRef.current
|
||||||
|
) {
|
||||||
|
message.warning("首次学习禁止快进");
|
||||||
|
window.player.seek(watchRef.current);
|
||||||
|
} else {
|
||||||
|
setPlayingTime(currentTime);
|
||||||
playTimeUpdate(parseInt(window.player.video.currentTime), false);
|
playTimeUpdate(parseInt(window.player.video.currentTime), false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
window.player.on("ended", () => {
|
window.player.on("ended", () => {
|
||||||
|
if (
|
||||||
|
systemConfig.playerIsDisabledDrag &&
|
||||||
|
watchRef.current < totalRef.current &&
|
||||||
|
window.player.video.duration - playRef.current >= 2
|
||||||
|
) {
|
||||||
|
window.player.seek(playRef.current);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setPlayingTime(0);
|
||||||
setPlayendedStatus(true);
|
setPlayendedStatus(true);
|
||||||
playTimeUpdate(parseInt(window.player.video.currentTime), true);
|
playTimeUpdate(parseInt(window.player.video.currentTime), true);
|
||||||
window.player && window.player.destroy();
|
window.player && window.player.destroy();
|
||||||
@ -165,6 +222,11 @@ const CoursePalyPage = () => {
|
|||||||
className={styles["close-btn"]}
|
className={styles["close-btn"]}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
window.player && window.player.destroy();
|
window.player && window.player.destroy();
|
||||||
|
document.oncontextmenu = function (e) {
|
||||||
|
/*恢复浏览器默认右键事件*/
|
||||||
|
e = e || window.event;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
navigate(-1);
|
navigate(-1);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -187,8 +187,6 @@ const IndexPage = () => {
|
|||||||
overflowX: "hidden",
|
overflowX: "hidden",
|
||||||
overflowY: "auto",
|
overflowY: "auto",
|
||||||
}}
|
}}
|
||||||
onMouseOut={() => setOpen(false)}
|
|
||||||
onMouseOver={() => setOpen(true)}
|
|
||||||
>
|
>
|
||||||
<Tree
|
<Tree
|
||||||
selectedKeys={selectKey}
|
selectedKeys={selectKey}
|
||||||
@ -332,10 +330,7 @@ const IndexPage = () => {
|
|||||||
trigger="click"
|
trigger="click"
|
||||||
onOpenChange={handleOpenChange}
|
onOpenChange={handleOpenChange}
|
||||||
>
|
>
|
||||||
<Space
|
<Space className={styles["dropButton"]}>
|
||||||
className={styles["dropButton"]}
|
|
||||||
onMouseOver={() => setOpen(true)}
|
|
||||||
>
|
|
||||||
{categoryText}
|
{categoryText}
|
||||||
<i
|
<i
|
||||||
className="iconfont icon-icon-xiala"
|
className="iconfont icon-icon-xiala"
|
||||||
|
@ -41,6 +41,11 @@ export const InitPage = (props: Props) => {
|
|||||||
props.configData["player-is-enabled-bullet-secret"] === "1"
|
props.configData["player-is-enabled-bullet-secret"] === "1"
|
||||||
? true
|
? true
|
||||||
: false,
|
: false,
|
||||||
|
playerIsDisabledDrag:
|
||||||
|
props.configData["player-disabled-drag"] &&
|
||||||
|
props.configData["player-disabled-drag"] === "1"
|
||||||
|
? true
|
||||||
|
: false,
|
||||||
playerBulletSecretText: props.configData["player-bullet-secret-text"],
|
playerBulletSecretText: props.configData["player-bullet-secret-text"],
|
||||||
playerBulletSecretColor: props.configData["player-bullet-secret-color"],
|
playerBulletSecretColor: props.configData["player-bullet-secret-color"],
|
||||||
playerBulletSecretOpacity:
|
playerBulletSecretOpacity:
|
||||||
|
@ -9,6 +9,7 @@ type SystemConfigStoreInterface = {
|
|||||||
pcIndexFooterMsg: string;
|
pcIndexFooterMsg: string;
|
||||||
playerPoster: string;
|
playerPoster: string;
|
||||||
playerIsEnabledBulletSecret: boolean;
|
playerIsEnabledBulletSecret: boolean;
|
||||||
|
playerIsDisabledDrag: boolean;
|
||||||
playerBulletSecretText: string;
|
playerBulletSecretText: string;
|
||||||
playerBulletSecretColor: string;
|
playerBulletSecretColor: string;
|
||||||
playerBulletSecretOpacity: string;
|
playerBulletSecretOpacity: string;
|
||||||
@ -23,6 +24,7 @@ let defaultValue: SystemConfigStoreInterface = {
|
|||||||
pcIndexFooterMsg: "",
|
pcIndexFooterMsg: "",
|
||||||
playerPoster: "",
|
playerPoster: "",
|
||||||
playerIsEnabledBulletSecret: false,
|
playerIsEnabledBulletSecret: false,
|
||||||
|
playerIsDisabledDrag: false,
|
||||||
playerBulletSecretText: "",
|
playerBulletSecretText: "",
|
||||||
playerBulletSecretColor: "",
|
playerBulletSecretColor: "",
|
||||||
playerBulletSecretOpacity: "",
|
playerBulletSecretOpacity: "",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user