|
@ -1,9 +1,7 @@ |
|
|
<template> |
|
|
<template> |
|
|
<div class="choujiang-main"> |
|
|
<div class="choujiang-main"> |
|
|
<Lottery3D ref="lottery3DRef" /> |
|
|
<Lottery3D ref="lottery3DRef" /> |
|
|
<PrizePanel |
|
|
|
|
|
:prizes="dataManager.state.basicData.prizes" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
<PrizePanel :prizes="dataManager.state.basicData.prizes" /> |
|
|
<ControlBar |
|
|
<ControlBar |
|
|
:lottery-state="lotteryState" |
|
|
:lottery-state="lotteryState" |
|
|
:is-disabled="isDisabled" |
|
|
:is-disabled="isDisabled" |
|
@ -12,6 +10,7 @@ |
|
|
@export="handleExport" |
|
|
@export="handleExport" |
|
|
/> |
|
|
/> |
|
|
<MusicPlayer /> |
|
|
<MusicPlayer /> |
|
|
|
|
|
<Mascot /> |
|
|
|
|
|
|
|
|
<!-- 透明弹窗 --> |
|
|
<!-- 透明弹窗 --> |
|
|
<div v-if="showPrizeExhaustedModal" class="prize-exhausted-modal"> |
|
|
<div v-if="showPrizeExhaustedModal" class="prize-exhausted-modal"> |
|
@ -39,6 +38,7 @@ import ControlBar from "./lottery/ControlBar.vue"; |
|
|
import MusicPlayer from "./lottery/MusicPlayer.vue"; |
|
|
import MusicPlayer from "./lottery/MusicPlayer.vue"; |
|
|
import Qipao from "./lottery/Qipao.vue"; |
|
|
import Qipao from "./lottery/Qipao.vue"; |
|
|
import UserList from "./lottery/UserList.vue"; |
|
|
import UserList from "./lottery/UserList.vue"; |
|
|
|
|
|
import Mascot from "./lottery/Mascot.vue"; |
|
|
import { ref, onMounted, nextTick, computed, watch } from "vue"; |
|
|
import { ref, onMounted, nextTick, computed, watch } from "vue"; |
|
|
import { useDataManager } from "./lottery/dataManager.js"; |
|
|
import { useDataManager } from "./lottery/dataManager.js"; |
|
|
import { useLotteryEngine } from "./lottery/lotteryEngine.js"; |
|
|
import { useLotteryEngine } from "./lottery/lotteryEngine.js"; |
|
@ -68,7 +68,6 @@ const waitingForNextReveal = computed({ |
|
|
set: (val) => lotteryStore.setWaitingForNextReveal(val), |
|
|
set: (val) => lotteryStore.setWaitingForNextReveal(val), |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isDisabled = ref(false); |
|
|
const isDisabled = ref(false); |
|
|
|
|
|
|
|
|
watch(isDisabled, (newVal, oldVal) => { |
|
|
watch(isDisabled, (newVal, oldVal) => { |
|
@ -100,7 +99,9 @@ function showLotteryQipao() { |
|
|
const prize = dataManager.state.currentPrize; |
|
|
const prize = dataManager.state.currentPrize; |
|
|
if (!luckys || luckys.length === 0) return; |
|
|
if (!luckys || luckys.length === 0) return; |
|
|
// 适配新的数据格式,支持 jwcode 和 username |
|
|
// 适配新的数据格式,支持 jwcode 和 username |
|
|
const names = luckys.map((item) => item.username || item[1] || item.jwcode || "").join("、"); |
|
|
|
|
|
|
|
|
const names = luckys |
|
|
|
|
|
.map((item) => item.username || item[1] || item.jwcode || "") |
|
|
|
|
|
.join("、"); |
|
|
qipaoText.value = `恭喜${names}获得${prize?.title || ""}!`; |
|
|
qipaoText.value = `恭喜${names}获得${prize?.title || ""}!`; |
|
|
showQipao.value = true; |
|
|
showQipao.value = true; |
|
|
setTimeout(() => { |
|
|
setTimeout(() => { |
|
@ -118,14 +119,16 @@ async function handleLotteryClick() { |
|
|
switch (lotteryState.value) { |
|
|
switch (lotteryState.value) { |
|
|
case "idle": |
|
|
case "idle": |
|
|
// 先切换到球体布局 |
|
|
// 先切换到球体布局 |
|
|
|
|
|
await lottery3DRef.value?.switchScreen?.("lottery"); |
|
|
|
|
|
|
|
|
console.log("lotteryState 变更前:", lotteryState.value, "-> ready"); |
|
|
console.log("lotteryState 变更前:", lotteryState.value, "-> ready"); |
|
|
|
|
|
// await new Promise((resolve) => setTimeout(resolve, 2000)); |
|
|
|
|
|
|
|
|
lotteryState.value = "ready"; |
|
|
lotteryState.value = "ready"; |
|
|
console.log("lotteryState 变更后:", lotteryState.value); |
|
|
console.log("lotteryState 变更后:", lotteryState.value); |
|
|
await lottery3DRef.value?.switchScreen?.("lottery"); |
|
|
|
|
|
break; |
|
|
break; |
|
|
case "ready": |
|
|
case "ready": |
|
|
if(waitingForNextReveal.value){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (waitingForNextReveal.value) { |
|
|
console.log("waitingForNextReveal.value", waitingForNextReveal.value); |
|
|
console.log("waitingForNextReveal.value", waitingForNextReveal.value); |
|
|
// 显示弹窗提示 |
|
|
// 显示弹窗提示 |
|
|
showPrizeExhaustedModal.value = true; |
|
|
showPrizeExhaustedModal.value = true; |
|
@ -135,19 +138,17 @@ async function handleLotteryClick() { |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(lastRevealed.value===-1){ |
|
|
|
|
|
|
|
|
if (lastRevealed.value === -1) { |
|
|
console.log("lastRevealed.value", lastRevealed.value); |
|
|
console.log("lastRevealed.value", lastRevealed.value); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 立即切换为“停止抽奖” |
|
|
// 立即切换为“停止抽奖” |
|
|
console.log("lotteryState 变更前:", lotteryState.value, "-> rotating"); |
|
|
console.log("lotteryState 变更前:", lotteryState.value, "-> rotating"); |
|
|
lotteryState.value = "rotating"; |
|
|
lotteryState.value = "rotating"; |
|
|
console.log("lotteryState 变更后:", lotteryState.value); |
|
|
console.log("lotteryState 变更后:", lotteryState.value); |
|
|
// 开始转动 |
|
|
// 开始转动 |
|
|
// isRunning.value = false; // 无论如何都恢复 |
|
|
|
|
|
|
|
|
// isRunning.value = false; // 无论如何都恢复 |
|
|
|
|
|
|
|
|
await lottery3DRef.value?.rotateBallStart?.(); |
|
|
await lottery3DRef.value?.rotateBallStart?.(); |
|
|
break; |
|
|
break; |
|
@ -167,7 +168,7 @@ async function handleLotteryClick() { |
|
|
// result 状态下点击不做任何事,或者你可以加提示 |
|
|
// result 状态下点击不做任何事,或者你可以加提示 |
|
|
await lottery3DRef.value?.switchScreen?.("lottery"); |
|
|
await lottery3DRef.value?.switchScreen?.("lottery"); |
|
|
|
|
|
|
|
|
await new Promise(resolve => setTimeout(resolve, 2000)); |
|
|
|
|
|
|
|
|
await new Promise((resolve) => setTimeout(resolve, 2000)); |
|
|
|
|
|
|
|
|
// 去除高光 |
|
|
// 去除高光 |
|
|
lottery3DRef.value?.changeCard1?.(); |
|
|
lottery3DRef.value?.changeCard1?.(); |
|
@ -212,12 +213,13 @@ function handleNextPrize() { |
|
|
.choujiang-main { |
|
|
.choujiang-main { |
|
|
width: 100vw; |
|
|
width: 100vw; |
|
|
height: 100vh; |
|
|
height: 100vh; |
|
|
position: relative; |
|
|
|
|
|
|
|
|
position: fixed; |
|
|
|
|
|
top: 0; |
|
|
|
|
|
left: 0; |
|
|
overflow: hidden; |
|
|
overflow: hidden; |
|
|
/* 添加背景图片 */ |
|
|
/* 添加背景图片 */ |
|
|
background: url('../../assets/登录.png') ; |
|
|
|
|
|
|
|
|
background: url("../../assets/bg@2x.png"); |
|
|
background-size: 1920px 980px; |
|
|
background-size: 1920px 980px; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* 透明弹窗样式 */ |
|
|
/* 透明弹窗样式 */ |
|
|