Showing
2 changed files
with
20 additions
and
10 deletions
@@ -2,7 +2,6 @@ import React, {PureComponent} from 'react'; | @@ -2,7 +2,6 @@ import React, {PureComponent} from 'react'; | ||
2 | import './index.scss' | 2 | import './index.scss' |
3 | import {conf, start} from '../../api' | 3 | import {conf, start} from '../../api' |
4 | import yaSDK from 'yoho-activity-sdk'; | 4 | import yaSDK from 'yoho-activity-sdk'; |
5 | -import config from '../../../../config'; | ||
6 | import cookie from 'react-cookies'; | 5 | import cookie from 'react-cookies'; |
7 | import LazyLoad from 'react-lazy-load' | 6 | import LazyLoad from 'react-lazy-load' |
8 | import queryString from '../../../../common/query-stringify' | 7 | import queryString from '../../../../common/query-stringify' |
@@ -20,7 +19,7 @@ export default class wheelSurf extends PureComponent { | @@ -20,7 +19,7 @@ export default class wheelSurf extends PureComponent { | ||
20 | super(props); | 19 | super(props); |
21 | this.state = { | 20 | this.state = { |
22 | uid: 0, | 21 | uid: 0, |
23 | - expIdx: 1, | 22 | + epPrize: {}, |
24 | query: {}, | 23 | query: {}, |
25 | canStart: true, // 可以抽奖 | 24 | canStart: true, // 可以抽奖 |
26 | slowEnding: false, // 减速结束 | 25 | slowEnding: false, // 减速结束 |
@@ -114,7 +113,7 @@ export default class wheelSurf extends PureComponent { | @@ -114,7 +113,7 @@ export default class wheelSurf extends PureComponent { | ||
114 | 113 | ||
115 | this.setState({ | 114 | this.setState({ |
116 | conf: result.data.conf, | 115 | conf: result.data.conf, |
117 | - expIdx: result.data.prize_idx, | 116 | + epPrize: result.data.emptyPrize, |
118 | totalParts: result.data.prize, | 117 | totalParts: result.data.prize, |
119 | remainCount: result.data.residueCount, | 118 | remainCount: result.data.residueCount, |
120 | dayLeftTimesTip: result.data.conf.btm_tip_one, | 119 | dayLeftTimesTip: result.data.conf.btm_tip_one, |
@@ -172,20 +171,31 @@ export default class wheelSurf extends PureComponent { | @@ -172,20 +171,31 @@ export default class wheelSurf extends PureComponent { | ||
172 | remainCount: this.state.remainCount - 1 | 171 | remainCount: this.state.remainCount - 1 |
173 | }); | 172 | }); |
174 | 173 | ||
175 | - let result = await start({ | 174 | + let result; |
175 | + try { | ||
176 | + result = await start({ | ||
176 | act_id: +this.state.query.actId, | 177 | act_id: +this.state.query.actId, |
177 | uid: cookie.load('uid'), | 178 | uid: cookie.load('uid'), |
178 | sessionKey: cookie.load('app_session_key'), | 179 | sessionKey: cookie.load('app_session_key'), |
179 | sessionType: cookie.load('app_client_type'), | 180 | sessionType: cookie.load('app_client_type'), |
180 | appVersion: cookie.load('app_version') | 181 | appVersion: cookie.load('app_version') |
181 | - }); | ||
182 | - | ||
183 | - if (result.code !== 200) { | 182 | + }); |
183 | + | ||
184 | + if (result.code !== 200) { | ||
184 | result = { | 185 | result = { |
185 | data: { | 186 | data: { |
186 | - prize_idx: this.state.expIdx | 187 | + prize_idx: this.state.epPrize.prize_idx, |
188 | + desc: '对不起,您没有中奖' | ||
187 | } | 189 | } |
188 | } | 190 | } |
191 | + } | ||
192 | + } catch (e) { | ||
193 | + result = { | ||
194 | + data: { | ||
195 | + prize_idx: this.state.epPrize.prize_idx, | ||
196 | + desc: '对不起,您没有中奖' | ||
197 | + } | ||
198 | + } | ||
189 | } | 199 | } |
190 | 200 | ||
191 | let timer = setTimeout(() => { | 201 | let timer = setTimeout(() => { |
@@ -197,7 +207,7 @@ export default class wheelSurf extends PureComponent { | @@ -197,7 +207,7 @@ export default class wheelSurf extends PureComponent { | ||
197 | }); | 207 | }); |
198 | this.state.angle = this.state.stopAngle; | 208 | this.state.angle = this.state.stopAngle; |
199 | this.stop(this.state.stopAngle); | 209 | this.stop(this.state.stopAngle); |
200 | - }, 4000); | 210 | + }, 3000); |
201 | }; | 211 | }; |
202 | 212 | ||
203 | calcStopAngle = idx => { | 213 | calcStopAngle = idx => { |
-
Please register or login to post a comment