Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
eslotsys-game-nuxt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
毛线
eslotsys-game-nuxt
Commits
fe4f4321
Commit
fe4f4321
authored
Jul 03, 2023
by
毛线
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
点击优化
parent
15c62341
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
6 deletions
+22
-6
index.vue
components/common/header/index.vue
+1
-1
index.vue
pages/index.vue
+16
-0
WebRTCPlayer.vue
pages/index/game/components/WebRTCPlayer.vue
+5
-5
No files found.
components/common/header/index.vue
View file @
fe4f4321
...
@@ -174,7 +174,7 @@ export default {
...
@@ -174,7 +174,7 @@ export default {
width
:
170px
;
width
:
170px
;
height
:
140px
;
height
:
140px
;
background-image
:
url(./static/left-block-bg.png)
;
background-image
:
url(./static/left-block-bg.png)
;
background-size
:
100%
;
background-size
:
100%
100%
;
z-index
:
1
;
z-index
:
1
;
.logo
{
.logo
{
width
:
136px
;
width
:
136px
;
...
...
pages/index.vue
View file @
fe4f4321
...
@@ -35,12 +35,28 @@ export default {
...
@@ -35,12 +35,28 @@ export default {
mounted
()
{
mounted
()
{
this
.
GetBaseInfo
()
this
.
GetBaseInfo
()
this
.
GetDeviceList
()
this
.
GetDeviceList
()
// this.network().isGaming()
},
},
methods
:
{
methods
:
{
...
mapActions
([
...
mapActions
([
'GetBaseInfo'
,
'GetBaseInfo'
,
'GetDeviceList'
,
'GetDeviceList'
,
]),
]),
network
()
{
return
{
isGaming
:
()
=>
{
const
url
=
'/api/gaming/isGaming'
this
.
$request
({
url
,
method
:
'get'
,
}).
then
(({
id
})
=>
{
if
(
id
)
{
// this.$router.replace(`/game/${id}`)
}
})
},
}
},
},
},
}
}
</
script
>
</
script
>
...
...
pages/index/game/components/WebRTCPlayer.vue
View file @
fe4f4321
<
template
>
<
template
>
<video
id=
"jswebrtc"
ref=
"jswebrtc"
style=
"width: 100%;height: 100%;object-fit: fill"
@
click=
"(e) => handler().click(e)"
/>
<video
ref=
"jswebrtc"
style=
"width: 100%;height: 100%;object-fit: fill"
@
click=
"(e) => handler().click(e)"
/>
</
template
>
</
template
>
<
script
>
<
script
>
...
@@ -53,7 +53,7 @@ export default {
...
@@ -53,7 +53,7 @@ export default {
}
}
// 获取承载元素dom
// 获取承载元素dom
const
videoDom
=
document
.
getElementById
(
'jswebrtc'
)
const
videoDom
=
this
.
$refs
.
jswebrtc
// 初始化播放器
// 初始化播放器
this
.
player
=
new
JSWebrtc
.
Player
(
url
,
{
this
.
player
=
new
JSWebrtc
.
Player
(
url
,
{
...
@@ -77,13 +77,13 @@ export default {
...
@@ -77,13 +77,13 @@ export default {
const
video
=
this
.
$refs
.
jswebrtc
const
video
=
this
.
$refs
.
jswebrtc
const
{
offsetWidth
,
offsetHeight
}
=
video
// 组件宽高
const
{
offsetWidth
,
offsetHeight
}
=
video
// 组件宽高
const
{
offsetX
,
offsetY
}
=
e
// 点击位置
const
{
offsetX
,
offsetY
}
=
e
// 点击位置
const
clickPercen
X
=
(
offsetHeight
*
zoom
-
offsetY
)
/
(
offsetHeight
*
zoom
)
const
clickPercen
Y
=
(
offsetHeight
*
zoom
-
offsetY
)
/
(
offsetHeight
*
zoom
)
const
clickPercen
Y
=
(
offsetX
)
/
(
offsetWidth
*
zoom
)
const
clickPercen
X
=
(
offsetX
)
/
(
offsetWidth
*
zoom
)
// 计算点击区域对应的十六进制
// 计算点击区域对应的十六进制
const
max
=
32639
const
max
=
32639
const
x16
=
(
+
(
max
*
clickPercenX
).
toFixed
(
0
)).
toString
(
16
)
const
y16
=
(
+
(
max
*
clickPercenY
).
toFixed
(
0
)).
toString
(
16
)
const
y16
=
(
+
(
max
*
clickPercenY
).
toFixed
(
0
)).
toString
(
16
)
const
x16
=
(
+
(
max
*
clickPercenX
).
toFixed
(
0
)).
toString
(
16
)
this
.
$emit
(
'click'
,
{
x16
,
y16
})
this
.
$emit
(
'click'
,
{
x16
,
y16
})
},
},
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment