Browse Source

feat[litemall-wx]: 部分页面支持下拉刷新

Junling Bu 6 years ago
parent
commit
dd41f392b8

+ 1 - 1
litemall-wx/pages/cart/cart.json

@@ -1,4 +1,4 @@
 {
-  "backgroundColor": "#f4f4f4",
+  "enablePullDownRefresh": true,
   "navigationBarTitleText": "购物车"
 }

+ 7 - 0
litemall-wx/pages/comment/comment.js

@@ -66,6 +66,13 @@ Page({
     this.getCommentCount();
     this.getCommentList();
   },
+  onPullDownRefresh() {
+    wx.showNavigationBarLoading() //在标题栏中显示加载
+    this.getCommentCount();
+    this.getCommentList();
+    wx.hideNavigationBarLoading() //完成停止加载
+    wx.stopPullDownRefresh() //停止下拉刷新
+  },
   onReady: function() {
     // 页面渲染完成
 

+ 1 - 0
litemall-wx/pages/comment/comment.json

@@ -1,3 +1,4 @@
 {
+  "enablePullDownRefresh": true,
   "navigationBarTitleText": "评价"
 }

+ 1 - 0
litemall-wx/pages/index/index.json

@@ -1,5 +1,6 @@
 {
   "navigationBarTitleText": "首页",
+  "enablePullDownRefresh": true,
   "usingComponents": {
     "zan-capsule": "../../lib/zanui-weapp/capsule/index"
   }

+ 7 - 0
litemall-wx/pages/topicComment/topicComment.js

@@ -68,6 +68,13 @@ Page({
     this.getCommentCount();
     this.getCommentList();
   },
+  onPullDownRefresh() {
+    wx.showNavigationBarLoading() //在标题栏中显示加载
+    this.getCommentCount();
+    this.getCommentList();
+    wx.hideNavigationBarLoading() //完成停止加载
+    wx.stopPullDownRefresh() //停止下拉刷新
+  },
   onReady: function() {
     // 页面渲染完成
 

+ 1 - 0
litemall-wx/pages/topicComment/topicComment.json

@@ -1,3 +1,4 @@
 {
+  "enablePullDownRefresh": true,
   "navigationBarTitleText": "评论"
 }

+ 6 - 3
litemall-wx/pages/ucenter/couponList/couponList.js

@@ -54,8 +54,11 @@ Page({
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
-  onPullDownRefresh: function() {
-
+  onPullDownRefresh() {
+    wx.showNavigationBarLoading() //在标题栏中显示加载
+    this.getCouponList();
+    wx.hideNavigationBarLoading() //完成停止加载
+    wx.stopPullDownRefresh() //停止下拉刷新
   },
 
   /**
@@ -89,7 +92,7 @@ Page({
         that.setData({
           scrollTop: 0,
           couponList: res.data.list,
-          showPage: true,
+          showPage: res.data.total > that.data.limit,
           count: res.data.total
         });
       }

+ 1 - 0
litemall-wx/pages/ucenter/couponList/couponList.json

@@ -1,3 +1,4 @@
 {
+  "enablePullDownRefresh": true,
   "navigationBarTitleText": "我的优惠券"
 }

+ 1 - 1
litemall-wx/pages/ucenter/couponList/couponList.wxss

@@ -129,7 +129,7 @@ page {
 .container .b .item {
   position: relative;
   height: 290rpx;
-  background: gray;
+  background: #ccc7c7;
   margin-bottom: 30rpx;
   margin-left: 30rpx;
   margin-right: 30rpx;