增加访客端显示是否在线

pull/23/head
taoshihan1991 3 years ago
commit 085c90ccd4

@ -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,
},
})
}

@ -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);}

@ -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="<img style='margin-top: 5px;' src='"+_this.GOFLY_URL+res.result.avatar+"' class='flyAvatar'>"+res.result.username;
if(res.result.status=='offline'){
_this.chatPageTitle="<div class='launchPointer offline'></div>";
}else{
_this.chatPageTitle="<div class='launchPointer'></div>";
}
_this.chatPageTitle+="<img src='"+_this.GOFLY_URL+res.result.avatar+"' class='flyAvatar'>"+res.result.username;
if(_this.GOFLY_AUTO_OPEN){
_this.showKefu();
$(".launchButtonBox").show();

Loading…
Cancel
Save