feat: 代客下单优惠券更新,挂账更新

This commit is contained in:
2025-03-06 11:27:01 +08:00
parent ed9a3335c8
commit dda4db24e0
22 changed files with 1219 additions and 300 deletions

View File

@@ -38,7 +38,7 @@ class WebSocketManager {
private reconnectAttempts = 0;
private maxReconnectAttempts = 3; // 自定义最大重试次数
private reconnectDelay = 5000; // 重试延迟(单位:毫秒)
private timer: any | null = null;
// 初始化 WebSocket 客户端
setupWebSocket() {
const endpoint = import.meta.env.VITE_APP_WS_ENDPOINT;
@@ -60,8 +60,13 @@ class WebSocketManager {
console.log("WebSocket 连接已建立");
// ElNotification.success('WebSocket 连接已建立')
this.sendMessage(this.initParams)
clearTimeout(this.timer)
this.timer = setInterval(() => {
this.sendMessage({ "type": "ping_interval" })
}, 1000 * 10);
};
this.client.onclose = () => {
clearTimeout(this.timer)
if (!this.connected) {
// ElMessageBox.alert('WebSocket 连接已断开', 'Title', {
// confirmButtonText: '立即重连',
@@ -74,6 +79,7 @@ class WebSocketManager {
console.log("WebSocket 连接已断开");
};
this.client.onerror = (error) => {
clearTimeout(this.timer)
console.error("WebSocket 发生错误:", error);
// ElNotification({
// title: "提示",