Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
scrm-wx-merchant-activity
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 701ce48c
authored
Sep 23, 2022
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
一点优化
1 parent
cea17c87
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
12 deletions
.eslintrc.js
src/components/LiveBox.vue
src/env.js
src/plugins/index.js
.eslintrc.js
View file @
701ce48
...
...
@@ -7,6 +7,11 @@ module.exports = {
parserOptions
:
{
parser
:
'babel-eslint'
},
globals
:
{
wx
:
true
,
Hls
:
true
,
TCPlayer
:
true
},
rules
:
{
'vue/max-attributes-per-line'
:
[
2
,
...
...
src/components/LiveBox.vue
View file @
701ce48
...
...
@@ -8,19 +8,19 @@
<div
class=
"center side"
></div>
<div
class=
"side"
></div>
</div>
<div
class=
"text"
>
{{
liveStatus
[
liveDetail
.
status
]
==
'live'
?
'直播'
:
'回放'
}}
</div>
<div
class=
"text"
>
{{
liveStatus
[
liveDetail
.
status
]
==
'live'
?
'直播'
:
'回放'
}}
</div>
</div>
</div>
<div
class=
"sprite-icon icon-live-close"
@
click=
"handleClose"
></div>
<div
:class=
"
{ videoShort: detail.activityStatus != 3
&&
detail.buyFlag != 2 }">
<div
class=
"mask"
@
click=
"openFullscreen"
>
<div
class=
"sprite-icon icon-live-close"
@
click=
"handleClose"
></div>
<div
class=
"status flex"
>
<div
v-if=
"liveStatus[liveDetail.status] == 'live'"
class=
"live-line"
>
<div
class=
"side"
></div>
<div
class=
"center side"
></div>
<div
class=
"side"
></div>
</div>
<div
class=
"text"
>
{{
liveStatus
[
liveDetail
.
status
]
==
'live'
?
'正在直播'
:
'直播回放'
}}
</div>
<div
class=
"text"
>
{{
liveStatus
[
liveDetail
.
status
]
==
'live'
?
'正在直播'
:
'直播回放'
}}
</div>
</div>
<template
v-if=
"isShowGif"
>
<img
v-if=
"liveStatus[liveDetail.status] == 'live'"
src=
"https://wimg.588ku.com/gif620/20/04/23/79a7882dfb0c59497976fd8b3bfe60ef.gif"
alt=
""
/>
...
...
@@ -78,7 +78,7 @@ export default {
},
mounted
()
{
console
.
log
(
this
.
liveDetail
,
'============'
)
le
t
_this
=
this
cons
t
_this
=
this
if
(
!
this
.
IsIOS
)
{
this
.
changeGifStatus
()
}
...
...
@@ -89,7 +89,7 @@ export default {
// bind them together
_this
.
hls
.
attachMedia
(
_this
.
video
)
}
le
t
playParams
=
{
cons
t
playParams
=
{
autoplay
:
true
,
// 自动播放
loop
:
true
,
// 循环播放
// muted: false, // 是否静音
...
...
@@ -101,11 +101,11 @@ export default {
}
}
_this
.
player
=
TCPlayer
(
'player-container-id'
,
playParams
)
let
src
=
this
.
liveStatus
[
this
.
liveDetail
.
status
]
==
'live'
?
this
.
liveDetail
.
playPath
:
(
this
.
liveDetail
.
liveBroadcastRecordingFileList
.
length
?
this
.
liveDetail
.
liveBroadcastRecordingFileList
[
0
].
videoUrl
:
''
)
_this
.
player
.
src
(
src
)
wx
.
getNetworkType
({
success
:
(
result
)
=>
{
_this
.
player
.
ready
(
function
()
{
// 设置播放器初始化完成后的回调
_this
.
player
.
ready
(
function
()
{
// 设置播放器初始化完成后的回调
const
src
=
_this
.
liveStatus
[
_this
.
liveDetail
.
status
]
==
'live'
?
_this
.
liveDetail
.
playPath
:
(
_this
.
liveDetail
.
liveBroadcastRecordingFileList
.
length
?
_this
.
liveDetail
.
liveBroadcastRecordingFileList
[
0
].
videoUrl
:
''
)
_this
.
player
.
src
(
src
)
_this
.
player
.
poster
()
_this
.
player
.
play
()
// 播放视频
_this
.
draggable
(
document
.
getElementById
(
'live-box'
),
_this
.
openFullscreen
)
...
...
@@ -124,9 +124,9 @@ export default {
methods
:
{
// 打开关闭全屏
openFullscreen
(
status
=
true
)
{
le
t
[
live
]
=
document
.
getElementsByClassName
(
'live-box'
)
le
t
[
volumePanel
]
=
document
.
getElementsByClassName
(
'vjs-volume-panel '
)
le
t
[
volume
]
=
volumePanel
.
getElementsByClassName
(
'vjs-mute-control'
)
cons
t
[
live
]
=
document
.
getElementsByClassName
(
'live-box'
)
cons
t
[
volumePanel
]
=
document
.
getElementsByClassName
(
'vjs-volume-panel '
)
cons
t
[
volume
]
=
volumePanel
.
getElementsByClassName
(
'vjs-mute-control'
)
volume
.
click
()
console
.
log
(
volume
)
this
.
player
.
play
()
...
...
@@ -136,7 +136,7 @@ export default {
},
// 处理tcplayer错误码14
dealTcPlayerErr14
(
_this
)
{
_this
.
hls
.
on
(
Hls
.
Events
.
ERROR
,
function
(
event
,
data
)
{
_this
.
hls
.
on
(
Hls
.
Events
.
ERROR
,
function
(
event
,
data
)
{
if
(
data
.
fatal
)
{
switch
(
data
.
type
)
{
case
Hls
.
ErrorTypes
.
NETWORK_ERROR
:
...
...
src/env.js
0 → 100644
View file @
701ce48
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2022-09-23 14:40:32
* @LastEditors: limin
* @LastEditTime: 2022-09-23 18:49:16
* @FilePath: \scrm-wx-merchant-activity\src\env.js
*/
const
SDK
=
{
WX
:
'//res.wx.qq.com/open/js/jweixin-1.2.0.js'
,
WXWORK
:
'//open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js'
}
function
__load
()
{
const
sdks
=
window
.
ENV
.
ISWXWORK
?
Object
.
values
(
SDK
)
:
[
SDK
.
WX
]
for
(
let
i
=
0
,
j
=
sdks
.
length
;
i
<
j
;
i
++
)
{
const
sdksrc
=
sdks
[
i
]
var
oScript
=
__creatScript
()
oScript
.
src
=
sdksrc
document
.
head
.
appendChild
(
oScript
)
}
}
function
__setEnvVar
()
{
const
ua
=
navigator
.
userAgent
const
ISWXWORK
=
Boolean
(
ua
.
match
(
/MicroMessenger/i
))
&&
Boolean
(
ua
.
match
(
/wxwork/i
))
const
ISIOS
=
/
(
iPhone|iPad|iPod|iOS
)
/i
.
test
(
ua
)
const
ISMiniprogram
=
window
.
__wxjs_environment
===
'miniprogram'
const
ISMOBILE
=
/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i
.
test
(
ua
.
toLowerCase
())
||
(
!
ua
.
toLowerCase
().
match
(
'iphone'
)
&&
navigator
.
maxTouchPoints
>
1
)
window
.
ENV
=
{
ISIOS
,
ISWXWORK
,
ISMiniprogram
,
ISMOBILE
}
}
function
__creatScript
()
{
return
document
.
createElement
(
'script'
)
}
export
const
loadSdk
=
()
=>
{
__setEnvVar
()
__load
()
}
src/plugins/index.js
0 → 100644
View file @
701ce48
import
Vue
from
'vue'
import
{
components
}
from
'./vant'
components
.
forEach
(
component
=>
Vue
.
use
(
component
))
Write
Preview
Markdown
is supported
Attach a file
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 post a comment