From ae2d855c89ca722ac7309fdf1aa6ceed370e3b95 Mon Sep 17 00:00:00 2001 From: heyujie <516346543@qq.com> Date: 星期一, 11 十月 2021 20:22:30 +0800 Subject: [PATCH] 监控ui --- src/components/wasmPlayer/index.vue | 131 +++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 124 insertions(+), 7 deletions(-) diff --git a/src/components/wasmPlayer/index.vue b/src/components/wasmPlayer/index.vue index 2053aa8..db673dc 100644 --- a/src/components/wasmPlayer/index.vue +++ b/src/components/wasmPlayer/index.vue @@ -13,14 +13,18 @@ v-loading="videoLoading" element-loading-background="rgba(0, 0, 0, 0.8)" style="position: unset !important" - ></div> - <canvas + ></div> + <canvas ref="playCanvas" id="paly-canvas" width="960" height="540" ></canvas> </div> + + <transition name="fade"> + <div class="popuptext" id="myPopup" v-if="fullScreenNotice">璧勬簮涓嬭浇涓�,璇风◢鍚�...</div> + </transition> <!-- 鎺у埗鏉� --> <section @@ -63,6 +67,12 @@ @click="fullScreen" :disable="false" ></b> + + <!-- 涓嬭浇 --> + <i + class="el-icon-download jsmodern-video-download" + @click="downLoad" + ></i> </section> <!-- 澶ф挱鏀炬寜閽� --> @@ -187,6 +197,9 @@ playerIndex: 0, isEmptyUrl: false, videoLoading: false, + loadUrl:'', + isFullScreen:false, + fullScreenNotice:false } }, watch: { @@ -464,6 +477,8 @@ } this.playerStatus = this.player.PlayOrPause + + this.loadUrl = url }, setPlayerStatus(stat) { this.videoLoading = false @@ -476,7 +491,62 @@ }, fullScreen() { - this.player.fullscreen() + if(!this.isFullScreen){ + this.player.fullscreen() + } + else{ + this.player.exitfullscreen() + } + this.isFullScreen = !this.isFullScreen + }, + + async downLoad() { + if (!this.loadUrl) { + this.$notify.info({ + title: '娑堟伅', + message:'涓嬭浇澶辫触锛屾棤鏁堢殑瑙嗛鍦板潃' + }); + return + } + + if (this.isFullScreen) { + /* const screen = this.player.webglPlayer.canvas.parentNode + var p = document.createElement("p"); + var txt = document.createTextNode("璧勬簮涓嬭浇涓�,璇风◢鍚�..."); + p.appendChild(txt); + p.classList.add("downloadNotice"); + screen.appendChild(p); */ + this.fullScreenNotice = true + setTimeout(()=>{this.fullScreenNotice = false},2000);} + + else { + this.$notify.info({ + title: '娑堟伅', + message:`璧勬簮涓嬭浇涓�,璇风◢鍚�...` + }); + } + + let url = 'http://'+window.location.host+this.loadUrl + + // let url = "http://localhost:8080/httpImage/192.168.20.189:6700/283,2f49bf283ad7?collection=2021-09-28-DSVAD010120190703-video" + let name = url.substring(url.lastIndexOf("/") + 1) + let responsePromise = await fetch(url) + let blob = await responsePromise.blob() + let objectURL = window.URL.createObjectURL(blob) + let a = document.createElement('a') + a.href = objectURL + a.download = name + a.click() + a.remove() + /* let url = 'http:/'+this.loadUrl.substring(10) + let link = document.createElement("a"); //鍒涘缓a鏍囩 + let name = url.substring(url.lastIndexOf("/") + 1) + link.style.display = "none"; //浣垮叾闅愯棌 + link.href = url; //璧嬩簣鏂囦欢涓嬭浇鍦板潃 + link.setAttribute("download", name); //璁剧疆涓嬭浇灞炴�� 浠ュ強鏂囦欢鍚� + document.body.appendChild(link); //a鏍囩鎻掕嚦椤甸潰涓� + link.click(); //寮哄埗瑙﹀彂a鏍囩浜嬩欢 */ + }, playPrev() { @@ -522,7 +592,7 @@ position: absolute; bottom: 0; left: 0; - z-index: 2147483648; + z-index: 100; width: 100%; height: 40px; line-height: 40px; @@ -547,9 +617,9 @@ background: rgba(255, 255, 255, 0.25); border-radius: 3px; width: 460px; - width: -webkit-calc(100% - 220px); - width: -moz-calc(100% - 220px); - width: calc(100% - 220px); + width: -webkit-calc(100% - 260px); + width: -moz-calc(100% - 260px); + width: calc(100% - 260px); float: left; margin: 19px 0 0 65px; position: relative; @@ -693,6 +763,15 @@ opacity: 0.5; cursor: default; } + + .el-icon-download { + font-size: 24px; + width: 18px; + height: 18px; + margin-top: 7px; + margin-left: -12px; + } + } .video-player:hover { @@ -738,4 +817,42 @@ font-size: 14px; color: #fff; } + +.downloadNotice { + position: absolute; + height: 200px; + width: 200px; + background-color: pink; +} + + .popuptext { + /* display:none; */ + height: 50px; + line-height: 50px; + font-size: 20px; + background-color: #555; + opacity: .8; + color: #fff; + text-align: center; + border-radius: 25px; + position: relative; + top: 30px; + z-index: 1; +} + + .fade-enter{ + opacity: 0; + } + .fade-enter-active{ + transition: opacity .5s; + } + .fade-leave-to{ + opacity: 0; + } + .fade-leave-active{ + transition: opacity 3s; + } + .canvasDiv .el-loading-mask { + z-index: 1000 !important; + } </style> -- Gitblit v1.8.0