base
This commit is contained in:
parent
81e35de2b6
commit
b01a671fb4
|
@ -75,38 +75,10 @@ app.controller('ActivityController',function($anchorScroll, $location,$scope, $h
|
|||
console.log("ActivityController load");
|
||||
|
||||
$scope.page = 0;
|
||||
var current_page = rms.get('current_page');
|
||||
if(typeof current_page !== 'undefined'){
|
||||
$scope.page = current_page;
|
||||
}
|
||||
|
||||
$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 has_more = rms.get('has_more');
|
||||
var activities = rms.get('activities');
|
||||
|
||||
|
||||
if(typeof has_more !== 'undefined'){
|
||||
$scope.has_more = has_more;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var loadActData = function(page){
|
||||
if (page > 0 && $scope.activities.length >0){ //应该是返回过来的
|
||||
loadPageConfig();
|
||||
var yOffset = rms.get("yoffset");
|
||||
$location.hash(yOffset);
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.page = page;
|
||||
$http({
|
||||
|
@ -126,12 +98,12 @@ app.controller('ActivityController',function($anchorScroll, $location,$scope, $h
|
|||
|
||||
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) {
|
||||
});
|
||||
};
|
||||
|
||||
if($scope.activities.length<=0){
|
||||
|
||||
auth.getOpenId().then(
|
||||
function successCallback(response){
|
||||
loadActData($scope.page);
|
||||
|
@ -140,6 +112,9 @@ app.controller('ActivityController',function($anchorScroll, $location,$scope, $h
|
|||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$scope.loadActData = loadActData;
|
||||
|
||||
|
@ -529,7 +504,7 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",function ($rou
|
|||
var rootPath = '/assets/wechat/'
|
||||
$locationProvider.html5Mode(true);
|
||||
$routeProvider
|
||||
.when('/activities', {
|
||||
.when('/', {
|
||||
templateUrl: rootPath + 'activities.html',
|
||||
controller: 'ActivityController'
|
||||
})
|
||||
|
@ -562,7 +537,7 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",function ($rou
|
|||
controller: 'BlogController'
|
||||
})
|
||||
.otherwise({
|
||||
redirectTo: '/activities'
|
||||
redirectTo: '/'
|
||||
});
|
||||
|
||||
//监听异步请求,实现加载中显隐标记
|
||||
|
|
Loading…
Reference in New Issue