Commit d3cfd893 by xuzhenghua

右侧浮窗

parent e6594804
......@@ -62,11 +62,15 @@ class YearCourse extends Component {
id: '',
key: ""
},
followBarcode: ''
followBarcode: '',
sum:'',
removable:'',
currentId:''
}
}
componentDidMount() {
this.getTeamInfo()
this.getLength()
this.fetchBigCourse()
this.fetchFreeCourse()
......@@ -107,7 +111,6 @@ class YearCourse extends Component {
_this.setState({
sum: data.sum
})
this.props.getSum(_this.state.sum)
}
})
}
......@@ -386,11 +389,70 @@ class YearCourse extends Component {
}
}
// 获取队伍信息
getTeamInfo = () => {
http.get(`${API.home}/sys/treasure/teamInfo`).then(res => {
const {code, data, msg} = res.data
if (code === 200) {
const {info, removable_data} = data
this.setState({
removable: info.removable,
currentId: info.removable > 0 ? removable_data[0].id : null
})
} else {
Toast.info(msg)
}
})
}
// 跳转到我的宝箱列表页
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 {
this.toLogin()
}
}
toYearWish = () => {
const isLogin = !this.props.user.hasError
if (isLogin) {
this.props.history.push('/year/yearWish')
} else {
this.toLogin()
}
}
render() {
const {bigcourse, freecourse, groupcourse, basic, advanced, higher, expand} = this.state
const {bigcourse, freecourse, groupcourse, basic, advanced, higher, expand,removable,sum} = this.state
return (
<div className={'year-index-course'}>
{/*浮框*/}
<div className='nav-right'>
<span onClick={this.toBoxList} className='nav-right__link'>
未拆宝箱
{
removable > 0 &&
<i className="nav-right__number">{removable}</i>
}
</span>
<a onClick={() => this.toYearWish()} className='nav-right__link'>
心愿单
{
sum > 0 &&
<i className="nav-right__number">{sum}</i>
}
</a>
</div>
<CommonContainer title='重磅好课' id='year-course'>
<div>
{
......
......@@ -265,4 +265,42 @@
outline: 0;
border: none;
}
.nav-right {
width: 100px;
height: 125px;
background-image: url("https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/H5/sd_fc_bj.png");
background-repeat: no-repeat;
background-size: cover;
position: fixed;
top: 50%;
right: 0;
margin-top: -57px;
z-index: 22;
.nav-right__link {
display: block;
position: relative;
font-size: 12px;
font-weight: 500;
color: #fff;
text-align: center;
top: 47px;
line-height: 25px;
}
.nav-right__number {
position: absolute;
top: -5px;
right: 5px;
padding: 0 5px;
border: 1px solid #F7D067;
border-radius: 7px 7px 7px 0px;
font-size: 12px;
font-style: normal;
color: #FEE41D;
background-color: #FF4F24;
height: 16px;
line-height: 14px;
}
}
}
\ No newline at end of file
......@@ -101,28 +101,7 @@ 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")
}
}
}
// 获取活动以及宝箱的阶段
......@@ -140,28 +119,8 @@ export default class index extends Component {
})
}
toYearWish = () => {
const isLogin = !this.props.user.hasError
if (isLogin) {
this.props.history.push('/year/yearWish')
} else {
if (!getParam('version')) {
this.props.history.push('/passport/login')
} else {
SendMessageToApp("toLogin")
}
}
}
sonToPar(e) {
this.setState({
txt1: e
})
}
render() {
const {banner, removable, treasure_stage} = this.state
const {banner, removable, treasure_stage, currentOpenId} = this.state
return (
<div className={'year-index'}>
<div className="banner-treasure">
......@@ -172,23 +131,7 @@ export default class index extends Component {
</div>
<div className="banner-treasure__decorate"></div>
</div>
{/*浮框*/}
<div className='nav-right'>
<span onClick={this.toBoxList} className='nav-right__link'>
未拆宝箱
{
removable > 0 &&
<i className="nav-right__number">{removable}</i>
}
</span>
<a onClick={() => this.toYearWish()} className='nav-right__link'>
心愿单
{
this.state.txt1 > 0 &&
<i className="nav-right__number">{this.state.txt1}</i>
}
</a>
</div>
{/* 大咖直播 */}
<LiveRoom/>
......@@ -198,7 +141,7 @@ export default class index extends Component {
}
{/*课程*/}
<YearCourse isAppUpdate={this.state.isAppUpdate} getSum={this.sonToPar.bind(this)}/>
<YearCourse currentOpenId={currentOpenId} removable={removable} isAppUpdate={this.state.isAppUpdate} />
{/*好友加入队伍提醒;获得宝箱提醒;开售提醒弹窗,需要自取,注意修改文案*/}
{
......
......@@ -59,42 +59,6 @@
}
}
.nav-right {
width: 100px;
height: 125px;
background-image: url("https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/H5/sd_fc_bj.png");
background-repeat: no-repeat;
background-size: cover;
position: fixed;
top: 50%;
right: 0;
margin-top: -57px;
z-index: 22;
.nav-right__link {
display: block;
position: relative;
font-size: 12px;
font-weight: 500;
color: #fff;
text-align: center;
top: 47px;
line-height: 25px;
}
.nav-right__number {
position: absolute;
top: -5px;
right: 5px;
padding: 0 5px;
border: 1px solid #F7D067;
border-radius: 7px 7px 7px 0px;
font-size: 12px;
font-style: normal;
color: #FEE41D;
background-color: #FF4F24;
height: 16px;
line-height: 14px;
}
}
}
.year-index + .year19-index {
......
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