|
|
@@ -23,9 +23,11 @@
|
|
|
<el-button v-if="machineAndAtl == 100" size="mini" type="primary" @click="exit"
|
|
|
style="margin-right: 10px;">退出聊天
|
|
|
</el-button>
|
|
|
- <i v-if="(selNum + tokNum) + hisLength > chatNum && !showject" @click="ejectEvl(10)" class="sc pointer"
|
|
|
+ <i v-if="(selNum + tokNum) + hisLength > chatNum && !showject" @click="ejectEvl(10)"
|
|
|
+ class="sc pointer"
|
|
|
:class="selType?'scActy':''"></i>
|
|
|
- <i v-if="showject && machineAndAtl == 100" class="sc pointer" :class="selType?'scActy':''" @click="tips"></i>
|
|
|
+ <i v-if="showject && machineAndAtl == 100" class="sc pointer" :class="selType?'scActy':''"
|
|
|
+ @click="tips"></i>
|
|
|
|
|
|
<div v-if="showleaveIcon" style="float: right" class="pointer" @click="leaveMsg()">
|
|
|
<span style="font-size: 25px; color: #b3c1e7; vertical-align: middle;" @click="back()"
|
|
|
@@ -660,8 +662,8 @@
|
|
|
jumps: false,
|
|
|
customerTime: "",
|
|
|
helloNum: true, // 欢迎语限制
|
|
|
- hisLength:0, // 历史数量
|
|
|
- showject:false,
|
|
|
+ hisLength: 0, // 历史数量
|
|
|
+ showject: false,
|
|
|
}
|
|
|
},
|
|
|
filters: {
|
|
|
@@ -834,7 +836,7 @@
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- tips(){
|
|
|
+ tips() {
|
|
|
this.$message.error('亲,您已经评价了...');
|
|
|
},
|
|
|
// 退出聊天
|
|
|
@@ -1029,8 +1031,8 @@
|
|
|
this.returnTimer = '';
|
|
|
this.service_on = true;
|
|
|
this.historyMsg = false,
|
|
|
- // this.automaticRolling();
|
|
|
- this.customerSviceChat = [];
|
|
|
+ // this.automaticRolling();
|
|
|
+ this.customerSviceChat = [];
|
|
|
this.reconnect();
|
|
|
this.selNum = 0;
|
|
|
this.tokNum = 0;
|
|
|
@@ -1247,7 +1249,7 @@
|
|
|
}
|
|
|
// 欢迎语
|
|
|
if (redata.message_type == 'helloMessage') {
|
|
|
- if(this.helloNum){
|
|
|
+ if (this.helloNum) {
|
|
|
this.machine.push(redata.data.content);
|
|
|
}
|
|
|
}
|
|
|
@@ -1266,25 +1268,23 @@
|
|
|
//处理会话时间大于两分钟显示会话时间并且储存本次会话时间
|
|
|
if (this.machineAndAtl == 100) {
|
|
|
let num = this.customerTime;
|
|
|
- // console.log(this.customerSviceChat[num]);
|
|
|
if (this.customerSviceChat[num].type == "user") {
|
|
|
if (this.webTime) {
|
|
|
- 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]) {
|
|
|
+ let newTime = redata.data.webTime.split(":");
|
|
|
+ let oldTime = this.webTime.split(":");
|
|
|
+ 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{
|
|
|
+ } else {
|
|
|
this.$set(this.customerSviceChat[num], 'time', '');
|
|
|
}
|
|
|
} else {
|
|
|
- this.$set(this.customerSviceChat[num], 'time',redata.data.webTime);
|
|
|
+ this.$set(this.customerSviceChat[num], 'time', redata.data.webTime);
|
|
|
}
|
|
|
} else {
|
|
|
this.$set(this.customerSviceChat[this.customerTime], 'time', redata.data.webTime);
|
|
|
}
|
|
|
+ this.webTime = redata.data.webTime
|
|
|
//console.log(this.customerSviceChat)
|
|
|
}
|
|
|
|
|
|
@@ -1295,9 +1295,9 @@
|
|
|
}
|
|
|
// 链接客服信息
|
|
|
if (redata.message_type == 'connect') {
|
|
|
- if(redata.data.evaluate_id > 0) {
|
|
|
+ if (redata.data.evaluate_id > 0) {
|
|
|
this.showject = true;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
this.showject = false;
|
|
|
}
|
|
|
const loading = this.$loading({
|
|
|
@@ -1372,12 +1372,13 @@
|
|
|
// console.log("暂无客服")
|
|
|
// this.chatCont.push({type:"tips",str:"artAndLeave100"})
|
|
|
}
|
|
|
+
|
|
|
//接收客服会话
|
|
|
if (redata.message_type == 'chatMessage') {
|
|
|
-
|
|
|
+
|
|
|
// 接收提示音
|
|
|
this.receiveAudio();
|
|
|
-
|
|
|
+
|
|
|
//会话大于两分钟显示
|
|
|
let timer = ''
|
|
|
let contType = this.isJSON(redata.data.content);
|
|
|
@@ -1394,9 +1395,9 @@
|
|
|
} 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)) {
|
|
|
+ if (timeStamp[0] < rdtime[0] || (timeStamp[0] == rdtime[0] && rdtime[1] - timeStamp[1] >= 2)) {
|
|
|
timer = redata.data.time;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
timer = ''
|
|
|
}
|
|
|
}
|
|
|
@@ -1451,7 +1452,7 @@
|
|
|
// console.log(redata.content);
|
|
|
this.Onlinemsg = redata.content;
|
|
|
|
|
|
- this.$alert(this.jumpName + this.Onlinemsg,'系统提示', {
|
|
|
+ this.$alert(this.jumpName + this.Onlinemsg, '系统提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
dangerouslyUseHTMLString: true
|
|
|
});
|
|
|
@@ -1525,9 +1526,8 @@
|
|
|
})
|
|
|
|
|
|
|
|
|
-
|
|
|
this.customerSviceChat.push({type: 'system', str: 'historyMsg'})
|
|
|
- this.hisLength =obj.data.chatLog.length
|
|
|
+ this.hisLength = obj.data.chatLog.length
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -1636,7 +1636,7 @@
|
|
|
});
|
|
|
//储存本次发送下标
|
|
|
this.customerTime = this.customerSviceChat.length - 1;
|
|
|
-
|
|
|
+
|
|
|
//消息发送-客服
|
|
|
this.websocketsend(JSON.stringify({
|
|
|
type: 'chatMessage',
|