Browse Source

拼团列表城市定位问题修改

ZhangWenQiang 6 years ago
parent
commit
a4c0d5d380
2 changed files with 35 additions and 17 deletions
  1. 33 16
      pages/pt/index.js
  2. 2 1
      pages/pt/index.json

+ 33 - 16
pages/pt/index.js

@@ -30,6 +30,29 @@ Page({
     canIUse: wx.canIUse('button.open-type.getUserInfo'),
   },
   onLoad: function(options) {
+
+  },
+  onReady: function() {
+
+  },
+  //下拉刷新
+  onPullDownRefresh: function () {
+    this.setData({
+      pageNo: 1, //当前分页
+      isScroll: true, //是否可以滚动
+      list: [],
+    })
+    this.start();
+    wx.stopPullDownRefresh();
+  },
+  onReachBottom: function() {
+    var pageNo = this.data.pageNo + 1;
+    this.setData({
+      pageNo
+    })
+    this.fetchList()
+  },
+  onShow: function() {
     if (app.globalData.userInfo) {
       console.log('有info===', app.globalData)
       this.start()
@@ -51,25 +74,19 @@ Page({
       })
     }
   },
-  onReady: function() {
-
-  },
-  onReachBottom: function() {
-    var pageNo = this.data.pageNo + 1;
-    this.setData({
-      pageNo
-    })
-    this.fetchList()
-  },
-  onShow: function() {
-
-  },
   start() {
+    let cityName = wx.getStorageSync('city') || app.globalData.userInfo.city || '无锡'
+    let cityCode = wx.getStorageSync('cityCode') || '320200';
+    console.log(cityName)
+    console.log(cityCode)
     this.setData({
-      cityName: updataStorageData('city') || app.globalData.userInfo.city || '无锡'
+      cityName: cityName,
+      cityCode: cityCode,
+      pageNo: 1, //当前分页
+      isScroll: true, //是否可以滚动
+      list: []
     })
     this.fetchList()
-    // this.fetchPt()
   },
 
   //获取拼团列表数据
@@ -130,7 +147,7 @@ Page({
   onShareAppMessage: function() {
     return {
       title: '快来开心工作看看吧',
-      path: '/pages/index/index?shareToken=' + updataStorageData('shareToken'),
+      path: '/pages/index/index',
       imageUrl: ''
     }
   },

+ 2 - 1
pages/pt/index.json

@@ -3,5 +3,6 @@
     "i-icon": "../../ui/icon/index",
     "i-tag": "../../ui/tag/index",
     "i-count-down": "../../ui/count-down/index"
-  }
+  },
+  "enablePullDownRefresh": true
 }