update 优化 !pr50 bug与代码实现

This commit is contained in:
疯狂的狮子Li 2023-11-02 13:53:44 +08:00
parent a8a334b3c3
commit f2372d3243
2 changed files with 6 additions and 6 deletions

View File

@ -115,18 +115,18 @@ export const sendMsg = (data: any) => {
// socket 接收数据
export const websocketonmessage = () => {
websocket.onmessage = function (e: any) {
const msg = JSON.parse(e.data) as any;
if (msg.type === 'heartbeat') {
if (e.data.indexOf('heartbeat') > 0) {
resetHeart();
}
if (msg.type === 'ping') {
if (e.data.indexOf('ping') > 0) {
return;
}
addNotice({
message: msg,
message: e.data,
read: false,
time: new Date().toLocaleString()
});
return msg;
ElMessage.success(e.data);
return e.data;
};
};