diff --git a/src/views/choujiang/hxl-cj/cj.vue b/src/views/choujiang/hxl-cj/cj.vue index 1818b65..73d20bd 100644 --- a/src/views/choujiang/hxl-cj/cj.vue +++ b/src/views/choujiang/hxl-cj/cj.vue @@ -853,6 +853,7 @@ function selectCard(duration = 600) { tag++; } } else { + // console.log(currentLuckys); // 小于等于5个一排显示(与抽不足10人时的排列相同) let tag = -(pageCount - 1) / 2; for (let i = 0; i < pageCount; i++) { @@ -1178,6 +1179,14 @@ const lotteryBtn = () => { // API返回结果时赋值 getPrizeUsers.value = res.data.data || []; isBackApi.value = false; + if (res.data.data.length != 0) { + console.log("抽出用户"); + //更新剩余抽奖数目的数据显示 + changePrize(); + } else { + console.log("没抽出用户"); + getPrizeUsers.value = [{ jwcode: "恭喜所有中奖用户!", type: "over" }]; + } console.log("API返回结果:", res.data.data); }) .catch((err) => { @@ -1187,17 +1196,22 @@ const lotteryBtn = () => { }); setLotteryStatus(true); - //更新剩余抽奖数目的数据显示 - changePrize(); + resetCard().then((res) => { + if (noUserObj.value.index != -1) { + console.log("noUserObj.value", noUserObj.value); + + let card = threeDCards[noUserObj.value.index].element; + card.style.width = "7.5vw"; + card.style.height = "18.5vh"; + card.innerHTML = `
${noUserObj.value.jwcode}
`; + noUserObj.value.index = -1; + } // 抽奖 lottery(); }); console.log("currentPrize", currentPrize.value); - - const text = "正在抽取[" + currentPrize.value.prizeName + "],调整好姿势"; - // addQipao(text); }; const throttledLotteryBtn = _.throttle(lotteryBtn, 1000, { @@ -1275,6 +1289,11 @@ function changeCard(cardIndex, user) { card.innerHTML = `
${user.jwcode}
`; } +const noUserObj = ref({ + index: -1, + jwcode: "", +}); + function changeSelectedCard(cardIndex, user) { // 保存到全局变量数组 if (!globalCardIndexes.includes(cardIndex)) { @@ -1283,6 +1302,14 @@ function changeSelectedCard(cardIndex, user) { let card = threeDCards[cardIndex].element; + if (user.type == "over") { + noUserObj.value.index = cardIndex; + noUserObj.value.jwcode = card.innerHTML; + + card.style.width = "18vw"; + card.style.height = "20vh"; + } + card.innerHTML = `
${user.jwcode}
`; } /**