cz 1 anno fa
parent
commit
22e412ac0d
1 ha cambiato i file con 4 aggiunte e 6 eliminazioni
  1. 4 6
      src/components/notice/index.vue

+ 4 - 6
src/components/notice/index.vue

@@ -204,7 +204,6 @@ const readFn = (item) => {
 };
 const commonRead = (ids, type) => {
   proxy.post("/pushInfo/read", { idList: ids }).then((res) => {
-    console.log(res);
     ElMessage({
       message: "已读成功",
       type: "success",
@@ -226,7 +225,6 @@ const confirm = () => {
 // }).then(res=>{
 // 	data.value = res.rows
 // })
-
 const socketInit = () => {
   window.ws = new WebSocket(
     "ws://" +
@@ -245,8 +243,6 @@ const socketInit = () => {
     //当客户端收到服务端发来的消息时,触发onmessage事件,参数e.data包含server传递过来的数据
     //在data.value前面插入
     const res = JSON.parse(e.data);
-    console.log(res);
-
     if (res.type == 1) {
       index.value = 0;
       data.value = res.list;
@@ -312,10 +308,12 @@ const getPushInfo = () => {
         .then((res) => {
           emit("changeNum", res.total * 1);
         });
-    }, 500);
+    }, 1100);
   });
 };
-socketInit();
+onMounted(() => {
+  socketInit();
+});
 const handleClose = () => {
   value.value = false;
 };