diff --git a/controller/notice.go b/controller/notice.go index b0c6780..79ec6aa 100644 --- a/controller/notice.go +++ b/controller/notice.go @@ -7,6 +7,7 @@ import ( "github.com/gorilla/websocket" "github.com/taoshihan1991/imaptool/models" "github.com/taoshihan1991/imaptool/tools" + "github.com/taoshihan1991/imaptool/ws" "log" "net/http" "time" @@ -27,6 +28,12 @@ func GetNotice(c *gin.Context) { } result = append(result, h) } + status := "online" + if kefus, ok := ws.KefuList[kefuId]; !ok { + if len(kefus) <= 0 { + status = "offline" + } + } c.JSON(200, gin.H{ "code": 200, "msg": "ok", @@ -34,6 +41,7 @@ func GetNotice(c *gin.Context) { "welcome": result, "username": user.Nickname, "avatar": user.Avator, + "status": status, }, }) } diff --git a/static/css/gofly-front.css b/static/css/gofly-front.css index f39e564..b2527e3 100644 --- a/static/css/gofly-front.css +++ b/static/css/gofly-front.css @@ -103,10 +103,13 @@ height: 30px; border-radius: 50%; display: inline-block; - border:1px solid #cccccc; + border:2px solid #fff; float: left; margin-right: 5px; } +.layui-layer-title .flyAvatar{ + margin-top: 5px; +} .launchButtonNotice .flyUsername{ font-weight: bold; float: left; @@ -130,6 +133,20 @@ #layui-layer1{ display: none; } +.launchPointer{ + background: #3cc51f; + width: 10px; + height: 10px; + display: inline-block; + border-radius: 50%; + position: absolute; + top: 25px; + left: 42px; + border:2px solid #fff; +} +.launchPointer.offline{ + background: #ce3c39; +} @-webkit-keyframes bounce-up { 25% {-webkit-transform: translateY(4px);} 50%, 100% {-webkit-transform: translateY(0);} diff --git a/static/js/gofly-front.js b/static/js/gofly-front.js index 4bc5330..272d446 100644 --- a/static/js/gofly-front.js +++ b/static/js/gofly-front.js @@ -119,7 +119,12 @@ GOFLY.clickBtn=function (){ GOFLY.getNotice=function(){ var _this=this; $.get(this.GOFLY_URL+"/notice?kefu_id="+this.GOFLY_KEFU_ID,function(res) { - _this.chatPageTitle=""+res.result.username; + if(res.result.status=='offline'){ + _this.chatPageTitle="
"; + }else{ + _this.chatPageTitle="
"; + } + _this.chatPageTitle+=""+res.result.username; if(_this.GOFLY_AUTO_OPEN){ _this.showKefu(); $(".launchButtonBox").show();