|
|
@ -28,6 +28,8 @@ Page({ |
|
|
|
currPage: 1, |
|
|
|
}) |
|
|
|
this.fetchHomeList() |
|
|
|
this.fetchHomeBanner() |
|
|
|
this.fetchHomeHot() |
|
|
|
wx.vibrateShort({ |
|
|
|
success () { |
|
|
|
console.log('震动') |
|
|
@ -46,7 +48,7 @@ Page({ |
|
|
|
this.fetchHomeList() |
|
|
|
}, |
|
|
|
// 获取首页列表
|
|
|
|
fetchHomeList() { |
|
|
|
fetchHomeList () { |
|
|
|
let page = this.data.currPage |
|
|
|
homeModel.getHomeList(page, res => { |
|
|
|
this.setData({ |
|
|
@ -89,7 +91,7 @@ Page({ |
|
|
|
wx.stopPullDownRefresh() |
|
|
|
}) |
|
|
|
}, |
|
|
|
fetchHomeBanner() { |
|
|
|
fetchHomeBanner () { |
|
|
|
homeModel.getHomeBanner(res => { |
|
|
|
console.log('Banner') |
|
|
|
console.log(res) |
|
|
@ -107,7 +109,7 @@ Page({ |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
fetchHomeHot() { |
|
|
|
fetchHomeHot () { |
|
|
|
homeModel.getHomeHot(res => { |
|
|
|
console.log('Hot') |
|
|
|
console.log(res) |
|
|
@ -125,19 +127,19 @@ Page({ |
|
|
|
}) |
|
|
|
}, |
|
|
|
// Banner/Hot/List事件
|
|
|
|
tapSwiperItem(e) { |
|
|
|
tapSwiperItem (e) { |
|
|
|
console.log(e.detail) |
|
|
|
this.gotoArticePage(e.detail.id) |
|
|
|
}, |
|
|
|
tapFocusItem(e) { |
|
|
|
tapFocusItem (e) { |
|
|
|
console.log(e.detail) |
|
|
|
this.gotoArticePage(e.detail.id) |
|
|
|
}, |
|
|
|
clickListItem(e) { |
|
|
|
clickListItem (e) { |
|
|
|
console.log(e.detail) |
|
|
|
this.gotoArticePage(e.detail.id) |
|
|
|
}, |
|
|
|
gotoArticePage(id) { |
|
|
|
gotoArticePage (id) { |
|
|
|
wx.navigateTo({ |
|
|
|
url: `/pages/article/index?id=${id}`, |
|
|
|
}) |
|
|
|