| | |
| | | category: [], |
| | | secondCategory: [], |
| | | showCate: true, |
| | | animationData: {}, |
| | | |
| | | catalogCode: '', |
| | | tagCode: '', |
| | |
| | | }, |
| | | onLoad(options) { |
| | | this.getCate() |
| | | this.animation = wx.createAnimation({ |
| | | duration: 500, |
| | | timingFunction: 'ease', |
| | | }); |
| | | }, |
| | | bindscrolltolower() { |
| | | console.log('触底事件'); |
| | | const { total, dataList, pageNum } = this.data |
| | | if(total > dataList.length){ |
| | | this.setData({ pageNum: pageNum + 1 }) |
| | | this.getList(false) |
| | | this.getList() |
| | | }else{ |
| | | wx.showToast({ |
| | | title: '暂无更多数据', |
| | |
| | | }) |
| | | } |
| | | }, |
| | | getList(showCate = true) { |
| | | getList() { |
| | | const { pageNum, pageSize, catalogCode, tagCode, query } = this.data |
| | | getZhongTaiProductNewsPage({ |
| | | pageNum, pageSize, query, catalogCode: tagCode || catalogCode |
| | |
| | | if(res.data){ |
| | | this.setData({ |
| | | dataList: [ ...this.data.dataList, ...res.data.records ], |
| | | total: res.data.total, |
| | | showCate |
| | | total: res.data.total |
| | | }) |
| | | } |
| | | |
| | |
| | | onReady() { |
| | | |
| | | }, |
| | | bindscrolltoupper() { |
| | | this.setData({ showCate: true }) |
| | | this.fadeIn(); |
| | | }, |
| | | touchstart(e){ |
| | | // touchDot = e.touches[0].pageY; |
| | | console.log('开始', e); |
| | | touchDot = e.detail.scrollTop; |
| | | }, |
| | | touchmove(e) { |
| | | // var touchMove = e.touches[0].pageY; |
| | | console.log('touchMove', e); |
| | | // if(touchDot - touchMove > 60){ |
| | | // this.setData({ showCate: false }) |
| | | // } |
| | | // if(touchMove - touchDot > 60){ |
| | | // this.setData({ showCate: true }) |
| | | // } |
| | | var touchMove = e.detail.scrollTop; |
| | | if(touchMove - touchDot > 60){ |
| | | // this.setData({ showCate: false }) |
| | | this.fadeOut(); |
| | | } |
| | | if(touchDot - touchMove > 60){ |
| | | this.fadeIn(); |
| | | this.setData({ showCate: true }) |
| | | } |
| | | }, |
| | | fadeIn: function () { |
| | | this.animation.opacity(1).step(); |
| | | this.setData({ |
| | | animationData: this.animation.export() |
| | | }); |
| | | }, |
| | | fadeOut: function () { |
| | | this.animation.opacity(0).step(); |
| | | this.setData({ |
| | | animationData: this.animation.export() |
| | | }); |
| | | setTimeout(() => { |
| | | this.setData({ showCate: false }); |
| | | }, 500); // 动画持续时间 |
| | | }, |
| | | onShow() { |
| | | refreshEnjoy(this) |