Commit c98c546a by xuzhenghua

新用户大礼包

parent 0edee270
......@@ -19,7 +19,7 @@ class UserGift extends Component {
}
get_newerModal = () => {
this.props.history.push('/passport/login')
this.props.get_newerModal()
}
close = () => {
this.props.close()
......
......@@ -63,20 +63,25 @@ class Index extends Component {
componentDidMount() {
this.getIndexData()
this.showUserGiftFun()
this.userStatus()
}
componentWillMount(){
this.showUserGiftFun()
}
userStatus =()=>{
this.setState({
isShowUserGift: false
})
http.get(`${API['base-api']}/sys/user/new_user_status`).then((res) => {
const {errno, data} = res.data
if (errno === 0) {
if (data.status == 1) {
// 新用户登录之后判断是否是新用户
this.setState({
isShowUserGift: false
})
Toast.info('新人大礼包已领取成功!', 2)
} else {
this.setState({
isShowUserGift: false
})
}
}
})
......@@ -103,6 +108,11 @@ class Index extends Component {
localStorage.setItem('newer_last_time', now_time) // 存储关闭时间
}
get_newerModal = ()=>{
this.close()
this.props.history.push('/passport/login')
}
// 首页课程
getIndexData = () => {
http.get(`${API.home}/m/home`).then((res) => {
......@@ -247,7 +257,7 @@ class Index extends Component {
{
this.state.isShowUserGift &&
<UserGift close={this.close} history={this.props.history}/>
<UserGift close={this.close} get_newerModal={this.get_newerModal}/>
}
</div>
)
......
......@@ -59,8 +59,6 @@ class Detail extends Component {
componentDidMount() {
this.fetchCourseInfo()
this.showUserGiftFun()
this.userStatus()
const {location: {state = {}}} = this.props
if (state.oid) {
this.check(state.oid)
......@@ -84,18 +82,28 @@ class Detail extends Component {
if (getParam('ac') && Number(getParam('ac')) === 11) {
this.getBorwerCourse()
}
this.userStatus()
}
componentWillMount(){
this.showUserGiftFun()
}
userStatus = () => {
this.setState({
isShowUserGift: false
})
http.get(`${API['base-api']}/sys/user/new_user_status`).then((res) => {
const {errno, data} = res.data
if (errno === 0) {
if (data.status == 1) {
// 新用户登录之后判断是否是新用户
this.setState({
isShowUserGift: false
})
Toast.info('新人大礼包已领取成功!', 2)
} else {
this.setState({
isShowUserGift: false
})
}
}
})
......@@ -121,6 +129,10 @@ class Detail extends Component {
let now_time = (new Date()).valueOf() // 获取当前时间
localStorage.setItem('newer_last_time', now_time) // 存储关闭时间
}
get_newerModal = ()=>{
this.close()
this.props.history.push('/passport/login')
}
getBorwerCourse = () => {
http.get(`${API.home}/sys/user/blessing`, {type: 4, course_id: getParam('id')}).then(res => {
......@@ -867,7 +879,7 @@ class Detail extends Component {
{
this.state.isShowUserGift &&
<UserGift close={this.close} history={this.props.history}/>
<UserGift close={this.close} get_newerModal={this.get_newerModal}/>
}
</div>
)
......
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