|
@ -45,22 +45,23 @@ Page({ |
|
|
}, |
|
|
}, |
|
|
onShow: function () { |
|
|
onShow: function () { |
|
|
// 页面出现在前台时执行
|
|
|
// 页面出现在前台时执行
|
|
|
console.log('啦啦啦') |
|
|
|
|
|
let segmentIndex = this.data.segmentIndex |
|
|
let segmentIndex = this.data.segmentIndex |
|
|
if (segmentIndex === 0 || segmentIndex === 1){ |
|
|
if (segmentIndex === 0 || segmentIndex === 1){ |
|
|
wx.pageScrollTo({ |
|
|
wx.pageScrollTo({ |
|
|
scrollTop: 0, |
|
|
scrollTop: 0, |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
currPage: 1, |
|
|
|
|
|
}) |
|
|
|
|
|
switch (this.data.segmentIndex) { |
|
|
|
|
|
case 0: |
|
|
|
|
|
return this.fetchTopicList() |
|
|
|
|
|
case 1: |
|
|
|
|
|
return this.fetchGoodIdeaList() |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
this.setData({ |
|
|
|
|
|
currPage: 1, |
|
|
|
|
|
}) |
|
|
|
|
|
switch (this.data.segmentIndex) { |
|
|
|
|
|
case 0: |
|
|
|
|
|
return this.fetchTopicList() |
|
|
|
|
|
case 1: |
|
|
|
|
|
return this.fetchGoodIdeaList() |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
}, |
|
|
fetchTopicList () { |
|
|
fetchTopicList () { |
|
|
let page = this.data.currPage |
|
|
let page = this.data.currPage |
|
@ -174,14 +175,24 @@ Page({ |
|
|
* 页面相关事件处理函数--监听用户下拉动作 |
|
|
* 页面相关事件处理函数--监听用户下拉动作 |
|
|
*/ |
|
|
*/ |
|
|
onPullDownRefresh: function () { |
|
|
onPullDownRefresh: function () { |
|
|
this.setData({ |
|
|
let segmentIndex = this.data.segmentIndex |
|
|
currPage: 1, |
|
|
if (segmentIndex === 2){ |
|
|
}) |
|
|
wx.stopPullDownRefresh() |
|
|
switch (this.data.segmentIndex) { |
|
|
} |
|
|
case 0: |
|
|
if (segmentIndex === 0 || segmentIndex === 1) { |
|
|
return this.fetchTopicList() |
|
|
wx.pageScrollTo({ |
|
|
case 1: |
|
|
scrollTop: 0, |
|
|
return this.fetchGoodIdeaList() |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
currPage: 1, |
|
|
|
|
|
}) |
|
|
|
|
|
switch (this.data.segmentIndex) { |
|
|
|
|
|
case 0: |
|
|
|
|
|
return this.fetchTopicList() |
|
|
|
|
|
case 1: |
|
|
|
|
|
return this.fetchGoodIdeaList() |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
@ -189,16 +200,24 @@ Page({ |
|
|
* 页面上拉触底事件的处理函数 |
|
|
* 页面上拉触底事件的处理函数 |
|
|
*/ |
|
|
*/ |
|
|
onReachBottom: function () { |
|
|
onReachBottom: function () { |
|
|
const page = this.data.currPage + 1 |
|
|
let segmentIndex = this.data.segmentIndex |
|
|
this.setData({ |
|
|
if(segmentIndex === 2){ |
|
|
currPage: page |
|
|
return |
|
|
}) |
|
|
|
|
|
switch (this.data.segmentIndex) { |
|
|
|
|
|
case 0: |
|
|
|
|
|
return this.fetchTopicList() |
|
|
|
|
|
case 1: |
|
|
|
|
|
return this.fetchGoodIdeaList() |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (segmentIndex === 0 || segmentIndex === 1) { |
|
|
|
|
|
const page = this.data.currPage + 1 |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
currPage: page |
|
|
|
|
|
}) |
|
|
|
|
|
switch (this.data.segmentIndex) { |
|
|
|
|
|
case 0: |
|
|
|
|
|
return this.fetchTopicList() |
|
|
|
|
|
case 1: |
|
|
|
|
|
return this.fetchGoodIdeaList() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 定义点击标题的事件处理函数,将选中标题的id赋值给selectedTitle
|
|
|
// 定义点击标题的事件处理函数,将选中标题的id赋值给selectedTitle
|
|
|