Commit c5370c15 by xuzhenghua

bug

parents e4c7a626 146532fb
......@@ -67,17 +67,18 @@ class YearCourse extends Component {
}
componentDidMount() {
this.getLength()
this.fetchBigCourse()
this.fetchFreeCourse()
this.fetchGroupCourse()
// AI之路-基础
this.fetchAICourse('one',false)
this.fetchAICourse('one', false)
// AI之路-进阶
this.fetchAICourse('two',false)
this.fetchAICourse('two', false)
// AI之路-高阶
this.fetchAICourse('three',false)
this.fetchAICourse('three', false)
// AI之路-拓展
this.fetchAICourse('four',false)
this.fetchAICourse('four', false)
}
shouldComponentUpdate(nextProps, nextState, nextContext) {
......@@ -98,6 +99,19 @@ class YearCourse extends Component {
return true
}
getLength = () => {
let _this = this
http.get(`${API.home}/activity/wish_sum`).then(res => {
const {code, data} = res.data
if (code == 200) {
_this.setState({
sum: data.sum
})
this.props.getSum(_this.state.sum)
}
})
}
fetchBigCourse = () => {
const {bigcourse} = this.state
http.get(`${API.home}/activity/preheat_data`).then(res => {
......@@ -144,11 +158,11 @@ class YearCourse extends Component {
})
}
fetchAICourse = (key,addshowMore) => {
fetchAICourse = (key, addshowMore) => {
http.get(`${API.home}/activity/four_stage/${key}`).then(res => {
const {code, data} = res.data
if (code === 200) {
this.getList(key, data,addshowMore)
this.getList(key, data, addshowMore)
}
})
}
......@@ -189,7 +203,7 @@ class YearCourse extends Component {
this.setState({
expand: Object.assign({}, expand, {
isMore: data.length > 4 && !addshowMore ? true : false,
course: data.length > 4&& !addshowMore ? data.filter((item, index) => index < 4) : data,
course: data.length > 4 && !addshowMore ? data.filter((item, index) => index < 4) : data,
courseList: data,
addshowMore: addshowMore,
})
......@@ -338,17 +352,18 @@ class YearCourse extends Component {
const {code, msg} = res.data
if (code == 200) {
Toast.success('已成功加入心愿单', 3)
_this.getLength()
if (key === '1') {
_this.fetchAICourse('one',_this.state.basic.addshowMore)
_this.fetchAICourse('one', _this.state.basic.addshowMore)
}
if (key === '2') {
_this.fetchAICourse('two',_this.state.advanced.addshowMore)
_this.fetchAICourse('two', _this.state.advanced.addshowMore)
}
if (key === '3') {
_this.fetchAICourse('three',_this.state.higher.addshowMore)
_this.fetchAICourse('three', _this.state.higher.addshowMore)
}
if (key === '4') {
_this.fetchAICourse('four',_this.state.expand.addshowMore)
_this.fetchAICourse('four', _this.state.expand.addshowMore)
}
if (key === 'group') {
_this.fetchGroupCourse()
......
......@@ -7,7 +7,13 @@ import TreasureNav from './nav'
import CommonPopup from './../common/commonPopup/index'
import cookie from "js-cookie"
import {setCurrentUser, startFetchUser} from "@/store/userAction"
import {SendMessageToApp, getParam} from '@/utils'
import {addDays} from "date-fns"
import {connect} from "react-redux"
@connect(state => ({
user: state.user
}))
export default class index extends Component {
state = {
......@@ -84,6 +90,26 @@ 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} = this.state
return (
......@@ -96,12 +122,25 @@ export default class index extends Component {
</div>
<div className="banner-treasure__decorate"></div>
</div>
{/*浮框*/}
<div className='nav-right'>
<a href="" className='nav-right__link'>
未拆宝箱
<i className="nav-right__number">2</i>
</a>
<a onClick={() => this.toYearWish()} className='nav-right__link'>
心愿单
<i className="nav-right__number">{this.state.txt1}</i>
</a>
</div>
{/* 大咖直播 */}
<LiveRoom/>
{/* 组队开宝箱 */}
<TreasureBox/>
<YearCourse isAppUpdate={this.state.isAppUpdate}/>
{/*课程*/}
<YearCourse isAppUpdate={this.state.isAppUpdate} getSum={this.sonToPar.bind(this)}/>
{/*好友加入队伍提醒;获得宝箱提醒;开售提醒弹窗,需要自取,注意修改文案*/}
{
......
......@@ -42,6 +42,7 @@
color: #666;
margin: 13px 0;
letter-spacing: 1px;
i {
font-style: normal;
color: #FF0000;
......@@ -57,8 +58,45 @@
margin-bottom: 5px;
}
}
.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{
.year-index + .year19-index {
display: none;
}
\ No newline at end of file
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