...
|
...
|
@@ -11,30 +11,17 @@ |
|
|
var goodsConsultsEle = $('#goods-consults')[0],
|
|
|
goodsConsultsHammer = goodsConsultsEle && new Hammer(goodsConsultsEle);
|
|
|
|
|
|
// $favBtn.on('click', function() {
|
|
|
// var id = $(this).closest('.consult-item').data('id'),
|
|
|
// $that = $(this),
|
|
|
// count = $that.find('.count').html() - 0;
|
|
|
// if (!$(this).hasClass('highlight')) {
|
|
|
// $.ajax({
|
|
|
// method: 'post',
|
|
|
// url: '/home/upxxDown',
|
|
|
// data: {
|
|
|
// consult_id: id
|
|
|
// }
|
|
|
// }).done(function(data) {
|
|
|
// if (data.code === 200) {
|
|
|
// $that.addClass('highlight');
|
|
|
// $that.find('.count').html(count+1);
|
|
|
// } else if (data.code === 400) {
|
|
|
// location.href = data.data;//未登录跳转登录页
|
|
|
// }
|
|
|
// }).fail(function(data) {
|
|
|
// $that.addClass('highlight');
|
|
|
// $that.find('.count').html(count+1);
|
|
|
// });
|
|
|
// }
|
|
|
// });
|
|
|
function showCountPlus($el) {
|
|
|
var $count = $el.find('.animate-count');
|
|
|
$count.css('display','inline');
|
|
|
$count.animate({
|
|
|
opacity: 0.25,
|
|
|
fontSize: '0.7rem',
|
|
|
right: '-=5'
|
|
|
}, 300, function () {
|
|
|
$count.css('display', 'none');
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (goodsConsultsHammer) {
|
|
|
|
...
|
...
|
@@ -48,22 +35,23 @@ if (goodsConsultsHammer) { |
|
|
if (!$this.hasClass('highlight')) {
|
|
|
|
|
|
if ($this.hasClass('fav')) {
|
|
|
url = '/product/opt/fav';
|
|
|
} else if ($this.hasClass('usefull')) {
|
|
|
url = '/product/opt/usefull';
|
|
|
url = '/product/detail/consultupvote';
|
|
|
} else if ($this.hasClass('useful')) {
|
|
|
url = '/product/detail/consultuseful';
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
method: 'post',
|
|
|
url: url,
|
|
|
data: {
|
|
|
consult_id: id
|
|
|
id: id
|
|
|
}
|
|
|
}).done(function(data) {
|
|
|
if (data.code === 200) {
|
|
|
showCountPlus($this);
|
|
|
$this.addClass('highlight');
|
|
|
$this.find('.count').html(count + 1);
|
|
|
} else if (data.code === 400) {
|
|
|
} else if (data.code === 401) {
|
|
|
location.href = data.data;//未登录跳转登录页
|
|
|
}
|
|
|
}).fail(function(data) {
|
...
|
...
|
@@ -72,4 +60,4 @@ if (goodsConsultsHammer) { |
|
|
|
|
|
}
|
|
|
});
|
|
|
} |
|
|
\ No newline at end of file |
|
|
} |
...
|
...
|
|