|
|
@@ -223,7 +223,7 @@ function append(ele, cname, msg, codes, dates, humanclass) {
|
|
223
|
223
|
$('.open_chat').find('.before').removeClass('hide').addClass('show');
|
|
224
|
224
|
}
|
|
225
|
225
|
|
|
226
|
|
-function insert(ele, cname, msg, nodown,humanclass) {
|
|
|
226
|
+function insert(ele, cname, msg, nodown, humanclass) {
|
|
227
|
227
|
var html = '<li>' +
|
|
228
|
228
|
// '<p class="message_time"><span>' + n.CreateDate + '</span></p>' +
|
|
229
|
229
|
'<div class="message_mincon ' + cname + '">'
|
|
|
@@ -288,6 +288,7 @@ $('.open_chat').click(function () {
|
|
288
|
288
|
$('#chat').hide();
|
|
289
|
289
|
} else {
|
|
290
|
290
|
$('#chat').show();
|
|
|
291
|
+ $(".send_content").focus();
|
|
291
|
292
|
}
|
|
292
|
293
|
|
|
293
|
294
|
})
|
|
|
@@ -299,6 +300,7 @@ $(".chat_ld-service li").click(function () {
|
|
299
|
300
|
var index = $(this).index();
|
|
300
|
301
|
var ss = $(this).attr("itemtype");
|
|
301
|
302
|
$(".chat_Content_box").find(".chat_complain").eq(index).addClass("chat_Shows").siblings().removeClass("chat_Shows");
|
|
|
303
|
+ $(".chat_Content_box").find(".chat_complain").eq(index).find("input").focus();
|
|
302
|
304
|
|
|
303
|
305
|
});
|
|
304
|
306
|
//聊天右侧列表结束
|
|
|
@@ -307,85 +309,216 @@ $(".chat_ld-service li").click(function () {
|
|
307
|
309
|
quick_answer();
|
|
308
|
310
|
//知识库列表
|
|
309
|
311
|
knowledge_answer();
|
|
|
312
|
+//工单搜索
|
|
|
313
|
+workorder_answer();
|
|
|
314
|
+//客户档案搜索
|
|
|
315
|
+customer_answer();
|
|
|
316
|
+
|
|
310
|
317
|
//快速回复搜索
|
|
311
|
|
-$('.Seach_answer').on('click',function(){
|
|
312
|
|
- quick_answer();
|
|
313
|
|
- if($('#key_answer').val().trim()){
|
|
314
|
|
- var content=document.getElementById('quick_answer').innerHTML;
|
|
315
|
|
- var keywords=document.getElementById('key_answer').value;
|
|
316
|
|
- var reg=new RegExp(keywords,'g')
|
|
317
|
|
- var newStr = content.replace(reg, `<font color=#c00>${keywords}</font>`)
|
|
318
|
|
- document.getElementById('quick_answer').innerHTML=newStr
|
|
319
|
|
- }
|
|
|
318
|
+$('.Seach_answer').on('click', function () {
|
|
|
319
|
+ quick_answer();
|
|
320
|
320
|
})
|
|
321
|
321
|
//知识库搜索
|
|
322
|
|
-$('.Seach_knowledge').on('click',function(){
|
|
323
|
|
- knowledge_answer();
|
|
324
|
|
- if($('#key_knowledge').val().trim()){
|
|
325
|
|
- var content1=document.getElementById('knowledge_anwser').innerHTML;
|
|
326
|
|
- var keywords1=document.getElementById('key_knowledge').value;
|
|
327
|
|
- console.log(keywords1)
|
|
328
|
|
- var reg1=new RegExp(keywords1,'g')
|
|
329
|
|
- console.log(reg1)
|
|
330
|
|
- var newStr1 = content1.replace(reg1, `<font color=#c00>${keywords1}</font>`)
|
|
331
|
|
- console.log(newStr1);
|
|
332
|
|
- document.getElementById('knowledge_anwser').innerHTML=newStr1
|
|
333
|
|
- }
|
|
|
322
|
+$('.Seach_knowledge').on('click', function () {
|
|
|
323
|
+ knowledge_answer();
|
|
|
324
|
+})
|
|
|
325
|
+//工单搜索
|
|
|
326
|
+$('.Seach_workorder').on('click', function () {
|
|
|
327
|
+ workorder_answer();
|
|
334
|
328
|
})
|
|
|
329
|
+//客户档案搜索
|
|
|
330
|
+$('.Seach_customer').on('click', function () {
|
|
|
331
|
+ customer_answer();
|
|
|
332
|
+})
|
|
|
333
|
+
|
|
335
|
334
|
//快速回复
|
|
336
|
|
-function quick_answer(){
|
|
337
|
|
- $('.quick_answer').empty();
|
|
338
|
|
- $.ajax({
|
|
339
|
|
- type: "get",
|
|
340
|
|
- url: huayi.config.callcenter_url + "ChatMessages/GetReplyList",
|
|
341
|
|
- dataType: 'json',
|
|
342
|
|
- async: false,
|
|
343
|
|
- data: {
|
|
344
|
|
- keyword:$('#key_answer').val(),
|
|
345
|
|
- token: $.cookie("token")
|
|
346
|
|
- },
|
|
347
|
|
- success: function(data) {
|
|
348
|
|
- $.each(data.rows, function (i, n) {
|
|
349
|
|
- var collection_imgurl = n.IsCollection == true ? "./img/collection_active.png" : "./img/collection.png";
|
|
350
|
|
- $('<li class="chat_item">' +
|
|
351
|
|
- '<span class="answer_text" title="' + n.F_ReplyContent + '">' + n.F_ReplyContent + '</span>' +
|
|
352
|
|
- '<button type="button" class="btn btn-primary btn-sm" onclick=sendMsg("' + n.F_ReplyContent + '",' + n.F_Id + ')>发送</button> ' +
|
|
353
|
|
- '<span class="collection"><img onclick="collection_img(' + n.F_Id + ')" src="' + collection_imgurl + '"/></span>' +
|
|
354
|
|
- '</li>').appendTo($('.quick_answer'));
|
|
355
|
|
- });
|
|
356
|
|
- }
|
|
357
|
|
- });
|
|
358
|
|
-
|
|
|
335
|
+function quick_answer() {
|
|
|
336
|
+ $('.quick_answer').empty();
|
|
|
337
|
+ $.ajax({
|
|
|
338
|
+ type: "get",
|
|
|
339
|
+ url: huayi.config.callcenter_url + "ChatMessages/GetReplyList",
|
|
|
340
|
+ dataType: 'json',
|
|
|
341
|
+ async: false,
|
|
|
342
|
+ data: {
|
|
|
343
|
+ keyword: $('#key_answer').val(),
|
|
|
344
|
+ page: 1, //当前第几页
|
|
|
345
|
+ pagesize: 20, //每页显示的记录数
|
|
|
346
|
+ token: $.cookie("token")
|
|
|
347
|
+ },
|
|
|
348
|
+ success: function (data) {
|
|
|
349
|
+ $.each(data.rows, function (i, n) {
|
|
|
350
|
+ var collection_imgurl = n.IsCollection == true ? "./img/collection_active.png" : "./img/collection.png";
|
|
|
351
|
+ $('<li class="chat_item">' +
|
|
|
352
|
+ '<span class="answer_text" title="' + n.F_ReplyContent + '">' + GetLimitStr(n.F_ReplyContent, 68) + '<div>' +
|
|
|
353
|
+ '<button type="button" class="btn btn-primary btn-sm" onclick=sendMsg("' + n.F_ReplyContent + '",' + n.F_Id + ')>发送</button> ' +
|
|
|
354
|
+ '<img onclick="collection_img(' + n.F_Id + ')" src="' + collection_imgurl + '"/>' +
|
|
|
355
|
+ '</div></span></li>').appendTo($('.quick_answer'));
|
|
|
356
|
+ });
|
|
|
357
|
+ // 搜索关键词高亮显示
|
|
|
358
|
+ GetReplaceKey(data.keys, document.getElementById('quick_answer').innerHTML, "quick_answer");
|
|
|
359
|
+ }
|
|
|
360
|
+ });
|
|
|
361
|
+
|
|
359
|
362
|
}
|
|
360
|
363
|
|
|
361
|
364
|
//知识库列表
|
|
362
|
|
-function knowledge_answer(){
|
|
363
|
|
- $('.knowledge_anwser').empty();
|
|
364
|
|
- $.ajax({
|
|
365
|
|
- type: "get",
|
|
366
|
|
- url: huayi.config.callcenter_url + "ChatMessages/GetKnowledgeList",
|
|
367
|
|
- dataType: 'json',
|
|
368
|
|
- async: true,
|
|
369
|
|
- data: {
|
|
370
|
|
- keyword:$('#key_knowledge').val(),
|
|
371
|
|
- token: $.cookie("token")
|
|
372
|
|
- },
|
|
373
|
|
- success: function(data) {
|
|
374
|
|
- $.each(data.rows, function(i,n) {
|
|
375
|
|
- var contant=n.F_Content.replace(/<[^>]+>/g,"");
|
|
376
|
|
- if(contant.length>30){
|
|
377
|
|
- contants = contant.substr(0, 30) + "...";
|
|
378
|
|
- }
|
|
379
|
|
- $('<div class="tel_title">' + n.F_Title + '</div><li class="chat_item">' +
|
|
380
|
|
- '<span title="' + n.F_Description + '">' + contants + '</span>' +
|
|
381
|
|
- '<button type="button" class="btn btn-primary btn-sm" onclick=sendMsg("' + contant + '",' + n.F_Id + ')>发送</button> <span class="collection"><img onclick="collection_img(' + n.F_CategoryId + ')" src="./img/collection.png"/></span>' +
|
|
382
|
|
- '</li>').appendTo($('.knowledge_anwser'));
|
|
383
|
|
- });
|
|
384
|
|
- }
|
|
385
|
|
- });
|
|
386
|
|
-
|
|
|
365
|
+function knowledge_answer() {
|
|
|
366
|
+ $('.knowledge_anwser').empty();
|
|
|
367
|
+ $.ajax({
|
|
|
368
|
+ type: "get",
|
|
|
369
|
+ url: huayi.config.callcenter_url + "ChatMessages/GetKnowledgeList",
|
|
|
370
|
+ dataType: 'json',
|
|
|
371
|
+ async: true,
|
|
|
372
|
+ data: {
|
|
|
373
|
+ keyword: $('#key_knowledge').val(),
|
|
|
374
|
+ page: 1, //当前第几页
|
|
|
375
|
+ pagesize: 20, //每页显示的记录数
|
|
|
376
|
+ token: $.cookie("token")
|
|
|
377
|
+ },
|
|
|
378
|
+ success: function (data) {
|
|
|
379
|
+ $.each(data.rows, function (i, n) {
|
|
|
380
|
+ var collection_imgurl = n.IsCollection == true ? "./img/collection_active.png" : "./img/collection.png";
|
|
|
381
|
+ $('<div class="knowledge_title">' + n.F_Title + '</div>' +
|
|
|
382
|
+ '<li class="chat_item">' +
|
|
|
383
|
+ '<span class="answer_text" title="' + GetLimitStr(n.F_Content, 200) + '">' + GetLimitStr(n.F_Content, 68) + '<div>' + //n.F_Description
|
|
|
384
|
+ '<button type="button" class="btn btn-primary btn-sm" onclick=sendKnowledgeMsg("' + GetLimitStr(n.F_Content, 1000) + '",' + n.F_RepositoryId + ')>发送</button> ' +
|
|
|
385
|
+ '<img id="collectionimg" itemcollection = ' + n.F_RepositoryId + ' src="' + collection_imgurl + '"/>' +
|
|
|
386
|
+ '</div></span></li>').appendTo($('.knowledge_anwser'));
|
|
|
387
|
+ });
|
|
|
388
|
+ // 搜索关键词高亮显示
|
|
|
389
|
+ GetReplaceKey(data.keys, document.getElementById('knowledge_anwser').innerHTML, "knowledge_anwser");
|
|
|
390
|
+ }
|
|
|
391
|
+ });
|
|
387
|
392
|
}
|
|
388
|
|
-function sendMsg(msg,id) {
|
|
|
393
|
+
|
|
|
394
|
+//工单列表
|
|
|
395
|
+function workorder_answer() {
|
|
|
396
|
+ $('.workorder_anwser').empty();
|
|
|
397
|
+ $.ajax({
|
|
|
398
|
+ type: "get",
|
|
|
399
|
+ url: huayi.config.callcenter_url + "ChatMessages/GetWorkOrderList",
|
|
|
400
|
+ dataType: 'json',
|
|
|
401
|
+ async: true,
|
|
|
402
|
+ data: {
|
|
|
403
|
+ keyword: $('#key_workorder').val(),
|
|
|
404
|
+ page: 1, //当前第几页
|
|
|
405
|
+ pagesize: 20, //每页显示的记录数
|
|
|
406
|
+ token: $.cookie("token")
|
|
|
407
|
+ },
|
|
|
408
|
+ success: function (data) {
|
|
|
409
|
+ $.each(data.rows, function (i, n) {
|
|
|
410
|
+ //var collection_imgurl = n.IsCollection == true ? "./img/collection_active.png" : "./img/collection.png";
|
|
|
411
|
+ $('<div class="knowledge_title">' + n.F_WorkOrderId + ' ' + n.F_ComTitle + '【' + States(n.F_WorkState, n.F_IsReturn) + '】</div>' +
|
|
|
412
|
+ '<li class="chat_item">' +
|
|
|
413
|
+ '<span class="answer_text" title="' + GetLimitStr(n.F_ComContent, 200) + '">' + GetLimitStr(n.F_ComContent, 68) + '<div>' + //n.F_Description
|
|
|
414
|
+ '<button type="button" class="btn btn-primary btn-sm" onclick=sendworkorderMsg("' + n.F_WorkOrderId + ' ' + n.F_ComTitle + '【' + States(n.F_WorkState, n.F_IsReturn) + '】 内容:' + GetLimitStr(n.F_ComContent, 1000) + '",' + n.F_WorkOrderId + ')>发送</button> ' +
|
|
|
415
|
+ //'<img id="collectionimg" itemcollection = ' + n.F_WorkOrderId + ' src="' + collection_imgurl + '"/>' +
|
|
|
416
|
+ '</div></span></li>').appendTo($('.workorder_anwser'));
|
|
|
417
|
+ });
|
|
|
418
|
+ // 搜索关键词高亮显示
|
|
|
419
|
+ GetReplaceKey(data.keys, document.getElementById('workorder_anwser').innerHTML, "workorder_anwser");
|
|
|
420
|
+ }
|
|
|
421
|
+ });
|
|
|
422
|
+}
|
|
|
423
|
+
|
|
|
424
|
+//客户档案列表
|
|
|
425
|
+function customer_answer() {
|
|
|
426
|
+ $('.customer_anwser').empty();
|
|
|
427
|
+ $.ajax({
|
|
|
428
|
+ type: "get",
|
|
|
429
|
+ url: huayi.config.callcenter_url + "ChatMessages/GetCustomerList",
|
|
|
430
|
+ dataType: 'json',
|
|
|
431
|
+ async: true,
|
|
|
432
|
+ data: {
|
|
|
433
|
+ keyword: $('#key_workorder').val(),
|
|
|
434
|
+ page: 1, //当前第几页
|
|
|
435
|
+ pagesize: 20, //每页显示的记录数
|
|
|
436
|
+ token: $.cookie("token")
|
|
|
437
|
+ },
|
|
|
438
|
+ success: function (data) {
|
|
|
439
|
+ $.each(data.rows, function (i, n) {
|
|
|
440
|
+ $('<div class="knowledge_title">' + n.F_CustomerName + '</div>' +
|
|
|
441
|
+ '<li class="chat_item">' +
|
|
|
442
|
+ '<span class="answer_text" title="客户电话:' + n.F_Mobile + ' ' + n.F_CustomerEName + ' 联系电话:' + n.F_Telephone + '">客户电话:' + n.F_Mobile + ' ' + n.F_CustomerEName + ' 联系电话:' + n.F_Telephone + '<div>' + //n.F_Description
|
|
|
443
|
+ '<button type="button" class="btn btn-primary btn-sm" onclick=sendcustomerMsg("' + n.F_CustomerName + ' 客户电话:' + n.F_Mobile + ' ' + n.F_CustomerEName + ' 联系电话:' + n.F_Telephone + '",' + n.F_CustomerId + ')>发送</button> ' +
|
|
|
444
|
+ '</div></span></li>').appendTo($('.customer_anwser'));
|
|
|
445
|
+ });
|
|
|
446
|
+ // 搜索关键词高亮显示
|
|
|
447
|
+ GetReplaceKey(data.keys, document.getElementById('customer_anwser').innerHTML, "customer_anwser");
|
|
|
448
|
+ }
|
|
|
449
|
+ });
|
|
|
450
|
+}
|
|
|
451
|
+
|
|
|
452
|
+//状态
|
|
|
453
|
+function States(WorkState, IsReturn) {
|
|
|
454
|
+ var html = '';
|
|
|
455
|
+ switch (WorkState + '') {
|
|
|
456
|
+ case '0':
|
|
|
457
|
+ html = '新工单';
|
|
|
458
|
+ if (IsReturn == 1) {
|
|
|
459
|
+ html = '新工单(回退)';
|
|
|
460
|
+ }
|
|
|
461
|
+ break;
|
|
|
462
|
+ case '1':
|
|
|
463
|
+ html = '待交办';
|
|
|
464
|
+ break;
|
|
|
465
|
+ case '2':
|
|
|
466
|
+ html = '待查收';
|
|
|
467
|
+ break;
|
|
|
468
|
+ case '3':
|
|
|
469
|
+ html = '退回审核中';
|
|
|
470
|
+ break;
|
|
|
471
|
+ case '4':
|
|
|
472
|
+ html = '办理中';
|
|
|
473
|
+ break;
|
|
|
474
|
+ case '5':
|
|
|
475
|
+ html = '延时审核';
|
|
|
476
|
+ break;
|
|
|
477
|
+ case '6':
|
|
|
478
|
+ html = '已办理';
|
|
|
479
|
+ break;
|
|
|
480
|
+ case '7':
|
|
|
481
|
+ html = '已回访';
|
|
|
482
|
+ break;
|
|
|
483
|
+ case '8':
|
|
|
484
|
+ html = '重办中';
|
|
|
485
|
+ break;
|
|
|
486
|
+ case '9':
|
|
|
487
|
+ html = '已结案';
|
|
|
488
|
+ break;
|
|
|
489
|
+ case '10':
|
|
|
490
|
+ html = '待审核';
|
|
|
491
|
+ break;
|
|
|
492
|
+ case '11':
|
|
|
493
|
+ html = '重办待交办';
|
|
|
494
|
+ break;
|
|
|
495
|
+ // case '12':
|
|
|
496
|
+ // html = '待审核';
|
|
|
497
|
+ // break;
|
|
|
498
|
+ case '13':
|
|
|
499
|
+ html = '重办驳回';
|
|
|
500
|
+ break;
|
|
|
501
|
+ }
|
|
|
502
|
+ return html;
|
|
|
503
|
+}
|
|
|
504
|
+
|
|
|
505
|
+// IM在线客服 - 键盘发送事件
|
|
|
506
|
+$('.inputkeyword').bind('keypress', function (event) {
|
|
|
507
|
+ if (event.keyCode == "13") {
|
|
|
508
|
+ var id = $(this).attr("id");
|
|
|
509
|
+ if (id == "key_answer")
|
|
|
510
|
+ $(".Seach_answer").click();
|
|
|
511
|
+ else if (id == "key_knowledge")
|
|
|
512
|
+ $(".Seach_knowledge").click();
|
|
|
513
|
+ else if (id == "key_workorder")
|
|
|
514
|
+ $(".Seach_workorder").click();
|
|
|
515
|
+ else
|
|
|
516
|
+ $(".Seach_customer").click();
|
|
|
517
|
+ }
|
|
|
518
|
+})
|
|
|
519
|
+
|
|
|
520
|
+// 发送 - 快速回复
|
|
|
521
|
+function sendMsg(msg, id) {
|
|
389
|
522
|
$.ajax({
|
|
390
|
523
|
type: "post",
|
|
391
|
524
|
url: huayi.config.callcenter_url + "ChatMessages/SendReply",
|
|
|
@@ -406,6 +539,7 @@ function sendMsg(msg,id) {
|
|
406
|
539
|
objs.msg = msg;
|
|
407
|
540
|
Sends();
|
|
408
|
541
|
}
|
|
|
542
|
+// 收藏 - 快速恢复
|
|
409
|
543
|
function collection_img(id) {
|
|
410
|
544
|
$.ajax({
|
|
411
|
545
|
type: "post",
|
|
|
@@ -424,3 +558,170 @@ function collection_img(id) {
|
|
424
|
558
|
}
|
|
425
|
559
|
});
|
|
426
|
560
|
}
|
|
|
561
|
+
|
|
|
562
|
+// 发送 - 快速回复
|
|
|
563
|
+function sendKnowledgeMsg(msg, id) {
|
|
|
564
|
+ $.ajax({
|
|
|
565
|
+ type: "post",
|
|
|
566
|
+ url: huayi.config.callcenter_url + "ChatMessages/SendKnowledge",
|
|
|
567
|
+ async: true,
|
|
|
568
|
+ data: {
|
|
|
569
|
+ id: id,
|
|
|
570
|
+ token: $.cookie('token')
|
|
|
571
|
+ },
|
|
|
572
|
+ success: function (result) {
|
|
|
573
|
+ var result = $.parseJSON(result)
|
|
|
574
|
+ if (result.state == 'success') {
|
|
|
575
|
+ layer.msg(result.message);
|
|
|
576
|
+ }
|
|
|
577
|
+ }
|
|
|
578
|
+ });
|
|
|
579
|
+ objs.action = "sersend";
|
|
|
580
|
+ // objs.code = $("#" + ele).find(".hidcid").val();
|
|
|
581
|
+ objs.msg = msg;
|
|
|
582
|
+ Sends();
|
|
|
583
|
+}
|
|
|
584
|
+
|
|
|
585
|
+// 收藏 - 知识库
|
|
|
586
|
+$('#knowledge_anwser').on('click', "li span div img", function () {
|
|
|
587
|
+ var collection_act_url = "./img/collection_active.png";
|
|
|
588
|
+ var collection_url = "./img/collection.png";
|
|
|
589
|
+ var id = $(this).attr("itemcollection");
|
|
|
590
|
+ var src = $(this).attr("src");
|
|
|
591
|
+ var b = false; var reg = "";
|
|
|
592
|
+ $.ajax({
|
|
|
593
|
+ type: "post",
|
|
|
594
|
+ url: huayi.config.callcenter_url + "ChatMessages/CollectionKnowledge",
|
|
|
595
|
+ async: false,
|
|
|
596
|
+ data: {
|
|
|
597
|
+ id: id,
|
|
|
598
|
+ token: $.cookie('token')
|
|
|
599
|
+ },
|
|
|
600
|
+ success: function (result) {
|
|
|
601
|
+ var result = $.parseJSON(result)
|
|
|
602
|
+ if (result.state == 'success') {
|
|
|
603
|
+ //knowledge_answer(); //注释掉原因 - 操作成功后列表刷新闪动厉害
|
|
|
604
|
+ b = true;
|
|
|
605
|
+ reg = result.message;
|
|
|
606
|
+ }
|
|
|
607
|
+ }
|
|
|
608
|
+ });
|
|
|
609
|
+ if(b){
|
|
|
610
|
+ if (src == collection_act_url) {
|
|
|
611
|
+ $(this).attr("src", collection_url);
|
|
|
612
|
+ } else {
|
|
|
613
|
+ $(this).attr("src", collection_act_url);
|
|
|
614
|
+ }
|
|
|
615
|
+ layer.msg(reg);
|
|
|
616
|
+ }
|
|
|
617
|
+})
|
|
|
618
|
+
|
|
|
619
|
+// 发送 - 工单
|
|
|
620
|
+function sendworkorderMsg(msg, id) {
|
|
|
621
|
+ $.ajax({
|
|
|
622
|
+ type: "post",
|
|
|
623
|
+ url: huayi.config.callcenter_url + "ChatMessages/SendWorkOrder",
|
|
|
624
|
+ async: true,
|
|
|
625
|
+ data: {
|
|
|
626
|
+ id: id,
|
|
|
627
|
+ token: $.cookie('token')
|
|
|
628
|
+ },
|
|
|
629
|
+ success: function (result) {
|
|
|
630
|
+ var result = $.parseJSON(result)
|
|
|
631
|
+ if (result.state == 'success') {
|
|
|
632
|
+ layer.msg(result.message);
|
|
|
633
|
+ }
|
|
|
634
|
+ }
|
|
|
635
|
+ });
|
|
|
636
|
+ objs.action = "sersend";
|
|
|
637
|
+ // objs.code = $("#" + ele).find(".hidcid").val();
|
|
|
638
|
+ objs.msg = msg;
|
|
|
639
|
+ Sends();
|
|
|
640
|
+}
|
|
|
641
|
+
|
|
|
642
|
+// 发送 - 客户档案
|
|
|
643
|
+function sendcustomerMsg(msg, id) {
|
|
|
644
|
+ $.ajax({
|
|
|
645
|
+ type: "post",
|
|
|
646
|
+ url: huayi.config.callcenter_url + "ChatMessages/SendCustomer",
|
|
|
647
|
+ async: true,
|
|
|
648
|
+ data: {
|
|
|
649
|
+ id: id,
|
|
|
650
|
+ token: $.cookie('token')
|
|
|
651
|
+ },
|
|
|
652
|
+ success: function (result) {
|
|
|
653
|
+ var result = $.parseJSON(result)
|
|
|
654
|
+ if (result.state == 'success') {
|
|
|
655
|
+ layer.msg(result.message);
|
|
|
656
|
+ }
|
|
|
657
|
+ }
|
|
|
658
|
+ });
|
|
|
659
|
+ objs.action = "sersend";
|
|
|
660
|
+ // objs.code = $("#" + ele).find(".hidcid").val();
|
|
|
661
|
+ objs.msg = msg;
|
|
|
662
|
+ Sends();
|
|
|
663
|
+}
|
|
|
664
|
+
|
|
|
665
|
+//// 收藏 - 知识库
|
|
|
666
|
+//function collection_img_knowledge(id) {
|
|
|
667
|
+// var ss = $(this).attr("itemcollection");
|
|
|
668
|
+// $.ajax({
|
|
|
669
|
+// type: "post",
|
|
|
670
|
+// url: huayi.config.callcenter_url + "ChatMessages/CollectionKnowledge",
|
|
|
671
|
+// async: true,
|
|
|
672
|
+// data: {
|
|
|
673
|
+// id: id,
|
|
|
674
|
+// token: $.cookie('token')
|
|
|
675
|
+// },
|
|
|
676
|
+// success: function (result) {
|
|
|
677
|
+// var result = $.parseJSON(result)
|
|
|
678
|
+// if (result.state == 'success') {
|
|
|
679
|
+// //knowledge_answer(); //注释掉原因 - 操作成功后列表刷新闪动厉害
|
|
|
680
|
+// var collection_act_url = "./img/collection_active.png";
|
|
|
681
|
+// var collection_url = "./img/collection.png";
|
|
|
682
|
+// if ($(this).attr("src") == collection_act_url) {
|
|
|
683
|
+// $(this).attr("src", collection_url);
|
|
|
684
|
+// } else {
|
|
|
685
|
+// $(this).attr("src", collection_act_url);
|
|
|
686
|
+// }
|
|
|
687
|
+// layer.msg(result.message);
|
|
|
688
|
+// }
|
|
|
689
|
+// }
|
|
|
690
|
+// });
|
|
|
691
|
+//}
|
|
|
692
|
+
|
|
|
693
|
+//截取字符串 - IM在线客服
|
|
|
694
|
+function GetLimitStr(val, len) {
|
|
|
695
|
+ if (val) {
|
|
|
696
|
+ // var val = val.replace(/<[^>]+>/g, "");
|
|
|
697
|
+ var val = RemoveHtml(val);
|
|
|
698
|
+ if (val.length > len) {
|
|
|
699
|
+ val = val.substr(0, len) + "...";
|
|
|
700
|
+ }
|
|
|
701
|
+ return val;
|
|
|
702
|
+ } else {
|
|
|
703
|
+ return '';
|
|
|
704
|
+ }
|
|
|
705
|
+}
|
|
|
706
|
+// 过滤HTML标签以及空格
|
|
|
707
|
+function RemoveHtml(str) {
|
|
|
708
|
+ str = str.replace(/<\/?[^>]*>/g, ''); //去除HTML tag
|
|
|
709
|
+ str = str.replace(/[ | ]*\n/g, '\n'); //去除行尾空白
|
|
|
710
|
+ str = str.replace(/\n[\s| | ]*\r/g, '\n'); //去除多余空行
|
|
|
711
|
+ str = str.replace(/(<br[^>]*>| |\s*)/g, '')
|
|
|
712
|
+ str = str.replace(/ /ig, ''); //去掉空格
|
|
|
713
|
+ str = str.replace(/(^\s*)|(\s*$)/g, ""); //去掉空格
|
|
|
714
|
+ str = str.replace(/ /ig, ""); // 全部替换为空字符串
|
|
|
715
|
+ return str;
|
|
|
716
|
+}
|
|
|
717
|
+// 批量替换关键词 - 搜索关键词高亮显示
|
|
|
718
|
+function GetReplaceKey(str, innerHtmlContent, id) {
|
|
|
719
|
+ if (str.trim()) {
|
|
|
720
|
+ var arr = str.split(',');
|
|
|
721
|
+ $.each(arr, function (index, j) {
|
|
|
722
|
+ var reg = new RegExp(j, 'g')
|
|
|
723
|
+ innerHtmlContent = innerHtmlContent.replace(reg, `<font color=#c00>${j}</font>`)
|
|
|
724
|
+ });
|
|
|
725
|
+ document.getElementById(id).innerHTML = innerHtmlContent
|
|
|
726
|
+ }
|
|
|
727
|
+}
|