diff --git a/src/App.vue b/src/App.vue index 303e518..521d4dd 100644 --- a/src/App.vue +++ b/src/App.vue @@ -95,6 +95,9 @@ clearInterval(heartBeatTimer.value!) const waveTestData = ref("") // 显示设置窗口 const showSettings = ref(false) +// 显示游戏开始警告 +const showWarnWindow = ref(false) +const warnWindowCountdown = ref(5); // 连接状态 const gameState = ref(false) @@ -129,6 +132,19 @@ watch(selectedGift, (newGift) => { selectedWave.value = waveData[newGift] }) +watch(showWarnWindow, (newVal) => { + if (newVal) { + let timer = setInterval(() => { + warnWindowCountdown.value--; + if (warnWindowCountdown.value <= 0) { + clearInterval(timer); + } + }, 1000); + } else { + warnWindowCountdown.value = 5; // 重置倒计时 + } +}); + const fansMedal = computed({ get: () => settings.value.fansMedal, set: (value) => { settings.value.fansMedal = value === 'true' } @@ -188,6 +204,7 @@ const gameStart = () => { heartBeatThis(game_info.game_id) }, 20000) handleCreateSocket() + showLiveWarn() gameState.value = true } else { console.log("-----游戏开始失败-----") @@ -323,6 +340,17 @@ const acknowledgeSafetyNotice = () => { localStorage.setItem('showSafetyNotice', 'false') } +/** + * 显示直播警告 + */ +const showLiveWarn = () => { + showWarnWindow.value = true + // 五秒后关闭 + setTimeout(() => { + showWarnWindow.value = false + }, 5000) +} + /** * 将数字大航海等级转换为文字 */ @@ -356,7 +384,7 @@ const guardLevelText = computed(() => { -
+