|
@ -1,6 +1,6 @@ |
|
|
<script setup> |
|
|
<script setup> |
|
|
|
|
|
|
|
|
import { ref, onBeforeMount,onMounted } from 'vue' |
|
|
|
|
|
|
|
|
import { ref, onBeforeMount, onMounted } from 'vue' |
|
|
import jiantou from '../assets/img/jiantou.png' |
|
|
import jiantou from '../assets/img/jiantou.png' |
|
|
|
|
|
|
|
|
const showPopup = ref(false); |
|
|
const showPopup = ref(false); |
|
@ -89,9 +89,9 @@ function endCallback(prize) { |
|
|
const result = prize.fonts[0].text |
|
|
const result = prize.fonts[0].text |
|
|
console.log(prize.fonts[0].text) |
|
|
console.log(prize.fonts[0].text) |
|
|
// 更新总分 |
|
|
// 更新总分 |
|
|
setTimeout(()=>{ |
|
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
totalScore.value = totalScore.value + result |
|
|
totalScore.value = totalScore.value + result |
|
|
},1000); |
|
|
|
|
|
|
|
|
}, 1000); |
|
|
|
|
|
|
|
|
// 触发动画 |
|
|
// 触发动画 |
|
|
animateScoreChange() |
|
|
animateScoreChange() |
|
@ -100,7 +100,7 @@ function endCallback(prize) { |
|
|
showPopup.value = true; |
|
|
showPopup.value = true; |
|
|
// 设置弹窗内容 |
|
|
// 设置弹窗内容 |
|
|
setTimeout(() => { |
|
|
setTimeout(() => { |
|
|
popupMessage.value= `${result}`; |
|
|
|
|
|
|
|
|
popupMessage.value = `${result}`; |
|
|
}, 1000); // <--- 正确的用法 |
|
|
}, 1000); // <--- 正确的用法 |
|
|
|
|
|
|
|
|
showPopup.value = true; |
|
|
showPopup.value = true; |
|
@ -118,38 +118,33 @@ const animateScoreChange = () => { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
onMounted(() => { |
|
|
console.log(import.meta.env.MODE,'1111') |
|
|
|
|
|
console.log(process.env.NODE_ENV,'2222') |
|
|
|
|
|
|
|
|
console.log(import.meta.env.MODE, '1111') |
|
|
|
|
|
console.log(process.env.NODE_ENV, '2222') |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<template> |
|
|
<template> |
|
|
<div class="full-background"> |
|
|
<div class="full-background"> |
|
|
<!-- <img :src="jiantou" alt="111"> --> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 把底图和转盘放入一个容器中,统一定位 --> |
|
|
|
|
|
<div class="lucky-wrapper"> |
|
|
|
|
|
<div class="wheel-base"> |
|
|
<div class="luckyWheel"> |
|
|
<div class="luckyWheel"> |
|
|
<LuckyWheel class="lucky" ref="myLucky" width="434px" height="434px" :default-config="wheelConfig" |
|
|
|
|
|
|
|
|
<LuckyWheel class="lucky" ref="myLucky" width="470" height="470" :default-config="wheelConfig" |
|
|
:prizes="prizes" :blocks="blocks" :buttons="buttons" @start="startCallback" @end="endCallback" /> |
|
|
:prizes="prizes" :blocks="blocks" :buttons="buttons" @start="startCallback" @end="endCallback" /> |
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="full-background"> |
|
|
|
|
|
<!-- 其他原有代码不变 --> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="wheel-base"> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 弹窗得分效果 --> |
|
|
<transition name="popup-fade"> |
|
|
<transition name="popup-fade"> |
|
|
<div v-if="showPopup" class="score-popup" :class="{ 'boom-effect': showPopup }"> |
|
|
<div v-if="showPopup" class="score-popup" :class="{ 'boom-effect': showPopup }"> |
|
|
<!-- <div class="score-popup" :class="{ 'boom-effect': showPopup }"> --> |
|
|
|
|
|
<div class="ziti"> |
|
|
<div class="ziti"> |
|
|
|
|
|
|
|
|
{{ popupMessage }} |
|
|
{{ popupMessage }} |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
</transition> |
|
|
</transition> |
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
@ -252,15 +247,12 @@ onMounted(() => { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.full-background { |
|
|
.full-background { |
|
|
background-image: url('/public/bg.png'); |
|
|
|
|
|
background-size: cover; |
|
|
|
|
|
|
|
|
background-image: url('/public/bg.jpg'); |
|
|
|
|
|
background-size: 100% 100%; |
|
|
background-repeat: no-repeat; |
|
|
background-repeat: no-repeat; |
|
|
background-position: center; |
|
|
background-position: center; |
|
|
width: 100vw; |
|
|
width: 100vw; |
|
|
height: 100vh; |
|
|
height: 100vh; |
|
|
position: fixed; |
|
|
|
|
|
top: 0; |
|
|
|
|
|
left: 0; |
|
|
|
|
|
z-index: 0; |
|
|
z-index: 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -273,24 +265,37 @@ onMounted(() => { |
|
|
z-index: 999; |
|
|
z-index: 999; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.luckyWheel { |
|
|
|
|
|
|
|
|
.lucky-wrapper { |
|
|
position: fixed; |
|
|
position: fixed; |
|
|
z-index: 999; |
|
|
|
|
|
left: 610px; |
|
|
|
|
|
top: 300px; |
|
|
top: 300px; |
|
|
pointer-events: auto; |
|
|
|
|
|
|
|
|
left: 610px; |
|
|
|
|
|
width: 568px; |
|
|
|
|
|
height: 600px; |
|
|
|
|
|
z-index: 999; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* 转盘底的样式 */ |
|
|
|
|
|
|
|
|
/* 背景底图 */ |
|
|
.wheel-base { |
|
|
.wheel-base { |
|
|
background-image: url('/public/wheel-base1.png'); |
|
|
|
|
|
position: fixed; |
|
|
|
|
|
left: 28%; |
|
|
|
|
|
top: 160px; |
|
|
|
|
|
width: 568px; |
|
|
|
|
|
height: 600px; |
|
|
|
|
|
z-index: 990; |
|
|
|
|
|
|
|
|
position: relative; |
|
|
|
|
|
width: 116%; |
|
|
|
|
|
height: 128%; |
|
|
|
|
|
background-image: url(/public/wheel-base1.png); |
|
|
|
|
|
background-size: 100% 100%; |
|
|
|
|
|
background-repeat: no-repeat; |
|
|
|
|
|
top: -11%; |
|
|
|
|
|
left: -12%; |
|
|
|
|
|
z-index: 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* 转盘组件 */ |
|
|
|
|
|
.luckyWheel { |
|
|
|
|
|
position: absolute; |
|
|
|
|
|
top: 83px; |
|
|
|
|
|
/* 微调转盘位置以对齐底图中心 */ |
|
|
|
|
|
left: 67px; |
|
|
|
|
|
width: 434px; |
|
|
|
|
|
height: 434px; |
|
|
|
|
|
z-index: 2; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -298,7 +303,8 @@ onMounted(() => { |
|
|
.luckyWheel .lucky { |
|
|
.luckyWheel .lucky { |
|
|
aspect-ratio: 1/1; |
|
|
aspect-ratio: 1/1; |
|
|
color: aqua; |
|
|
color: aqua; |
|
|
margin-top: -10%; |
|
|
|
|
|
|
|
|
margin-top: 6%; |
|
|
|
|
|
margin-left: 4%; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
h1 { |
|
|
h1 { |
|
|