节流阀

This commit is contained in:
liuye
2023-02-03 17:52:55 +08:00
parent 3b34496bde
commit 01dd997c73

View File

@@ -185,12 +185,7 @@ export default {
methods: {
...mapActions(['injectJWeixin', 'wxInvoke', 'agentSign']),
//封装动画旋转整数圈的方法,只需接受(角度,时间)即可开始旋转动画
rotate(deg, duration) {
if (this.isStart) return; //防止用户多次点击动画
this.isStart = true; //此时旋转开始,动画无法再次触发
setTimeout(() => {
this.isStart = false;
}, duration)
rotate(deg) {
this.animation.rotate(deg).step().rotate((this.awardNumber - 1) * -(360 / this.activeInfo.prizes.length)).step({
duration: 0,
timingFunction: "linear",
@@ -240,6 +235,9 @@ export default {
if(!this.activeInfo.vaildPhone) {
return this.showPhoneMask = true
}
if (this.isStart) return
this.isStart = true
this.$http.post(`/app/appmarketingactivityinfo/raffle?activityId=${this.activityId}`).then((res) => {
if (res.code == 0) {
this.awardNumber = res.data
@@ -248,6 +246,7 @@ export default {
this.$u.toast(this.activeInfo.prizes[this.awardNumber-1].defaultPrize == 1 ? `很遗憾您抽中了${this.activeInfo.prizes[this.awardNumber-1].name}` : `恭喜抽中${this.activeInfo.prizes[this.awardNumber-1].name}!`)
this.getDetail()
this.getAwardedList()
this.isStart = false
}, 2000)}
}).catch((err) => {
this.$u.toast(err)