...
|
...
|
@@ -51,21 +51,28 @@ function setLazyLoadAndMellipsis($infos) { |
|
|
function initInfosEvt($container) {
|
|
|
$container.delegate('.like-btn', 'touchstart', function(e) {
|
|
|
var $likeBtn = $(e.currentTarget),
|
|
|
$info = $likeBtn.closest('.guang-info');
|
|
|
$info = $likeBtn.closest('.guang-info'),
|
|
|
opt = 'ok';
|
|
|
|
|
|
if ($likeBtn.hasClass('like')) {
|
|
|
opt = 'cancel';
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/guang/info/prise', //TODO:cancelPrise
|
|
|
type: 'POST',
|
|
|
url: '/guang/opt/praiseArticle',
|
|
|
data: {
|
|
|
id: $info.data('id')
|
|
|
id: $info.data('id'),
|
|
|
opt: opt
|
|
|
},
|
|
|
success: function(data) {
|
|
|
var code = data.code;
|
|
|
|
|
|
if (code === 200) {
|
|
|
$likeBtn.next('.like-count').text(data.data);
|
|
|
} else if (code === 400) {
|
|
|
tip.show('未登录');
|
|
|
|
|
|
//切换点赞状态
|
|
|
$likeBtn.toggleClass('like');
|
|
|
}
|
|
|
},
|
|
|
error: function() {
|
...
|
...
|
|