diff --git a/public/assets/wechat/class_list.html b/public/assets/wechat/class_list.html index 69a3db43c..dafce2cfc 100644 --- a/public/assets/wechat/class_list.html +++ b/public/assets/wechat/class_list.html @@ -1,34 +1,35 @@
课程列表
- -
+
我创建的课程
-
{{syllabus.title}}
-
    -
  • - - - > - {{course.member_count}}人 -
  • -
+
+
{{syllabus.title}}
+
    +
  • + + + > + {{course.member_count}}人 +
  • +
+
- -
+
我参与的课程
-
{{syllabus.title}}
-
    -
  • - - - > - {{course.member_count}}人 -
  • -
+
+
{{syllabus.title}}
+
    +
  • + + + > + {{course.member_count}}人 +
  • +
+
-
新建课程 加入班级 diff --git a/public/javascripts/wechat/controllers/activity.js b/public/javascripts/wechat/controllers/activity.js index b89c46300..16a8e71d0 100644 --- a/public/javascripts/wechat/controllers/activity.js +++ b/public/javascripts/wechat/controllers/activity.js @@ -137,6 +137,9 @@ app.controller('ActivityController', //跳到详情页 $scope.goDetail = function(type, act_id,id){ rms.save("yoffset", window.document.body.scrollTop); + rms.save("activities",$scope.activities); + rms.save("course_activities",$scope.course_activities); + rms.save("project_activities",$scope.project_activities); $location.path('/'+type+'/'+act_id); } diff --git a/public/javascripts/wechat/others/factory.js b/public/javascripts/wechat/others/factory.js index 6acf25c59..64204dfca 100644 --- a/public/javascripts/wechat/others/factory.js +++ b/public/javascripts/wechat/others/factory.js @@ -86,7 +86,7 @@ app.factory('rms', function(){ return {save: save, get: get}; }); -app.factory('common', ['$http', 'auth', '$routeParams', function($http, auth, $routeParams){ +app.factory('common', ['$http', 'auth', '$routeParams','rms', function($http, auth, $routeParams,rms){ var addCommonReply = function(id, type, data, cb){ if(!data.comment || data.comment.length<=0){ @@ -174,8 +174,71 @@ app.factory('common', ['$http', 'auth', '$routeParams', function($http, auth, $r } }); }; - args.scope.addPraise = addCommonPraise; - args.scope.decreasePraise = decreaseCommonPraise; + +// 动态详情界面点赞与动态界面的数据要同步 保证进入详情点赞后出来显示一致 + args.scope.addPraise = function(act){ + activities = rms.get("activities") || []; + course_activities = rms.get("course_activities") || []; + project_activities = rms.get("project_activities") || []; + for(var i in activities){ + if(activities[i].act_id == act.act_id){ + activities[i].praise_count += 1; + activities[i].has_praise = true; + break; + } + } + for(var i in course_activities){ + if(course_activities[i].act_id == act.act_id){ + course_activities[i].praise_count += 1; + course_activities[i].has_praise = true; + break; + } + } + for(var i in project_activities){ + if(project_activities[i].act_id == act.act_id){ + project_activities[i].praise_count += 1; + project_activities[i].has_praise = true; + break; + } + } + rms.save("activities",activities); + rms.save("course_activities",course_activities); + rms.save("project_activities",project_activities); + + addCommonPraise(act); + }; + + args.scope.decreasePraise = function(act){ + activities = rms.get("activities") || []; + course_activities = rms.get("course_activities") || []; + project_activities = rms.get("project_activities") || []; + for(var i in activities){ + if(activities[i].act_id == act.act_id){ + activities[i].praise_count -= 1; + activities[i].has_praise = false; + break; + } + } + for(var i in course_activities){ + if(course_activities[i].act_id == act.act_id){ + course_activities[i].praise_count -= 1; + course_activities[i].has_praise = false; + break; + } + } + for(var i in project_activities){ + if(project_activities[i].act_id == act.act_id){ + project_activities[i].praise_count -= 1; + project_activities[i].has_praise = false; + break; + } + } + rms.save("activities",activities); + rms.save("course_activities",course_activities); + rms.save("project_activities",project_activities); + + decreaseCommonPraise(act); + }; } return {init: init, addCommonReply: addCommonReply, loadCommonData: loadCommonData, addCommonPraise: addCommonPraise, decreaseCommonPraise: decreaseCommonPraise};