...
|
...
|
@@ -4,6 +4,7 @@ import listModel from '../../../models/product/list'; |
|
|
import {parse} from '../../../vendors/query-stringify';
|
|
|
|
|
|
const yas = new Yas();
|
|
|
const {windowHeight} = getApp().getSystemInfo();
|
|
|
|
|
|
Page({
|
|
|
data: {
|
...
|
...
|
@@ -16,7 +17,7 @@ Page({ |
|
|
currentPage: 0,
|
|
|
totalPage: 1,
|
|
|
urlParams: {},
|
|
|
showBackTop: true
|
|
|
showBackTop: false
|
|
|
},
|
|
|
onLoad:function (options) {
|
|
|
let title = decodeURIComponent(options.title) || '默认标题';
|
...
|
...
|
@@ -32,6 +33,18 @@ Page({ |
|
|
this.productList(options);
|
|
|
yas.pageOpenReport();
|
|
|
},
|
|
|
onPageScroll: function({scrollTop}) {
|
|
|
if (scrollTop > windowHeight * 2 !== this.data.showBackTop) {
|
|
|
this.setData({
|
|
|
showBackTop: scrollTop > windowHeight * 2
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
backTop: function() {
|
|
|
wx.pageScrollTo({
|
|
|
scrollTop: 0
|
|
|
});
|
|
|
},
|
|
|
onReachBottom: function () {
|
|
|
this.productList(this.data.urlParams);
|
|
|
},
|
...
|
...
|
@@ -77,6 +90,13 @@ Page({ |
|
|
totalPage: res.data.page_total,
|
|
|
showNoMore: params.page === res.data.page_total
|
|
|
});
|
|
|
|
|
|
if (params.resetScroll) {
|
|
|
wx.pageScrollTo({
|
|
|
scrollTop: 0,
|
|
|
duration: 10
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
},
|
...
|
...
|
@@ -89,6 +109,6 @@ Page({ |
|
|
this.data.totalPage = 1;
|
|
|
|
|
|
this.data.productList = [];
|
|
|
this.productList(this.data.urlParams);
|
|
|
this.productList(Object.assign({resetScroll: true}, this.data.urlParams));
|
|
|
}
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|