...
|
...
|
@@ -7,18 +7,24 @@ var $ = require('jquery'), |
|
|
Hammer = require('yoho.hammer'),
|
|
|
tip = require('../../plugin/tip');
|
|
|
|
|
|
var likeHammer = new Hammer(document.getElementById('likeBtn'));
|
|
|
var likeHammer = new Hammer(document.getElementById('likeBtn')),
|
|
|
addToCartHammer = new Hammer(document.getElementById('addtoCart'));
|
|
|
|
|
|
var productId = $('#productId').val();
|
|
|
|
|
|
likeHammer.on('tap', function(e) {
|
|
|
var productId = $('#productId').val(),
|
|
|
opt;
|
|
|
var opt,
|
|
|
favorite;
|
|
|
|
|
|
|
|
|
var $this = $(this);
|
|
|
|
|
|
if ($this.hasClass('liked')) {
|
|
|
opt = 'cancel';
|
|
|
favorite = 0;
|
|
|
} else {
|
|
|
opt = 'ok';
|
|
|
favorite = 1;
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
...
|
...
|
@@ -36,6 +42,14 @@ likeHammer.on('tap', function(e) { |
|
|
} else {
|
|
|
tip.show(data.message);
|
|
|
}
|
|
|
|
|
|
// 统计代码:用于统计用户加入或取消商品收藏的动作
|
|
|
if (window._yas) {
|
|
|
window._yas.sendCustomInfo({
|
|
|
pd: productId,
|
|
|
fa: favorite
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
...
|
...
|
@@ -44,6 +58,15 @@ likeHammer.on('tap', function(e) { |
|
|
|
|
|
});
|
|
|
|
|
|
// $('#likeBtn').on('click', function(e) {
|
|
|
// return false;
|
|
|
// }); |
|
|
\ No newline at end of file |
|
|
addToCartHammer.on('tap', function(e) {
|
|
|
|
|
|
// 统计代码:用于统计用户加入购物车的动作
|
|
|
if (window._yas) {
|
|
|
window._yas.sendCustomInfo({
|
|
|
pd: productId,
|
|
|
by: 1
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
...
|
...
|
|