Commit 9917dc13 by zhanghaozhe

app登录

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