抽奖
This commit is contained in:
@@ -150,7 +150,7 @@ export default {
|
||||
return {
|
||||
deg: 0, // 初始化角度
|
||||
duration: 4000, //动画时长
|
||||
awardNumber: 2, // 中奖区域 从1开始
|
||||
awardNumber: 0, // 中奖区域 从1开始
|
||||
isStart: false, //防止多次触发动画
|
||||
animationData: {}, //动画对象
|
||||
showPhoneMask: false,
|
||||
@@ -165,6 +165,10 @@ export default {
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
this.animation = uni.createAnimation({
|
||||
duration: this.duration,
|
||||
timingFunction: "ease-in-out", //旋转模式
|
||||
});
|
||||
this.activityId = option.activityId
|
||||
this.friendId = option.friendId || ''
|
||||
// this.activityId = '75a4c4493de54f9fb63868817079c89c'
|
||||
@@ -173,12 +177,6 @@ export default {
|
||||
},
|
||||
onShow() {
|
||||
wx.hideOptionMenu();
|
||||
//创建对象,并将对象存放在data中以挂载在需要进行动画的元素之上
|
||||
var animation = uni.createAnimation({
|
||||
duration: this.duration,
|
||||
timingFunction: "ease-in-out", //旋转模式
|
||||
});
|
||||
this.animation = animation; //挂载在vue实例上以便渲染
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['injectJWeixin', 'wxInvoke', 'agentSign']),
|
||||
@@ -197,8 +195,6 @@ export default {
|
||||
duration: 0,
|
||||
timingFunction: "linear",
|
||||
});
|
||||
this.$u.toast(`恭喜抽中${this.activeInfo.prizes[this.awardNumber].name}!`)
|
||||
this.getDetail()
|
||||
this.animationData = this.animation.export();
|
||||
},
|
||||
//开始旋转
|
||||
@@ -246,7 +242,10 @@ export default {
|
||||
if (res.code == 0) {
|
||||
this.awardNumber = res.data
|
||||
this.onStart()
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.$u.toast(`恭喜抽中${this.activeInfo.prizes[this.awardNumber].name}!`)
|
||||
this.getDetail()
|
||||
}, 4000)}
|
||||
}).catch((err) => {
|
||||
this.$u.toast(err)
|
||||
})
|
||||
@@ -586,7 +585,7 @@ export default {
|
||||
.clock-img {
|
||||
width: 80px;
|
||||
position: absolute;
|
||||
top: 70px;
|
||||
top: 80px;
|
||||
left: 50%;
|
||||
margin-left: -40px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user