点赞功能修改
This commit is contained in:
parent
60c8320f82
commit
139a7931ee
|
@ -15,20 +15,21 @@ module Mobile
|
||||||
obj_id = params[:id]
|
obj_id = params[:id]
|
||||||
obj_type = params[:type]
|
obj_type = params[:type]
|
||||||
user = UserWechat.find_by_openid(params[:openid]).user
|
user = UserWechat.find_by_openid(params[:openid]).user
|
||||||
obj = PraiseTreadCache.find_object_by_type_and_id(obj_id,obj_type)
|
pts = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",obj_id,obj_type.to_s,user.id).first
|
||||||
pts = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",obj_id,obj_type.to_s,user.id)
|
if pts.blank?
|
||||||
if pts.empty?
|
|
||||||
praise_or_cancel(obj_type,obj_id,user,1)
|
praise_or_cancel(obj_type,obj_id,user,1)
|
||||||
num = get_activity_praise_num(obj)
|
obj = PraiseTreadCache.where("object_id=? and object_type=?",obj_id,obj_type.to_s).first
|
||||||
|
num = get_activity_praise_num(obj) if !obj.blank?
|
||||||
else
|
else
|
||||||
pts.delete if !pts.empty?
|
pts.destroy if !pts.blank?
|
||||||
#再更新praise_tread_cache表 使相应的记录减1 当为0时删除
|
#再更新praise_tread_cache表 使相应的记录减1 当为0时删除
|
||||||
ptc = PraiseTreadCache.where("object_id=? and object_type=?",obj_id,obj_type.to_s).first
|
ptc = PraiseTreadCache.where("object_id=? and object_type=?",obj_id,obj_type.to_s).first
|
||||||
ptc.praise_minus(1) if !ptc.nil?
|
ptc.praise_minus(1) if !ptc.blank?
|
||||||
if ptc.praise_num == 0
|
if ptc.praise_num == 0
|
||||||
ptc.delete
|
ptc.delete
|
||||||
end
|
end
|
||||||
num = get_activity_praise_num(obj)
|
obj = PraiseTreadCache.where("object_id=? and object_type=?",obj_id,obj_type.to_s).first
|
||||||
|
num = !obj.blank? ? get_activity_praise_num(obj) : 0
|
||||||
end
|
end
|
||||||
|
|
||||||
present :data, num
|
present :data, num
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive">
|
<div class="post-interactive">
|
||||||
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" ng-href="#/homework/{{act.act_id}}" class="c-grey">回复 ({{act.reply_count}})</a></div>
|
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" ng-href="#/homework/{{act.act_id}}" class="c-grey">回复 ({{act.reply_count}})</a></div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="!act.has_praise" ng-click="addPraise(act);">赞 ({{act.activity_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="!act.has_praise" ng-click="addPraise(act);">赞 ({{act.praise_count}})</div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="act.has_praise" ng-click="decreasePraise(act);">已赞 ({{act.activity_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="act.has_praise" ng-click="decreasePraise(act);">已赞 ({{act.praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -49,8 +49,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive">
|
<div class="post-interactive">
|
||||||
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" ng-href="#/course_notice/{{act.act_id}}" class="c-grey">回复 ({{act.reply_count}})</a></div>
|
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" ng-href="#/course_notice/{{act.act_id}}" class="c-grey">回复 ({{act.reply_count}})</a></div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="!act.has_praise" ng-click="addPraise(act);">赞 ({{act.activity_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="!act.has_praise" ng-click="addPraise(act);">赞 ({{act.praise_count}})</div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="act.has_praise" ng-click="decreasePraise(act);">已赞 ({{act.activity_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="act.has_praise" ng-click="decreasePraise(act);">已赞 ({{act.praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -73,8 +73,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive">
|
<div class="post-interactive">
|
||||||
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" ng-href="#/course_discussion/{{act.act_id}}" class="c-grey">回复 ({{act.reply_count}})</a></div>
|
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" ng-href="#/course_discussion/{{act.act_id}}" class="c-grey">回复 ({{act.reply_count}})</a></div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="!act.has_praise" ng-click="addPraise(act);">赞 ({{act.activity_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="!act.has_praise" ng-click="addPraise(act);">赞 ({{act.praise_count}})</div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="act.has_praise" ng-click="decreasePraise(act);">已赞 ({{act.activity_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="act.has_praise" ng-click="decreasePraise(act);">已赞 ({{act.praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -118,8 +118,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive">
|
<div class="post-interactive">
|
||||||
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" ng-href="#/issues/{{act.act_id}}" class="c-grey"> 回复 ({{act.reply_count}})</a></div>
|
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" ng-href="#/issues/{{act.act_id}}" class="c-grey"> 回复 ({{act.reply_count}})</a></div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="!act.has_praise" ng-click="addPraise(act);">赞 ({{act.activity_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="!act.has_praise" ng-click="addPraise(act);">赞 ({{act.praise_count}})</div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="act.has_praise" ng-click="decreasePraise(act);">已赞 ({{act.activity_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="act.has_praise" ng-click="decreasePraise(act);">已赞 ({{act.praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -144,8 +144,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive">
|
<div class="post-interactive">
|
||||||
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" ng-href="#/project_discussion/{{act.act_id}}" class="c-grey"> 回复 ({{act.reply_count}}) </a></div>
|
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" ng-href="#/project_discussion/{{act.act_id}}" class="c-grey"> 回复 ({{act.reply_count}}) </a></div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="!act.has_praise" ng-click="addPraise(act);">赞 ({{act.activity_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="!act.has_praise" ng-click="addPraise(act);">赞 ({{act.praise_count}})</div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="act.has_praise" ng-click="decreasePraise(act);">已赞 ({{act.activity_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="act.has_praise" ng-click="decreasePraise(act);">已赞 ({{act.praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -182,8 +182,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive">
|
<div class="post-interactive">
|
||||||
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" ng-href="#/journal_for_message/{{act.act_id}}" class="c-grey"> 回复 ({{act.reply_count}})</a></div>
|
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" ng-href="#/journal_for_message/{{act.act_id}}" class="c-grey"> 回复 ({{act.reply_count}})</a></div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="!act.has_praise" ng-click="addPraise(act);">赞 ({{act.activity_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="!act.has_praise" ng-click="addPraise(act);">赞 ({{act.praise_count}})</div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="act.has_praise" ng-click="decreasePraise(act);">已赞 ({{act.activity_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="act.has_praise" ng-click="decreasePraise(act);">已赞 ({{act.praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -207,8 +207,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive">
|
<div class="post-interactive">
|
||||||
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" ng-href="#/blog_comment/{{act.act_id}}" class="c-grey"> 回复 ({{act.reply_count}})</a></div>
|
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" ng-href="#/blog_comment/{{act.act_id}}" class="c-grey"> 回复 ({{act.reply_count}})</a></div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="!act.has_praise" ng-click="addPraise(act);">赞 ({{act.activity_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="!act.has_praise" ng-click="addPraise(act);">赞 ({{act.praise_count}})</div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="act.has_praise" ng-click="decreasePraise(act);">已赞 ({{act.activity_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="act.has_praise" ng-click="decreasePraise(act);">已赞 ({{act.praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive border-bottom">
|
<div class="post-interactive border-bottom">
|
||||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{blog.comments_count}})</span></div>
|
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{blog.comments_count}})</span></div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="blog.has_praise" ng-click="addPraise(blog);">已赞 ({{blog.blog_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="blog.has_praise" ng-click="decreasePraise(blog);">已赞 ({{blog.praise_count}})</div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="!blog.has_praise" ng-click="addPraise(blog);">赞 ({{blog.blog_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="!blog.has_praise" ng-click="addPraise(blog);">赞 ({{blog.praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="all_blog_reply">
|
<div id="all_blog_reply">
|
||||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in blog.blog_comment_children">
|
<div class="post-reply-wrap border-bottom" ng-repeat="journal in blog.blog_comment_children">
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive border-bottom">
|
<div class="post-interactive border-bottom">
|
||||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{discussion.replies_count}})</span></div>
|
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{discussion.replies_count}})</span></div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="discussion.has_praise" ng-click="addPraise(discussion);">已赞 ({{discussion.message_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="discussion.has_praise" ng-click="decreasePraise(discussion);">已赞 ({{discussion.praise_count}})</div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="!discussion.has_praise" ng-click="addPraise(discussion);">赞 ({{discussion.message_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="!discussion.has_praise" ng-click="addPraise(discussion);">赞 ({{discussion.praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="all_course_message_reply">
|
<div id="all_course_message_reply">
|
||||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in discussion.message_children">
|
<div class="post-reply-wrap border-bottom" ng-repeat="journal in discussion.message_children">
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive border-bottom">
|
<div class="post-interactive border-bottom">
|
||||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{news.comments_count}})</span></div>
|
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{news.comments_count}})</span></div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="news.has_praise" ng-click="addPraise(news);">已赞 ({{news.news_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="news.has_praise" ng-click="decreasePraise(news);">已赞 ({{news.praise_count}})</div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="!news.has_praise" ng-click="addPraise(news);">赞 ({{news.news_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="!news.has_praise" ng-click="addPraise(news);">赞 ({{news.praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="all_news_reply">
|
<div id="all_news_reply">
|
||||||
<div class="post-reply-wrap border-bottom" ng-repeat="comments in news.comments">
|
<div class="post-reply-wrap border-bottom" ng-repeat="comments in news.comments">
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive border-bottom">
|
<div class="post-interactive border-bottom">
|
||||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{homework.whomework_journal_count}})</span></div>
|
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{homework.whomework_journal_count}})</span></div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="homework.has_praise" ng-click="addPraise(homework);">已赞 ({{homework.whomework_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="homework.has_praise" ng-click="decreasePraise(homework);">已赞 ({{homework.praise_count}})</div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="!homework.has_praise" ng-click="addPraise(homework);">赞 ({{homework.whomework_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="!homework.has_praise" ng-click="addPraise(homework);">赞 ({{homework.praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="all_homework_reply">
|
<div id="all_homework_reply">
|
||||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in homework.journals_for_messages">
|
<div class="post-reply-wrap border-bottom" ng-repeat="journal in homework.journals_for_messages">
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive border-bottom">
|
<div class="post-interactive border-bottom">
|
||||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{issue.journals_count}})</span></div>
|
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{issue.journals_count}})</span></div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="!issue.has_praise" ng-click="addPraise(issue);">已赞 ({{issue.issue_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="issue.has_praise" ng-click="decreasePraise(issue);">已赞 ({{issue.praise_count}})</div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="issue.has_praise" ng-click="addPraise(issue);">赞 ({{issue.issue_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="!issue.has_praise" ng-click="addPraise(issue);">赞 ({{issue.praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="all_issue_reply">
|
<div id="all_issue_reply">
|
||||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in issue.issue_journals">
|
<div class="post-reply-wrap border-bottom" ng-repeat="journal in issue.issue_journals">
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive border-bottom">
|
<div class="post-interactive border-bottom">
|
||||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{message.reply_count}})</span></div>
|
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{message.reply_count}})</span></div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="message.has_praise" ng-click="addPraise(message);">已赞 ({{message.message_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="message.has_praise" ng-click="decreasePraise(message);">已赞 ({{message.praise_count}})</div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="!message.has_praise" ng-click="addPraise(message);">赞 ({{message.message_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="!message.has_praise" ng-click="addPraise(message);">赞 ({{message.praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="all_message_reply">
|
<div id="all_message_reply">
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive border-bottom">
|
<div class="post-interactive border-bottom">
|
||||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{discussion.replies_count}})</span></div>
|
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{discussion.replies_count}})</span></div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="discussion.has_praise" ng-click="addPraise(discussion);">已赞 ({{discussion.message_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="discussion.has_praise" ng-click="decreasePraise(discussion);">已赞 ({{discussion.praise_count}})</div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="!discussion.has_praise" ng-click="addPraise(discussion);">赞 ({{discussion.message_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="!discussion.has_praise" ng-click="addPraise(discussion);">赞 ({{discussion.praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="all_course_message_reply">
|
<div id="all_course_message_reply">
|
||||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in discussion.message_children">
|
<div class="post-reply-wrap border-bottom" ng-repeat="journal in discussion.message_children">
|
||||||
|
|
|
@ -96,12 +96,12 @@ app.controller('ActivityController',function($scope, $http, auth, rms, common){
|
||||||
$scope.addPraise = function(act){
|
$scope.addPraise = function(act){
|
||||||
console.log(act);
|
console.log(act);
|
||||||
common.addCommonPraise(act);
|
common.addCommonPraise(act);
|
||||||
}
|
};
|
||||||
|
|
||||||
$scope.decreasePraise = function(act){
|
$scope.decreasePraise = function(act){
|
||||||
console.log(act);
|
console.log(act);
|
||||||
common.decreaseCommonPraise(act);
|
common.decreaseCommonPraise(act);
|
||||||
}
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ app.factory('common', function($http, auth, $routeParams){
|
||||||
};
|
};
|
||||||
|
|
||||||
var addCommonPraise = function(act){
|
var addCommonPraise = function(act){
|
||||||
act.activity_praise_count += 1;
|
act.praise_count += 1;
|
||||||
act.has_praise = true;
|
act.has_praise = true;
|
||||||
|
|
||||||
$http({
|
$http({
|
||||||
|
@ -155,7 +155,7 @@ app.factory('common', function($http, auth, $routeParams){
|
||||||
};
|
};
|
||||||
|
|
||||||
var decreaseCommonPraise = function(act){
|
var decreaseCommonPraise = function(act){
|
||||||
act.activity_praise_count -= 1;
|
act.praise_count -= 1;
|
||||||
act.has_praise = false;
|
act.has_praise = false;
|
||||||
|
|
||||||
$http({
|
$http({
|
||||||
|
@ -163,7 +163,7 @@ app.factory('common', function($http, auth, $routeParams){
|
||||||
url: apiUrl + "praise/" + act.act_id,
|
url: apiUrl + "praise/" + act.act_id,
|
||||||
data:{openid:auth.openid(),type:act.act_type}
|
data:{openid:auth.openid(),type:act.act_type}
|
||||||
}).then(function successCallback(response) {
|
}).then(function successCallback(response) {
|
||||||
console.log("取消赞成功");
|
console.log(response.data);
|
||||||
}, function errorCallback(response) {
|
}, function errorCallback(response) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -192,6 +192,16 @@ app.controller('IssueController', function($scope, $http, $routeParams, auth, co
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.addPraise = function(act){
|
||||||
|
console.log(act);
|
||||||
|
common.addCommonPraise(act);
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.decreasePraise = function(act){
|
||||||
|
console.log(act);
|
||||||
|
common.decreaseCommonPraise(act);
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
app.controller('HomeworkController', function($scope, $http, $routeParams, auth, common){
|
app.controller('HomeworkController', function($scope, $http, $routeParams, auth, common){
|
||||||
|
@ -214,6 +224,16 @@ app.controller('HomeworkController', function($scope, $http, $routeParams, auth,
|
||||||
loadData($routeParams.id);
|
loadData($routeParams.id);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.addPraise = function(act){
|
||||||
|
console.log(act);
|
||||||
|
common.addCommonPraise(act);
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.decreasePraise = function(act){
|
||||||
|
console.log(act);
|
||||||
|
common.decreaseCommonPraise(act);
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
app.controller('CourseNoticeController', function($scope, $http, $routeParams, auth, common){
|
app.controller('CourseNoticeController', function($scope, $http, $routeParams, auth, common){
|
||||||
|
@ -235,7 +255,17 @@ app.controller('CourseNoticeController', function($scope, $http, $routeParams, a
|
||||||
$scope.formData = {comment: ''};
|
$scope.formData = {comment: ''};
|
||||||
loadData($routeParams.id);
|
loadData($routeParams.id);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
|
$scope.addPraise = function(act){
|
||||||
|
console.log(act);
|
||||||
|
common.addCommonPraise(act);
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.decreasePraise = function(act){
|
||||||
|
console.log(act);
|
||||||
|
common.decreaseCommonPraise(act);
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
app.controller('DiscussionController', function($scope, $http, $routeParams, auth, common){
|
app.controller('DiscussionController', function($scope, $http, $routeParams, auth, common){
|
||||||
|
@ -257,7 +287,17 @@ app.controller('DiscussionController', function($scope, $http, $routeParams, aut
|
||||||
$scope.formData = {comment: ''};
|
$scope.formData = {comment: ''};
|
||||||
loadData($routeParams.id);
|
loadData($routeParams.id);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
|
$scope.addPraise = function(act){
|
||||||
|
console.log(act);
|
||||||
|
common.addCommonPraise(act);
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.decreasePraise = function(act){
|
||||||
|
console.log(act);
|
||||||
|
common.decreaseCommonPraise(act);
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
app.controller('JournalsController', function($scope, $http, $routeParams, auth, common){
|
app.controller('JournalsController', function($scope, $http, $routeParams, auth, common){
|
||||||
|
@ -280,6 +320,16 @@ app.controller('JournalsController', function($scope, $http, $routeParams, auth,
|
||||||
loadData($routeParams.id);
|
loadData($routeParams.id);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.addPraise = function(act){
|
||||||
|
console.log(act);
|
||||||
|
common.addCommonPraise(act);
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.decreasePraise = function(act){
|
||||||
|
console.log(act);
|
||||||
|
common.decreaseCommonPraise(act);
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
app.controller('BlogController', function($scope, $http, $routeParams, auth, common){
|
app.controller('BlogController', function($scope, $http, $routeParams, auth, common){
|
||||||
|
@ -302,6 +352,16 @@ app.controller('BlogController', function($scope, $http, $routeParams, auth, com
|
||||||
loadData($routeParams.id);
|
loadData($routeParams.id);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.addPraise = function(act){
|
||||||
|
console.log(act);
|
||||||
|
common.addCommonPraise(act);
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.decreasePraise = function(act){
|
||||||
|
console.log(act);
|
||||||
|
common.decreaseCommonPraise(act);
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
app.filter('safeHtml', function ($sce) {
|
app.filter('safeHtml', function ($sce) {
|
||||||
|
|
Loading…
Reference in New Issue