| | |
| | | this.getTabList() |
| | | this.getList() |
| | | }, |
| | | onPullDownRefresh() { |
| | | this.setData({ dataList: [], pageNum: 1, total: 0 }) |
| | | wx.stopPullDownRefresh() |
| | | this.getList() |
| | | }, |
| | | onReachBottom() { |
| | | console.log('触底事件'); |
| | | const { total, dataList, pageNum } = this.data |
| | |
| | | }, |
| | | itemClick(e) { |
| | | const item = e.currentTarget.dataset.item |
| | | console.log('item', item); |
| | | actionDo({actionType: 'view',id: item.id}) |
| | | const { dataList } = this.data |
| | | dataList.forEach(ite => { |
| | | if(item.id === ite.id){ |
| | | ite.viewCount += 1 |
| | | } |
| | | }) |
| | | this.setData({ dataList }) |
| | | if(item.contentType == 'video'){ |
| | | wx.previewMedia({ |
| | | sources: [{ url: item.content, type: 'video' }] |
| | | }) |
| | | }) |
| | | actionDo({actionType: 'view',id: item.id}) |
| | | } |
| | | if(item.contentType == 'link'){ |
| | | wx.navigateTo({ |
| | | url: '/pages/webView/index?link=' + item.content, |
| | | }) |
| | | url: '/pages/webView/index', |
| | | success: function(res) { |
| | | // 通过eventChannel向被打开页面传送数据 |
| | | res.eventChannel.emit('data',{link:item.content} ); |
| | | } |
| | | }) |
| | | actionDo({actionType: 'view',id: item.id}) |
| | | } |
| | | if(item.contentType == 'page'){ |
| | | getApp().globalData.catalogCode=item.content |
| | | wx.switchTab({ |
| | | url: '/pages/discover/discover' |
| | | }) |
| | | }) |
| | | actionDo({actionType: 'view',id: item.id}) |
| | | } |
| | | }, |
| | | cateClick(e) { |
| | |
| | | /** |
| | | * 页面相关事件处理函数--监听用户下拉动作 |
| | | */ |
| | | onPullDownRefresh() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 页面上拉触底事件的处理函数 |