下来刷新性能优化

This commit is contained in:
chenbo 2020-03-26 17:01:46 +08:00
parent 78ceda87ef
commit 0d4b86754d
10 changed files with 130 additions and 31 deletions

View File

@ -5,6 +5,7 @@
"pages/newGoods/newGoods", "pages/newGoods/newGoods",
"pages/hotGoods/hotGoods", "pages/hotGoods/hotGoods",
"pages/ucenter/index/index", "pages/ucenter/index/index",
"pages/ucenter/main/index",
"pages/ucenter/address/address", "pages/ucenter/address/address",
"pages/ucenter/addressAdd/addressAdd", "pages/ucenter/addressAdd/addressAdd",
"pages/ucenter/feedback/feedback", "pages/ucenter/feedback/feedback",
@ -49,13 +50,13 @@
"lib/home/index" "lib/home/index"
], ],
"window": { "window": {
"navigationBarBackgroundColor": "#85c43f", "navigationBarBackgroundColor": "#85c43f",
"navigationBarTitleText": "聚惠星", "navigationBarTitleText": "聚惠星",
"enablePullDownRefresh": true, "enablePullDownRefresh": true,
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",
"backgroundColor": "#FFFFFF", "backgroundColor": "#FFFFFF",
"backgroundTextStyle": "dark" "backgroundTextStyle": "dark"
}, },
"tabBar": { "tabBar": {
"backgroundColor": "#fafafa", "backgroundColor": "#fafafa",
"borderStyle": "white", "borderStyle": "white",

View File

@ -80,4 +80,4 @@ button::after{border:0;}
.loading .text{position: relative;display: inline-block;padding: 0 20rpx;background: #fff;z-index: 2;color: #777;} .loading .text{position: relative;display: inline-block;padding: 0 20rpx;background: #fff;z-index: 2;color: #777;}
.loadingicon .loading {animation: load linear 1s infinite;font-size:45rpx;color:#000;} .loadingicon .loading {animation: load linear 1s infinite;font-size:45rpx;color:#000;}
.loadingicon{width:100%;height:80rpx;} .loadingicon{width:100%;height:80rpx;}

View File

@ -92,7 +92,7 @@ module.exports = {
CouponReceive: WxApiRoot + 'coupon/receive', //优惠券领取 CouponReceive: WxApiRoot + 'coupon/receive', //优惠券领取
CouponReceiveAll: WxApiRoot + 'coupon/receiveAll', //优惠券领取 CouponReceiveAll: WxApiRoot + 'coupon/receiveAll', //优惠券领取
CouponExchange: WxApiRoot + 'coupon/exchange', //优惠券兑换 CouponExchange: WxApiRoot + 'coupon/exchange', //优惠券兑换
GetUserCoupon:WxApiRoot + 'coupon/getUserCoupon',//用户个人可领取优惠券查询 GetUserCoupon: WxApiRoot + 'coupon/getUserCoupon',//用户个人可领取优惠券查询
StorageUpload: WxApiRoot + 'storage/upload', //图片上传, StorageUpload: WxApiRoot + 'storage/upload', //图片上传,
@ -100,5 +100,7 @@ module.exports = {
BrokerageMain: WxApiRoot + 'brokerage/main',//佣金收益主页面 BrokerageMain: WxApiRoot + 'brokerage/main',//佣金收益主页面
SettleOrderList: WxApiRoot + 'brokerage/settleOrderList',//佣金收益主页面 SettleOrderList: WxApiRoot + 'brokerage/settleOrderList',//佣金收益主页面
ExtractList: WxApiRoot + 'brokerage/extractList',//佣金账号提现记录 ExtractList: WxApiRoot + 'brokerage/extractList',//佣金账号提现记录
ArticleDetail: WxApiRoot + 'article/detail' //公告详情 ArticleDetail: WxApiRoot + 'article/detail',//公告详情
ApplyAgency: WxApiRoot + 'user/applyAgency',//代理申请
GetSharedUrl: WxApiRoot + 'user/getSharedUrl' //获取推广二维码
}; };

View File

@ -10,7 +10,8 @@ Page({
brand: {}, brand: {},
goodsList: [], goodsList: [],
page: 1, page: 1,
size: 200 size: 10,
totalPages: 1
}, },
onLoad: function(options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
@ -45,7 +46,8 @@ Page({
.then(function(res) { .then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
goodsList: res.data.goodsList goodsList: that.data.goodsList.concat(res.data.goodsList),
totalPages: res.data.totalPages
}); });
} }
}); });
@ -65,5 +67,20 @@ Page({
onUnload: function() { onUnload: function() {
// 页面关闭 // 页面关闭
} },
onReachBottom:function() {
if (this.data.totalPages > this.data.page) {
this.setData({
page: this.data.page + 1
});
} else {
wx.showToast({
title: '已经到底了!',
icon: 'none',
duration: 2000
});
return false;
}
this.getGoodsList();
}
}) })

View File

@ -9,7 +9,7 @@
<view class="service-policy"> <view class="service-policy">
<view class="item">全场优惠券抵扣</view> <view class="item">全场优惠券抵扣</view>
<view class="item">7天无忧快速退货</view> <view class="item">7天无忧快速退货</view>
<view class="item">满66元免邮费</view> <view class="item">满40元免邮费</view>
</view> </view>
<view class="no-cart" wx:if="{{cartGoods.length <= 0 && brandCartgoods.length <=0 }}"> <view class="no-cart" wx:if="{{cartGoods.length <= 0 && brandCartgoods.length <=0 }}">
<view class="c"> <view class="c">

View File

@ -11,7 +11,8 @@ Page({
scrollTop: 0, scrollTop: 0,
scrollHeight: 0, scrollHeight: 0,
page: 1, page: 1,
size: 500 size: 10,
totalPages: 1
}, },
onLoad: function(options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
@ -100,7 +101,8 @@ Page({
}) })
.then(function(res) { .then(function(res) {
that.setData({ that.setData({
goodsList: res.data.goodsList, goodsList: that.data.goodsList.concat(res.data.goodsList),
totalPages: res.data.totalPages
}); });
}); });
}, },
@ -124,9 +126,27 @@ Page({
}); });
} }
this.setData({ this.setData({
id: event.currentTarget.dataset.id id: event.currentTarget.dataset.id,
goodsList: [],
page: 1,
totalPages: 1
}); });
this.getCategoryInfo(); this.getCategoryInfo();
} },
onReachBottom:function() {
if (this.data.totalPages > this.data.page) {
this.setData({
page: this.data.page + 1
});
} else {
wx.showToast({
title: '已经到底了!',
icon: 'none',
duration: 2000
});
return false;
}
this.getGoodsList();
}
}) })

View File

@ -16,7 +16,8 @@ Page({
currentSort: 'browse', currentSort: 'browse',
currentSortOrder: 'desc', currentSortOrder: 'desc',
page: 1, page: 1,
size: 200 size: 10,
totalPages: 1
}, },
getCategoryList: function() { getCategoryList: function() {
var that = this; var that = this;
@ -46,8 +47,9 @@ Page({
.then(function(res) { .then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
goodsList: res.data.goodsList, goodsList: that.data.goodsList.concat(res.data.goodsList),
filterCategory: res.data.filterCategoryList filterCategory: res.data.filterCategoryList,
totalPages: res.data.totalPages
}); });
} }
}); });
@ -128,5 +130,20 @@ Page({
'categoryId': this.data.filterCategory[currentIndex].id 'categoryId': this.data.filterCategory[currentIndex].id
}); });
this.getGoodsList(); this.getGoodsList();
},
onReachBottom:function() {
if (this.data.totalPages > this.data.page) {
this.setData({
page: this.data.page + 1
});
} else {
wx.showToast({
title: '已经到底了!',
icon: 'none',
duration: 2000
});
return false;
}
this.getGoodsList();
} }
}) })

View File

@ -16,7 +16,8 @@ Page({
currentSort: 'add_time', currentSort: 'add_time',
currentSortOrder: 'desc', currentSortOrder: 'desc',
page: 1, page: 1,
size: 200 size: 10,
totalPages: 1
}, },
getGoodsList: function() { getGoodsList: function() {
var that = this; var that = this;
@ -32,8 +33,9 @@ Page({
.then(function(res) { .then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
goodsList: res.data.goodsList, goodsList: that.data.goodsList.concat(res.data.goodsList),
filterCategory: res.data.filterCategoryList filterCategory: res.data.filterCategoryList,
totalPages: res.data.totalPages
}); });
} }
}); });
@ -113,6 +115,20 @@ Page({
'categoryId': this.data.filterCategory[currentIndex].id 'categoryId': this.data.filterCategory[currentIndex].id
}); });
this.getGoodsList(); this.getGoodsList();
},
onReachBottom:function() {
if (this.data.totalPages > this.data.page) {
this.setData({
page: this.data.page + 1
});
} else {
wx.showToast({
title: '已经到底了!',
icon: 'none',
duration: 2000
});
return false;
}
this.getGoodsList();
} }
}) })

View File

@ -17,8 +17,9 @@ Page({
defaultKeyword: {}, defaultKeyword: {},
hotKeyword: [], hotKeyword: [],
page: 1, page: 1,
size: 20, size: 10,
categoryId: 0 categoryId: 0,
totalPages: 1
}, },
//事件处理函数 //事件处理函数
closeSearch: function() { closeSearch: function() {
@ -104,8 +105,9 @@ Page({
that.setData({ that.setData({
searchStatus: true, searchStatus: true,
categoryFilter: false, categoryFilter: false,
goodsList: res.data.goodsList, goodsList: that.data.goodsList.concat(res.data.goodsList),
filterCategory: res.data.filterCategoryList filterCategory: res.data.filterCategoryList,
totalPages: res.data.totalPages
}); });
} }
@ -125,6 +127,7 @@ Page({
this.setData({ this.setData({
keyword: keyword, keyword: keyword,
page: 1, page: 1,
totalPages: 1,
categoryId: 0, categoryId: 0,
goodsList: [] goodsList: []
}); });
@ -185,11 +188,27 @@ Page({
categoryFilter: false, categoryFilter: false,
categoryId: currentCategory.id, categoryId: currentCategory.id,
page: 1, page: 1,
totalPages: 1,
goodsList: [] goodsList: []
}); });
this.getGoodsList(); this.getGoodsList();
}, },
onKeywordConfirm(event) { onKeywordConfirm(event) {
this.getSearchResult(event.detail.value); this.getSearchResult(event.detail.value);
} },
onReachBottom:function() {
if (this.data.totalPages > this.data.page) {
this.setData({
page: this.data.page + 1
});
} else {
wx.showToast({
title: '已经到底了!',
icon: 'none',
duration: 2000
});
return false;
}
this.getGoodsList();
}
}) })

View File

@ -40,7 +40,7 @@
"list": [] "list": []
}, },
"miniprogram": { "miniprogram": {
"current": 22, "current": 38,
"list": [ "list": [
{ {
"id": -1, "id": -1,
@ -269,6 +269,13 @@
"name": "优惠券列表", "name": "优惠券列表",
"pathName": "pages/coupon/coupon", "pathName": "pages/coupon/coupon",
"query": "" "query": ""
},
{
"id": 38,
"name": "QcCode",
"pathName": "pages/index/index",
"query": "shareUserId=100",
"scene": 1011
} }
] ]
} }