feat:sfg
This commit is contained in:
@@ -100,12 +100,28 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { ref, onUnmounted } from "vue";
|
||||
import { getBavBarHeight } from "@/utils/system";
|
||||
|
||||
const status = ref("initial"); // initial, shaking, result
|
||||
const remainingCount = ref(1);
|
||||
|
||||
// 音效控制
|
||||
const audioContext = uni.createInnerAudioContext();
|
||||
audioContext.src = "/static/music/shake.mp3";
|
||||
let playCount = 0;
|
||||
|
||||
audioContext.onEnded(() => {
|
||||
playCount++;
|
||||
if (playCount < 3) {
|
||||
audioContext.play();
|
||||
}
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
audioContext.destroy();
|
||||
});
|
||||
|
||||
const fortunes = [
|
||||
{ title: "好运连连", desc: "2026年你将万事如意,惊喜不断。", icon: "☀" },
|
||||
{ title: "财源滚滚", desc: "正财偏财滚滚来,荷包满满乐开怀。", icon: "💰" },
|
||||
@@ -132,6 +148,10 @@ const startShake = () => {
|
||||
|
||||
status.value = "shaking";
|
||||
|
||||
// 播放音效
|
||||
playCount = 0;
|
||||
audioContext.play();
|
||||
|
||||
// 模拟摇晃动画和数据请求
|
||||
setTimeout(() => {
|
||||
const idx = Math.floor(Math.random() * fortunes.length);
|
||||
|
||||
Reference in New Issue
Block a user