Commit c98c546a by xuzhenghua

新用户大礼包

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