Authored by 李奇

留言开关添加

... ... @@ -227,33 +227,32 @@ var _loadPage = function() {
/**
* 人工链接
* @param msgType 内部消息类型
* @param message 内部消息对象
* @param rec 接收对象
* @private
*/
function linkSuccess(msgType, message) {
function linkSuccess(rec) {
var OUT_SERVICE = 0, // 0 没上班
LINE_UP = 1, // 1 需要排队
MANUAL_SERVICE = 2, // 2 接入人工
ADMIN_MANUAL_SERVICE = 3; // 3 管理员分配
var OUT_SERVICE = 0,
LINE_UP = 1,
MANUAL_SERVICE = 2,
ADMIN_MANUAL_SERVICE = 3;
var message = rec.chatMessage;
var msgType = message.type;
var dom,
tipText;
switch (msgType) {
case OUT_SERVICE: // 0是没上班
tipText = message.content +
'您也可以选择<a class="leave-msg">留言</a>';
case OUT_SERVICE:
tipText = receive.leaMsgTip(rec);
dom = tipTpl({
content: tipText
});
break;
case LINE_UP: // 1是需要排队
tipText = message.content +
'您也可以选择<a class="leave-msg">留言</a>';
case LINE_UP:
tipText = receive.leaMsgTip(rec);
dom = tipTpl({
content: tipText
});
... ... @@ -264,7 +263,7 @@ var _loadPage = function() {
});
break;
case MANUAL_SERVICE: // 2是接入人工成功
case MANUAL_SERVICE:
tipText = message.content;
dom = tipTpl({
content: tipText
... ... @@ -282,7 +281,7 @@ var _loadPage = function() {
});
break;
case ADMIN_MANUAL_SERVICE: // 3是管理员分配客服成功
case ADMIN_MANUAL_SERVICE:
tipText = message.content;
dom = tipTpl({
content: tipText
... ... @@ -482,7 +481,7 @@ var _loadPage = function() {
break;
case allTypes.LINK_SUCCESS:
linkSuccess(msgType, message);
linkSuccess(rec);
break;
case allTypes.IN_QUNEUE:
... ...
... ... @@ -82,3 +82,21 @@ exports.preProcess = function(rec) {
break;
}
};
/**
* 是否显示留言
* @param rec 接收对象
*/
exports.leaMsgTip = function(rec) {
var val = rec.isLeaveMessage;
var chatMsg = rec.chatMessage;
var canLeave = val === 2;
var append = canLeave ? '您也可以选择<a class="leave-msg">留言</a>' : '';
var reg = /[,|,]$/g;
chatMsg.content = canLeave ?
chatMsg.content :
(chatMsg.content = chatMsg.content.replace(reg, ""));
return [chatMsg.content, append].join("");
};
... ...