update:修复日志和防抖

This commit is contained in:
2026-07-09 14:35:48 +08:00
parent f8efe4c4a4
commit 12729a1cef
5 changed files with 106 additions and 31 deletions
+23 -1
View File
@@ -13,7 +13,11 @@ import TestDistance from "@/components/TestDistance.vue";
import SModal from "@/components/SModal.vue";
import audioManager from "@/audioManager";
import { getBattleAPI, laserCloseAPI } from "@/apis";
import { closeMatchWebSocket, connectMatchWebSocket } from "@/matchWebsocket";
import {
closeMatchWebSocket,
connectMatchWebSocket,
MATCH_WS_AUDIO_ACK_EVENT,
} from "@/matchWebsocket";
import { MESSAGETYPESV2 } from "@/constants";
import { takeMatchReturnSnapshot } from "@/utils/matchReturn";
import useStore from "@/store";
@@ -172,6 +176,23 @@ function closeBattleServer(reason) {
closeMatchWebSocket({ reason });
}
function notifyMatchAudioAck(message) {
if (
message?.sequence === undefined ||
message?.sequence === null ||
message?.sequence === ""
) {
return;
}
uni.$emit(MATCH_WS_AUDIO_ACK_EVENT, {
matchId: message.matchId || battleId.value,
sequence: message.sequence,
matchWsType: message.matchWsType,
matchWsTypeName: message.matchWsTypeName,
});
}
/**
* 监听设备在线状态,大乱斗比赛进行中设备离线时弹窗提示用户
*/
@@ -346,6 +367,7 @@ async function onReceiveMessage(msg) {
startHalfRestCountdown();
} else if (msg.type === MESSAGETYPESV2.BattleEnd) {
battleEnded = true;
notifyMatchAudioAck(msg);
setTimeout(() => {
// 全部跳转到新结算页
uni.redirectTo({