tapd相关修改更新

This commit is contained in:
GaoHao
2025-03-19 18:19:34 +08:00
parent 994cf8bf2b
commit f01bc839f7
53 changed files with 1084 additions and 1032 deletions

View File

@@ -32,6 +32,7 @@ class WebsocketUtil {
},
fail: (error) => {
console.error('WebSocket连接失败', error);
uni.$emit('is-socket-open', true)
this.reconnect();
}
});
@@ -42,10 +43,12 @@ class WebsocketUtil {
// 连接成功后启动心跳和消息监听
this.startHeartbeat();
this.listenForMessages();
uni.$emit('is-socket-open', true)
});
this.socketTask.onError((res) => {
console.log('WebSocket连接失败==',res);
uni.$emit('is-socket-open', false)
this.reconnect();
});
// 注意:这里的 onClose 监听器应该放在 uni.connectSocket 调用之后
@@ -93,7 +96,7 @@ class WebsocketUtil {
const { data } = res;
this.messageCallbacks.forEach(callback => callback(data.toString())); // 假设 data 是字符串或可转换为字符串
});
this.send("WebSocket连接正常");
// this.send("WebSocket连接正常");
} else {
console.error('WebSocket 连接尚未建立,无法监听消息');
}