Commit b57dc624 by zhanghaozhe

Merge branch '11-11-formal' into dev

parents 8ff449de 9917dc13
...@@ -8,7 +8,10 @@ import classnames from 'classnames' ...@@ -8,7 +8,10 @@ import classnames from 'classnames'
import Swiper from 'swiper' import Swiper from 'swiper'
import { Popup } from "@common/index" import { Popup } from "@common/index"
import QRCode from 'qrcode' import QRCode from 'qrcode'
import { connect } from 'react-redux'
@connect(state => ({user: state.user}))
class FormalDraw extends Component { class FormalDraw extends Component {
swiper = null swiper = null
...@@ -21,7 +24,6 @@ class FormalDraw extends Component { ...@@ -21,7 +24,6 @@ class FormalDraw extends Component {
tabs: [], tabs: [],
today: '', today: '',
initialPageIndex: 0, initialPageIndex: 0,
isLogin: false,
list: [], list: [],
activeTimeRangeIndex: 0, activeTimeRangeIndex: 0,
userValue: {}, userValue: {},
...@@ -34,12 +36,11 @@ class FormalDraw extends Component { ...@@ -34,12 +36,11 @@ class FormalDraw extends Component {
const oneDay = data.list.filter(item => item.date === data.value.today) const oneDay = data.list.filter(item => item.date === data.value.today)
const activeIndex = oneDay[0]['son'].findIndex(item => item.status == 3) const activeIndex = oneDay[0]['son'].findIndex(item => item.status == 3)
if (code == 200) { if (code == 200) {
const {is_login, today} = data.value const {today} = data.value
this.setState({ this.setState({
tabs: data.list.map(item => ({title: item.date})), tabs: data.list.map(item => ({title: item.date})),
today, today,
initialPageIndex: data.list.findIndex(item => item.date == today) || 0, initialPageIndex: data.list.findIndex(item => item.date == today) || 0,
isLogin: is_login,
list: data.list, list: data.list,
userValue: data.value, userValue: data.value,
activeTimeRangeIndex: activeIndex < 0 ? 0 : activeIndex activeTimeRangeIndex: activeIndex < 0 ? 0 : activeIndex
...@@ -117,8 +118,9 @@ class FormalDraw extends Component { ...@@ -117,8 +118,9 @@ class FormalDraw extends Component {
} }
lotteryFunc = (status, id) => { lotteryFunc = (status, id) => {
if (!this.state.isLogin) { const {hasError} = this.props.user
this.props.history.push('/passport') if (hasError) {
this.props.toLogin()
return return
} }
if (status == 3) { if (status == 3) {
...@@ -156,7 +158,9 @@ class FormalDraw extends Component { ...@@ -156,7 +158,9 @@ class FormalDraw extends Component {
} }
render() { render() {
const {tabs, today, initialPageIndex, isLogin, list, activeTimeRangeIndex, userValue} = this.state const {tabs, today, initialPageIndex, list, activeTimeRangeIndex, userValue} = this.state
const {hasError} = this.props.user
const isLogin = !hasError
const schedule = userValue.schedule <= 2 ? 2 : userValue.schedule const schedule = userValue.schedule <= 2 ? 2 : userValue.schedule
return ( return (
list.length > 0 ? list.length > 0 ?
......
...@@ -578,7 +578,7 @@ class BlessingPreheat extends Component { ...@@ -578,7 +578,7 @@ class BlessingPreheat extends Component {
<button className="luck-draw__button" onClick={() => this.handleToShow('isRule')}>活动规则></button> <button className="luck-draw__button" onClick={() => this.handleToShow('isRule')}>活动规则></button>
<button className='prize-record' onClick={this.getMyPrizeRecord}>中奖记录></button> <button className='prize-record' onClick={this.getMyPrizeRecord}>中奖记录></button>
</div> </div>
<FormalDraw/> <FormalDraw toLogin={this.toLogin}/>
</> </>
} }
......
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