Commit 42ea043a by zhanghaozhe

弹幕

parent 73a1dd12
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment