...
|
...
|
@@ -66,6 +66,7 @@ var chat = { |
|
|
$ratingView: $('#chat-comment'),
|
|
|
canEvalute: true,
|
|
|
canManualService: true,
|
|
|
canLeaveMSG: false,
|
|
|
|
|
|
|
|
|
messageT: require('service/chat/msg.hbs'),
|
...
|
...
|
@@ -159,7 +160,7 @@ var chat = { |
|
|
}
|
|
|
})
|
|
|
.on('click.leaveMSG', '[data-trigger=leave-msg]', function() {
|
|
|
self.leaveMSGView.trigger('show.LeaveMSGView');
|
|
|
self.canLeaveMSG && self.leaveMSGView.trigger('show.LeaveMSGView');
|
|
|
})
|
|
|
.on('click.orderList', '[data-trigger=order-list]', function() {
|
|
|
let orderType = $(this).data('type') || '';
|
...
|
...
|
@@ -176,6 +177,14 @@ var chat = { |
|
|
$('#chat-footer')[0].scrollIntoView();
|
|
|
});
|
|
|
})
|
|
|
.on('click', '#chat-window', function() {
|
|
|
self.toggleMenu(false);
|
|
|
})
|
|
|
.on('focus', '.text-in', function() {
|
|
|
self.chatWinScrollToBottom();
|
|
|
|
|
|
return false;
|
|
|
})
|
|
|
.on('keydown.chat.sendText', '.text-in', function(event) {
|
|
|
event.stopPropagation();
|
|
|
|
...
|
...
|
@@ -254,7 +263,7 @@ var chat = { |
|
|
this.$chatWin.on('click', '.link', function(event) {
|
|
|
event.preventDefault();
|
|
|
|
|
|
tip.show('抱歉,暂不支持,长按复制到手机浏览器打开');
|
|
|
// tip.show('抱歉,暂不支持,长按复制到手机浏览器打开');
|
|
|
|
|
|
return false;
|
|
|
});
|
...
|
...
|
@@ -278,9 +287,11 @@ var chat = { |
|
|
disconnect(content) {
|
|
|
var self = this;
|
|
|
|
|
|
this.canLeaveMSG = true;
|
|
|
|
|
|
this.$chat.toggleClass('online', false);
|
|
|
this.toggleMenu(false);
|
|
|
this._sysInfo(`<p>${content}<span class="blue">重连</span></p>`)
|
|
|
this._sysInfo(`<p>${content}<span class="blue">连接客服</span></p>`)
|
|
|
.one('click', function() {
|
|
|
self.connect();
|
|
|
});
|
...
|
...
|
@@ -506,6 +517,7 @@ var chat = { |
|
|
var viewData;
|
|
|
|
|
|
this.canManualService = true;
|
|
|
this.canLeaveMSG = false;
|
|
|
|
|
|
// 服务状态: 离线
|
|
|
if (
|
...
|
...
|
@@ -608,7 +620,10 @@ var chat = { |
|
|
|
|
|
// state 1: 排队中
|
|
|
function inQueue() {
|
|
|
let info = `${chatMessage.content}您可以<span class="blue" data-trigger="leave-msg">留言</span>`;
|
|
|
// 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);
|
|
|
}
|
...
|
...
|
@@ -804,14 +819,22 @@ var chat = { |
|
|
}
|
|
|
this.$chat.toggleClass('menu-open', willShow);
|
|
|
|
|
|
let chatWin = this.$chatWin[0];
|
|
|
let footerH = $('#chat-footer .menu').outerHeight() || 0;
|
|
|
this.chatWinScrollToBottom();
|
|
|
|
|
|
if (willShow) {
|
|
|
chatWin.scrollTop += footerH;
|
|
|
} else {
|
|
|
chatWin.scrollTop -= footerH;
|
|
|
}
|
|
|
// let chatWin = this.$chatWin[0];
|
|
|
// let footerH = $('#chat-footer .menu').outerHeight() || 0;
|
|
|
|
|
|
// if (willShow) {
|
|
|
// chatWin.scrollTop += footerH;
|
|
|
// } else {
|
|
|
// chatWin.scrollTop -= footerH;
|
|
|
// }
|
|
|
},
|
|
|
|
|
|
chatWinScrollToBottom: function() {
|
|
|
let chatWin = chat.$chatWin[0];
|
|
|
|
|
|
chatWin.scrollTop = chatWin.scrollHeight;
|
|
|
}
|
|
|
|
|
|
};
|
...
|
...
|
@@ -864,7 +887,10 @@ $upload.on('change', function() { |
|
|
.done(function(res) {
|
|
|
if (res.code === 200) {
|
|
|
$elem.removeClass('send-loading')
|
|
|
.find('.chat-image').attr('src', res.data.filePath);
|
|
|
.find('.chat-image').attr('src', res.data.filePath)
|
|
|
.on('load', function() {
|
|
|
chat.chatWinScrollToBottom();
|
|
|
});
|
|
|
msg.data.content = res.data.filePath;
|
|
|
chat.sendMSG(msg, true); // only send msg, no draw msg;
|
|
|
}
|
...
|
...
|
@@ -879,9 +905,7 @@ $upload.on('change', function() { |
|
|
.always(function() {
|
|
|
input.value = '';
|
|
|
|
|
|
let chatWin = chat.$chatWin[0];
|
|
|
|
|
|
chatWin.scrollTop = chatWin.scrollHeight;
|
|
|
chat.chatWinScrollToBottom();
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
|