更改首页

This commit is contained in:
魏啾
2024-07-05 18:26:46 +08:00
parent a40cfd9c5f
commit 380a6312f8
19 changed files with 3841 additions and 1179 deletions

View File

@@ -63,33 +63,37 @@ class webSocketUtils {
this.canReconnect = true;
clearInterval(this.heartbeatInterval);
clearInterval(this.reconnectTimeOut);
if (this.connectNum <= 10) {
// uni.showLoading({
// title: `网络连接失败,正尝试第${this.connectNum}次连接`,
// mask: true
// })
uni.$emit('message', 1) //进行重连
uni.showToast({
title: `网络连接失败,正尝试第${this.connectNum}次连接`,
icon: 'none',
});
this.reconnect();
this.connectNum += 1;
} else {
// uni.$emit('connectError');
uni.showToast({
title: `网络连接失败,请检查网络!`,
icon: 'none',
});
this.connectNum = 1;
this.canReconnect = false;
this.Close()
setTimeout(res => {
uni.switchTab({
url: '/pages/index/index'
})
uni.hideLoading()
}, 1000)
try {
if (this.connectNum <= 10) {
// uni.showLoading({
// title: `网络连接失败,正尝试第${this.connectNum}次连接`,
// mask: true
// })
uni.$emit('message', 1) //进行重连
uni.showToast({
title: `网络连接失败,正尝试第${this.connectNum}次连接`,
icon: 'none',
});
this.reconnect();
this.connectNum += 1;
} else {
// uni.$emit('connectError');
uni.showToast({
title: `网络连接失败,请检查网络!`,
icon: 'none',
});
this.connectNum = 1;
this.canReconnect = false;
this.Close()
setTimeout(res => {
uni.switchTab({
url: '/pages/index/index'
})
uni.hideLoading()
}, 1000)
}
} catch (e) {
//TODO handle the exception
}
});
// 这里仅是事件监听【如果socket关闭了会执行】