Commit b91f6919 by wangshuo

Merge branch '11-11-formal' into dev

parents a2761e81 f18b9d30
#main-banner{ #main-banner{
overflow: auto; overflow: auto;
margin-bottom: 70px;
.banner{ .banner{
width: 375px; width: 375px;
height: 183px; height: 183px;
......
...@@ -77,50 +77,57 @@ class FormalDraw extends Component { ...@@ -77,50 +77,57 @@ class FormalDraw extends Component {
draw = id => { draw = id => {
let {surplus, is_prize, hot_value} = this.state.userValue let {surplus, is_prize, hot_value} = this.state.userValue
if(hot_value<50){ if (hot_value < 50) {
Toast.info('你的福气值未达到参与抽奖所需福气值分数,快去积攒福气值吧', 2, null, false) Toast.info('你的福气值未达到参与抽奖所需福气值分数,快去积攒福气值吧', 2, null, false)
} else if(is_prize == 1){ } else if (is_prize == 1) {
Toast.info('你已参与当前时段抽奖', 2, null, false) Toast.info('你已参与当前时段抽奖', 2, () => {
} else if(surplus<1){ this.requestDraw(id)
}, false)
} else if (surplus < 1) {
Toast.info('你的抽奖次数已用光,快去积攒福气值可获得更多抽奖机会', 2, null, false) Toast.info('你的抽奖次数已用光,快去积攒福气值可获得更多抽奖机会', 2, null, false)
} else { } else {
http.post(`${API.home}/sys/activity/prize`, { this.requestDraw(id)
id
}).then(res => {
const {code, msg, data} = res.data
if (code == 200) {
var _czc = _czc || []
_czc.push(["_trackEvent", '点击抽奖', 'm端双十一正式活动-点击抽奖'])
QRCode.toDataURL(data.url, (err, url) => {
this.popupInstance = Popup({
title: '你已成功参与本时段抽奖',
className: 'join-lottery',
content: (
<>
<div className="text">
<div className="code">抽奖码为:{data.code}</div>
<div className="time">本时段的中奖结果将在{data.date}公布</div>
<div className="hint">你可关注‘七月在线’服务号第一时间获得中奖信息。</div>
<img src={url} className='qr-code' alt=""/>
</div>
<button onClick={() => {
this.popupInstance.close()
}}>知道了
</button>
</>
)
})
this.setState({
userValue: {...this.state.userValue, ...{surplus: --surplus}}
})
})
} else {
Toast.info(msg, 2, null, false)
}
})
} }
} }
requestDraw = id => {
let {surplus} = this.state.userValue
http.post(`${API.home}/sys/activity/prize`, {
id
}).then(res => {
const {code, msg, data} = res.data
if (code == 200) {
var _czc = _czc || []
_czc.push(["_trackEvent", '点击抽奖', 'm端双十一正式活动-点击抽奖'])
QRCode.toDataURL(data.url, (err, url) => {
this.popupInstance = Popup({
title: '你已成功参与本时段抽奖',
className: 'join-lottery',
content: (
<>
<div className="text">
<div className="code">抽奖码为:{data.code}</div>
<div className="time">本时段的中奖结果将在{data.date}公布</div>
<div className="hint">你可关注‘七月在线’服务号第一时间获得中奖信息。</div>
<img src={url} className='qr-code' alt=""/>
</div>
<button onClick={() => {
this.popupInstance.close()
}}>知道了
</button>
</>
)
})
this.setState({
userValue: {...this.state.userValue, ...{surplus: --surplus}, ...{is_prize: 1}}
})
})
} else {
Toast.info(msg, 2, null, false)
}
})
}
lotteryFunc = (status, id) => { lotteryFunc = (status, id) => {
const {hasError} = this.props.user const {hasError} = this.props.user
if (hasError) { if (hasError) {
...@@ -184,7 +191,16 @@ class FormalDraw extends Component { ...@@ -184,7 +191,16 @@ class FormalDraw extends Component {
{ {
list.map((listItem, index) => { list.map((listItem, index) => {
return ( return (
<div className="content" key={index}> <div className={`content ${today === userValue.today ? 'current':''}`} key={index}>
{
(isLogin && (today === userValue.today))
?
<div className="prize_number_con">
当日剩余抽奖次数:
<span className={'prize__number'}>{userValue.surplus}</span>
</div>
: ""
}
<div className="title"> <div className="title">
<img src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/title-decorate-left.png" <img src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/title-decorate-left.png"
alt=""/> alt=""/>
...@@ -199,6 +215,7 @@ class FormalDraw extends Component { ...@@ -199,6 +215,7 @@ class FormalDraw extends Component {
src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/title-decorate-right.png" src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/title-decorate-right.png"
alt=""/> alt=""/>
</div> </div>
{ {
isLogin ? isLogin ?
<div className="progress-bar"> <div className="progress-bar">
...@@ -224,14 +241,14 @@ class FormalDraw extends Component { ...@@ -224,14 +241,14 @@ class FormalDraw extends Component {
statusContent = ( statusContent = (
<> <>
<span>已结束</span> <span>已结束</span>
<Link to={`/prize-winner-list?tid=${item.id}`}>查看中奖记录</Link> <Link to={`/prize-winner-list?tid=${item.id}`}>查看中奖名单</Link>
</> </>
) )
break break
case 3: case 3:
statusContent = ( statusContent = (
<> <>
<div>参与抽奖</div> <div>立即抽奖</div>
<div>{item.num}人正在参与</div> <div>{item.num}人正在参与</div>
</> </>
) )
......
...@@ -85,6 +85,7 @@ ...@@ -85,6 +85,7 @@
.content { .content {
position: relative;
.title { .title {
display: flex; display: flex;
justify-content: center; justify-content: center;
...@@ -126,6 +127,26 @@ ...@@ -126,6 +127,26 @@
} }
} }
.prize_number_con {
width:280px;
height:30px;
background:rgba(255,255,255,1);
border-radius:15px;
font-size:14px;
font-weight:400;
color:rgba(83,39,250,1);
text-align: center;
text-align-last: center;
line-height: 30px;
position: absolute;
left: 50%;
transform: translateX(-50%);
top: 18px;
}
}
.current {
padding-top: 50px;
} }
.progress-bar { .progress-bar {
......
...@@ -245,9 +245,7 @@ class BlessingPreheat extends Component { ...@@ -245,9 +245,7 @@ class BlessingPreheat extends Component {
if (code === 200) { if (code === 200) {
this.setState({ this.setState({
isSign: !!data.today_signed, isSign: !!data.today_signed,
// isFormal: data.is_activity, isFormal: data.is_activity,
//todo 去掉假数据
isFormal: 1,
testSum: parseInt(data.user_test_total, 10) || 0, testSum: parseInt(data.user_test_total, 10) || 0,
userInfo: Object.assign({}, userInfo, { userInfo: Object.assign({}, userInfo, {
isFollow: data.subscribed, isFollow: data.subscribed,
...@@ -540,8 +538,23 @@ class BlessingPreheat extends Component { ...@@ -540,8 +538,23 @@ class BlessingPreheat extends Component {
toSection={this.toSection} toSection={this.toSection}
index={index} index={index}
/> />
{/* 抽奖--正式 */}
{
isFormal === 1 &&
<>
<ListHeader id={'lucky-draw'} text="幸运大抽奖" styles={{margin: '30px 0 10px'}}/>
<div className="formal-draw-btns">
<button className="luck-draw__button" onClick={() => this.handleToShow('isRule')}>活动规则></button>
<button className='prize-record' onClick={this.getMyPrizeRecord}>中奖记录></button>
</div>
<FormalDraw toLogin={this.toLogin}/>
</>
}
{/* 积福气 */} {/* 积福气 */}
<ListHeader id={'lucky-value'} text="积福气,享受更多福利" styles={{margin: '60px 0 15px'}}/> <ListHeader id={'lucky-value'} text="积福气,享受更多福利" styles={{margin: '30px 0 15px'}}/>
<Link className="luck-draw__button" to="/blessingRank">福气排行榜></Link> <Link className="luck-draw__button" to="/blessingRank">福气排行榜></Link>
...@@ -558,11 +571,10 @@ class BlessingPreheat extends Component { ...@@ -558,11 +571,10 @@ class BlessingPreheat extends Component {
/> />
{/* 幸运大抽奖--预热 */} {/* 幸运大抽奖--预热 */}
<ListHeader id={'lucky-draw'} text="幸运大抽奖" styles={{margin: '30px 0 10px'}}/>
{ {
isFormal === 0 && isFormal === 0 &&
<> <>
<ListHeader id={'lucky-draw'} text="幸运大抽奖" styles={{margin: '30px 0 10px'}}/>
<p className="luck-draw__tip">- 将于111110点开启 -</p> <p className="luck-draw__tip">- 将于111110点开启 -</p>
<button className="luck-draw__button" onClick={() => this.handleToShow('isRule')}>活动规则></button> <button className="luck-draw__button" onClick={() => this.handleToShow('isRule')}>活动规则></button>
<LuckDraw/> <LuckDraw/>
...@@ -570,20 +582,6 @@ class BlessingPreheat extends Component { ...@@ -570,20 +582,6 @@ class BlessingPreheat extends Component {
} }
{/* 抽奖--正式 */}
{
isFormal === 1 &&
<>
<div className="formal-draw-btns">
<button className="luck-draw__button" onClick={() => this.handleToShow('isRule')}>活动规则></button>
<button className='prize-record' onClick={this.getMyPrizeRecord}>中奖记录></button>
</div>
<FormalDraw toLogin={this.toLogin}/>
</>
}
{/*定金--只在预热期间显示*/} {/*定金--只在预热期间显示*/}
{ {
isFormal === 0 && isFormal === 0 &&
......
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