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 5c4aaf03
authored
Aug 26, 2022
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提交代码
1 parent
ff9fe87c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
13 deletions
src/assets/css/sprite.scss
src/utils/util.js
src/views/crowdfunding/components/LiveBox.vue
src/assets/css/sprite.scss
View file @
5c4aaf0
...
...
@@ -8,6 +8,7 @@
.icon-kf-box
{
width
:
300px
;
height
:
350px
;
background-position
:
0px
0px
;}
.icon-kf-logo
{
width
:
56px
;
height
:
70px
;
background-position
:
-310px
-152px
;}
.icon-kf
{
width
:
20px
;
height
:
20px
;
background-position
:
-376px
-202px
;}
.icon-live-close
{
width
:
18px
;
height
:
18px
;
background-position
:
-420px
-316px
;}
.icon-music-off
{
width
:
34px
;
height
:
34px
;
background-position
:
-354px
-232px
;}
.icon-music
{
width
:
32px
;
height
:
32px
;
background-position
:
-398px
-232px
;}
.icon-order
{
width
:
20px
;
height
:
20px
;
background-position
:
-406px
-202px
;}
...
...
@@ -20,5 +21,4 @@
.icon-success
{
width
:
20px
;
height
:
20px
;
background-position
:
-390px
-316px
;}
.icon-time
{
width
:
12px
;
height
:
11px
;
background-position
:
-20px
-374px
;}
.icon-title
{
width
:
170px
;
height
:
4px
;
background-position
:
0px
-360px
;}
.icon-top
{
width
:
30px
;
height
:
30px
;
background-position
:
-350px
-316px
;}
.icon-live-close
{
width
:
18px
;
height
:
18px
;
background-position
:
-420px
-316px
;}
\ No newline at end of file
.icon-top
{
width
:
30px
;
height
:
30px
;
background-position
:
-350px
-316px
;}
\ No newline at end of file
src/utils/util.js
View file @
5c4aaf0
...
...
@@ -256,7 +256,71 @@ const date_format = num => {
}
return
`
${
days
}
天
${
hours
}
:
${
minutes
}
:
${
second
}
`
}
const
draggable
=
(
drag
,
fun
)
=>
{
var
startEvt
,
moveEvt
,
endEvt
// 判断是否支持触摸事件
if
(
'ontouchstart'
in
window
)
{
startEvt
=
'touchstart'
moveEvt
=
'touchmove'
endEvt
=
'touchend'
}
else
{
startEvt
=
'mousedown'
moveEvt
=
'mousemove'
endEvt
=
'mouseup'
}
drag
.
style
.
cursor
=
'grab'
var
disX
,
disY
,
left
,
top
,
starX
,
starY
,
oLeft
,
oTop
drag
.
addEventListener
(
startEvt
,
startFun
)
function
startFun
(
event
)
{
// 阻止页面的滚动,缩放
event
.
preventDefault
()
// 兼容IE浏览器
drag
.
style
.
cursor
=
'grabbing'
var
e
=
event
||
window
.
event
oLeft
=
drag
.
offsetLeft
oTop
=
drag
.
offsetTop
// 手指按下时的坐标
starX
=
e
.
touches
?
e
.
touches
[
0
].
clientX
:
e
.
clientX
starY
=
e
.
touches
?
e
.
touches
[
0
].
clientY
:
e
.
clientY
// 手指相对于拖动元素左上角的位置
disX
=
starX
-
drag
.
offsetLeft
disY
=
starY
-
drag
.
offsetTop
// 按下之后才监听后续事件
document
.
addEventListener
(
moveEvt
,
moveFun
)
document
.
addEventListener
(
endEvt
,
endFun
)
}
function
moveFun
(
event
)
{
// 兼容IE浏览器
var
e
=
event
||
window
.
event
left
=
(
e
.
touches
?
e
.
touches
[
0
].
clientX
:
e
.
clientX
)
-
disX
top
=
(
e
.
touches
?
e
.
touches
[
0
].
clientY
:
e
.
clientY
)
-
disY
// 限制拖拽的X范围,不能拖出屏幕
if
(
left
<
0
)
{
left
=
0
}
else
if
(
left
>
document
.
documentElement
.
clientWidth
-
drag
.
offsetWidth
)
{
left
=
document
.
documentElement
.
clientWidth
-
drag
.
offsetWidth
}
// 限制拖拽的Y范围,不能拖出屏幕
if
(
top
<
0
)
{
top
=
0
}
else
if
(
top
>
window
.
innerHeight
-
drag
.
offsetHeight
)
{
top
=
window
.
innerHeight
-
drag
.
offsetHeight
}
drag
.
style
.
left
=
left
+
'px'
drag
.
style
.
top
=
top
+
'px'
}
function
endFun
(
event
)
{
drag
.
style
.
cursor
=
''
document
.
removeEventListener
(
moveEvt
,
moveFun
)
document
.
removeEventListener
(
endEvt
,
endFun
)
if
(
oLeft
==
drag
.
offsetLeft
&&
oTop
==
drag
.
offsetTop
&&
fun
)
{
// 点击
fun
()
}
}
}
const
utils
=
{
removeLocalStorage
,
...
...
@@ -286,6 +350,7 @@ const utils = {
toUnicode
,
setCookie
,
getCookie
,
draggable
,
setAppId
,
getAppId
,
debounce
,
...
...
src/views/crowdfunding/components/LiveBox.vue
View file @
5c4aaf0
...
...
@@ -2,7 +2,7 @@
<div
:class=
"['live-box',
{'videoFullscreen':videoFullscreen}]"
:style="videoStyle"
@touchmove="move
"
id="live-box
"
>
<div
class=
"mask"
...
...
@@ -53,7 +53,6 @@
<
script
type=
'text/ecmascript-6'
>
import
{
KfModal
}
from
'./index'
import
{
wxConfig
}
from
'@/api'
export
default
{
components
:
{
KfModal
},
name
:
'LiveBox'
,
...
...
@@ -71,9 +70,9 @@ export default {
mounted
()
{
let
_this
=
this
wxConfig
.
ready
(()
=>
{
_this
.
player
=
TCPlayer
(
"player-container-id"
,
{
fileID
:
"387702305074716718"
,
//点播ID
appID
:
"1311227058"
,
//点播APPID
_this
.
player
=
TCPlayer
(
'player-container-id'
,
{
fileID
:
'387702305074716718'
,
//点播ID
appID
:
'1311227058'
,
//点播APPID
autoplay
:
true
,
//自动播放
loop
:
true
,
// 循环播放
muted
:
true
,
//是否静音
...
...
@@ -91,6 +90,7 @@ export default {
_this
.
player
.
ready
(
function
()
{
//设置播放器初始化完成后的回调
console
.
log
(
'-------------------------'
,
_this
.
player
.
poster
())
_this
.
player
.
play
()
//播放视频
_this
.
draggable
(
document
.
getElementById
(
'live-box'
))
})
}
})
...
...
@@ -112,11 +112,6 @@ export default {
this
.
videoFullscreen
=
status
},
move
(
e
)
{
let
{
srcElement
}
=
e
,
[
data
]
=
e
.
changedTouches
this
.
videoStyle
=
`left:
${
data
.
pageX
-
srcElement
.
clientWidth
/
2
}
;top:
${
data
.
pageY
-
srcElement
.
clientHeight
/
2
}
;`
}
}
}
</
script
>
...
...
@@ -131,6 +126,7 @@ export default {
height
:
148px
;
border-radius
:
4px
;
overflow
:
hidden
;
-webkit-user-select
:
auto
;
.mask
{
width
:
100%
;
height
:
100%
;
...
...
@@ -141,7 +137,7 @@ export default {
border
:
2px
solid
#f95d35
;
border-radius
:
4px
;
box-sizing
:
border-box
;
.icon-live-close{
.icon-live-close
{
position
:
absolute
;
top
:
0
;
right
:
0
;
...
...
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