修改展示自动回复部分js

pull/23/head
陶士涵 4 years ago
parent 2b32997184
commit 819c52e6d5

@ -76,5 +76,5 @@
var KEFU_ID='{{.KEFU_ID}}'; var KEFU_ID='{{.KEFU_ID}}';
var REFER='{{.Refer}}'; var REFER='{{.Refer}}';
</script> </script>
<script src="/static/js/chat-page.js?v=0.3.1"></script> <script src="/static/js/chat-page.js?v=0.3.2"></script>
</html> </html>

@ -14,6 +14,7 @@ new Vue({
face:[], face:[],
showKfonline:false, showKfonline:false,
socketClosed:false, socketClosed:false,
timer:null,
}, },
methods: { methods: {
//初始化websocket //初始化websocket
@ -126,6 +127,7 @@ new Vue({
//_this.saveHistory(content); //_this.saveHistory(content);
_this.scrollBottom(); _this.scrollBottom();
_this.messageContent = ""; _this.messageContent = "";
clearInterval(_this.timer);
}); });
}, },
@ -231,14 +233,21 @@ new Vue({
//debugger; //debugger;
if (res.result != null) { if (res.result != null) {
let msg = res.result; let msg = res.result;
for(let i=0;i<msg.length;i++){ var len=msg.length;
let content = msg[i]; var i=0;
content.content = replaceContent(content.content); if(len>0){
setTimeout(function () { _this.timer=setInterval(function(){
if(i>=len){
clearInterval(_this.timer);
}
let content = msg[i];
content.content = replaceContent(content.content);
_this.msgList.push(content); _this.msgList.push(content);
_this.scrollBottom(); _this.scrollBottom();
}, 5000*(i+1)); i++;
},3000);
} }
} }
}); });
}, },

Loading…
Cancel
Save