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
42ea043a
Commit
42ea043a
authored
Sep 10, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
弹幕
parent
73a1dd12
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
+15
-11
src/components/detail/barrage/index.js
+15
-11
No files found.
src/components/detail/barrage/index.js
View file @
42ea043a
import
React
,
{
Component
}
from
'react'
import
{
WingBlank
}
from
'antd-mobile'
import
React
,
{
Component
}
from
'react'
import
{
WingBlank
}
from
'antd-mobile'
import
'./index.scss'
import
{
api
,
getParam
,
http
}
from
"@/utils"
import
{
getParam
,
http
}
from
"@/utils"
// 课程页面滚动广告
class
Carouselw
extends
Component
{
class
Barrage
extends
Component
{
timer
barageTimer
constructor
(
props
)
{
super
(
props
)
this
.
state
=
{
...
...
@@ -26,7 +27,7 @@ class Carouselw extends Component {
]
const
now
=
new
Date
(
Date
.
now
()).
getHours
()
for
(
let
period
of
periods
)
{
if
(
now
>=
period
.
start
&&
now
<=
period
.
end
)
{
if
(
now
>=
period
.
start
&&
now
<=
period
.
end
)
{
this
.
timer
=
setTimeout
(()
=>
{
this
.
getList
()
this
.
setupBarrage
()
...
...
@@ -39,9 +40,11 @@ class Carouselw extends Component {
componentDidUpdate
(
prevProps
)
{
const
{
isShow
}
=
this
.
props
const
{
isShow
:
prevIsShow
}
=
prevProps
if
(
prevIsShow
!==
isShow
&&
isShow
!==
undefined
){
if
(
isShow
){
this
.
setupBarrage
()
if
(
prevIsShow
!==
isShow
&&
isShow
!==
undefined
)
{
if
(
isShow
)
{
setTimeout
(()
=>
{
this
.
getList
()
},
5000
)
}
this
.
componentDidUpdate
=
null
}
...
...
@@ -66,6 +69,7 @@ class Carouselw extends Component {
},
()
=>
{
this
.
barageTimer
=
setTimeout
(()
=>
{
this
.
setState
({
isShowBarrage
:
!
this
.
state
.
isShowBarrage
})
this
.
setupBarrage
()
},
5000
)
});
}
...
...
@@ -84,7 +88,7 @@ class Carouselw extends Component {
<
/div
>
}
<
/div
>
{
/*
{
/*
<Carousel className="my-carousel"
vertical
dots={false}
...
...
@@ -106,4 +110,4 @@ class Carouselw extends Component {
}
}
export
default
Carouselw
\ No newline at end of file
export
default
Barrage
\ No newline at end of file
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