Browse Source

仅剩获奖列表后端接口

songtongtong/feature-20250717104937-众筹
Ethereal 4 weeks ago
parent
commit
90c69d6e2e
  1. BIN
      src/assets/music.mp3
  2. 11
      src/views/choujiang/index.vue
  3. 32
      src/views/choujiang/lottery/MusicPlayer.vue
  4. 4
      src/views/choujiang/lottery/PrizePanel.vue

BIN
src/assets/music.mp3

11
src/views/choujiang/index.vue

@ -9,7 +9,7 @@
@reset="handleReset" @reset="handleReset"
@export="handleExport" @export="handleExport"
/> />
<MusicPlayer />
<MusicPlayer ref="musicPlayerRef" />
<Mascot /> <Mascot />
<!-- 透明弹窗 --> <!-- 透明弹窗 -->
@ -77,6 +77,7 @@ watch(isDisabled, (newVal, oldVal) => {
// //
const dataManager = useDataManager(); const dataManager = useDataManager();
let lottery3DRef = ref(null); let lottery3DRef = ref(null);
let musicPlayerRef = ref(null);
const lotteryEngine = useLotteryEngine(dataManager, { const lotteryEngine = useLotteryEngine(dataManager, {
resetCard: (...args) => lottery3DRef.value?.resetCard?.(...args), resetCard: (...args) => lottery3DRef.value?.resetCard?.(...args),
addHighlight: (...args) => lottery3DRef.value?.addHighlight?.(...args), addHighlight: (...args) => lottery3DRef.value?.addHighlight?.(...args),
@ -92,6 +93,14 @@ onMounted(async () => {
// dataManager window 使 // dataManager window 使
window.dataManager = dataManager; window.dataManager = dataManager;
//
setTimeout(() => {
if (musicPlayerRef.value && !musicPlayerRef.value.isPlaying()) {
//
musicPlayerRef.value.toggleMusic();
}
}, 1000);
}); });
function showLotteryQipao() { function showLotteryQipao() {

32
src/views/choujiang/lottery/MusicPlayer.vue

@ -6,8 +6,8 @@
</template> </template>
<script setup> <script setup>
import { ref } from 'vue';
const musicSrc = '/src/assets/lottery/music.mp3';
import { ref, onMounted } from 'vue';
const musicSrc = '/src/assets/music.mp3';
const audioRef = ref(null); const audioRef = ref(null);
const playing = ref(false); const playing = ref(false);
@ -21,10 +21,36 @@ function toggleMusic() {
playing.value = false; playing.value = false;
} }
} }
//
function isPlaying() {
return playing.value;
}
//
onMounted(() => {
//
setTimeout(() => {
if (audioRef.value) {
audioRef.value.play().then(() => {
playing.value = true;
}).catch((error) => {
console.log('自动播放失败,可能需要用户交互:', error);
});
}
}, 500);
});
//
defineExpose({
toggleMusic,
isPlaying
});
</script> </script>
<style scoped> <style scoped>
.music-box { .music-box {
position: absolute; position: absolute;
top: 24px; top: 24px;
right: 32px; right: 32px;
@ -42,7 +68,7 @@ function toggleMusic() {
} }
.music-icon.playing { .music-icon.playing {
animation: rotate 1.2s linear infinite; animation: rotate 1.2s linear infinite;
box-shadow: 0 0 12px #0078ff;
/* box-shadow: 0 0 12px #0078ff; */
} }
@keyframes rotate { @keyframes rotate {
100% { transform: rotate(360deg); } 100% { transform: rotate(360deg); }

4
src/views/choujiang/lottery/PrizePanel.vue

@ -505,7 +505,7 @@ function getProgressPercent(prize) {
} }
.winner-btn { .winner-btn {
background: rgba(255, 210, 131, 0.8); background: rgba(255, 210, 131, 0.8);
color: #fff;
color: #D5291F;
border: #fff; border: #fff;
border-radius: 8px; border-radius: 8px;
padding: 15px 79px; padding: 15px 79px;
@ -532,10 +532,12 @@ function getProgressPercent(prize) {
padding-top: 12px; padding-top: 12px;
padding-left: 25px; padding-left: 25px;
padding-right: 25px; padding-right: 25px;
padding-bottom: 10px;
min-width: 280px; min-width: 280px;
max-width: 90vw; max-width: 90vw;
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12); box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
position: relative; position: relative;
margin-left: 10px;
} }
.winner-modal-title { .winner-modal-title {
font-size: 22px; font-size: 22px;

Loading…
Cancel
Save