From 80362c5f67d2c6a372719a121a2d2d2e8d790d94 Mon Sep 17 00:00:00 2001 From: taoshihan <630892807@qq.com> Date: Wed, 12 Apr 2023 14:24:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=9C=8D=E7=AB=AF=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E8=AE=B0=E5=BD=95=E4=B9=9F=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/chat-main.js | 47 ++++++++++++++++++++++++++++++++- static/js/chat-page.js | 1 + static/templates/chat_main.html | 6 ++--- 3 files changed, 50 insertions(+), 4 deletions(-) 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 @@
- -
-