优化播放器基础组件按钮样式

This commit is contained in:
lin 2026-06-11 12:36:13 +08:00
parent 5eea3a19f5
commit 3417244705
6 changed files with 15 additions and 25 deletions

View File

@ -1,13 +1,13 @@
<template> <template>
<div id="h265Player" ref="container" style="background-color: #000000; position: relative; display: flex; align-items: center; justify-content: center;" @dblclick="fullscreenSwich"> <div id="h265Player" ref="container" style="background-color: #000000; position: relative; display: flex; align-items: center; justify-content: center;" @dblclick="fullscreenSwich" @mouseenter="showBar = true" @mouseleave="showBar = false">
<div id="glplayer" ref="playerBox" style="width: 100%; height: 100%; margin: 0 auto;"> <div id="glplayer" ref="playerBox" style="width: 100%; height: 100%; margin: 0 auto;">
<div v-if="playerLoading" class="play-loading"> <div v-if="playerLoading" class="play-loading">
<i class="el-icon-loading" /> <i class="el-icon-loading" />
视频加载中 <span style="margin-left: 5px">视频加载中</span>
</div> </div>
</div> </div>
<div v-if="showButton" id="buttonsBox" class="buttons-box"> <div v-if="showButton" id="buttonsBox" class="buttons-box" :style="{ opacity: showBar ? 1 : 0, pointerEvents: showBar ? 'auto' : 'none' }">
<div class="buttons-box-left"> <div class="buttons-box-left">
<i v-if="!playing" class="iconfont icon-play h265web-btn" @click="unPause" /> <i v-if="!playing" class="iconfont icon-play h265web-btn" @click="unPause" />
<i v-if="playing" class="iconfont icon-pause h265web-btn" @click="pause" /> <i v-if="playing" class="iconfont icon-pause h265web-btn" @click="pause" />
@ -60,7 +60,8 @@ export default {
playerHeight: 0, playerHeight: 0,
inited: false, inited: false,
playerLoading: false, playerLoading: false,
mediaInfo: null mediaInfo: null,
showBar: true
} }
}, },
watch: { watch: {
@ -267,6 +268,7 @@ export default {
height: 56px; height: 56px;
background: linear-gradient(to top, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0)); background: linear-gradient(to top, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
position: absolute; position: absolute;
transition: opacity 0.3s ease;
display: -webkit-box; display: -webkit-box;
display: -ms-flexbox; display: -ms-flexbox;
display: flex; display: flex;

View File

@ -3,8 +3,9 @@
ref="container" ref="container"
style="width:100%; height: 100%; background-color: #000000;margin:0 auto;position: relative;" style="width:100%; height: 100%; background-color: #000000;margin:0 auto;position: relative;"
@dblclick="fullscreenSwich" @dblclick="fullscreenSwich"
@mouseenter="showBar = true" @mouseleave="showBar = false"
> >
<div id="buttonsBox" class="buttons-box" v-if="showButton === undefined || showButton"> <div id="buttonsBox" class="buttons-box" v-if="showButton === undefined || showButton" :style="{ opacity: showBar ? 1 : 0, pointerEvents: showBar ? 'auto' : 'none' }">
<div class="buttons-box-left"> <div class="buttons-box-left">
<i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick" /> <i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick" />
<i v-if="playing" class="iconfont icon-pause jessibuca-btn" @click="pause" /> <i v-if="playing" class="iconfont icon-pause jessibuca-btn" @click="pause" />
@ -51,7 +52,8 @@ export default {
rotate: 0, rotate: 0,
vod: true, // vod: true, //
forceNoOffscreen: false, forceNoOffscreen: false,
localVideoUrl: this.videoUrl localVideoUrl: this.videoUrl,
showBar: true
} }
}, },
created() { created() {
@ -289,6 +291,7 @@ export default {
height: 28px; height: 28px;
background-color: rgba(43, 51, 63, 0.7); background-color: rgba(43, 51, 63, 0.7);
position: absolute; position: absolute;
transition: opacity 0.3s ease;
display: flex; display: flex;
left: 0; left: 0;
bottom: 0; bottom: 0;

View File

@ -120,7 +120,7 @@ export default {
} }
.player-video-area { .player-video-area {
width: 100%; width: 100%;
height: 100%; height:calc(100% - 36px);;
background: #000; background: #000;
} }
</style> </style>

View File

@ -15,7 +15,7 @@
</div> </div>
<div class="ptz-func-col"> <div class="ptz-func-col">
<div class="ptz-func-group" :class="{ row: btnLayout === 'row' }"> <div class="ptz-func-group" :class="{ row: btnLayout === 'row' }">
<div class="ptz-func-row"> <div class="ptz-func-row" v-if="homePosition">
<div class="ptz-func-row"> <div class="ptz-func-row">
<div class="ptz-func-btn" title="看守位" @click.prevent="$emit('ptz-guard')"> <div class="ptz-func-btn" title="看守位" @click.prevent="$emit('ptz-guard')">
<i class="el-icon-s-home" /><span>看守位</span> <i class="el-icon-s-home" /><span>看守位</span>
@ -70,7 +70,8 @@
export default { export default {
name: 'PtzControls', name: 'PtzControls',
props: { props: {
btnLayout: { type: String, default: 'column' } btnLayout: { type: String, default: 'column' },
homePosition: { type: Boolean, default: false }
}, },
data() { data() {
return { return {

View File

@ -12,7 +12,6 @@
:show-precise="false" :show-precise="false"
@ptz-move="onPtzMove" @ptz-move="onPtzMove"
@ptz-stop="onPtzStop" @ptz-stop="onPtzStop"
@ptz-guard="onPtzGuard"
@focus-move="onFocusMove" @focus-move="onFocusMove"
@focus-stop="onFocusStop" @focus-stop="onFocusStop"
@iris-move="onIrisMove" @iris-move="onIrisMove"
@ -72,13 +71,6 @@ export default {
zoomSpeed: 0 zoomSpeed: 0
}) })
}, },
onPtzGuard() {
this.$store.dispatch('device/homePosition', {
deviceId: this.deviceId,
channelId: this.channelDeviceId,
enabled: true
})
},
onFocusMove(e) { onFocusMove(e) {
const speedVal = this.ptzSpeed(e.speed) const speedVal = this.ptzSpeed(e.speed)
this.$store.dispatch('frontEnd/focus', [this.deviceId, this.channelDeviceId, e.command, speedVal]) this.$store.dispatch('frontEnd/focus', [this.deviceId, this.channelDeviceId, e.command, speedVal])

View File

@ -25,7 +25,6 @@
btn-layout="row" btn-layout="row"
@ptz-move="onPtzMove" @ptz-move="onPtzMove"
@ptz-stop="onPtzStop" @ptz-stop="onPtzStop"
@ptz-guard="onPtzGuard"
@focus-move="onFocusMove" @focus-move="onFocusMove"
@focus-stop="onFocusStop" @focus-stop="onFocusStop"
@iris-move="onIrisMove" @iris-move="onIrisMove"
@ -193,13 +192,6 @@ export default {
zoomSpeed: 0 zoomSpeed: 0
}) })
}, },
onPtzGuard() {
this.$store.dispatch('device/homePosition', {
deviceId: this.deviceId,
channelId: this.channelId,
enabled: true
})
},
onFocusMove(e) { onFocusMove(e) {
const speedVal = this.ptzSpeed(e.speed) const speedVal = this.ptzSpeed(e.speed)
this.$store.dispatch('frontEnd/focus', [this.deviceId, this.channelId, e.command, speedVal]) this.$store.dispatch('frontEnd/focus', [this.deviceId, this.channelId, e.command, speedVal])