...
|
...
|
@@ -5,7 +5,7 @@ import indexModel from '../../models/index/index'; |
|
|
|
|
|
//获取应用实例
|
|
|
let app = getApp();
|
|
|
let yas = new Yas();
|
|
|
let yas;
|
|
|
let router = global.router;
|
|
|
let {windowHeight} = app.getSystemInfo();
|
|
|
|
...
|
...
|
@@ -18,7 +18,7 @@ Page({ |
|
|
resetListScrollPos: 0,
|
|
|
showLoading: false,
|
|
|
showNoMore: false,
|
|
|
|
|
|
|
|
|
isLoading: false,
|
|
|
currentPage: 1,
|
|
|
totalPage: 0,
|
...
|
...
|
@@ -29,6 +29,8 @@ Page({ |
|
|
},
|
|
|
onLoad: function () {
|
|
|
this.productList({ page: 1, limit: 20});
|
|
|
|
|
|
yas = new Yas(app);
|
|
|
yas.pageOpenReport();
|
|
|
},
|
|
|
onReady: function () {
|
...
|
...
|
@@ -80,7 +82,7 @@ Page({ |
|
|
query.selectViewport().scrollOffset();
|
|
|
query.exec(res => {
|
|
|
this.setData({
|
|
|
floatFilter: res[0].scrollTop > this.data.filterInitialTop - this.data.topSearchHeight
|
|
|
floatFilter: res[0].scrollTop > this.data.filterInitialTop - this.data.topSearchHeight
|
|
|
});
|
|
|
});
|
|
|
|
...
|
...
|
@@ -94,7 +96,7 @@ Page({ |
|
|
sortChange: function (e) {
|
|
|
let params;
|
|
|
let {curSort, gender} = e.detail;
|
|
|
|
|
|
|
|
|
params = {
|
|
|
gender,
|
|
|
order: curSort,
|
...
|
...
|
@@ -102,16 +104,16 @@ Page({ |
|
|
limit: 20
|
|
|
};
|
|
|
this.data.productList = [];
|
|
|
|
|
|
|
|
|
params.setScrollPos = true;
|
|
|
this.productList(params);
|
|
|
},
|
|
|
productList: function (params) {
|
|
|
if (this.data.isLoading) return;
|
|
|
|
|
|
|
|
|
this.data.isLoading = true;
|
|
|
wx.showLoading({title: '加载中'});
|
|
|
indexModel.productList(params).then(res => {
|
|
|
indexModel.productList(params).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
const keyAdapter = {
|
|
|
skn: 'product_skn',
|
...
|
...
|
@@ -125,7 +127,7 @@ Page({ |
|
|
let item = {};
|
|
|
|
|
|
Object.keys(keyAdapter).forEach(key => {
|
|
|
item[key] = product[keyAdapter[key]]
|
|
|
item[key] = product[keyAdapter[key]]
|
|
|
});
|
|
|
list.push(item);
|
|
|
});
|
...
|
...
|
@@ -138,13 +140,13 @@ Page({ |
|
|
currentPage: params.page,
|
|
|
totalPage: res.data.page_total
|
|
|
});
|
|
|
|
|
|
|
|
|
if (!this.data.showCopyright) {
|
|
|
this.setData({
|
|
|
showCopyright: true
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
// 浮动筛选时滚动位置
|
|
|
if (this.data.floatFilter && params.setScrollPos) {
|
|
|
wx.pageScrollTo({
|
...
|
...
|
@@ -152,7 +154,7 @@ Page({ |
|
|
duration: 10
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
if (this.data.pullRefresh) {
|
|
|
this.setData({
|
|
|
pullRefresh: false
|
...
|
...
|
@@ -178,4 +180,4 @@ Page({ |
|
|
resourceClickReport: function (e) {
|
|
|
yas.report('YB_MAIN_EVENT', e.detail);
|
|
|
}
|
|
|
}); |
|
|
\ No newline at end of file |
|
|
}); |
...
|
...
|
|