Ver Código Fonte

在想客服收藏,发送

lihai 5 anos atrás
pai
commit
1aca6869e1
1 arquivos alterados com 46 adições e 39 exclusões
  1. 46 39
      WebUI/CallCenterWeb.UI/js/chat.js

+ 46 - 39
WebUI/CallCenterWeb.UI/js/chat.js

@@ -345,11 +345,13 @@ function quick_answer(){
345 345
 				token: $.cookie("token")
346 346
 			},
347 347
 			success: function(data) {
348
-				$.each(data.rows, function(i,n) {
349
-					$('<li class="chat_item">'+
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>'+
352
-                            '</li>').appendTo($('.quick_answer'))
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'));
353 355
 				});
354 356
 			}
355 357
 		});
@@ -374,46 +376,51 @@ function knowledge_answer(){
374 376
 					if(contant.length>30){
375 377
 						contants = contant.substr(0, 30) + "...";	
376 378
 					}
377
-					$('<div class="tel_title">'+n.F_Title+'</div><li class="chat_item">'+
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>'+
380
-                            '</li>').appendTo($('.knowledge_anwser'))
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'));
381 383
 				});
382 384
 			}
383 385
 		});
384 386
         	
385 387
 }
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
-//	});
398
-	objs.action = "sersend";
399
-//  objs.code = $("#" + ele).find(".hidcid").val();
388
+function sendMsg(msg,id) {
389
+    $.ajax({
390
+        type: "post",
391
+        url: huayi.config.callcenter_url + "ChatMessages/SendReply",
392
+        async: true,
393
+        data: {
394
+            id: id,
395
+            token: $.cookie('token')
396
+        },
397
+        success: function (result) {
398
+            var result = $.parseJSON(result)
399
+            if (result.state == 'success') {
400
+                layer.msg(result.message);
401
+            }
402
+        }
403
+    });
404
+    objs.action = "sersend";
405
+    //  objs.code = $("#" + ele).find(".hidcid").val();
400 406
     objs.msg = msg;
401 407
     Sends();
402 408
 }
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
-	});
409
+function collection_img(id) {
410
+    $.ajax({
411
+        type: "post",
412
+        url: huayi.config.callcenter_url + "ChatMessages/CollectionReply",
413
+        async: true,
414
+        data: {
415
+            id: id,
416
+            token: $.cookie('token')
417
+        },
418
+        success: function (result) {
419
+            var result = $.parseJSON(result)
420
+            if (result.state == 'success') {
421
+                quick_answer();
422
+                layer.msg(result.message);
423
+            }
424
+        }
425
+    });
419 426
 }