From 938bf48d08be3b425786409617448d9311f58abd Mon Sep 17 00:00:00 2001 From: txz Date: Thu, 7 Apr 2016 15:26:23 +0800 Subject: [PATCH] =?UTF-8?q?=E7=82=B9=E8=B5=9E=E5=8A=9F=E8=83=BD=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/activities.html | 4 ++-- public/javascripts/wechat/app.js | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index 716385537..c99c9ee09 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -118,8 +118,8 @@
回复 ({{act.reply_count}})
-
赞 ({{act.activity_praise_count}})
-
已赞 ({{act.activity_praise_count}})
+
赞 ({{act.activity_praise_count}})
+
已赞 ({{act.activity_praise_count}})
diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index 1e0e0f737..cfbda146e 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -10,7 +10,7 @@ app.factory('auth', function($http,$routeParams, $cookies, $q){ var _openid = ''; if(debug===true){ - _openid = "2"; + _openid = "1"; } var getOpenId = function() { @@ -93,14 +93,14 @@ app.controller('ActivityController',function($scope, $http, auth, rms, common){ $scope.loadActData = loadActData; - $scope.addPraise = function(id, type){ - console.log(type); - common.addCommonPraise(id, type); + $scope.addPraise = function(act){ + console.log(act); + common.addCommonPraise(act); } $scope.decreasePraise = function(act){ console.log(act); - common.decreaseCommonPraise(act,'activities'); + common.decreaseCommonPraise(act); } }); @@ -139,14 +139,14 @@ app.factory('common', function($http, auth, $routeParams){ }) }; - var addCommonPraise = function(id, type){ + var addCommonPraise = function(act){ act.activity_praise_count += 1; act.has_praise = true; $http({ method: 'POST', - url: apiUrl + "praise/" +id, - data:{openid:auth.openid(),type:type} + url: apiUrl + "praise/" + act.act_id, + data:{openid:auth.openid(),type:act.act_type} }).then(function successCallback(response) { console.log("点赞成功"); }, function errorCallback(response) { @@ -154,14 +154,14 @@ app.factory('common', function($http, auth, $routeParams){ }; - var decreaseCommonPraise = function(id, type){ + var decreaseCommonPraise = function(act){ act.activity_praise_count -= 1; act.has_praise = false; $http({ method: 'POST', - url: apiUrl + "praise/" +id, - data:{openid:auth.openid(),type:type} + url: apiUrl + "praise/" + act.act_id, + data:{openid:auth.openid(),type:act.act_type} }).then(function successCallback(response) { console.log("取消赞成功"); }, function errorCallback(response) {