Closed Jekin6 closed 9 years ago
当点赞一次别人的回复后,再此点击那个回复,弹出的ActionSheet上的按钮上还是显示”赞“,应该显示”已赞“。也就说 下面的已赞逻辑永远走不到 //cnodejs-ionic/app/js/controllers/topic.js
$log.debug('action reply:', reply); var upLabel = '赞'; // detect if current user already do up if (reply.ups.indexOf(currentUser.id) !== -1) { upLabel = '已赞'; } var replyContent = '@' + reply.author.loginname; $ionicActionSheet.show({
原因好像是reply.ups.push('') 应该push(currentUser.id) //cnodejs-ionic/app/js/services/topic.js
upReply: function(replyId) { var currentUser = User.getCurrentUser(); return resource.upReply({ replyId: replyId, accesstoken: currentUser.accesstoken }, null, function(response) { if (response.success) { angular.forEach(topic.replies, function(reply, key) { if (reply.id === replyId) { if (response.action === 'up') { reply.ups.push(''); } else { reply.ups.pop(); }
赞同楼主
当点赞一次别人的回复后,再此点击那个回复,弹出的ActionSheet上的按钮上还是显示”赞“,应该显示”已赞“。也就说 下面的已赞逻辑永远走不到 //cnodejs-ionic/app/js/controllers/topic.js
原因好像是reply.ups.push('') 应该push(currentUser.id) //cnodejs-ionic/app/js/services/topic.js