Authored by lijing

投票

... ... @@ -475,14 +475,21 @@
$(this).addClass('isclick');
}
});
$(".vote").click(function() {
if ($(this).hasClass("vote_click")) {
$(this).removeClass("vote_click");
nums--;
} else {
$(this).addClass("vote_click");
nums++;
if (nums > 3) {
diaCover("每人最多投三张票");
$(this).removeClass("vote_click");
nums--;
return;
}
}
});
... ... @@ -544,32 +551,35 @@
// return;
// }
var itemIds = [];
var voted = $(".vote_click");
if (!voted || voted.length == 0) {
diaCover("您还没有投票");
return;
}
if (voted.length > 3) {
diaCover("每人最多投三张票");
return;
}
$(voted).each(function(index, item) {
itemIds.push({
uid : json.data,
voteItemId : $(item).attr("id")
});
});
$.post("/activity/ActVoteResultController/addActVoteResult", {
uid : json.data,
itemIds : JSON.stringify(itemIds)
}, function(data) {
if (!data || data.code != 200) {
diaCover(data.message);
return;
} else {
diaCover("投票成功");
}
}, "json");
if(uid){
if (!voted || voted.length == 0) {
diaCover("您还没有投票");
return;
}
if (voted.length > 3) {
diaCover("每人最多投三张票");
return;
}
$(voted).each(function(index, item) {
itemIds.push({
uid : json.data,
voteItemId : $(item).attr("id")
});
});
$.post("/activity/ActVoteResultController/addActVoteResult", {
uid : json.data,
itemIds : JSON.stringify(itemIds)
}, function(data) {
if (!data || data.code != 200) {
diaCover(data.message);
return;
} else {
diaCover("投票成功");
}
}, "json");
}
});
});
... ...
... ... @@ -247,6 +247,16 @@ img{
$(this).addClass("vote_click");
nums++;
}
var voted = $(".vote_click");
if (!voted || voted.length == 0) {
diaCover("您还没有投票");
return;
}
if (voted.length > 3) {
diaCover("每人最多投三张票");
$(this).removeClass("vote_click");
return;
}
});
$('.vote_button').click(function(){
... ...