|
|
@@ -272,7 +272,7 @@
|
|
|
<!-- 人工客服回复消息 -->
|
|
|
<div v-for="item in customerSviceChat" :key="item.id">
|
|
|
<div class="conversationBox" v-if="item.type == 'service' ">
|
|
|
- <div class="timer" v-html="item.timer"></div>
|
|
|
+ <div class="timer" v-html="item.time"></div>
|
|
|
<div class="row">
|
|
|
<div class="conversation row">
|
|
|
<div class="headImg">
|
|
|
@@ -1250,29 +1250,29 @@
|
|
|
//返回的会话时间
|
|
|
if (redata.message_type == 'webTime') {
|
|
|
|
|
|
- // if(this.machineAndAtl == 100){
|
|
|
- // // this.customerSviceChat[this.customerTime].time = redata.data.webTime;
|
|
|
- // this.$set(this.customerSviceChat[this.customerTime], 'time' , redata.data.webTime);
|
|
|
- // console.log(this.customerSviceChat);
|
|
|
- //
|
|
|
- // }
|
|
|
//处理会话时间大于两分钟显示会话时间并且储存本次会话时间
|
|
|
if (this.machineAndAtl == 100) {
|
|
|
- console.log(redata.data.webTime)
|
|
|
-
|
|
|
- let num = this.customerSviceChat.length - 1;
|
|
|
+ let num = this.customerTime;
|
|
|
+ console.log(this.customerSviceChat[num]);
|
|
|
if (this.customerSviceChat[num].type == "user") {
|
|
|
if (this.webTime) {
|
|
|
- if (redata.data.webTime.split(":")[1] - this.webTime.split(":")[1] > 2) {
|
|
|
+ let newTime = redata.data.webTime.split(":");
|
|
|
+ let oldTime = this.webTime.split(":");
|
|
|
+ console.log(newTime[1] - oldTime[1] >= 2 , newTime[0]> oldTime[0])
|
|
|
+ // console.log(newTime[1] - oldTime[1] >= 2 , newTime[0]> oldTime[0])
|
|
|
+ if (newTime[1] - oldTime[1] >= 2 || newTime[0]> oldTime[0]) {
|
|
|
this.$set(this.customerSviceChat[num], 'time', redata.data.webTime);
|
|
|
this.webTime = redata.data.webTime;
|
|
|
+ }else{
|
|
|
+ this.$set(this.customerSviceChat[num], 'time', '');
|
|
|
}
|
|
|
} else {
|
|
|
- this.$set(this.customerSviceChat[num], 'time', '');
|
|
|
+ this.$set(this.customerSviceChat[num], 'time',redata.data.webTime);
|
|
|
}
|
|
|
} else {
|
|
|
this.$set(this.customerSviceChat[this.customerTime], 'time', redata.data.webTime);
|
|
|
}
|
|
|
+ //console.log(this.customerSviceChat)
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -1306,11 +1306,12 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- this.webTime = ''
|
|
|
+ // this.webTime = ''
|
|
|
this.artAndLeave = 10;
|
|
|
this.machineAndAtl = 100;
|
|
|
- // console.log(server, '============客服信息')
|
|
|
+ console.log(server, '============客服信息')
|
|
|
this.service = server;
|
|
|
+ // console.log();
|
|
|
this.serviceImg = server.serverInfo.avatar;
|
|
|
this.consult = false;
|
|
|
this.evlShow = false;
|
|
|
@@ -1335,32 +1336,34 @@
|
|
|
}
|
|
|
//接收客服会话
|
|
|
if (redata.message_type == 'chatMessage') {
|
|
|
+
|
|
|
// 接收提示音
|
|
|
this.receiveAudio();
|
|
|
- //存储会话超时间
|
|
|
- this.webTime = redata.data.time;
|
|
|
+
|
|
|
//会话大于两分钟显示
|
|
|
let timer = ''
|
|
|
- if (this.returnTimer == '') {
|
|
|
- timer = redata.data.time;
|
|
|
- this.returnTimer = redata.data.time
|
|
|
- } else {
|
|
|
- let timeStamp = this.returnTimer.split(":");
|
|
|
- let rdtime = redata.data.time.split(":");
|
|
|
- if (timeStamp[0] == rdtime[0]) {
|
|
|
- if ((rdtime[1] - timeStamp[1]) < 2) {
|
|
|
- timer = ''
|
|
|
- } else {
|
|
|
- timer = redata.data.time;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
let contType = this.isJSON(redata.data.content);
|
|
|
let content = {};
|
|
|
if (contType == false) {
|
|
|
- content.text = redata.data.content
|
|
|
+ content.text = redata.data.content;
|
|
|
+ timer = ''
|
|
|
} else {
|
|
|
content = JSON.parse(redata.data.content)
|
|
|
+
|
|
|
+ if (this.webTime == '') {
|
|
|
+ timer = redata.data.time;
|
|
|
+ this.webTime = redata.data.time;
|
|
|
+ } else {
|
|
|
+ let timeStamp = this.webTime.split(":");
|
|
|
+ let rdtime = redata.data.time.split(":");
|
|
|
+ if (timeStamp[0] < rdtime[0] || (timeStamp[0] == rdtime[0] && rdtime[1] -timeStamp[1] >=2)) {
|
|
|
+ timer = redata.data.time;
|
|
|
+ }else{
|
|
|
+ timer = ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //存储会话超时间
|
|
|
+ this.webTime = redata.data.time;
|
|
|
}
|
|
|
let obj = {
|
|
|
time: timer,
|
|
|
@@ -1466,15 +1469,18 @@
|
|
|
if (redata.message_type == 'toOld') {
|
|
|
let obj = redata;
|
|
|
this.historyMsgtext = obj.data.content;
|
|
|
-
|
|
|
obj.data.chatLog.forEach(res => {
|
|
|
let content = JSON.parse(res.content)
|
|
|
+ res.content = content;
|
|
|
if (content.text) {
|
|
|
content.text = this.turnFace(content.text)
|
|
|
res.content = content
|
|
|
}
|
|
|
this.hisSviceChat.push(res)
|
|
|
})
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
this.customerSviceChat.push({type: 'system', str: 'historyMsg'})
|
|
|
if (obj.data.chatLog.length >= 3) {
|
|
|
this.selNum = 3;
|
|
|
@@ -1583,9 +1589,9 @@
|
|
|
imgUrl: this.img,
|
|
|
type: 'user',
|
|
|
});
|
|
|
+ //储存本次发送下标
|
|
|
this.customerTime = this.customerSviceChat.length - 1;
|
|
|
- console.log(this.customerTime, "--------123123")
|
|
|
-
|
|
|
+
|
|
|
//消息发送-客服
|
|
|
this.websocketsend(JSON.stringify({
|
|
|
type: 'chatMessage',
|