Jelajahi Sumber

新增檢查抽獎動畫狀態 修正中獎清單方向

maa3520 2 tahun lalu
induk
melakukan
b262c4adba

+ 1 - 1
resources/js/src/views/lottery/PrizeList.vue

@@ -180,7 +180,7 @@ export default {
           }
         }
       } else {
-        this.index = (this.index + this.prizes.length + index) % this.prizes.length;
+        this.index = (this.index + this.prizes.length - index) % this.prizes.length;
         this.getPrizeList(this.prizes[this.index].id,index)
       }
     },

+ 4 - 2
resources/js/src/views/lottery/Slot.vue

@@ -352,7 +352,7 @@ export default {
 		},
 		recieve(e) {
 			e.currentTarget.blur();
-			if (this.isDrawn) {
+			if (this.isDrawn && this.isAnimated) {
 				var idList = [];
 				this.drawList.forEach(element => {
 					idList.push(element.user_id);
@@ -373,7 +373,7 @@ export default {
 		},
 		restart(e) {
 			e.currentTarget.blur();
-			if (this.isDrawn) {
+			if (this.isDrawn && this.isAnimated) {
 				var idList = [];
 				this.drawList.forEach(element => {
 					idList.push(element.user_id);
@@ -432,6 +432,7 @@ export default {
 							if (i == 3) {
 								document.querySelector("div.slot.counter_" + index + " > div > div:nth-child(3) > span").innerText = element.user_name;
 								this.user_id = element.user_id;
+								this.isAnimated = true;
 							}
 						}
 					}, 50);
@@ -446,6 +447,7 @@ export default {
 			document.querySelectorAll("div.slot.counter_0 > div > div:nth-child(2) > span > i")[3].innerText = "0";
 			document.querySelector("div.slot.counter_0 > div > div:nth-child(3) > span").innerText = "";
 			this.isDrawn = false;
+			this.isAnimated = false;
 		},
 		count() {
 			useJwt.postData('/api/prize/count_by_prize', { prize_id: this.drawOption.prize_id }).then(res => {