...
|
...
|
@@ -55,16 +55,19 @@ function initInfosEvt($container) { |
|
|
|
|
|
cHammer = new Hammer($container[0]);
|
|
|
|
|
|
//点赞或者收藏事件
|
|
|
cHammer.on('tap', function(e) {
|
|
|
var $this = $(e.target),
|
|
|
opt = 'ok',
|
|
|
$likeBtn,
|
|
|
$collectBtn,
|
|
|
$btn,
|
|
|
$info;
|
|
|
|
|
|
$likeBtn = $this.closest('.like-btn');
|
|
|
if ($likeBtn.length > 0) {
|
|
|
if ($likeBtn.hasClass('like')) {
|
|
|
e.preventDefault();
|
|
|
|
|
|
//点赞
|
|
|
$btn = $this.closest('.like-btn');
|
|
|
if ($btn.length > 0) {
|
|
|
if ($btn.hasClass('like')) {
|
|
|
opt = 'cancel';
|
|
|
}
|
|
|
|
...
|
...
|
@@ -80,22 +83,23 @@ function initInfosEvt($container) { |
|
|
var code = data.code;
|
|
|
|
|
|
if (code === 200) {
|
|
|
$likeBtn.next('.like-count').text(data.data);
|
|
|
$btn.next('.like-count').text(data.data);
|
|
|
|
|
|
//切换点赞状态
|
|
|
$likeBtn.toggleClass('like');
|
|
|
$btn.toggleClass('like');
|
|
|
}
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
// 2015/11/03 hf: 增加APP里的收藏资讯功能. 写得不对的地方还请大神修改!
|
|
|
$collectBtn = $this.closest('.collect-btn');
|
|
|
if ($collectBtn.length > 0) {
|
|
|
if ($collectBtn.hasClass('collected')) {
|
|
|
//APP收藏
|
|
|
$btn = $this.closest('.collect-btn');
|
|
|
if ($btn.length > 0) {
|
|
|
if ($btn.hasClass('collected')) {
|
|
|
opt = 'cancel';
|
|
|
}
|
|
|
|
...
|
...
|
@@ -111,7 +115,7 @@ function initInfosEvt($container) { |
|
|
if (data.code && data.code === 200) {
|
|
|
|
|
|
//切换收藏状态
|
|
|
$collectBtn.toggleClass('collected');
|
|
|
$btn.toggleClass('collected');
|
|
|
}
|
|
|
},
|
|
|
error: function() {
|
...
|
...
|
|