From 7c5a060af890be7e2c4b239cb2718f7e45c38f9f Mon Sep 17 00:00:00 2001 From: liuye Date: Fri, 3 Feb 2023 16:14:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=BD=E5=A5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppLuckyDraw/AppLuckyDraw.vue | 41 +++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/src/project/activeAnalysis/AppLuckyDraw/AppLuckyDraw.vue b/src/project/activeAnalysis/AppLuckyDraw/AppLuckyDraw.vue index 7979b678..5a358e03 100644 --- a/src/project/activeAnalysis/AppLuckyDraw/AppLuckyDraw.vue +++ b/src/project/activeAnalysis/AppLuckyDraw/AppLuckyDraw.vue @@ -3,7 +3,7 @@
- +
@@ -149,7 +149,7 @@ export default { data() { return { deg: 0, // 初始化角度 - duration: 4000, //动画时长 + duration: 2000, //动画时长 awardNumber: 0, // 中奖区域 从1开始 isStart: false, //防止多次触发动画 animationData: {}, //动画对象 @@ -176,7 +176,9 @@ export default { this.getAwardedList() }, onShow() { - wx.hideOptionMenu(); + this.injectJWeixin('showOptionMenu').then(() => { + wx.showOptionMenu(); + }) }, methods: { ...mapActions(['injectJWeixin', 'wxInvoke', 'agentSign']), @@ -184,11 +186,9 @@ export default { rotate(deg, duration) { if (this.isStart) return; //防止用户多次点击动画 this.isStart = true; //此时旋转开始,动画无法再次触发 - setTimeout( - function () { - //设置定时器在动画时间后方可再次触发转盘动画 - this.isStart = false; - }.bind(this), duration); //此时用的普通函数,存在this指向问题,需要改变this指向 + setTimeout(() => { + this.isStart = false; + }, duration) this.animation.rotate(deg).step().rotate((this.awardNumber - 1) * -(360 / this.activeInfo.prizes.length)).step({ duration: 0, timingFunction: "linear", @@ -241,9 +241,9 @@ export default { this.awardNumber = res.data this.onStart() setTimeout(() => { - this.$u.toast(`恭喜抽中${this.activeInfo.prizes[this.awardNumber].name}!`) + this.$u.toast(`恭喜抽中${this.activeInfo.prizes[this.awardNumber-1].name}!`) this.getDetail() - }, 4000)} + }, 2000)} }).catch((err) => { this.$u.toast(err) }) @@ -287,11 +287,28 @@ export default { this.agentSign().then((res) => { console.log(999, res) this.injectJWeixin(['shareAppMessage', 'shareWechatMessage']).then(() => { - this.wxInvoke(['shareAppMessage', { + console.log(111) + // this.wxInvoke(['shareAppMessage', { + // title: '幸运抽奖', + // desc: '新年伊始,企业微信团队为创建安全和谐的网络办公环境,诚邀大家使用企业微信参与打卡活动!', + // link: `./AppLuckyDraw/AppLuckyDraw?activityId=${this.activityId}&friendId=${this.user.id}`, + // }]) + wx.onMenuShareWechat({ title: '幸运抽奖', desc: '新年伊始,企业微信团队为创建安全和谐的网络办公环境,诚邀大家使用企业微信参与打卡活动!', link: `./AppLuckyDraw/AppLuckyDraw?activityId=${this.activityId}&friendId=${this.user.id}`, - }]) + success: function () { + // 用户确认分享后执行的回调函数 + console.log(22,res) + }, + error: function(res) { + console.log(11,res) + }, + cancel: function () { + // 用户取消分享后执行的回调函数 + console.log(33,res) + } + }); }) }) },