Commit fd29d46149c07d0f85df0614c1ca8d8bc390f1d2
1 parent
86a02db2
团购列表的优化
Showing
1 changed file
with
30 additions
and
33 deletions
packageC/pages/group_list/group_list.js
| @@ -64,47 +64,44 @@ Page({ | @@ -64,47 +64,44 @@ Page({ | ||
| 64 | * 生命周期函数--监听页面显示 | 64 | * 生命周期函数--监听页面显示 |
| 65 | */ | 65 | */ |
| 66 | onShow: function () { | 66 | onShow: function () { |
| 67 | - getApp().check_can_share(); | ||
| 68 | - if(app.globalData.userInfo) { | ||
| 69 | - if(!this.data.isLogin) { | ||
| 70 | - this.setData({ | ||
| 71 | - userInfo: app.globalData.userInfo, | ||
| 72 | - imghost: app.globalData.setting.imghost, | ||
| 73 | - isLogin: true, | ||
| 74 | - }); | ||
| 75 | - | ||
| 76 | - let typeVal = this.data.type; | ||
| 77 | - let url = '/api/weshop/goods/groupBuy/page'; | ||
| 78 | - let data = { | ||
| 79 | - store_id: app.globalData.setting.stoid, | ||
| 80 | - is_show: 1, | ||
| 81 | - is_end: 0, | ||
| 82 | - timetype: typeVal | ||
| 83 | - }; | ||
| 84 | - | ||
| 85 | - this.setData({ | ||
| 86 | - list: [], | ||
| 87 | - pageNum: 1, | ||
| 88 | - noMore: false, | ||
| 89 | - }); | ||
| 90 | - | ||
| 91 | - this.getData(true, url, data).then(function() { | ||
| 92 | - self.setData({ | ||
| 93 | - currentData: data, | ||
| 94 | - }); | ||
| 95 | - }); | ||
| 96 | - | ||
| 97 | - this.data.is_timer = 1; | 67 | + getApp().check_can_share(this); |
| 68 | + | ||
| 69 | + var user=app.globalData.userInfo; | ||
| 70 | + this.setData({ | ||
| 71 | + userInfo: user, | ||
| 72 | + imghost: app.globalData.setting.imghost, | ||
| 73 | + isLogin: true, | ||
| 74 | + }); | ||
| 98 | 75 | ||
| 76 | + let typeVal = this.data.type; | ||
| 77 | + let url = '/api/weshop/goods/groupBuy/page'; | ||
| 78 | + let data = { | ||
| 79 | + store_id: app.globalData.setting.stoid, | ||
| 80 | + is_show: 1, | ||
| 81 | + is_end: 0, | ||
| 82 | + timetype: typeVal | ||
| 99 | }; | 83 | }; |
| 100 | - | 84 | + |
| 85 | + this.setData({ | ||
| 86 | + list: [], | ||
| 87 | + pageNum: 1, | ||
| 88 | + noMore: false, | ||
| 89 | + }); | ||
| 90 | + | ||
| 91 | + this.getData(true, url, data).then(function() { | ||
| 92 | + self.setData({ | ||
| 93 | + currentData: data, | ||
| 94 | + }); | ||
| 95 | + }); | ||
| 96 | + this.data.is_timer = 1; | ||
| 97 | + | ||
| 101 | //设置全局定时器 | 98 | //设置全局定时器 |
| 102 | clearInterval(this.data.timer); | 99 | clearInterval(this.data.timer); |
| 103 | this.data.timer = setInterval(function () { | 100 | this.data.timer = setInterval(function () { |
| 104 | self.countDown(); | 101 | self.countDown(); |
| 105 | }, 1000); | 102 | }, 1000); |
| 106 | 103 | ||
| 107 | - }; | 104 | + |
| 108 | 105 | ||
| 109 | }, | 106 | }, |
| 110 | 107 |