优化返回刷新

This commit is contained in:
guange 2016-05-31 20:46:46 +08:00
parent 814fde878e
commit 48b36e5d16
2 changed files with 17 additions and 2 deletions

View File

@ -118,7 +118,7 @@
<div class="post-container"> <div class="post-container">
<div class="post-wrapper"> <div class="post-wrapper">
<div class="post-main"> <div class="post-main">
<div class="mb5" dataID = "{{act.act_id}}" onclick="javascript:window.location.href='#/issues/'+ ($(this).attr('dataID'))"> <div class="mb5" dataID = "{{act.act_id}}" onclick="goDetail('issues',act.act_id)" id="{{act.act_id}}">
<div class="post-avatar fl"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="40" height="40" class="border-radius" /></div> <div class="post-avatar fl"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="40" height="40" class="border-radius" /></div>
<div class="post-title hidden mb5"><a herf="javascript:void(0);">{{act.author.realname}}</a></div> <div class="post-title hidden mb5"><a herf="javascript:void(0);">{{act.author.realname}}</a></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="f12 c-grey2">{{act.course_project_name}}</a></div> <div class="post-title hidden"><a herf="javascript:void(0);" class="f12 c-grey2">{{act.course_project_name}}</a></div>

View File

@ -7,6 +7,7 @@ if(debug===true){
apiUrl = 'https://www.trustie.net/api/v1/'; apiUrl = 'https://www.trustie.net/api/v1/';
} }
app.factory('auth', function($http,$routeParams, $cookies, $q){ app.factory('auth', function($http,$routeParams, $cookies, $q){
var _openid = ''; var _openid = '';
@ -66,7 +67,7 @@ app.factory('rms', function(){
return {save: save, get: get}; 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){ $scope.replaceUrl = function(url){
return url; return url;
}; };
@ -76,6 +77,12 @@ app.controller('ActivityController',function($scope, $http, auth, rms, common){
$scope.page = 0; $scope.page = 0;
var loadActData = function(page){ var loadActData = function(page){
if (page <= 0 && $scope.activities.length >0){
var yOffset = rms.get("yoffset");
$location.hash(yOffset);
return;
}
$scope.page = page; $scope.page = page;
$http({ $http({
method: 'POST', method: 'POST',
@ -109,6 +116,12 @@ app.controller('ActivityController',function($scope, $http, auth, rms, common){
$scope.loadActData = loadActData; $scope.loadActData = loadActData;
//跳到详情页
$scope.goDetail = function(type, id){
rms.save("yoffset", id);
$location.path('/'+type+'/'+id);
}
$scope.addPraise = function(act){ $scope.addPraise = function(act){
common.addCommonPraise(act); common.addCommonPraise(act);
}; };
@ -117,6 +130,8 @@ app.controller('ActivityController',function($scope, $http, auth, rms, common){
common.decreaseCommonPraise(act); common.decreaseCommonPraise(act);
}; };
}); });
app.factory('common', function($http, auth, $routeParams){ app.factory('common', function($http, auth, $routeParams){