Merge branch 'weixin_guange' of https://git.trustie.net/jacknudt/trustieforge into weixin_guange

This commit is contained in:
txz 2016-04-08 10:10:19 +08:00
commit 4ab96586de
2 changed files with 7 additions and 3 deletions

View File

@ -219,7 +219,9 @@
</div> </div>
<div id="more_activities" class="more-events mt10" ng-click="loadActData(page+1);">更多</div> <div ng-if="(count + page * 10) < all_count">
<div id="more_activities" class="more-events mt10" ng-click="loadActData(page+1);">更多</div>
</div>
</div> </div>

View File

@ -1,6 +1,6 @@
var app = angular.module('wechat', ['ngRoute','ngCookies']); var app = angular.module('wechat', ['ngRoute','ngCookies']);
var apiUrl = 'http://wechat.trustie.net/api/v1/'; var apiUrl = 'http://wechat.trustie.net/api/v1/';
var debug = true; //调试标志,如果在本地请置为true var debug = false; //调试标志,如果在本地请置为true
if(debug===true){ if(debug===true){
apiUrl = 'http://localhost:3000/api/v1/'; apiUrl = 'http://localhost:3000/api/v1/';
@ -68,7 +68,7 @@ app.controller('ActivityController',function($scope, $http, auth, rms, common){
console.log("ActivityController load"); console.log("ActivityController load");
$scope.activities = rms.get("activities") || []; $scope.activities = rms.get("activities") || [];
$scope.page = 1; $scope.page = 0;
var loadActData = function(page){ var loadActData = function(page){
$scope.page = page; $scope.page = page;
@ -78,6 +78,8 @@ app.controller('ActivityController',function($scope, $http, auth, rms, common){
data: {openid: auth.openid(), page: page} data: {openid: auth.openid(), page: page}
}).then(function successCallback(response) { }).then(function successCallback(response) {
$scope.activities = $scope.activities.concat(response.data.data); $scope.activities = $scope.activities.concat(response.data.data);
$scope.all_count = response.data.all_count;
$scope.count = response.data.count;
rms.save('activities', $scope.activities); rms.save('activities', $scope.activities);
}, function errorCallback(response) { }, function errorCallback(response) {
}); });