Commit 545e6046 authored by 毛线's avatar 毛线

屏幕点击事件

parent ff3aaf39
...@@ -42,15 +42,13 @@ export default { ...@@ -42,15 +42,13 @@ export default {
initSceen() { initSceen() {
let zoom = 1 let zoom = 1
const { innerWidth, innerHeight } = window const { innerWidth, innerHeight } = window
console.log('innerWidth', innerWidth)
console.log('innerHeight', innerHeight)
if (innerWidth / innerHeight > 1080 / 608) { if (innerWidth / innerHeight > 1080 / 608) {
console.log('比例') console.log('比例')
zoom = window.innerHeight / 608 zoom = window.innerHeight / 608
} else { } else {
zoom = window.innerWidth / 1080 zoom = window.innerWidth / 1080
} }
this.zoom = zoom // this.zoom = zoom
}, },
}, },
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<img src="@/assets/images/temp/game/video-play.png" alt="" class="bg"> <img src="@/assets/images/temp/game/video-play.png" alt="" class="bg">
<img v-if="isPlay" src="@/assets/images/temp/game/video-play-state.png" alt="" class="play-state"> <img v-if="isPlay" src="@/assets/images/temp/game/video-play-state.png" alt="" class="play-state">
<div class="box"> <div class="box">
<WebRTCPlayer ref="webrtc" :video-src="player"/> <WebRTCPlayer ref="webrtc" :video-src="player" @click="(data) => click().player(data)"/>
</div> </div>
</div> </div>
<div class="option-block"> <div class="option-block">
...@@ -48,7 +48,9 @@ ...@@ -48,7 +48,9 @@
</div> </div>
<!-- play --> <!-- play -->
<img v-audio src="@/assets/images/temp/game/play-button.png" alt="" class="play-btn btn" @click="click().play()"> <div class="play-btn btn" @click="click().play()">
<img v-audio src="@/assets/images/temp/game/play-button.png" alt="">
</div>
<!-- 自动下注 --> <!-- 自动下注 -->
<div v-audio class="auto"> <div v-audio class="auto">
<img v-show="!isAuto" src="https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/chinese/ic_autoChinese.png" alt="" class="auto-btn btn" @click="showTime = !showTime;"> <img v-show="!isAuto" src="https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/chinese/ic_autoChinese.png" alt="" class="auto-btn btn" @click="showTime = !showTime;">
...@@ -117,13 +119,14 @@ export default { ...@@ -117,13 +119,14 @@ export default {
return this.deviceButtonPanel.backgroundUrl return this.deviceButtonPanel.backgroundUrl
}, },
btnList() { btnList() {
return this.deviceButtonPanel.keyMapping || [] const btnList = this.deviceButtonPanel.keyMapping || []
return btnList.filter(i => i.buttonStatus === 1)
}, },
btnList1() { btnList1() {
return this.btnList.filter(i => i.buttonStatus === 1 && i.buttonValue >= 9) return this.btnList.filter((i, index) => index < 6)
}, },
btnList2() { btnList2() {
return this.btnList.filter(i => i.buttonStatus === 1 && i.buttonValue <= 8) return this.btnList.filter((i, index) => index >= 6)
}, },
// 当前设备 // 当前设备
device() { device() {
...@@ -300,6 +303,21 @@ export default { ...@@ -300,6 +303,21 @@ export default {
console.log('jackpotList', data) console.log('jackpotList', data)
}) })
}, },
touch: ({ x, y }) => {
const url = '/api/game/touch'
const { id } = this
const params = {
deviceId: id,
x,
y,
}
this.$request({
url,
method: 'get',
params,
}).then(({ data }) => {
})
},
} }
}, },
click() { click() {
...@@ -319,6 +337,9 @@ export default { ...@@ -319,6 +337,9 @@ export default {
play: () => { play: () => {
this.network().button({ buttonValue: 2 }) this.network().button({ buttonValue: 2 })
}, },
player: ({ x16, y16 }) => {
this.network().touch({ x: x16, y: y16 })
},
// 设置自动play时间 // 设置自动play时间
setAutoPlay: (time) => { setAutoPlay: (time) => {
if (time === -1) { if (time === -1) {
...@@ -501,10 +522,20 @@ export default { ...@@ -501,10 +522,20 @@ export default {
} }
.play-btn { .play-btn {
position: absolute;
right: 204px;
bottom: 26px;
overflow: visible;
width: 90px;
height: 90px;
img {
width: 186px; width: 186px;
position: absolute; position: absolute;
right: 149px; left: -48px;
bottom: 15px; bottom: -5px;
user-select: none;
pointer-events: none;
}
} }
.auto { .auto {
width: 70px; width: 70px;
......
<template> <template>
<video id="jswebrtc" ref="jswebrtc" style="width: 100%;height: 100%;object-fit: fill"/> <video id="jswebrtc" ref="jswebrtc" style="width: 100%;height: 100%;object-fit: fill" @click="(e) => handler().click(e)"/>
</template> </template>
<script> <script>
...@@ -63,7 +63,25 @@ export default { ...@@ -63,7 +63,25 @@ export default {
console.log(obj, '播放器开始播放!') console.log(obj, '播放器开始播放!')
} }
}) })
},
handler() {
return {
click: (e) => {
console.log('click', e)
const video = this.$refs.jswebrtc
const { offsetWidth, offsetHeight } = video // 组件宽高
const { offsetX, offsetY } = e // 点击位置
const clickPercenX = (offsetHeight - offsetY) / offsetHeight
const clickPercenY = (offsetX) / offsetWidth
// 计算点击区域对应的十六进制
const max = 32639
const x16 = (+(max * clickPercenX).toFixed(0)).toString(16)
const y16 = (+(max * clickPercenY).toFixed(0)).toString(16)
this.$emit('click', {x16, y16})
},
} }
}, },
},
} }
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment