Commit 2cd9cdc0 by wangshuo

我的宝箱浮框

parent 146532fb
......@@ -17,6 +17,8 @@ import {connect} from "react-redux"
export default class index extends Component {
state = {
removable: 0, // 未拆宝箱的数量
currentOpenId: 0, // 当前要拆的宝箱的队伍的ID
userInfoList: [],
userInfo: {},
isAppUpdate: false,
......@@ -90,6 +92,32 @@ export default class index extends Component {
})
}
// 获取未拆宝箱数量
getRemovable = (removable, currentOpenId) => {
this.setState({
removable,
currentOpenId,
})
}
// 跳转到我的宝箱列表页
toBoxList = () => {
const isLogin = !this.props.user.hasError
const {currentOpenId} = this.state;
let search = '';
if(currentOpenId) {
search = `?id=${currentOpenId}`;
}
if (isLogin) {
this.props.history.push(`/year/yearTreasure${search}`)
} else {
if (!getParam('version')) {
this.props.history.push('/passport/login')
} else {
SendMessageToApp("toLogin")
}
}
}
toYearWish = () => {
const isLogin = !this.props.user.hasError
if (isLogin) {
......@@ -111,7 +139,7 @@ export default class index extends Component {
}
render() {
const {banner} = this.state
const {banner, removable} = this.state
return (
<div className={'year-index'}>
<div className="banner-treasure">
......@@ -124,10 +152,10 @@ export default class index extends Component {
</div>
{/*浮框*/}
<div className='nav-right'>
<a href="" className='nav-right__link'>
<span onClick={this.toBoxList} className='nav-right__link'>
未拆宝箱
<i className="nav-right__number">2</i>
</a>
<i className="nav-right__number">{removable}</i>
</span>
<a onClick={() => this.toYearWish()} className='nav-right__link'>
心愿单
<i className="nav-right__number">{this.state.txt1}</i>
......@@ -137,7 +165,7 @@ export default class index extends Component {
<LiveRoom/>
{/* 组队开宝箱 */}
<TreasureBox/>
<TreasureBox getRemovable={this.getRemovable} />
{/*课程*/}
<YearCourse isAppUpdate={this.state.isAppUpdate} getSum={this.sonToPar.bind(this)}/>
......
......@@ -29,7 +29,7 @@ class TreasureNav extends Component {
},
{
id: 'year-group',
name: '一拼团'
name: '一拼团'
},
{
id: 'year-discount',
......
......@@ -6,13 +6,16 @@ import Prizes from "@components/activity/newyear-2019/common/prizes"
import UserBulletScreen from "@components/activity/newyear-2019/common/user-bullet-screen"
class TreasureBox extends Component {
constructor(props) {
super(props);
}
render() {
return (
<CommonContainer id="year-treasure" title={'组队开宝箱'}>
<div style={{textAlign: 'center', fontSize: '12px', color: '#FFDC1E', marginTop: '10px'}}>邀请好友组队一起开宝箱,满5人后将随机获得以下奖品~</div>
<Prizes showSystemNotices={true}/>
<UserBulletScreen/>
<TeamInfo />
<TeamInfo getRemovable={this.props.getRemovable} />
<TreasureRank />
</CommonContainer>
)
......
......@@ -40,6 +40,11 @@ class TeamInfo extends Component {
removable_data,
my_team
})
let currentId = null;
if(info.removable > 0) {
currentId = removable_data[0].id;
}
this.props.getRemovable(info.removable, currentId);
} else {
Toast.info(msg);
}
......
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