|
|
@@ -181,8 +181,6 @@ function getmore(ele) {
|
|
181
|
181
|
//发送消息
|
|
182
|
182
|
function sendinfo(ele) {
|
|
183
|
183
|
var msg = $("#" + ele).find(".send_content").val();
|
|
184
|
|
- console.log(msg)
|
|
185
|
|
- return false;
|
|
186
|
184
|
if ($.trim(msg)) {
|
|
187
|
185
|
objs.action = "sersend";
|
|
188
|
186
|
objs.code = $("#" + ele).find(".hidcid").val();
|
|
|
@@ -312,12 +310,27 @@ knowledge_answer();
|
|
312
|
310
|
//快速回复搜索
|
|
313
|
311
|
$('.Seach_answer').on('click',function(){
|
|
314
|
312
|
quick_answer();
|
|
315
|
|
-// var content = document.getElementById('quick_answer');
|
|
316
|
|
-// var keyword_answer = document.getElementById("key_answer");
|
|
317
|
|
-// var contents =content.innerHTML;
|
|
318
|
|
-// var keyWords = keyword_answer.value;
|
|
319
|
|
-// var cut = contents.split(keyWords);
|
|
320
|
|
-// content.innerHTML = cut.join('<span style="color:red;">' + keyWords + '</span>');
|
|
|
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=#FF6633>${keywords}</font>`)
|
|
|
318
|
+ document.getElementById('quick_answer').innerHTML=newStr
|
|
|
319
|
+ }
|
|
|
320
|
+})
|
|
|
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=#FF6633>${keywords1}</font>`)
|
|
|
331
|
+ console.log(newStr1);
|
|
|
332
|
+ document.getElementById('knowledge_anwser').innerHTML=newStr1
|
|
|
333
|
+ }
|
|
321
|
334
|
})
|
|
322
|
335
|
//快速回复
|
|
323
|
336
|
function quick_answer(){
|
|
|
@@ -334,8 +347,8 @@ function quick_answer(){
|
|
334
|
347
|
success: function(data) {
|
|
335
|
348
|
$.each(data.rows, function(i,n) {
|
|
336
|
349
|
$('<li class="chat_item">'+
|
|
337
|
|
- '<span title="'+n.F_ReplyContent+'">'+n.F_ReplyContent+'</span>'+
|
|
338
|
|
- '<button type="button" class="btn btn-primary btn-sm" onclick=sendMsg("'+n.F_ReplyContent+'")>发送</button> <span class="collection"><img src="./img/collection.png"/></span>'+
|
|
|
350
|
+ '<span class="answer_text" title="'+n.F_ReplyContent+'">'+n.F_ReplyContent+'</span>'+
|
|
|
351
|
+ '<button type="button" class="btn btn-primary btn-sm" onclick=sendMsg("'+n.F_ReplyContent+'")>发送</button> <span class="collection"><img onclick="collection_img('+n.F_Id+')" src="./img/collection.png"/></span>'+
|
|
339
|
352
|
'</li>').appendTo($('.quick_answer'))
|
|
340
|
353
|
});
|
|
341
|
354
|
}
|
|
|
@@ -357,12 +370,13 @@ function knowledge_answer(){
|
|
357
|
370
|
},
|
|
358
|
371
|
success: function(data) {
|
|
359
|
372
|
$.each(data.rows, function(i,n) {
|
|
360
|
|
- if(n.F_Description.length>30){
|
|
361
|
|
- var contant = n.F_Description.substr(0, 30) + "...";
|
|
|
373
|
+ var contant=n.F_Content.replace(/<[^>]+>/g,"");
|
|
|
374
|
+ if(contant.length>30){
|
|
|
375
|
+ contants = contant.substr(0, 30) + "...";
|
|
362
|
376
|
}
|
|
363
|
377
|
$('<div class="tel_title">'+n.F_Title+'</div><li class="chat_item">'+
|
|
364
|
|
- '<span title="'+n.F_Description+'">'+contant+'</span>'+
|
|
365
|
|
- '<button type="button" class="btn btn-primary btn-sm">发送</button> <span class="collection"><img src="./img/collection.png"/></span>'+
|
|
|
378
|
+ '<span title="'+n.F_Description+'">'+contants+'</span>'+
|
|
|
379
|
+ '<button type="button" class="btn btn-primary btn-sm" onclick=sendMsg("'+contant+'")>发送</button> <span class="collection"><img onclick="collection_img('+n.F_CategoryId+')" src="./img/collection.png"/></span>'+
|
|
366
|
380
|
'</li>').appendTo($('.knowledge_anwser'))
|
|
367
|
381
|
});
|
|
368
|
382
|
}
|
|
|
@@ -370,8 +384,36 @@ function knowledge_answer(){
|
|
370
|
384
|
|
|
371
|
385
|
}
|
|
372
|
386
|
function sendMsg(msg){
|
|
|
387
|
+// $.ajax({
|
|
|
388
|
+// type:"get",
|
|
|
389
|
+// url:huayi.config.callcenter_url + "ChatMessages/SendReply",
|
|
|
390
|
+// async:true,
|
|
|
391
|
+// data:{
|
|
|
392
|
+// id:id,
|
|
|
393
|
+// token:$.cookie('token')
|
|
|
394
|
+// },
|
|
|
395
|
+// success:function(result){
|
|
|
396
|
+// }
|
|
|
397
|
+// });
|
|
373
|
398
|
objs.action = "sersend";
|
|
374
|
399
|
// objs.code = $("#" + ele).find(".hidcid").val();
|
|
375
|
400
|
objs.msg = msg;
|
|
376
|
401
|
Sends();
|
|
377
|
402
|
}
|
|
|
403
|
+function collection_img(id){
|
|
|
404
|
+ $.ajax({
|
|
|
405
|
+ type:"post",
|
|
|
406
|
+ url:huayi.config.callcenter_url + "ChatMessages/CollectionReply",
|
|
|
407
|
+ async:true,
|
|
|
408
|
+ data:{
|
|
|
409
|
+ id:id,
|
|
|
410
|
+ token:$.cookie('token')
|
|
|
411
|
+ },
|
|
|
412
|
+ success:function(result){
|
|
|
413
|
+ var result=$.parseJSON(result)
|
|
|
414
|
+ if(result.state =='success'){
|
|
|
415
|
+ layer.msg('收藏成功')
|
|
|
416
|
+ }
|
|
|
417
|
+ }
|
|
|
418
|
+ });
|
|
|
419
|
+}
|