update:新增比赛服链接

This commit is contained in:
2026-07-08 14:51:35 +08:00
parent 348d490de8
commit 01ac4f9c03
10 changed files with 3160 additions and 326 deletions
+26
View File
@@ -7,9 +7,13 @@
onHide
} from "@dcloudio/uni-app";
import websocket from "@/websocket";
import matchWebsocket from "@/matchWebsocket";
import {
getDeviceBatteryAPI
} from "@/apis";
import {
MESSAGETYPES
} from "@/constants";
import useStore from "@/store";
import {
storeToRefs
@@ -36,6 +40,9 @@
websocket.createWebSocket(token, onShootWsMsg);
}
if (!newVal) {
matchWebsocket.closeMatchWebSocket({
reason: "logout"
});
websocket.closeWebSocket();
}
}, {
@@ -73,10 +80,26 @@
// audioManager.play("射箭声音")
}
function connectMatchServerFromMessage(content) {
const messages = Array.isArray(content) ? content : [content];
messages.forEach((message) => {
if (
message?.constructor ===
MESSAGETYPES.ShootSyncBattleCreateMatchLinkID
) {
matchWebsocket.connectMatchWebSocketFromNotice(
message,
user.value.id
);
}
});
}
function onShootWsMsg(content) {
if(content.type === 'shoot-trigger'){
onDeviceShoot()
}
connectMatchServerFromMessage(content);
uni.$emit("socket-inbox", content);
}
@@ -99,6 +122,9 @@
uni.$off("update-online", emitUpdateOnline);
uni.$off("session-kicked-out", onSessionKickedOut);
uni.$off("device-bind-invalid", onDeviceBindInvalid);
matchWebsocket.closeMatchWebSocket({
reason: "app-hide"
});
websocket.closeWebSocket();
});
</script>