|
|
@@ -246,6 +246,20 @@
|
|
|
<span>您对我们的服务评价为: {{comtCount}}。非常感谢!</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
+
|
|
|
+ <!-- 客服会话转接 -->
|
|
|
+ <div class="promptBox" v-if="changeKeFu">
|
|
|
+ <div class="prompt help">
|
|
|
+ <span>会话转接成功</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 客服会话超时 -->
|
|
|
+ <div class="promptBox" v-if="willOverTime">
|
|
|
+ <div class="prompt help">
|
|
|
+ <span>您好,未能收到您的回复,稍后将自动结束本次会话</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</el-row>
|
|
|
|
|
|
@@ -457,9 +471,10 @@
|
|
|
hourse: '', //返回时间,小时
|
|
|
closeByServer: false, //客服关闭会话
|
|
|
serverNotOnlin: false, //客服掉线
|
|
|
- willOverTime: '', //超时关闭会话
|
|
|
+ willOverTime: false, //超时关闭会话
|
|
|
allLoading: true, //整个页面加载中
|
|
|
webTime: '',//网络时间
|
|
|
+ changeKeFu:false, //客服转接
|
|
|
/*****************websockt心跳变量*******************/
|
|
|
reconnectData: null,
|
|
|
lockReconnect: false, //避免重复连接,因为onerror之后会立即触发 onclose
|
|
|
@@ -793,7 +808,7 @@
|
|
|
|
|
|
/*************连接建立失败重连***************** */
|
|
|
websocketonerror(e) {
|
|
|
- console.log('连接建立失败重连: ' + e.code + ' ' + e.reason + ' ', e)
|
|
|
+ console.log('连接建立失败重连:', e)
|
|
|
this.goBack(1);
|
|
|
},
|
|
|
|
|
|
@@ -804,8 +819,11 @@
|
|
|
redata = JSON.parse(e.data);
|
|
|
}
|
|
|
//心跳检测
|
|
|
- this.heatBeat()
|
|
|
- console.log(redata)
|
|
|
+ this.heatBeat();
|
|
|
+
|
|
|
+ if(redata.type != 'pong'){
|
|
|
+ console.log(redata)
|
|
|
+ }
|
|
|
// 欢迎语
|
|
|
if (redata.message_type == 'helloMessage') {
|
|
|
this.machine = redata.data;
|
|
|
@@ -938,9 +956,14 @@
|
|
|
this.closeByServer = true;
|
|
|
this.automaticRolling();
|
|
|
}
|
|
|
- // 超时.
|
|
|
+ // 客服转接
|
|
|
+ if(redata.message_type == 'changeKeFuSuccess'){
|
|
|
+ console.log('======转接成功========')
|
|
|
+ this.changeKeFu = true;
|
|
|
+ }
|
|
|
+ // 客服会话超时
|
|
|
if (redata.message_type == 'overtime') {
|
|
|
- this.willOverTime = redata.data.content;
|
|
|
+ this.willOverTime = true;
|
|
|
this.automaticRolling();
|
|
|
}
|
|
|
|
|
|
@@ -963,7 +986,6 @@
|
|
|
/***************************************/
|
|
|
//socket重连
|
|
|
reconnect() {
|
|
|
- console.log('=========重连==============')
|
|
|
if (this.lockReconnect) { //这里很关键,因为连接失败之后之后会相继触发 连接关闭,不然会连接上两个 WebSocket
|
|
|
return
|
|
|
}
|
|
|
@@ -982,7 +1004,7 @@
|
|
|
this.timeoutObj && clearTimeout(this.timeoutObj);
|
|
|
this.serverTimeoutObj && clearTimeout(this.serverTimeoutObj);
|
|
|
this.timeoutObj = setTimeout(() => {
|
|
|
- console.log('发送', {type: 'ping'});
|
|
|
+ // console.log('发送', {type: 'ping'});
|
|
|
this.websocketsend(JSON.stringify({type: 'ping'})) //根据后台要求发送
|
|
|
this.serverTimeoutObj = setTimeout(() => {
|
|
|
console.log('------close-------')
|
|
|
@@ -1016,6 +1038,8 @@
|
|
|
}
|
|
|
}))
|
|
|
} else if (this.machineAndAtl == 100) { //人工聊天
|
|
|
+ // 人工聊天超时隐藏
|
|
|
+ this.willOverTime = false;
|
|
|
//发送给客服消息-本地储存
|
|
|
this.customerSviceChat.push({
|
|
|
time: '',
|