更多修复
This commit is contained in:
parent
32ffd2a5b5
commit
c9eddad45d
|
@ -249,8 +249,8 @@
|
|||
|
||||
</div>
|
||||
|
||||
<div ng-if="(count + page * 10) < all_count">
|
||||
<div id="more_activities" class="more-events mt10" ng-click="loadActData(current_page+1);">更多</div>
|
||||
<div ng-if="has_more">
|
||||
<div id="more_activities" class="more-events mt10" ng-click="loadActData(page+1);">更多</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -73,11 +73,35 @@ app.controller('ActivityController',function($anchorScroll, $location,$scope, $h
|
|||
};
|
||||
|
||||
console.log("ActivityController load");
|
||||
$scope.activities = rms.get("activities") || [];
|
||||
|
||||
$scope.page = 0;
|
||||
$scope.activities = rms.get("activities") || [];
|
||||
|
||||
var savePageConfig = function(){
|
||||
rms.save('current_page', $scope.current_page);
|
||||
rms.save('has_more', $scope.has_more);
|
||||
rms.save('activities', $scope.activities);
|
||||
}
|
||||
|
||||
var loadPageConfig = function(){
|
||||
var current_page = rms.get('current_page');
|
||||
var has_more = rms.get('has_more');
|
||||
var activities = rms.get('activities');
|
||||
|
||||
if(typeof current_page !== 'undefined'){
|
||||
$scope.page = current_page;
|
||||
}
|
||||
if(typeof has_more !== 'undefined'){
|
||||
$scope.has_more = has_more;
|
||||
}
|
||||
if(typeof activities !== 'undefined'){
|
||||
$scope.activities = activities;
|
||||
}
|
||||
}
|
||||
|
||||
var loadActData = function(page){
|
||||
if (page <= 0 && $scope.activities.length >0){
|
||||
if (page <= 0 && $scope.activities.length >0){ //应该是返回过来的
|
||||
loadPageConfig();
|
||||
var yOffset = rms.get("yoffset");
|
||||
$location.hash(yOffset);
|
||||
return;
|
||||
|
@ -97,10 +121,12 @@ app.controller('ActivityController',function($anchorScroll, $location,$scope, $h
|
|||
} else {
|
||||
$scope.activities = response.data.data;
|
||||
}
|
||||
$scope.current_page = response.data.page;
|
||||
$scope.all_count = response.data.all_count;
|
||||
$scope.count = response.data.count;
|
||||
$scope.has_more = (response.data.count + response.data.page * 10) < response.data.all_count;
|
||||
|
||||
console.log(response.data);
|
||||
|
||||
rms.save('current_page', $scope.page);
|
||||
rms.save('has_more', $scope.has_more);
|
||||
rms.save('activities', $scope.activities);
|
||||
}, function errorCallback(response) {
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue