...
|
...
|
@@ -979,7 +979,6 @@ function fetchComment() { |
|
|
var totalnum;
|
|
|
if (data.code === 200) {
|
|
|
res = data.data;
|
|
|
|
|
|
if (res.length === 0) {
|
|
|
$consultsUl.next('.more-wrap').addClass('hide');
|
|
|
return;
|
...
|
...
|
@@ -989,17 +988,55 @@ function fetchComment() { |
|
|
$consultNum.text(res[0].total);
|
|
|
|
|
|
totalnum = Math.ceil(res[0].total / 10) * 20;
|
|
|
|
|
|
console.log(res);
|
|
|
$consultsUl.empty().append(consultsTpl({
|
|
|
consults: res
|
|
|
}));
|
|
|
|
|
|
$('#consults-ul .zan-content').on('click', '.iconfont', function() {
|
|
|
$('#consults-ul .zan-content').on('click', '.cuslike', function() {
|
|
|
var $this = $(this);
|
|
|
$this.addClass('getzan');
|
|
|
var id = $this.data('id');
|
|
|
var like = $this.data('like');
|
|
|
|
|
|
$.ajax({
|
|
|
type : 'GET',
|
|
|
url : '/product/detail/consult/like/' + id
|
|
|
}).then(function(data){
|
|
|
if(data && data.code === 400){
|
|
|
return window.jumpUrl(data.data.refer);
|
|
|
}
|
|
|
|
|
|
if(data && data.code === 200){
|
|
|
$this.addClass('getzan');
|
|
|
$('.zan-content .icon-border[data-id='+id+'] .likeNum')
|
|
|
.replaceWith('<em class="likeNum">'+(like+1)+'</em>');
|
|
|
}
|
|
|
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
$('#consults-ul .zan-content').on('click', '.cususeful', function() {
|
|
|
var $this = $(this);
|
|
|
var id = $this.data('id');
|
|
|
var useful = $this.data('useful');
|
|
|
$this.addClass('getzan');
|
|
|
$.ajax({
|
|
|
type : 'GET',
|
|
|
url : '/product/detail/consult/useful/' + id
|
|
|
}).then(function(data){
|
|
|
if(data && data.code === 400){
|
|
|
return window.jumpUrl(data.data.refer);
|
|
|
}
|
|
|
|
|
|
if(data && data.code === 200){
|
|
|
$('.zan-content .usefulData[data-id='+id+'] .usefulNum')
|
|
|
.replaceWith('<em class="usefulNum">'+(useful+1)+'</em>');
|
|
|
}
|
|
|
|
|
|
});
|
|
|
});
|
|
|
|
|
|
baseUrl = '/product/detail/consult?productId=' + id + '&filterId=7';
|
|
|
|
|
|
$('.consults-devide').empty().append(
|
...
|
...
|
|