Commit 01b93f3e by xuzhenghua

app-bug

parent 9b5257be
...@@ -30,27 +30,39 @@ class FormalDraw extends Component { ...@@ -30,27 +30,39 @@ class FormalDraw extends Component {
} }
componentDidMount() { componentDidMount() {
this.getPrizeData()
}
shouldComponentUpdate(nextProps, nextState, nextContext) {
if(this.props.isApp !== nextProps.isApp) {
this.getPrizeData()
return false;
}
return true;
}
getPrizeData = () => {
http.get(`${API.home}/sys/activity/prize_data`) http.get(`${API.home}/sys/activity/prize_data`)
.then(res => { .then(res => {
const {data, code, msg} = res.data const {data, code, msg} = res.data
if (code == 200) { if (code == 200) {
const {today} = data.value const {today} = data.value
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)
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,
list: data.list, list: data.list,
userValue: data.value, userValue: data.value,
activeTimeRangeIndex: activeIndex < 0 ? 0 : activeIndex activeTimeRangeIndex: activeIndex < 0 ? 0 : activeIndex
}, () => { }, () => {
this.initializeSwiper() this.initializeSwiper()
}) })
} else { } else {
Toast.info(msg, 2, null, false) Toast.info(msg, 2, null, false)
} }
}) })
} }
initializeSwiper = () => { initializeSwiper = () => {
......
...@@ -586,7 +586,7 @@ class BlessingPreheat extends Component { ...@@ -586,7 +586,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 toLogin={this.toLogin}/> <FormalDraw toLogin={this.toLogin} isApp={isApp}/>
</> </>
} }
......
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