Commit ba3c79fc by zhanghaozhe

大咖直播

parent 37a9be4d
......@@ -368,7 +368,7 @@ class BlessingPreheat extends Component {
<RankList></RankList>
<Live></Live>
<Live isFormal={isFormal}></Live>
</div>
)
}
......
import React, { Component } from 'react'
import './index.scss'
import { Tabs, Toast } from "antd-mobile"
import { http } from "@/utils"
import { getParam, http, SendMessageToApp } from "@/utils"
import { Popup } from "@common/index"
import QRCode from 'qrcode'
import { uniqBy } from 'lodash'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
const isFormal = false
@connect(state => ({user: state.user}))
class Live extends Component {
......@@ -19,7 +18,8 @@ class Live extends Component {
preheatLives: [],
visible: false,
qrcode: '',
today: ''
today: '',
isApp: getParam('version')
}
......@@ -39,7 +39,7 @@ class Live extends Component {
}, {})
let tabs, today
if (isFormal) {
if (this.props.isFormal) {
tabs = Object.keys(lives).map(item => ({title: item}))
today = uniqBy(data.data['data_active'], value => value.date).findIndex(item => item['is_today'])
} else {
......@@ -62,6 +62,10 @@ class Live extends Component {
})
}
toLiveRoom = id => {
SendMessageToApp('toLiveRoom', id)
}
makeSubscribe = id => {
const {user, history} = this.props
if (user.hasError) {
......@@ -109,7 +113,7 @@ class Live extends Component {
initialPage={today}
>
{
isFormal
this.props.isFormal
? tabs.map((item, index) => {
const todayLives = lives[item.title]
return (
......@@ -179,7 +183,7 @@ function LiveContent({item, makeSubscribe}) {
</div>
{
item['on_live']
? <button className={'on-living'}>正在直播</button>
? <button className={'on-living'} onClick={this.toLiveRoom.bind(this, item['live_id'])}>正在直播</button>
:
item['is_subscribe']
? <button className={'subscribed'}>已预约</button>
......
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