Browse Source

未抽出用户时提示

hongxilin/feature-20250710175148-抽奖
no99 1 week ago
parent
commit
5337feff47
  1. 37
      src/views/choujiang/hxl-cj/cj.vue

37
src/views/choujiang/hxl-cj/cj.vue

@ -853,6 +853,7 @@ function selectCard(duration = 600) {
tag++; tag++;
} }
} else { } else {
// console.log(currentLuckys);
// 510 // 510
let tag = -(pageCount - 1) / 2; let tag = -(pageCount - 1) / 2;
for (let i = 0; i < pageCount; i++) { for (let i = 0; i < pageCount; i++) {
@ -1178,6 +1179,14 @@ const lotteryBtn = () => {
// API // API
getPrizeUsers.value = res.data.data || []; getPrizeUsers.value = res.data.data || [];
isBackApi.value = false; 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); console.log("API返回结果:", res.data.data);
}) })
.catch((err) => { .catch((err) => {
@ -1187,17 +1196,22 @@ const lotteryBtn = () => {
}); });
setLotteryStatus(true); setLotteryStatus(true);
//
changePrize();
resetCard().then((res) => { 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 = `<div class="name">${noUserObj.value.jwcode}</div>`;
noUserObj.value.index = -1;
}
// //
lottery(); lottery();
}); });
console.log("currentPrize", currentPrize.value); console.log("currentPrize", currentPrize.value);
const text = "正在抽取[" + currentPrize.value.prizeName + "],调整好姿势";
// addQipao(text);
}; };
const throttledLotteryBtn = _.throttle(lotteryBtn, 1000, { const throttledLotteryBtn = _.throttle(lotteryBtn, 1000, {
@ -1275,6 +1289,11 @@ function changeCard(cardIndex, user) {
card.innerHTML = `<div class="name">${user.jwcode}</div>`; card.innerHTML = `<div class="name">${user.jwcode}</div>`;
} }
const noUserObj = ref({
index: -1,
jwcode: "",
});
function changeSelectedCard(cardIndex, user) { function changeSelectedCard(cardIndex, user) {
// //
if (!globalCardIndexes.includes(cardIndex)) { if (!globalCardIndexes.includes(cardIndex)) {
@ -1283,6 +1302,14 @@ function changeSelectedCard(cardIndex, user) {
let card = threeDCards[cardIndex].element; 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 = `<div class="name">${user.jwcode}</div>`; card.innerHTML = `<div class="name">${user.jwcode}</div>`;
} }
/** /**

Loading…
Cancel
Save