diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index 30b4dafaa..ab0e85faf 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -118,7 +118,7 @@
-
+
diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index 59605271c..4c17027e0 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -7,6 +7,7 @@ if(debug===true){ apiUrl = 'https://www.trustie.net/api/v1/'; } + app.factory('auth', function($http,$routeParams, $cookies, $q){ var _openid = ''; @@ -66,7 +67,7 @@ app.factory('rms', function(){ return {save: save, get: get}; }); -app.controller('ActivityController',function($scope, $http, auth, rms, common){ +app.controller('ActivityController',function($anchorScroll, $location,$scope, $http, auth, rms, common){ $scope.replaceUrl = function(url){ return url; }; @@ -76,6 +77,12 @@ app.controller('ActivityController',function($scope, $http, auth, rms, common){ $scope.page = 0; var loadActData = function(page){ + if (page <= 0 && $scope.activities.length >0){ + var yOffset = rms.get("yoffset"); + $location.hash(yOffset); + return; + } + $scope.page = page; $http({ method: 'POST', @@ -109,6 +116,12 @@ app.controller('ActivityController',function($scope, $http, auth, rms, common){ $scope.loadActData = loadActData; + //跳到详情页 + $scope.goDetail = function(type, id){ + rms.save("yoffset", id); + $location.path('/'+type+'/'+id); + } + $scope.addPraise = function(act){ common.addCommonPraise(act); }; @@ -117,6 +130,8 @@ app.controller('ActivityController',function($scope, $http, auth, rms, common){ common.decreaseCommonPraise(act); }; + + }); app.factory('common', function($http, auth, $routeParams){