Authored by 李奇

店铺页修改

... ... @@ -11,7 +11,7 @@ Component({
properties: {
show: {
type: Boolean,
value: false
value: true
},
showBackTop: {
type: Boolean,
... ...
... ... @@ -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
... ...
<scroll-view class="list-container">
<view class="list-container">
<view class="filter-view">
<product-list-filter bind:sortchange="sortChange"></product-list-filter>
</view>
... ... @@ -8,6 +8,5 @@
show-no-more="{{showNoMore}}"></product-list>
</view>
<copyright></copyright>
<quick-navigation show-menu="{{false}}" show-back-top="{{showBackTop}}" show="{{true}}"
bindbacktop="backTop"></quick-navigation>
</scroll-view>
\ No newline at end of file
<quick-navigation show-menu="{{true}}" show-back-top="{{showBackTop}}" bindbacktop="backTop"></quick-navigation>
</view>
\ No newline at end of file
... ...
... ... @@ -121,6 +121,13 @@ Page({
currentPage: params.page,
totalPage: res.data.page_total
});
if (this.data.fixedFilter && params.resetScroll) {
wx.pageScrollTo({
scrollTop: this.data.shopInfoHeight,
duration: 10
});
}
}
}).catch(() => {
this.data.isLoading = false;
... ... @@ -155,6 +162,7 @@ Page({
limit: 20
};
this.data.productList = [];
params.resetScroll = true;
this.productList(params);
},
//店铺信息
... ... @@ -252,13 +260,24 @@ Page({
});
});
},
scroll: function (e) {
const { scrollTop } = e.detail;
onPageScroll: function({scrollTop}) {
if (scrollTop >= this.data.shopInfoHeight !== this.data.fixedFilter) {
this.setData({
fixedFilter: scrollTop >= this.data.shopInfoHeight
});
}
if (scrollTop > windowHeight * 2 !== this.data.showBackTop) {
this.setData({
showBackTop: scrollTop > windowHeight * 2
});
}
},
backTop: function() {
wx.pageScrollTo({
scrollTop: 0
});
},
loadMore: function () {
onReachBottom: function () {
if (this.data.currentPage < this.data.totalPage) {
this.setData({
showLoading: true
... ...
<wxs src="../../../wxs/helper.wxs" module="helper"></wxs>
<import src="../../../vendors/zanui/actionsheet/index.wxml"/>
<scroll-view class="shop-container" scroll-y bindscroll="scroll" scroll-top="{{scrollTop}}" bindscrolltolower="loadMore"
<view class="shop-container" scroll-y bindscroll="scroll" scroll-top="{{scrollTop}}" bindscrolltolower="loadMore"
style="height:{{windowHeight}}px;">
<view class="shop-info">
<image class="shop-info-bg" src="{{bannerUrl}}"></image>
... ... @@ -22,7 +22,6 @@
show-no-more="{{showNoMore}}"></product-list>
</view>
<copyright></copyright>
<quick-navigation show-menu="{{false}}" show-back-top="{{showBackTop}}" show="{{true}}"
bindbacktop="backTop"></quick-navigation>
</scroll-view>
<quick-navigation show-menu="{{true}}" show-back-top="{{showBackTop}}" bindbacktop="backTop"></quick-navigation>
</view>
<template is="zan-actionsheet" data="{{...actionsheet}}" />
\ No newline at end of file
... ...
... ... @@ -13,7 +13,7 @@
}
.filter-view-float-holder {
height: 96rpx;
height: 92rpx;
}
.shop-container .list-view {
... ...
... ... @@ -3,6 +3,7 @@ import Yas from '../../../common/yas'
import searchModel from '../../../models/product/search';
const yas = new Yas();
const {windowHeight} = getApp().getSystemInfo();
Page({
data: {
... ... @@ -17,7 +18,7 @@ Page({
noResult: false,
showLoading: false,
showNoMore: false,
showBackTop: true
showBackTop: false
},
onReachBottom: function () {
if (this.data.currentPage < this.data.totalPage) {
... ... @@ -40,6 +41,18 @@ Page({
onLoad: function() {
yas.pageOpenReport();
},
onPageScroll: function({scrollTop}) {
if (scrollTop > windowHeight * 2 !== this.data.showBackTop) {
this.setData({
showBackTop: scrollTop > windowHeight * 2
});
}
},
backTop: function() {
wx.pageScrollTo({
scrollTop: 0
});
},
bindQueryInput: function(e) {
this.setData({
query: e.detail.value
... ... @@ -105,10 +118,12 @@ Page({
noResult: this.data.productList.concat(list).length === 0
});
if (params.resetScroll) {
wx.pageScrollTo({
scrollTop: 0,
duration: 10
});
}
wx.hideLoading();
}
}).catch(() => {
... ... @@ -131,6 +146,7 @@ Page({
query: this.data.query
};
this.data.productList = [];
params.resetScroll = true;
this.productList(params);
}
});
\ No newline at end of file
... ...
... ... @@ -20,6 +20,5 @@
</product-list>
</view>
</view>
<quick-navigation show-menu="{{false}}" show-back-top="{{showBackTop}}" show="{{true}}"
bindbacktop="backTop"></quick-navigation>
<quick-navigation show-back-top="{{showBackTop}}" bindbacktop="backTop"></quick-navigation>
</view>
... ...