退出全屏 ,需要水印1

This commit is contained in:
gengxin
2025-03-11 10:01:54 +08:00
parent 797c08d8fc
commit 23928a0865
2 changed files with 12 additions and 17 deletions

View File

@@ -392,12 +392,11 @@ export default {
console.log("按键 退出全屏 执行") console.log("按键 退出全屏 执行")
} }
}) })
// 监听全屏事件的变化,保存数据 // 监听全屏事件的变化,保存数据
window.addEventListener("fullscreenchange", () => { window.addEventListener("fullscreenchange", () => {
this.isFullscreen = this.isFullScreen(); this.isFullscreen = this.isFullScreen();
}); });
window.addEventListener("keydown", (e) => { this.videoDom.addEventListener("keydown", (e) => {
console.log("是否监听到"); console.log("是否监听到");
if(e.keyCode == 27){ if(e.keyCode == 27){
console.log("是否监听到 esc"); console.log("是否监听到 esc");

View File

@@ -167,7 +167,6 @@
</div> </div>
<!-- 课程单元 --> <!-- 课程单元 -->
<div class="course-units" v-if="tab == 1"> <div class="course-units" v-if="tab == 1">
<div :style="`height: ${controlHeight}px;overflow-y: auto;`"> <div :style="`height: ${controlHeight}px;overflow-y: auto;`">
<div class="catalog" v-if="courseInfo.type == 20"> <div class="catalog" v-if="courseInfo.type == 20">
<div v-for="(item, index) in catalogTree" :key="index" :name="index"> <div v-for="(item, index) in catalogTree" :key="index" :name="index">
@@ -461,7 +460,7 @@
let localKey = "user_" + this.userInfo.sysId + "_gids"; let localKey = "user_" + this.userInfo.sysId + "_gids";
let hasIds = sessionStorage.getItem(localKey); let hasIds = sessionStorage.getItem(localKey);
this.audiences = hasIds ?? '' this.audiences = hasIds ?? ''
// this.$watermark.set(this.userInfo.name + this.userInfo.loginName); this.$watermark.set(this.userInfo.name + this.userInfo.loginName);
this.courseId = this.$route.query.id; this.courseId = this.$route.query.id;
this.initContentId = this.$route.query.contentId; this.initContentId = this.$route.query.contentId;
this.stopStudyTime();//先关闭 this.stopStudyTime();//先关闭
@@ -1140,7 +1139,7 @@
// } // }
// } // }
this.playerBoxShow = false; this.playerBoxShow = false;
this.onPlayerPlayFullscreen() // this.onPlayerPlayFullscreen()
// this.$watermark.set(this.userInfo.name + this.userInfo.loginName); // this.$watermark.set(this.userInfo.name + this.userInfo.loginName);
let $this = this; let $this = this;
//这里有些不准备,如果文件未能加载,这个事件就是错误的 //这里有些不准备,如果文件未能加载,这个事件就是错误的
@@ -1180,7 +1179,6 @@
}, },
onFullscreen(full) { onFullscreen(full) {
console.log("onFullscreen full 点击 exit 退出",full);
let divId = 'videowatermark'; let divId = 'videowatermark';
var div = document.getElementById('myVideoPlayer') var div = document.getElementById('myVideoPlayer')
if (full) { if (full) {
@@ -1198,17 +1196,15 @@
div3.style.cssText = div3.style.cssText =
"position:absolute;pointer-events: none; width: 100%;height: 100%;top:0;left:0;bottom: 0;right: 0; display: flex;justify-content: center;flex-wrap: wrap;overflow: hidden; opacity:0.3;padding-top:10px"; "position:absolute;pointer-events: none; width: 100%;height: 100%;top:0;left:0;bottom: 0;right: 0; display: flex;justify-content: center;flex-wrap: wrap;overflow: hidden; opacity:0.3;padding-top:10px";
div.appendChild(div3); div.appendChild(div3);
} else {
console.log("去除水印 ---- gx ----");
var markDiv = div.querySelector("#" + divId);
console.log("去除水印 ---- gx markDiv ----",markDiv);
if (markDiv) {
console.log("执行去除水印 ---- gx markDiv ----",markDiv);
div.removeChild(markDiv);
}
} }
// else {
// console.log("去除水印 ---- gx ----");
// var markDiv = div.querySelector("#" + divId);
// console.log("去除水印 ---- gx markDiv ----",markDiv);
// if (markDiv) {
// console.log("执行去除水印 ---- gx markDiv ----",markDiv);
// div.removeChild(markDiv);
// }
// }
}, },
onPlayerPause() { onPlayerPause() {
//console.log("暂停"); //console.log("暂停");