Commit fe903686 by xuzhenghua

2

parents 4d836938 034128b3
import React, {Component} from 'react'
import {Carousel, WingBlank} from 'antd-mobile'
import './index.scss'
import {api, getParam, http} from "@/utils"
// 课程页面滚动广告
class Carouselw extends Component {
constructor(props) {
super(props)
this.state = {
list: []
}
}
componentDidMount() {
const _this = this
_this.getList()
this.timer = setInterval(function () {
_this.getList()
}, 10000);
}
componentWillUnmount() {
this.timer && clearTimeout(this.timer);
}
// 获取课程接口
getList = () => {
let data = {
course_id: getParam('id')
}
http.post(`${API.home}/m/course/barrages`, data).then((res) => {
if (res.data.code === 200) {
this.setState({
list: res.data.data,
});
}
})
}
render() {
return (
<WingBlank>
<Carousel className="my-carousel"
vertical
dots={false}
autoplay
infinite
>
{
this.state.list &&
<div className="v-item text-overflow-one">
<img src={this.state.list.avatar} alt=""/>
{this.state.list.user_name} {this.state.list.live_msg}
</div>
}
</Carousel>
</WingBlank>
)
}
}
export default Carouselw
\ No newline at end of file
.detail-box {
.my-carousel {
position: absolute!important;
top: 66px;
width: 168px!important;
background: rgba(0, 0, 0, .6);
font-size: 12px;
color: $white;
border-radius: 3px;
padding: 6px 9px;
z-index:99;
img {
width: 18px;
height: 18px;
border-radius: 50%;
vertical-align: middle;
margin-right: 7px;
}
}
}
\ No newline at end of file
......@@ -156,8 +156,7 @@ export default [
},
{
path: '/togroup',
component: ToGroup,
isPrivate: true
component: ToGroup
},
{
path: '/aist-share',
......
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