抽奖
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<div class="header-bg">
|
||||
<img src="./img/header-bg.png" alt="" class="header-bg-img">
|
||||
<!-- <img src="./img/share-btn.png" alt="" class="share-bg-img"> -->
|
||||
<div class="share-btn" @click="share">分享活动</div>
|
||||
<!-- <div class="share-btn" @click="share">分享活动</div> -->
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<div class="title">
|
||||
@@ -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)
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user