소스 검색

长链接注释

FengChaoYu 3 년 전
부모
커밋
8a67d9b6e4
1개의 변경된 파일19개의 추가작업 그리고 17개의 파일을 삭제
  1. 19 17
      src/layout/components/Navbar.vue

+ 19 - 17
src/layout/components/Navbar.vue

@@ -191,14 +191,15 @@ export default {
     const that = this;
     // 开定时器轮询未读消息接口(写在全局vuex里比较好)
     // that.initNotice();
-    // that.tcMessage();
+    that.tcMessage();
     this.intivalId = setInterval(function () {
       that.tcMessage();
     }, 5000);
     // this.timer = setInterval(function () {
     //   that.initNotice();
     // }, 3000);
-    this.initWebSocket();
+    // 长链接
+    // this.initWebSocket();
   },
   created() {
     this.userInfo = JSON.parse(localStorage.getItem("supply_user"));
@@ -246,22 +247,23 @@ export default {
       });
     },
     async tcMessage() {
-      let data = {
-        type: 'RebateOrderMsg',
-        params: {
-        }
-      }
-      this.websocketSend(JSON.stringify(data))
-      // let res = await getRebateOrderMsg();
-      // if (res.data.hasMessage) {
-      //   this.$notify.info({
-      //     title: "消息",
-      //     message: res.data.messages,
-      //     position: "bottom-right",
-      //     duration: 4000,
-      //     showClose: false,
-      //   });
+      // 长链接
+      // let data = {
+      //   type: 'RebateOrderMsg',
+      //   params: {
+      //   }
       // }
+      // this.websocketSend(JSON.stringify(data))
+      let res = await getRebateOrderMsg();
+      if (res.data.hasMessage) {
+        this.$notify.info({
+          title: "消息",
+          message: res.data.messages,
+          position: "bottom-right",
+          duration: 4000,
+          showClose: false,
+        });
+      }
     },
     goNotice() {
       this.$router.push("/notice/index");