Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
Overview
Details
Activity
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baiguangyao
mr-julyedu
Commits
73be78b3
Commit
73be78b3
authored
Dec 11, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
弹幕
parent
98d6cad9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
30 deletions
+86
-30
src/components/activity/newyear-2019/common/system-bullet-screen/index.js
+64
-23
src/components/activity/newyear-2019/common/system-bullet-screen/system-bullet-screen.scss
+22
-7
No files found.
src/components/activity/newyear-2019/common/system-bullet-screen/index.js
View file @
73be78b3
...
@@ -8,24 +8,50 @@ class SystemBulletScreen extends Component {
...
@@ -8,24 +8,50 @@ class SystemBulletScreen extends Component {
swiper
swiper
count
=
0
count
=
0
sysNotice
state
=
{
showNotices
:
true
}
componentDidMount
()
{
componentDidMount
()
{
this
.
initializeSwiper
()
this
.
initializeSwiper
()
}
}
componentWillUnmount
()
{
this
.
swiper
&&
this
.
swiper
.
destroy
(
true
,
true
)
}
initializeSwiper
=
()
=>
{
initializeSwiper
=
()
=>
{
const
_this
=
this
const
_this
=
this
console
.
log
(
document
.
querySelector
(
'.sys-bullet-screen-swiper-container'
))
this
.
swiper
=
new
Swiper
(
'.sys-bullet-screen-swiper-container'
,
{
this
.
swiper
=
new
Swiper
(
'.sys-bullet-screen-swiper-container'
,
{
allowTouchMove
:
false
,
allowTouchMove
:
false
,
direction
:
'vertical'
,
direction
:
'vertical'
,
loop
:
true
,
on
:
{
on
:
{
init
()
{
init
()
{
let
el
=
this
.
slides
[
this
.
activeIndex
],
Array
.
from
(
this
.
slides
).
forEach
(
item
=>
{
item
.
querySelector
(
'span'
).
addEventListener
(
'transitionend'
,
_this
.
transitionEnd
)
})
},
slideChangeTransitionEnd
()
{
_this
.
slideHorizontal
(
this
)
},
transitionEnd
()
{
const
el
=
this
.
slides
[
this
.
previousIndex
].
querySelector
(
'span'
)
el
.
style
.
transition
=
'unset'
el
.
style
.
transform
=
'translate3d(0,0,0)'
}
}
})
}
slideHorizontal
=
(
swiper
)
=>
{
let
el
=
swiper
.
slides
[
swiper
.
activeIndex
],
content
=
el
.
querySelector
(
'span'
),
content
=
el
.
querySelector
(
'span'
),
contentWidth
=
content
.
offsetWidth
,
contentWidth
=
content
.
offsetWidth
,
wrapperWidth
=
el
.
querySelector
(
'div'
)
.
clientWidth
wrapperWidth
=
el
.
clientWidth
const
co
=
131.25
const
co
=
131.25
...
@@ -33,56 +59,71 @@ class SystemBulletScreen extends Component {
...
@@ -33,56 +59,71 @@ class SystemBulletScreen extends Component {
content
.
style
.
transition
=
`transform
${
contentWidth
/
co
}
s linear`
content
.
style
.
transition
=
`transform
${
contentWidth
/
co
}
s linear`
setTimeout
(()
=>
{
setTimeout
(()
=>
{
content
.
style
.
transform
=
`translate3d(
${
-
(
contentWidth
-
wrapperWidth
)
-
10
}
px,0,0)`
content
.
style
.
transform
=
`translate3d(
${
-
(
contentWidth
-
wrapperWidth
)
-
10
}
px,0,0)`
},
3000
)
},
1000
)
console
.
log
(
contentWidth
,
wrapperWidth
)
}
else
{
}
else
{
_this
.
swiper
.
slideNext
()
this
.
swiper
.
slideNext
()
}
},
transitionEnd
()
{
console
.
log
(
this
.
slides
[
this
.
activeIndex
])
}
}
}
}
})
}
transitionEnd
=
()
=>
{
transitionEnd
=
()
=>
{
const
{
const
{
bullets
=
[
bullets
=
[
'
通知内容,后台编辑,单条超字左滑滚动显示完整,多条上下滚动轮播
'
,
'
第一条消息,第一条消息,第一条消息,第一条消息,第一条消息,第一条消息,
'
,
'
通知内容,后台编辑,单条超字左滑滚动显示完整,多条上下滚动轮播
'
,
'
第二条消息,第二条消息,第二条消息,第二条消息,第二条消息,第二条消息,
'
,
'
通知内容,后台编辑,单条超字左滑滚动显示完整,多条上下滚动轮播
'
,
'
第三条消息,第三条消息,第三条消息,第三条消息,第三条消息,第三条消息,
'
,
]
]
}
=
this
.
props
}
=
this
.
props
const
len
=
bullets
.
length
*
3
const
len
=
bullets
.
length
*
3
if
(
++
this
.
count
===
len
)
{
setTimeout
(()
=>
{
this
.
sysNotice
.
style
.
height
=
`0px`
},
2000
)
}
else
{
setTimeout
(()
=>
{
this
.
swiper
&&
this
.
swiper
.
slideNext
()
},
1000
)
}
}
removeSystemNotices
=
e
=>
{
e
.
persist
()
if
(
e
.
target
===
this
.
sysNotice
){
this
.
setState
({
showNotices
:
false
})
}
}
}
render
()
{
render
()
{
const
{
const
{
bullets
=
[
bullets
=
[
'
通知内容,后台编辑,单条超字左滑滚动显示完整,多条上下滚动轮播
'
,
'
第一条消息,第一条消息,第一条消息,第一条消息,第一条消息,第一条消息,
'
,
'
通知内容,后台编辑,单条超字左滑滚动显示完整,多条上下滚动轮播
'
,
'
第二条消息,第二条消息,第二条消息,第二条消息,第二条消息,第二条消息,
'
,
'
通知内容,后台编辑,单条超字左滑滚动显示完整,多条上下滚动轮播
'
,
'
第三条消息,第三条消息,第三条消息,第三条消息,第三条消息,第三条消息,
'
,
]
]
}
=
this
.
props
}
=
this
.
props
return
(
return
(
<
div
id
=
'system-bullet-screen'
className
=
'sys-bullet-screen-swiper-container'
>
this
.
state
.
showNotices
&&
<
div
id
=
"system-bullet-screen"
onTransitionEnd
=
{
this
.
removeSystemNotices
}
ref
=
{
el
=>
this
.
sysNotice
=
el
}
>
<
img
className
=
'avatar'
src
=
'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/system-avatar.png'
alt
=
""
/>
<
div
className
=
'sys-bullet-screen-swiper-container'
>
<
ul
className
=
"swiper-wrapper"
>
<
ul
className
=
"swiper-wrapper"
>
{
{
bullets
&&
bullets
.
length
&&
bullets
.
map
((
item
,
index
)
=>
{
bullets
&&
bullets
.
length
&&
bullets
.
map
((
item
,
index
)
=>
{
return
(
return
(
<
li
className
=
"swiper-slide"
key
=
{
index
}
>
<
li
className
=
"swiper-slide"
key
=
{
index
}
>
<
img
className
=
'avatar'
<
span
>
{
item
}
<
/span
>
src
=
'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/system-avatar.png'
alt
=
""
/>
<
div
><
span
onTransitionEnd
=
{
this
.
transitionEnd
}
>
{
item
}
<
/span></
div
>
<
/li
>
<
/li
>
)
)
})
})
}
}
<
/ul
>
<
/ul
>
<
/div
>
<
/div
>
<
/div
>
)
)
}
}
}
}
...
...
src/components/activity/newyear-2019/common/system-bullet-screen/system-bullet-screen.scss
View file @
73be78b3
@import
"../user-bullet-screen/bullet-screen"
;
@import
"../user-bullet-screen/bullet-screen"
;
#system-bullet-screen
{
#system-bullet-screen
{
overflow
:
hidden
;
overflow
:
hidden
;
margin-top
:
11px
;
margin-bottom
:
16px
;
margin-bottom
:
16px
;
li
{
padding-left
:
2px
;
display
:
flex
;
display
:
flex
;
overflow
:
hidden
;
align-items
:
center
;
div
{
transition
:
height
.3s
ease-in-out
;
width
:
100%
;
overflow
:
hidden
;
.sys-bullet-screen-swiper-container
{
height
:
100%
;
}
}
span
{
ul
{
flex
:
auto
;
max-width
:
293px
;
}
li
{
overflow
:
hidden
;
height
:
30px
;
span
{
display
:
inline-block
;
display
:
inline-block
;
white-space
:
nowrap
;
white-space
:
nowrap
;
line-height
:
30px
;
}
}
}
}
@extend
.bullet-screen
;
@extend
.bullet-screen
;
}
}
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