From fd29d46149c07d0f85df0614c1ca8d8bc390f1d2 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Sat, 3 Jun 2023 15:32:01 +0800 Subject: [PATCH] 团购列表的优化 --- packageC/pages/group_list/group_list.js | 63 ++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/packageC/pages/group_list/group_list.js b/packageC/pages/group_list/group_list.js index 358019d..d2738a0 100644 --- a/packageC/pages/group_list/group_list.js +++ b/packageC/pages/group_list/group_list.js @@ -64,47 +64,44 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - getApp().check_can_share(); - if(app.globalData.userInfo) { - if(!this.data.isLogin) { - this.setData({ - userInfo: app.globalData.userInfo, - imghost: app.globalData.setting.imghost, - isLogin: true, - }); - - let typeVal = this.data.type; - let url = '/api/weshop/goods/groupBuy/page'; - let data = { - store_id: app.globalData.setting.stoid, - is_show: 1, - is_end: 0, - timetype: typeVal - }; - - this.setData({ - list: [], - pageNum: 1, - noMore: false, - }); - - this.getData(true, url, data).then(function() { - self.setData({ - currentData: data, - }); - }); - - this.data.is_timer = 1; + getApp().check_can_share(this); + + var user=app.globalData.userInfo; + this.setData({ + userInfo: user, + imghost: app.globalData.setting.imghost, + isLogin: true, + }); + let typeVal = this.data.type; + let url = '/api/weshop/goods/groupBuy/page'; + let data = { + store_id: app.globalData.setting.stoid, + is_show: 1, + is_end: 0, + timetype: typeVal }; - + + this.setData({ + list: [], + pageNum: 1, + noMore: false, + }); + + this.getData(true, url, data).then(function() { + self.setData({ + currentData: data, + }); + }); + this.data.is_timer = 1; + //设置全局定时器 clearInterval(this.data.timer); this.data.timer = setInterval(function () { self.countDown(); }, 1000); - }; + }, -- libgit2 0.21.4