调试重新进入比赛
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { MESSAGETYPES } from "@/constants";
|
||||
let socket = null;
|
||||
let heartbeatInterval = null;
|
||||
let reconnectCount = 0;
|
||||
@@ -32,6 +33,29 @@ function createWebSocket(token, onMessage) {
|
||||
uni.onSocketMessage((res) => {
|
||||
const data = JSON.parse(res.data);
|
||||
if (onMessage) onMessage(data.data.updates);
|
||||
const msg = data.data.updates[0];
|
||||
if (msg && msg.constructor === MESSAGETYPES.BackToGame) {
|
||||
const { battleInfo } = msg;
|
||||
uni.setStorageSync(`battle-${battleInfo.id}`, battleInfo);
|
||||
// 约战
|
||||
if (battleInfo.config.battleMode === 1) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/team-match?battleId=${battleInfo.id}`,
|
||||
});
|
||||
}
|
||||
// 排位
|
||||
if (battleInfo.config.battleMode === 2) {
|
||||
if (battleInfo.config.mode === 1) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/team-match?battleId=${battleInfo.id}`,
|
||||
});
|
||||
} else if (battleInfo.config.mode === 2) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/melee-match?battleId=${battleInfo.id}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 错误处理
|
||||
|
||||
Reference in New Issue
Block a user