优化加载更多

pull/23/head
taoshihan1991 4 years ago
parent db909c6e11
commit c52d50a191

@ -27,16 +27,7 @@
:closable="false" :closable="false"
type="success"> type="success">
</el-alert> </el-alert>
<el-alert <div class="el-alert el-alert--info is-center is-light el-alert__title" v-show="msgListNum>10" v-on:click="getMesssagesByVisitorId(true)"><i class="el-icon-info" ></i>&nbsp;<{flyLang['moremessage']}></div>
style="margin:10px auto;width: 100%;"
center
:title="flyLang['moremessage']"
close-text="more"
@close="getMesssagesByVisitorId(true)"
v-show="msgList.length>10"
show-icon
type="info">
</el-alert>
<el-row :gutter="2" v-for="v in msgList" v-bind:class="{'chatBoxMe': v.is_kefu==true}"> <el-row :gutter="2" v-for="v in msgList" v-bind:class="{'chatBoxMe': v.is_kefu==true}">
<div class="chatTime" v-bind:class="{'chatTimeHide': v.show_time==false}"><{v.time}></div> <div class="chatTime" v-bind:class="{'chatTimeHide': v.show_time==false}"><{v.time}></div>
<el-col :span="3"><el-avatar shape="square" :size="36" :src="v.avator"></el-avatar></el-col> <el-col :span="3"><el-avatar shape="square" :size="36" :src="v.avator"></el-avatar></el-col>

@ -5,7 +5,7 @@ var GOFLY_LANG={
"connectok":"连接成功!", "connectok":"连接成功!",
"chating":"正在与您沟通!", "chating":"正在与您沟通!",
"historymes":"—— 以上是历史消息 ——", "historymes":"—— 以上是历史消息 ——",
"moremessage":"点击more加载更多记录", "moremessage":" 点击加载更多记录",
"copyright":"GO-FLY1.0.0客服陶士涵提供技术支持", "copyright":"GO-FLY1.0.0客服陶士涵提供技术支持",
"textarea":"请输入内容", "textarea":"请输入内容",
"closemes":"系统自动关闭连接!点击会重连", "closemes":"系统自动关闭连接!点击会重连",
@ -17,7 +17,7 @@ var GOFLY_LANG={
"connectok":"connection succeeded!", "connectok":"connection succeeded!",
"chating":"chating with you!", "chating":"chating with you!",
"historymes":"—— Today ——", "historymes":"—— Today ——",
"moremessage":"click buuton show more messages", "moremessage":" click buuton show more messages",
"copyright":"We run on GOFLY", "copyright":"We run on GOFLY",
"textarea":"Enter your message", "textarea":"Enter your message",
"closemes":"The system automatically closes the connection!", "closemes":"The system automatically closes the connection!",

@ -7,6 +7,7 @@ new Vue({
server:getWsBaseUrl()+"/ws_visitor", server:getWsBaseUrl()+"/ws_visitor",
socket:null, socket:null,
msgList:[], msgList:[],
msgListNum:[],
messageContent:"", messageContent:"",
chatTitle:GOFLY_LANG[LANG]['connecting'], chatTitle:GOFLY_LANG[LANG]['connecting'],
visitor:{}, visitor:{},
@ -211,11 +212,13 @@ new Vue({
url:"/messages?visitorId="+this.visitor.visitor_id, url:"/messages?visitorId="+this.visitor.visitor_id,
success: function(data) { success: function(data) {
if(data.code==200 && data.result!=null&&data.result.length!=0){ if(data.code==200 && data.result!=null&&data.result.length!=0){
_this.msgListNum=data.result.length;
let msgList=data.result; let msgList=data.result;
_this.msgList=[]; _this.msgList=[];
if(!isAll&&msgList.length>10){ if(!isAll&&msgList.length>10){
var i=msgList.length-10 var i=msgList.length-10
}else{ }else{
_this.msgListNum=0;
var i=0; var i=0;
} }
for(;i<msgList.length;i++){ for(;i<msgList.length;i++){

Loading…
Cancel
Save