diff --git a/static/js/chat-main.js b/static/js/chat-main.js index 419f398..28854eb 100644 --- a/static/js/chat-main.js +++ b/static/js/chat-main.js @@ -56,6 +56,12 @@ var app=new Vue({ ipBlacks:[], sendDisabled:false, showFaceIcon:false, + showLoadMore:false, + messages:{ + page:1, + pagesize:15, + list:[], + }, }, methods: { //跳转 @@ -185,7 +191,10 @@ var app=new Vue({ //获取当前访客信息 this.getVistorInfo(guestId); //获取当前客户消息 - this.getMesssagesByVisitorId(guestId); + this.messages.page=1; + this.msgList=[]; + this.getHistoryMessage(); + //this.getMesssagesByVisitorId(guestId); for(var i=0;i=_this.messages.pagesize){ + _this.showLoadMore=true; + }else{ + _this.showLoadMore=false; + } + for(let i in msgList){ + let item = msgList[i]; + //let content = {} + if (item["mes_type"] == "kefu") { + item.is_kefu = true; + item.avator=item["kefu_avator"]; + item.name=item["kefu_name"]; + } else { + item.is_kefu = false; + item.avator=item["visitor_avator"]; + item.name=item["visitor_name"]; + } + item.content=replaceContent(item["content"]); + item.time = item["create_time"]; + _this.msgList.unshift(item); + } + if(_this.messages.page==1){ + _this.scrollBottom(); + } + _this.messages.page++; + }); + }, //获取信息列表 getMesssagesByVisitorId(visitorId,isAll){ let _this=this; diff --git a/static/js/chat-page.js b/static/js/chat-page.js index 28f751c..4827807 100644 --- a/static/js/chat-page.js +++ b/static/js/chat-page.js @@ -246,6 +246,7 @@ new Vue({ item.avator=item["visitor_avator"]; } item.time = item["create_time"]; + item.content=replaceContent(item["content"]); _this.msgList.unshift(item); } if(_this.messages.page==1){ diff --git a/static/templates/chat_main.html b/static/templates/chat_main.html index b26d4d5..37217d2 100644 --- a/static/templates/chat_main.html +++ b/static/templates/chat_main.html @@ -92,6 +92,9 @@ 结束
+
+ 点击加载更多记录 +
<{v.time}>
@@ -123,9 +126,6 @@
- -
-