Commit 2deb35ad by zhanghaozhe

周年庆

parent bf513c26
......@@ -30,6 +30,7 @@ class Anniversary2020 extends Component {
4.每人只能当1次队员哦
`
drawTimer = null
hasMore = true
state = {
//静态数据
......@@ -113,9 +114,6 @@ class Anniversary2020 extends Component {
this.getBulletScreenData()
this.getRankList()
this.getStageCourses('zero')
if (!this.props.user.hasError) {
this.getPrizeRecords()
}
if (this.store.session.get('toInvitation') && !this.props.user.hasError) {
this.getFollowStaus()
this.store.session.remove('toInvitation')
......@@ -250,9 +248,9 @@ class Anniversary2020 extends Component {
}
getPrizeRecords = (() => {
let hasMore = true, isFetching = false
let isFetching = false
return () => {
if (isFetching || !hasMore) {
if (isFetching || !this.hasMore) {
return
}
isFetching = true
......@@ -261,7 +259,7 @@ class Anniversary2020 extends Component {
const {code, msg, data} = res.data
if (code === 200) {
if (isEmpty(data)) {
hasMore = false
this.hasMore = false
}
const _records = Array.isArray(data) ? data : []
this.setState(state => {
......@@ -422,10 +420,8 @@ class Anniversary2020 extends Component {
}
draw = debounce((i) => {
if (i !== 4) {
return
}
if (this.state.isDrawing) {
const {activityData, prizeData, isDrawing} = this.state
if (i !== 4 || isDrawing || prizeData.odd_times === 0 || activityData.stage === 4) {
return
}
this.startDraw()
......@@ -451,7 +447,9 @@ class Anniversary2020 extends Component {
} else {
Toast.info(msg)
}
})
}).catch(e => {
Toast.fail('操作频繁,请稍后再试')
})
}
startDraw = () => {
......@@ -498,11 +496,7 @@ class Anniversary2020 extends Component {
isGotoLogin = () => {
const {user, history} = this.props
if (user.hasError) {
if (browser.isWeixin) {
window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx23dac6775ac82877&redirect_uri=" + encodeURIComponent(window.location.href + "?aa=bb") + "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"
} else {
history.push('/passport')
}
history.push('/passport')
return true
}
return false
......@@ -726,6 +720,7 @@ class Anniversary2020 extends Component {
return
}
document.body.style.overflow = 'hidden'
this.getPrizeRecords()
this.setState({
isShowPrizesRecords: true,
}, () => {
......@@ -785,8 +780,13 @@ class Anniversary2020 extends Component {
<div className="invite">
{
activityData.stage === 1 ? <button className={'invite'}>715日开始</button> :
<Link to={'/anniversary_2020/invitation'} onClick={() => {
this.store.session.set('toInvitation', '1')
<Link to={'/anniversary_2020/invitation'} onClick={(e) => {
if (user.hasError) {
e.preventDefault()
history.push('/passport')
} else {
this.store.session.set('toInvitation', '1')
}
}}>
<button className={'invite'}>邀请好友加入队伍</button>
</Link>
......@@ -815,7 +815,12 @@ class Anniversary2020 extends Component {
: <>
{
activityData.practice_num
? <Link to={'/anniversary_2020/question/1'}>
? <Link to={'/anniversary_2020/question/1'} onClick={(e) => {
if (user.hasError) {
e.preventDefault()
history.push('/passport')
}
}}>
<div className="btn">
<button><i></i>开始练习</button>
</div>
......@@ -824,7 +829,9 @@ class Anniversary2020 extends Component {
<button><i></i>开始练习</button>
</div>
}
< div className="chance">今日剩余<span>{activityData.practice_num}</span>次</div>
{
!user.hasError && <div className="chance">今日剩余<span>{activityData.practice_num}</span>次</div>
}
</>
}
</div>
......@@ -1106,8 +1113,10 @@ class Anniversary2020 extends Component {
<i className={'iconfont iconiconfront-2 close'} onClick={() => {
this.records.removeEventListener('scroll', this.handleRecordsScroll)
document.body.style.overflow = 'auto'
this.hasMore = true
this.setState({
isShowPrizesRecords: false,
prizeRecordsPagination: 0
});
}}></i>
</div>
......@@ -1157,7 +1166,7 @@ function WinPrize({name, close, info}) {
<div className="modal win-prize">
<div className="title">恭喜您</div>
<div className="des">抽中了XXX<span className={'name'}>{name}</span></div>
<div className="contact">{info}</div>
<div className="contact">{/*{info}*/}请添加客服微信号:********请添加客服微信号:</div>
<button onClick={close}>我知道了</button>
</div>
</div>
......
......@@ -863,6 +863,10 @@
}
}
a{
text-decoration: underline;
}
td:nth-of-type(1) {
font-size: 16px;
......@@ -1055,12 +1059,10 @@
.contact {
width: 250px;
height: 40px;
padding: 12px 10px;
margin-bottom: 40px;
line-height: 40px;
border: 1px solid rgba(221, 221, 221, 1);
color: #271BD3;
text-align: center;
}
button {
......
......@@ -25,16 +25,6 @@ class Question extends Component {
}
componentDidMount() {
const {history, user} = this.props
if (user.hasError) {
if (browser.isWeixin) {
window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx23dac6775ac82877&redirect_uri=" + encodeURIComponent(url + "&aa=bb").toLowerCase() + "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"
} else {
history.push('/passport')
}
return
}
if (this.props.cache.recommends.length === 0) {
this.getQuestion()
}
......
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