| | |
| | | import { getZhongTaiProductNewsPage, getCatalogList,actionDo,refreshEnjoy } from '../../api/index' |
| | | let touchDot = 0 |
| | | Page({ |
| | | |
| | | /** |
| | |
| | | data: { |
| | | category: [], |
| | | secondCategory: [], |
| | | showCate: true, |
| | | |
| | | catalogCode: '', |
| | | tagCode: '', |
| | |
| | | total: 0, |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | scrollTop: 0 |
| | | |
| | | // height: 0, |
| | | // top: 0, |
| | |
| | | onLoad(options) { |
| | | this.getCate() |
| | | }, |
| | | onReachBottom() { |
| | | bindscrolltolower() { |
| | | console.log('触底事件'); |
| | | const { total, dataList, pageNum } = this.data |
| | | if(total > dataList.length){ |
| | | this.setData({ pageNum: pageNum + 1 }) |
| | | this.getList() |
| | | this.getList(false) |
| | | }else{ |
| | | wx.showToast({ |
| | | title: '暂无更多数据', |
| | |
| | | }) |
| | | } |
| | | }, |
| | | getList() { |
| | | getList(showCate = true) { |
| | | 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 |
| | | total: res.data.total, |
| | | showCate |
| | | }) |
| | | } |
| | | |
| | |
| | | onReady() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面显示 |
| | | */ |
| | | touchstart(e){ |
| | | // touchDot = e.touches[0].pageY; |
| | | console.log('开始', e); |
| | | }, |
| | | 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 }) |
| | | // } |
| | | }, |
| | | onShow() { |
| | | refreshEnjoy(this) |
| | | }, |