script(language='javascript').
cursession = '#{curagentuser.userid}';
curHeadImgUrl = '!{curagentuser.headimgurl}';
var userid = '#{curagentuser.userid}',
agentserviceid = '#{curagentuser.agentserviceid}',
agentuserid = '#{curagentuser.id}',
masscuragentuser = '#{masscuragentuser}',
isAisuggest = '#{aisuggest}';
.main-agentuser
.chat-agent
h1.site-h1
if curagentuser
div(style="width:250px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-wrap: break-word;word-break: break-all;")
| #{curagentuser.username}
.ukefu-service-btn(style="float:right;")
a(href="/agent/summary.html?userid=" + curagentuser.userid + "&agentserviceid=" + curagentuser.agentserviceid + "&agentuserid=" + curagentuser.id + "&channel=" + curagentuser.channel, data-toggle="ajax", data-width="950", data-height="450", title="记录服务小结")
button.layui-btn.layui-btn-small
i.kfont
| 服务小结
a(href="/agent/transfer.html?userid=" + curagentuser.userid + "&agentserviceid=" + curagentuser.agentserviceid + "&agentuserid=" + curagentuser.id, data-toggle="ajax", data-width="750", data-height="550", title="选择转接对象")
button.layui-btn.layui-btn-small(style="margin:0 5px")
i.kfont
| 转接坐席
a(href="javascript:void(0)", onclick="submitEndAgentUser('#{curagentuser.id}','#{curagentuser.username}')")
button.layui-btn.layui-btn-small.layui-btn-danger
i.kfont
| 结束对话
#chat_msg_list.chat-message.chat_msg_list(style='position: relative')
if agentUserMessageList && agentUserMessageList.content
for chatmessage in pugHelper.reverse(agentUserMessageList.content)
.clearfix.chat-block(name=chatmessage.createtime)
div(class=(chatmessage.calltype && chatmessage.calltype == '呼出' ? 'chat-right' : 'chat-left'))
img.user-img(alt="", src=(chatmessage.calltype && chatmessage.calltype == '呼出' ? '/images/agent.png' : curagentuser.headimgurl && curagentuser.headimgurl != '' ? curagentuser.headimgurl : '/images/im/user.png'), style="width:45px;height:45px;")
.chat-message
span(class=(chatmessage.calltype && chatmessage.calltype == '呼出' ? 'rateright' : 'rateleft'))
i.layui-icon.iconclick(id=chatmessage.id, name=(chatmessage.islabel == true ? 'yeslabe' : 'nolabe'), style="font-size:30px;cursor:pointer;color: #{chatmessage.islabel == true ? '#46cad4' : '#aaaaaa'}")
| #{chatmessage.islabel == true ? '' : 'စ'}
span.user
if chatmessage && chatmessage.calltype && chatmessage.calltype == '呼出'
if chatmessage.intervented
| #{chatmessage.supervisorname}
else
| #{chatmessage.username}
else
| #{chatmessage.username}
span.time= pugHelper.formatDate('yyyy-MM-dd HH:mm:ss', chatmessage.createtime)
span(class=(chatmessage.calltype && chatmessage.calltype == '呼出' ? 'rateleft' : 'rateright'), style="cursor: pointer; font-size: 30px")
i.layui-icon.iconclick(id=chatmessage.id, name=(chatmessage.islabel == true ? 'yeslabe' : 'nolabe'), style="cursor:pointer;font-size:30px;color: #{chatmessage.islabel == true ? '#46cad4' : '#aaaaaa'}")
| #{chatmessage.islabel == true ? '' : 'စ'}
div(class=(chatmessage.calltype && chatmessage.calltype == '呼出' ? 'chatting-right' : 'chatting-left'))
i.userarrow
.chat-content
include /apps/agent/media/message.pug
else if curagentuser
if curagentuser.status && curagentuser.status == "end"
#agentuser-curstatus.clearfix.chat-block.connect-end
span.connect-message 用户#{curagentuser.username}已经离开
else
#agentuser-curstatus.clearfix.chat-block.connect-begin
span.connect-message 用户#{curagentuser.username}开始对话
.chat-bottom
#agentAnswer(style='width: 50%;min-width:310px;height: 180px;border: 1px solid #eee;position: absolute;top: -180px;right:0px;background: #ffffff;display: none')
h1.site-h1(style='background-color:#EEEEEE;padding: 0px 10px')
| 知识库联想
i.layui-icon(style='position: absolute;top: 0px;right: 5px;font-size:16px;z-index: 10', onclick='showOrHide(\'none\')') ဆ
div(style='width: calc(100% - 19px);height: 129px;position: absolute;top: 31px;overflow-y: scroll;padding: 10px 10px')
ul.info-list.ukefu-quick-reply#quickReplyAgentBox(style='width: 100%;height: auto').
.row
.col-lg-12
textarea#message(name='message')
button.send-btn(type='button', onclick='sendMessage()')
| 发送
style.
.ke-container {
border: 0px solid #E0E0E0 !important;
}
script(language='javascript').
var editor, layer;
KindEditor.plugin('evaluation', function (K) {
var editor = this, name = 'evaluation';
editor.clickToolbar(name, function () {
$.post('/agent/evaluation', {agentuserid: agentuserid}).success(function () {
top.layer.msg('发送满意度调研成功!', {icon: 1, time: 3000})
});
});
});
KindEditor.lang({
evaluation: '满意度评价'
});
$(document).ready(function () {
// KindEditor.ready(function(K) {
var K = KindEditor;
editor = K.create('#message', {
height: "160px",
themeType: 'simple',
width: "100%",
items: ['emoticons', 'image', 'insertfile', 'evaluation'],
resizeType: 0,
uploadJson: "/agent/image/upload.html?id=" + "#{curagentuser.id}",
allowFileManager: false,
newlineTag: "br",
fontsize: 16,
allowFileUpload: true,
allowInsertUpload: false, //增加的参数,上传图片后是否插入到当前区域
allowImageRemote: false,
afterUpload: function (url) {
return false;
},
afterCreate: function () { //设置编辑器创建后执行的回调函数
var self = this;
if ('#{sessionConfig}' && '#{sessionConfig.agentctrlenter}' && '#{sessionConfig.agentctrlenter}' == true) {
//Ctrl+Enter提交表单
K.ctrl(document, 13, function () {
self.sync();
sendMessage();
});
K.ctrl(self.edit.doc, 13, function () {
self.sync();
sendMessage();
});
} else {
var kindEditorIframe = $("iframe").contents().find("body");
kindEditorIframe.keydown(function (event) {
if (event.keyCode == 13 && !event.ctrlKey) {
self.sync();
sendMessage();
return false;
} else if (event.keyCode == 13 && event.ctrlKey) {
editor.insertHtml('
');
}
});
//Ctrl+Enter提交表单
K.ctrl(document, 13, function () {
editor.insertHtml('
');
});
K.ctrl(self.edit.doc, 13, function () {
editor.insertHtml('
');
});
}
}
});
// });
KindEditor.options.cssData = "body {font - size: 15px; font-family:'Microsoft Yahei', 'Helvetica', 'Simsun', 'Arial';}";
var agentEnterInput = $("iframe").contents().find("body");
agentEnterInput.keyup(function (event) {
if (isAisuggest && isAisuggest == "true") {
debouncefun();
}
})
var debouncefun = _.debounce(agentQuickReply, 500)
function agentQuickReply() {
restApiRequest({
silent: true,
path: 'chatbot',
data: {
ops: 'faq',
snsaccountid: "#{curagentuser.appid}",
userId: "#{curagentuser.userid}",
textMessage: editor.html()
}
}).then(function (result) {
if (result.rc === 0) {
if (result.data.length > 0) {
$("#quickReplyAgentBox").html("");
$.each(sortByKey(result.data, 'score'), function (j, n) {
var answerList = result.data[j].replies;
var answer;
for (var i = 0; i < answerList.length; i++) {
if (answerList[i].rtype == 'plain' && answerList[i].enabled == true) {
answer = answerList[i]
break;
}
}
if (answer) {
var li = '
答案:' + answer.content + '
\n' + ' \n' + '答案:' + answer.content + '
\n' + ' \n' + '