Commit 2cd9cdc0 by wangshuo

我的宝箱浮框

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