cz 1 an în urmă
părinte
comite
f637009191
1 a modificat fișierele cu 10 adăugiri și 4 ștergeri
  1. 10 4
      src/views/main.vue

+ 10 - 4
src/views/main.vue

@@ -84,6 +84,9 @@ const socketInit = () => {
   window.ws.onopen = function () {
     //当WebSocket创建成功时,触发onopen事件
     console.log("open");
+    setInterval(() => {
+      window.ws.send('{"getTaskCount":1}');
+    }, 30000);
   };
   window.ws.onmessage = function (e) {
     //当客户端收到服务端发来的消息时,触发onmessage事件,参数e.data包含server传递过来的数据
@@ -119,12 +122,15 @@ const socketInit = () => {
           pushRead: 0,
         })
         .then((res) => {
-          if (res.data.rows && res.data.rows.length > 0) {
-            let list = res.data.rows.filter((x) => x.businessType == 10);
-            msgCountOne.value = list.length;
-          }
+          // if (res.data.rows && res.data.rows.length > 0) {
+          //   let list = res.data.rows.filter((x) => x.businessType == 10);
+          //   msgCountOne.value = list.length;
+          // }
         });
     }
+    if (res && res.taskCount) {
+      msgCountOne.value = res.taskCount;
+    }
     if (res.type == 3) {
       // ElNotification({
       // 	title: '提示',