...
|
...
|
@@ -153,8 +153,6 @@ var chat = { |
|
|
onMessage: function(event) {
|
|
|
let received = JSON.parse(event.data);
|
|
|
|
|
|
console.log('客户端接收到消息:', received);
|
|
|
|
|
|
// update 会话id
|
|
|
cmEntity.conversationId = received.newConversationId > 0 ?
|
|
|
received.newConversationId : received.conversationId;
|
...
|
...
|
@@ -643,6 +641,19 @@ var chat = { |
|
|
const sysInfo = self._sysInfo.bind(this);
|
|
|
const chatMessage = cmEntity.chatMessage;
|
|
|
|
|
|
function whetherLeaveMsg(cm) {
|
|
|
const canLeave = cm.isLeaveMessage === 2;
|
|
|
const append = canLeave ? '您可以选择<span class="blue" data-trigger="leave-msg">留言</span>' : '';
|
|
|
const reg = /[,|,]$/g;
|
|
|
|
|
|
chatMessage.content = canLeave ?
|
|
|
chatMessage.content :
|
|
|
(chatMessage.content = chatMessage.content.replace(reg, ""));
|
|
|
|
|
|
canLeave && (self.canLeaveMSG = true);
|
|
|
sysInfo(`${chatMessage.content || ''}${append}`);
|
|
|
}
|
|
|
|
|
|
|
|
|
function noService() {
|
|
|
$chatHeader.find('.js-service-txt').text('YOHO客服');
|
...
|
...
|
@@ -654,18 +665,12 @@ var chat = { |
|
|
$chatHeader.find('.js-service-txt').text('YOHO客服');
|
|
|
|
|
|
$chat.append(time(Date.now()).show());
|
|
|
sysInfo(`${chatMessage.content || ''}您可以选择<span class="blue" data-trigger="leave-msg">留言</span>`);
|
|
|
whetherLeaveMsg(cmEntity);
|
|
|
}
|
|
|
|
|
|
// state 1: 排队中
|
|
|
function inQueue() {
|
|
|
let info = `${chatMessage.content}您可以<span class="blue" data-trigger="leave-msg">留言</span>`;
|
|
|
|
|
|
// let info = '您可以选择<span class="blue" data-trigger="leave-msg">留言</span>,客服会以短信形式回复您';
|
|
|
|
|
|
self.canLeaveMSG = true;
|
|
|
|
|
|
sysInfo(info);
|
|
|
whetherLeaveMsg(cmEntity);
|
|
|
}
|
|
|
|
|
|
// state 2: 人工客服进入
|
...
|
...
|
@@ -707,7 +712,6 @@ var chat = { |
|
|
viewData.data.content = viewData.data.content.replace(/^http:/, '');
|
|
|
}
|
|
|
|
|
|
// console.log(viewData);
|
|
|
let $html = $(this.messageT(viewData));
|
|
|
|
|
|
|
...
|
...
|
|