Commit 67718390 by xuzhenghua

pull

parents f61f8135 9d9cc01d
...@@ -8,7 +8,7 @@ import ListHeader from './../listHeader'; ...@@ -8,7 +8,7 @@ import ListHeader from './../listHeader';
import './index.scss'; import './index.scss';
@connect(({user})=> ({ @connect(({user})=> ({
uid: user.data.uid || '' uid: user && user.data && user.data.uid ? user.data.uid :''
})) }))
class CollectBlessing extends Component { class CollectBlessing extends Component {
......
...@@ -62,6 +62,27 @@ class CourseList extends Component { ...@@ -62,6 +62,27 @@ class CourseList extends Component {
this.fetchAICourse('four'); this.fetchAICourse('four');
} }
shouldComponentUpdate(nextProps, nextState, nextContext) {
if(this.props.isApp !== nextProps.isApp) {
// 精品课程-集训营、就业班/AI特训营
this.fetchCourseData();
// AI之路-基础
this.fetchAICourse('one');
// AI之路-进阶
this.fetchAICourse('two');
// AI之路-高阶
this.fetchAICourse('three');
// AI之路-拓展
this.fetchAICourse('four');
return false;
}
return true;
}
fetchAICourse = (key) => { fetchAICourse = (key) => {
const { basic, advanced, higher, expand } = this.state; const { basic, advanced, higher, expand } = this.state;
http.get(`${API.home}/sys/ai_grow_up_courses/${key}`).then(res => { http.get(`${API.home}/sys/ai_grow_up_courses/${key}`).then(res => {
...@@ -221,8 +242,7 @@ class CourseList extends Component { ...@@ -221,8 +242,7 @@ class CourseList extends Component {
} }
toReceiveCoupon(id, key = '') { toReceiveCoupon(id, key = '') {
const {isLogin, toLogin,uid} = this.props; const {isLogin, toLogin} = this.props;
alert(uid)
if(isLogin) { if(isLogin) {
http.post(`${API.home}/sys/activity/coupon/receive`, { http.post(`${API.home}/sys/activity/coupon/receive`, {
course_id: id course_id: id
......
...@@ -81,7 +81,8 @@ class BlessingPreheat extends Component { ...@@ -81,7 +81,8 @@ class BlessingPreheat extends Component {
}, },
], ],
index: 0, index: 0,
userHasError: props.user.hasError userHasError: props.user.hasError,
isApp: false
} }
} }
...@@ -110,7 +111,6 @@ class BlessingPreheat extends Component { ...@@ -110,7 +111,6 @@ class BlessingPreheat extends Component {
this.handleToAddBlessing(result); this.handleToAddBlessing(result);
} }
} }
...@@ -138,6 +138,9 @@ class BlessingPreheat extends Component { ...@@ -138,6 +138,9 @@ class BlessingPreheat extends Component {
if (cookie.get("token") && cookie.get("uid")) { if (cookie.get("token") && cookie.get("uid")) {
this.fetchUserBlessing(); this.fetchUserBlessing();
this.setState({
isApp: true
})
} }
this.props.setCurrentUser(this.transformUser(this.state.userInfoList)) this.props.setCurrentUser(this.transformUser(this.state.userInfoList))
...@@ -419,11 +422,11 @@ class BlessingPreheat extends Component { ...@@ -419,11 +422,11 @@ class BlessingPreheat extends Component {
isSign, isSign,
showRecordList, showRecordList,
shareMark, shareMark,
index index,
isApp
} = this.state; } = this.state;
const {history} = this.props; const {history} = this.props;
const isLogin = !this.props.user.hasError const isLogin = !this.props.user.hasError
const uid = this.props.user.data.uid
return ( return (
<div id={'blessing-preheat'}> <div id={'blessing-preheat'}>
<Banner <Banner
...@@ -473,9 +476,9 @@ class BlessingPreheat extends Component { ...@@ -473,9 +476,9 @@ class BlessingPreheat extends Component {
{/* 精品课程特惠专区 */} {/* 精品课程特惠专区 */}
<ListHeader id={'best-courses'} text="精品课程特惠专区" styles={{margin: '30px 0 15px'}}/> <ListHeader id={'best-courses'} text="精品课程特惠专区" styles={{margin: '30px 0 15px'}}/>
<CourseList <CourseList
isApp={isApp}
isFormal={isFormal} isFormal={isFormal}
isLogin={isLogin} isLogin={isLogin}
uid={uid}
history={this.props.history} history={this.props.history}
toLogin={this.toLogin} toLogin={this.toLogin}
/> />
......
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