From 01d2cf4e9b8239e83707ccbd42bb87e443267cb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Tue, 30 May 2023 09:54:33 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=A0=8F=E5=8F=96=E6=B6=88=E6=82=AC=E6=B5=AE?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index/index.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index c67e52b..2c02372 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -187,8 +187,6 @@ const IndexPage = () => { overflowX: "hidden", overflowY: "auto", }} - onMouseOut={() => setOpen(false)} - onMouseOver={() => setOpen(true)} > { trigger="click" onOpenChange={handleOpenChange} > - setOpen(true)} - > + {categoryText} Date: Tue, 30 May 2023 09:58:37 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=B1=8F=E8=94=BD=E5=8F=B3=E9=94=AE=E8=8F=9C?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/video.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pages/course/video.tsx b/src/pages/course/video.tsx index 4ba2c52..096e19f 100644 --- a/src/pages/course/video.tsx +++ b/src/pages/course/video.tsx @@ -27,6 +27,11 @@ const CoursePalyPage = () => { useEffect(() => { getCourse(); getDetail(); + document.oncontextmenu = function (e) { + /*屏蔽浏览器默认右键事件*/ + e = e || window.event; + return false; + }; }, [params.courseId, params.hourId]); useEffect(() => { From 537cac224a974a8ed64f998d21c01bb8fd8e817f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Tue, 30 May 2023 10:00:43 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=B1=8F=E8=94=BD=E5=8F=B3=E9=94=AE=E8=8F=9C?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/video.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/pages/course/video.tsx b/src/pages/course/video.tsx index 096e19f..af1c4c2 100644 --- a/src/pages/course/video.tsx +++ b/src/pages/course/video.tsx @@ -32,6 +32,13 @@ const CoursePalyPage = () => { e = e || window.event; return false; }; + return () => { + document.oncontextmenu = function (e) { + /*恢复浏览器默认右键事件*/ + e = e || window.event; + return true; + }; + }; }, [params.courseId, params.hourId]); useEffect(() => { @@ -170,6 +177,11 @@ const CoursePalyPage = () => { className={styles["close-btn"]} onClick={() => { window.player && window.player.destroy(); + document.oncontextmenu = function (e) { + /*恢复浏览器默认右键事件*/ + e = e || window.event; + return true; + }; navigate(-1); }} > From 1a9a20cbcaba9333f6fd4933ce6c0cef063d4c06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Tue, 30 May 2023 16:40:10 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E9=85=8D=E7=BD=AE=E7=A6=81=E6=AD=A2=E6=8B=96?= =?UTF-8?q?=E5=8A=A8=E8=BF=9B=E5=BA=A6=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/video.tsx | 35 +++++++++++++++++++++++++-- src/pages/init/index.tsx | 5 ++++ src/store/system/systemConfigSlice.ts | 2 ++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/pages/course/video.tsx b/src/pages/course/video.tsx index af1c4c2..8208df0 100644 --- a/src/pages/course/video.tsx +++ b/src/pages/course/video.tsx @@ -22,7 +22,11 @@ const CoursePalyPage = () => { const [loading, setLoading] = useState(false); const [isLastpage, setIsLastpage] = useState(false); const [totalHours, setTotalHours] = useState([]); + const [playingTime, setPlayingTime] = useState(0); + const [watchedSeconds, setWatchedSeconds] = useState(0); const myRef = useRef(0); + const playRef = useRef(0); + const watchRef = useRef(0); useEffect(() => { getCourse(); @@ -45,6 +49,14 @@ const CoursePalyPage = () => { myRef.current = playDuration; }, [playDuration]); + useEffect(() => { + playRef.current = playingTime; + }, [playingTime]); + + useEffect(() => { + watchRef.current = watchedSeconds; + }, [watchedSeconds]); + const getCourse = () => { Course.detail(Number(params.courseId)).then((res: any) => { let totalHours: any = []; @@ -89,6 +101,7 @@ const CoursePalyPage = () => { }; setLastSeeValue(params); setLastSeeValue(params); + setWatchedSeconds(record.finished_duration); } getVideoUrl(params); setLoading(false); @@ -126,14 +139,32 @@ const CoursePalyPage = () => { color: systemConfig.playerBulletSecretColor || "red", opacity: Number(systemConfig.playerBulletSecretOpacity), }, - ban_drag: false, + ban_drag: systemConfig.playerIsDisabledDrag, last_see_pos: params, }); // 监听播放进度更新evt window.player.on("timeupdate", () => { - playTimeUpdate(parseInt(window.player.video.currentTime), false); + let currentTime = parseInt(window.player.video.currentTime); + if ( + systemConfig.playerIsDisabledDrag && + currentTime - playRef.current >= 2 && + currentTime > watchRef.current + ) { + window.player.seek(playRef.current); + } else { + setPlayingTime(currentTime); + playTimeUpdate(parseInt(window.player.video.currentTime), false); + } }); window.player.on("ended", () => { + if ( + systemConfig.playerIsDisabledDrag && + window.player.video.duration - playRef.current >= 2 + ) { + window.player.seek(playRef.current); + return; + } + setPlayingTime(0); setPlayendedStatus(true); playTimeUpdate(parseInt(window.player.video.currentTime), true); window.player && window.player.destroy(); diff --git a/src/pages/init/index.tsx b/src/pages/init/index.tsx index fd76a09..5b0aa75 100644 --- a/src/pages/init/index.tsx +++ b/src/pages/init/index.tsx @@ -41,6 +41,11 @@ export const InitPage = (props: Props) => { props.configData["player-is-enabled-bullet-secret"] === "1" ? true : false, + playerIsDisabledDrag: + props.configData["player-disabled-drag"] && + props.configData["player-disabled-drag"] === "1" + ? true + : false, playerBulletSecretText: props.configData["player-bullet-secret-text"], playerBulletSecretColor: props.configData["player-bullet-secret-color"], playerBulletSecretOpacity: diff --git a/src/store/system/systemConfigSlice.ts b/src/store/system/systemConfigSlice.ts index a166363..0fa2e39 100644 --- a/src/store/system/systemConfigSlice.ts +++ b/src/store/system/systemConfigSlice.ts @@ -9,6 +9,7 @@ type SystemConfigStoreInterface = { pcIndexFooterMsg: string; playerPoster: string; playerIsEnabledBulletSecret: boolean; + playerIsDisabledDrag: boolean; playerBulletSecretText: string; playerBulletSecretColor: string; playerBulletSecretOpacity: string; @@ -23,6 +24,7 @@ let defaultValue: SystemConfigStoreInterface = { pcIndexFooterMsg: "", playerPoster: "", playerIsEnabledBulletSecret: false, + playerIsDisabledDrag: false, playerBulletSecretText: "", playerBulletSecretColor: "", playerBulletSecretOpacity: "", From c8e9f8cc7a3adcd9fdcf589393111bb980d1e1ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Tue, 30 May 2023 17:26:14 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E5=B0=81=E9=9D=A2=E5=AE=BD=E9=AB=98=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.scss | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/index.scss b/src/index.scss index a2ac0e1..b7dfcf8 100644 --- a/src/index.scss +++ b/src/index.scss @@ -291,9 +291,13 @@ h1 { } #meedu-player-container { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; width: 100%; - height: auto; - position: relative; + height: 100%; } .ant-tree-switcher { From cec5251da4aabf79454da0ea31a1ec7d468d0247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Tue, 30 May 2023 17:47:12 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E5=B7=B2=E7=9C=8B=E5=AE=8C=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E6=98=BE=E7=A4=BA=E8=BF=9B=E5=BA=A6=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/video.tsx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/pages/course/video.tsx b/src/pages/course/video.tsx index 8208df0..b50d576 100644 --- a/src/pages/course/video.tsx +++ b/src/pages/course/video.tsx @@ -27,6 +27,7 @@ const CoursePalyPage = () => { const myRef = useRef(0); const playRef = useRef(0); const watchRef = useRef(0); + const totalRef = useRef(0); useEffect(() => { getCourse(); @@ -57,6 +58,10 @@ const CoursePalyPage = () => { watchRef.current = watchedSeconds; }, [watchedSeconds]); + useEffect(() => { + totalRef.current = hour.duration; + }, [hour]); + const getCourse = () => { Course.detail(Number(params.courseId)).then((res: any) => { let totalHours: any = []; @@ -102,6 +107,8 @@ const CoursePalyPage = () => { setLastSeeValue(params); setLastSeeValue(params); setWatchedSeconds(record.finished_duration); + } else { + setWatchedSeconds(res.data.hour.duration); } getVideoUrl(params); setLoading(false); @@ -121,6 +128,10 @@ const CoursePalyPage = () => { }; const initDPlayer = (playUrl: string, isTrySee: number, params: any) => { + let banDrag = + systemConfig.playerIsDisabledDrag && watchRef.current < totalRef.current; + console.log(watchRef.current); + console.log(totalRef.current); window.player = new window.DPlayer({ container: document.getElementById("meedu-player-container"), autoplay: false, @@ -139,14 +150,14 @@ const CoursePalyPage = () => { color: systemConfig.playerBulletSecretColor || "red", opacity: Number(systemConfig.playerBulletSecretOpacity), }, - ban_drag: systemConfig.playerIsDisabledDrag, + ban_drag: banDrag, last_see_pos: params, }); // 监听播放进度更新evt window.player.on("timeupdate", () => { let currentTime = parseInt(window.player.video.currentTime); if ( - systemConfig.playerIsDisabledDrag && + banDrag && currentTime - playRef.current >= 2 && currentTime > watchRef.current ) { @@ -157,10 +168,7 @@ const CoursePalyPage = () => { } }); window.player.on("ended", () => { - if ( - systemConfig.playerIsDisabledDrag && - window.player.video.duration - playRef.current >= 2 - ) { + if (banDrag && window.player.video.duration - playRef.current >= 2) { window.player.seek(playRef.current); return; } From 58440be42478480f20b691bd1e7b090f4c80a84d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Tue, 30 May 2023 17:47:26 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E5=B7=B2=E7=9C=8B=E5=AE=8C=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E6=98=BE=E7=A4=BA=E8=BF=9B=E5=BA=A6=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/video.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pages/course/video.tsx b/src/pages/course/video.tsx index b50d576..fe83d9a 100644 --- a/src/pages/course/video.tsx +++ b/src/pages/course/video.tsx @@ -130,8 +130,6 @@ const CoursePalyPage = () => { const initDPlayer = (playUrl: string, isTrySee: number, params: any) => { let banDrag = systemConfig.playerIsDisabledDrag && watchRef.current < totalRef.current; - console.log(watchRef.current); - console.log(totalRef.current); window.player = new window.DPlayer({ container: document.getElementById("meedu-player-container"), autoplay: false, From 0075a848e35dc8239b562b47f444c1e55690c4f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Tue, 30 May 2023 18:05:30 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E8=A7=86=E9=A2=91=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E6=AC=A1=E6=92=AD=E6=94=BE=E6=98=BE=E7=A4=BA=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E6=9D=A1bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/video.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/course/video.tsx b/src/pages/course/video.tsx index fe83d9a..49416fc 100644 --- a/src/pages/course/video.tsx +++ b/src/pages/course/video.tsx @@ -107,7 +107,7 @@ const CoursePalyPage = () => { setLastSeeValue(params); setLastSeeValue(params); setWatchedSeconds(record.finished_duration); - } else { + } else if (record && record.is_finished === 1) { setWatchedSeconds(res.data.hour.duration); } getVideoUrl(params); From 97f4abfe412624ff7db33f39b073764db1cc6763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Tue, 30 May 2023 18:13:10 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=B7=B2=E5=AD=A6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=BF=9B=E5=BA=A6=E6=9D=A1b?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/video.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/pages/course/video.tsx b/src/pages/course/video.tsx index 49416fc..4abf5fe 100644 --- a/src/pages/course/video.tsx +++ b/src/pages/course/video.tsx @@ -129,7 +129,9 @@ const CoursePalyPage = () => { const initDPlayer = (playUrl: string, isTrySee: number, params: any) => { let banDrag = - systemConfig.playerIsDisabledDrag && watchRef.current < totalRef.current; + systemConfig.playerIsDisabledDrag && + watchRef.current < totalRef.current && + watchRef.current === 0; window.player = new window.DPlayer({ container: document.getElementById("meedu-player-container"), autoplay: false, @@ -155,7 +157,8 @@ const CoursePalyPage = () => { window.player.on("timeupdate", () => { let currentTime = parseInt(window.player.video.currentTime); if ( - banDrag && + systemConfig.playerIsDisabledDrag && + watchRef.current < totalRef.current && currentTime - playRef.current >= 2 && currentTime > watchRef.current ) { @@ -166,7 +169,11 @@ const CoursePalyPage = () => { } }); window.player.on("ended", () => { - if (banDrag && window.player.video.duration - playRef.current >= 2) { + if ( + systemConfig.playerIsDisabledDrag && + watchRef.current < totalRef.current && + window.player.video.duration - playRef.current >= 2 + ) { window.player.seek(playRef.current); return; } From 465cc901b14a4a2f2fb22fa3738565cf8e76f3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Wed, 31 May 2023 09:08:54 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E6=92=AD=E6=94=BE=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=8B=96=E5=8A=A8=E8=BF=9B=E5=BA=A6=E6=9D=A1=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/video.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/course/video.tsx b/src/pages/course/video.tsx index 4abf5fe..96292da 100644 --- a/src/pages/course/video.tsx +++ b/src/pages/course/video.tsx @@ -162,7 +162,8 @@ const CoursePalyPage = () => { currentTime - playRef.current >= 2 && currentTime > watchRef.current ) { - window.player.seek(playRef.current); + message.warning("首次学习禁止快进"); + window.player.seek(watchRef.current); } else { setPlayingTime(currentTime); playTimeUpdate(parseInt(window.player.video.currentTime), false); From 59b80c415876fb640373e439cd26479bb6a09490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Wed, 31 May 2023 09:37:36 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E6=92=AD=E6=94=BE=E5=99=A8=E5=BF=AB?= =?UTF-8?q?=E8=BF=9B=E3=80=81=E5=BF=AB=E9=80=80toast=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.scss b/src/index.scss index b7dfcf8..96b296f 100644 --- a/src/index.scss +++ b/src/index.scss @@ -379,3 +379,7 @@ h1 { .ant-popover-inner { padding: 8px 0px !important; } + +.dplayer-notice { + opacity: 0 !important; +}