This commit is contained in:
liuye
2023-02-03 15:05:01 +08:00
parent 17d4eedf39
commit 1f26a4b67d

View File

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