diff --git a/packageB/pages/luckactivity/luckinfo/luckinfo.js b/packageB/pages/luckactivity/luckinfo/luckinfo.js index 6b3281e..58255e2 100644 --- a/packageB/pages/luckactivity/luckinfo/luckinfo.js +++ b/packageB/pages/luckactivity/luckinfo/luckinfo.js @@ -828,6 +828,10 @@ Page({ }, start () { + // self.data.start = true; + if(this.data.start) return; + this.data.start = true; + if(!this.data.luckInfo) { wx.showToast({ title: this.data.msg, @@ -836,14 +840,16 @@ Page({ return; }; - if(self.data.luckInfo.msgInfo) { + if(this.data.luckInfo.msgInfo) { wx.showToast({ title: self.data.luckInfo.msgInfo, icon: 'none', }); return; }; - + wx.showLoading({ + title: '准备抽奖中' + }); // 获取积分 app.request.promisePost('/api/weshop/marketing/marketingLuckForm/startLuckIntegral', { isShowLoading: false, @@ -860,6 +866,9 @@ Page({ wx.showToast({ title: res.data.msg, icon: 'none', + success: function() { + self.data.start = false; + } }); return; }; @@ -869,13 +878,13 @@ Page({ if(self.data.luckInfo.user_LuckNumDay > 0 || self.data.luckInfo.vip_act_num == 0) { // console.log('start choujiang'); // let start = false; - if(!self.data.start) { - self.data.start = true; + if(self.data.start) { + // self.data.start = true; // 获取抽奖组件实例 const $lucky = self.selectComponent('#myLucky'); // 调用play方法开始旋转 $lucky.play(); - + wx.hideLoading(); // 获取抽奖结果 app.request.post('/api/weshop/marketing/marketingLuckForm/startLuck', { isShowLoading: false, @@ -910,10 +919,14 @@ Page({ let random = Math.random() * indexArr.length >> 0; // console.log('random', random); let index = indexArr[random]; - setTimeout(() => { - $lucky.stop(index); - self.data.start = false; - }, 3000); + + $lucky.stop(index); + // setTimeout(() => { + // Promise.resolve($lucky.stop(index)).then(()=>{ + // self.data.start = false; + // }); + + // }, 2000); //获取兑奖记录 @@ -942,10 +955,12 @@ Page({ const index = thxIndexArr[random]; // console.log('谢谢参与数组', thxIndexArr); // console.log('请求出错产生谢谢参与的随机数', index); - setTimeout(() => { - $lucky.stop(index); - self.data.start = false; - }, 3000); + $lucky.stop(index); + // setTimeout(() => { + // Promise.resolve($lucky.stop(index)).then(()=>{ + // self.data.start = false; + // }); + // }, 2000); @@ -982,10 +997,12 @@ Page({ let thxIndexArr = self.data.thxIndexArr; const random = Math.random() * thxIndexArr.length >> 0; const index = thxIndexArr[random]; - setTimeout(() => { - $lucky.stop(index); - self.data.start = false; - }, 3000); + $lucky.stop(index); + // setTimeout(() => { + // Promise.resolve($lucky.stop(index)).then(()=>{ + // self.data.start = false; + // }); + // }, 2000); }, @@ -1012,8 +1029,9 @@ Page({ }, end (event) { + // 中奖奖品详情 - console.log('抽奖结果:',event.detail); + // console.log('抽奖结果:',event.detail); let no_luck_urltype = this.data.luckInfo.no_luck_urltype; let lbtype = null; // let good_id = null; @@ -1148,6 +1166,7 @@ Page({ showResult: false, showMask: false, hiddenCanvas: false, + start: false, }); }, diff --git a/packageB/pages/luckactivity/luckinfo/luckinfo.wxml b/packageB/pages/luckactivity/luckinfo/luckinfo.wxml index 0ecb734..1fe23a4 100644 --- a/packageB/pages/luckactivity/luckinfo/luckinfo.wxml +++ b/packageB/pages/luckactivity/luckinfo/luckinfo.wxml @@ -130,7 +130,7 @@ - +