|
@@ -106,7 +106,7 @@ export default {
|
|
lastOutTimer: null,
|
|
lastOutTimer: null,
|
|
lastEndTimer: null,
|
|
lastEndTimer: null,
|
|
setIntervalTimer: null, // 定时查询聊天记录
|
|
setIntervalTimer: null, // 定时查询聊天记录
|
|
- isShowNps: true // 是否显示评价按钮
|
|
|
|
|
|
+ isShowNps: 0 // 0:机器人,1排队中,2会话中
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -288,6 +288,7 @@ export default {
|
|
console.log('websocket接收的消息:' + JSON.stringify(data))
|
|
console.log('websocket接收的消息:' + JSON.stringify(data))
|
|
if (data.type === 6) {
|
|
if (data.type === 6) {
|
|
const { rUserId, nickName, sessionId } = data.data
|
|
const { rUserId, nickName, sessionId } = data.data
|
|
|
|
+ this.isShowNps = 2
|
|
// 客服端认领后回复建立会话的消息 返回客服昵称、userId(entId)、sessionId
|
|
// 客服端认领后回复建立会话的消息 返回客服昵称、userId(entId)、sessionId
|
|
if (this.other.userId === rUserId) {
|
|
if (this.other.userId === rUserId) {
|
|
this.other.isRobot = false
|
|
this.other.isRobot = false
|
|
@@ -418,6 +419,7 @@ export default {
|
|
} else if (data.type === 10) {
|
|
} else if (data.type === 10) {
|
|
// 收到系统消息-关闭会话
|
|
// 收到系统消息-关闭会话
|
|
// 系统关闭会话消息由服务端保存 前端只更新列表
|
|
// 系统关闭会话消息由服务端保存 前端只更新列表
|
|
|
|
+ this.isShowNps = 0
|
|
const { rUserId, content, id } = data.data
|
|
const { rUserId, content, id } = data.data
|
|
const params = {
|
|
const params = {
|
|
messageId: id,
|
|
messageId: id,
|
|
@@ -453,7 +455,7 @@ export default {
|
|
this.$refs?.userSide.setScrollTop()
|
|
this.$refs?.userSide.setScrollTop()
|
|
})
|
|
})
|
|
this.getUserListFn()
|
|
this.getUserListFn()
|
|
- this.isShowNps = false
|
|
|
|
|
|
+ this.isShowNps = 0
|
|
this.other.isRobot = true
|
|
this.other.isRobot = true
|
|
} else if (data.type === 11) {
|
|
} else if (data.type === 11) {
|
|
// 获取用户聊天状态 type 1:排队中 2:会话中
|
|
// 获取用户聊天状态 type 1:排队中 2:会话中
|
|
@@ -463,19 +465,19 @@ export default {
|
|
// this.other.isRobot = false
|
|
// this.other.isRobot = false
|
|
// this.getFindMessage()
|
|
// this.getFindMessage()
|
|
// 需要创建会话
|
|
// 需要创建会话
|
|
- this.isShowNps = true
|
|
|
|
|
|
+ this.isShowNps = 1
|
|
this.other.isRobot = true
|
|
this.other.isRobot = true
|
|
console.log('需要走创建会话逻辑')
|
|
console.log('需要走创建会话逻辑')
|
|
this.createSessionFn()
|
|
this.createSessionFn()
|
|
} else if (type === 2) {
|
|
} else if (type === 2) {
|
|
// 会话中
|
|
// 会话中
|
|
- this.isShowNps = true
|
|
|
|
|
|
+ this.isShowNps = 2
|
|
this.other.isRobot = false
|
|
this.other.isRobot = false
|
|
this.getFindMessage()
|
|
this.getFindMessage()
|
|
this.other.sessionId = sessionId
|
|
this.other.sessionId = sessionId
|
|
} else {
|
|
} else {
|
|
// 需要创建会话
|
|
// 需要创建会话
|
|
- this.isShowNps = false
|
|
|
|
|
|
+ this.isShowNps = 0
|
|
this.other.isRobot = true
|
|
this.other.isRobot = true
|
|
console.log('需要走创建会话逻辑')
|
|
console.log('需要走创建会话逻辑')
|
|
this.createSessionFn()
|
|
this.createSessionFn()
|
|
@@ -484,8 +486,8 @@ export default {
|
|
},
|
|
},
|
|
// 转人工
|
|
// 转人工
|
|
onTurnPeople (content = '') {
|
|
onTurnPeople (content = '') {
|
|
- // clearTimeout(this.lastEndTimer)
|
|
|
|
- // clearTimeout(this.lastOutTimer)
|
|
|
|
|
|
+ clearTimeout(this.lastEndTimer)
|
|
|
|
+ clearTimeout(this.lastOutTimer)
|
|
this.webSocketSend({
|
|
this.webSocketSend({
|
|
type: 2,
|
|
type: 2,
|
|
content: content,
|
|
content: content,
|
|
@@ -623,7 +625,9 @@ export default {
|
|
}
|
|
}
|
|
const socketParams = {}
|
|
const socketParams = {}
|
|
this.onSendCommon({ apiParams, socketParams }, false)
|
|
this.onSendCommon({ apiParams, socketParams }, false)
|
|
- this.robotOvertimeReply()
|
|
|
|
|
|
+ if (this.isShowNps === 0) {
|
|
|
|
+ this.robotOvertimeReply()
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|