|
|
|
@ -25,43 +25,55 @@ Page({ |
|
|
|
*/ |
|
|
|
|
|
|
|
onLoad: function () { |
|
|
|
if (store.hasBindUserInfo()){ |
|
|
|
|
|
|
|
}, |
|
|
|
onShow: function () { |
|
|
|
if (store.hasBindUserInfo()) { |
|
|
|
console.log('已经绑定微信') |
|
|
|
if (store.hasPhone()) { |
|
|
|
console.log('已经绑定手机号码') |
|
|
|
// 页面出现在前台时执行
|
|
|
|
let segmentIndex = this.data.segmentIndex |
|
|
|
if (segmentIndex === 0 || segmentIndex === 1) { |
|
|
|
wx.pageScrollTo({ |
|
|
|
scrollTop: 0, |
|
|
|
}) |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
currPage: 1, |
|
|
|
}) |
|
|
|
switch (this.data.segmentIndex) { |
|
|
|
case 0: |
|
|
|
return this.fetchTopicList() |
|
|
|
case 1: |
|
|
|
return this.fetchGoodIdeaList() |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
console.log('未绑定手机号码') |
|
|
|
wx.redirectTo({ |
|
|
|
url: '/pages/register/index', |
|
|
|
wx.showModal({ |
|
|
|
title: '温馨提示', |
|
|
|
content: '是否前往验证手机号码?', |
|
|
|
success(res) { |
|
|
|
if (res.confirm) { |
|
|
|
wx.redirectTo({ |
|
|
|
url: '/pages/register/index', |
|
|
|
}) |
|
|
|
} else if (res.cancel) { |
|
|
|
wx.switchTab({ |
|
|
|
url: '/pages/home/index', |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
console.log('未绑定微信') |
|
|
|
wx.reLaunch({ |
|
|
|
wx.switchTab({ |
|
|
|
url: '/pages/user/index', |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
onShow: function () { |
|
|
|
// 页面出现在前台时执行
|
|
|
|
let segmentIndex = this.data.segmentIndex |
|
|
|
if (segmentIndex === 0 || segmentIndex === 1){ |
|
|
|
wx.pageScrollTo({ |
|
|
|
scrollTop: 0, |
|
|
|
}) |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
currPage: 1, |
|
|
|
}) |
|
|
|
switch (this.data.segmentIndex) { |
|
|
|
case 0: |
|
|
|
return this.fetchTopicList() |
|
|
|
case 1: |
|
|
|
return this.fetchGoodIdeaList() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
fetchTopicList () { |
|
|
|
let page = this.data.currPage |
|
|
|
|