hy 7 lat temu
rodzic
commit
813e03e3d9

+ 0 - 1
frontend/saas-web/app/view/main/Main.js

@@ -145,7 +145,6 @@ Ext.define('saas.view.main.Main', {
                                 if(rolesMap&&rolesMap.length>0){
                                     for(var i = 0; i < rolesMap.length; i++) {
                                         if(rolesMap[i].type==0){
-                                             main.isAdmin = true;
                                              main.getController().loadInvitationMsg(1,nowCompanyId)
                                         }
                                      }

+ 35 - 15
frontend/saas-web/app/view/main/MainController.js

@@ -149,24 +149,44 @@ Ext.define('saas.view.main.MainController', {
                 }else{
                     hasInvitationMsg = false;
                 }
+                var s = me.items.items[0].down('[name=realname]')
+                if(hasInvitationMsg){
+                    s.getEl().dom.classList.add('x-header-redpoint')
+                }else{
+                    s.getEl().dom.classList.remove('x-header-redpoint')
+                }
+                if(count==1){
+                    //打开加入邀请窗口
+                    setTimeout(function() {
+                        me.getController().invitation();
+                    }, 300);
+                }
             },
             failure: function (response, opts) {}
         });
-        var s = me.items.items[0].down('[name=realname]')
-        if(hasInvitationMsg){
-            s.getEl().dom.classList.add('x-header-redpoint')
-        }else{
-            s.getEl().dom.classList.remove('x-header-redpoint')
-        }
-        if(count==1){
-            //打开加入邀请窗口
-            setTimeout(function() {
-                me.getController().invitation();
-            }, 300);
-        }
-        setTimeout(function() {
-            me.getController().loadInvitationMsg(count+1,nowCompanyId);
-        }, 8000);
+        //与后台建立连接
+        //me.getController().InvitationSocket();
+    },
+
+    InvitationSocket:function(){
+        //建立连接
+        var  wsServer = 'ws://10.1.80.23:8560/msg/invitation'; 
+        var  ws = new WebSocket(wsServer); 
+        ws.onopen = function () {
+        // 使用 send() 方法发送数据
+            ws.send("发送数据");
+            alert("数据发送中...");
+        };
+        // 接收服务端数据时触发事件
+        ws.onmessage = function (evt) {
+            var received_msg = evt.data;
+            alert("数据已接收...");
+        };
+        // 断开 web socket 连接成功触发事件
+            ws.onclose = function () {
+            alert("连接已关闭...");
+        };
+        
     },
 
     invitation:function(){