详情页面传参openid
This commit is contained in:
parent
3008c0c44d
commit
f1783c06a2
|
@ -3,14 +3,14 @@ var apiUrl = 'http://wechat.trustie.net/api/v1/';
|
|||
var debug = true; //调试标志,如果在本地请置为true
|
||||
|
||||
if(debug===true){
|
||||
//apiUrl = 'http://localhost:3000/api/v1/';
|
||||
apiUrl = 'http://localhost:3000/api/v1/';
|
||||
}
|
||||
|
||||
app.factory('auth', function($http,$routeParams, $cookies, $q){
|
||||
var _openid = '';
|
||||
|
||||
if(debug===true){
|
||||
_openid = "oCnvgvz8R7QheXE-R9Kkr39j8Ndg";
|
||||
_openid = "1";
|
||||
}
|
||||
|
||||
var getOpenId = function() {
|
||||
|
@ -43,7 +43,7 @@ app.factory('auth', function($http,$routeParams, $cookies, $q){
|
|||
};
|
||||
var openid = function(){
|
||||
return _openid;
|
||||
}
|
||||
};
|
||||
return {getOpenId: getOpenId, openid: openid};
|
||||
});
|
||||
|
||||
|
@ -56,7 +56,7 @@ app.factory('rms', function(){
|
|||
|
||||
var get = function(key){
|
||||
return _saveStorage[key];
|
||||
}
|
||||
};
|
||||
|
||||
return {save: save, get: get};
|
||||
});
|
||||
|
@ -64,7 +64,7 @@ app.factory('rms', function(){
|
|||
app.controller('ActivityController',function($scope, $http, auth, rms){
|
||||
$scope.replaceUrl = function(url){
|
||||
return "http://www.trustie.net/" + url;
|
||||
}
|
||||
};
|
||||
|
||||
console.log("ActivityController load");
|
||||
$scope.activities = rms.get("activities") || [];
|
||||
|
@ -75,13 +75,13 @@ app.controller('ActivityController',function($scope, $http, auth, rms){
|
|||
$http({
|
||||
method: 'POST',
|
||||
url: apiUrl+ "activities",
|
||||
data: {openid: auth.openid(), page: page},
|
||||
data: {openid: auth.openid(), page: page}
|
||||
}).then(function successCallback(response) {
|
||||
$scope.activities = $scope.activities.concat(response.data.data);
|
||||
rms.save('activities', $scope.activities);
|
||||
}, function errorCallback(response) {
|
||||
});
|
||||
}
|
||||
};
|
||||
auth.getOpenId().then(
|
||||
function successCallback(response){
|
||||
loadActData($scope.page);
|
||||
|
@ -96,11 +96,11 @@ app.controller('ActivityController',function($scope, $http, auth, rms){
|
|||
|
||||
//$http
|
||||
|
||||
}
|
||||
};
|
||||
$scope.decreasePraise = function(act){
|
||||
act.activity_praise_count -= 1;
|
||||
act.has_praise = false;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.loadActData = loadActData;
|
||||
|
||||
|
@ -133,23 +133,16 @@ app.factory('common', function($http, auth){
|
|||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var loadCommonData = function(id, type){
|
||||
return $http({
|
||||
method: 'GET',
|
||||
url: apiUrl+ type + "/" + id
|
||||
url: apiUrl+ type + "/" + id+"?openid="+auth.openid()
|
||||
})
|
||||
};
|
||||
|
||||
return {addCommonReply: addCommonReply, loadCommonData: loadCommonData};
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
app.controller('IssueController', function($scope, $http, $routeParams, auth, common){
|
||||
$scope.formData = {comment: ''};
|
||||
|
||||
|
@ -204,7 +197,7 @@ app.controller('CourseNoticeController', function($scope, $http, $routeParams, a
|
|||
$scope.news = response.data.data;
|
||||
}, function errorCallback(response) {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
loadData($routeParams.id);
|
||||
|
||||
|
@ -226,7 +219,7 @@ app.controller('DiscussionController', function($scope, $http, $routeParams, aut
|
|||
$scope.discussion = response.data.data;
|
||||
}, function errorCallback(response) {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
loadData($routeParams.id);
|
||||
|
||||
|
@ -248,7 +241,7 @@ app.controller('JournalsController', function($scope, $http, $routeParams, auth,
|
|||
$scope.message = response.data.data;
|
||||
}, function errorCallback(response) {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
loadData($routeParams.id);
|
||||
|
||||
|
@ -258,7 +251,7 @@ app.controller('JournalsController', function($scope, $http, $routeParams, auth,
|
|||
$scope.formData = {comment: ''};
|
||||
loadData($routeParams.id);
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
app.controller('BlogController', function($scope, $http, $routeParams, auth, common){
|
||||
|
@ -270,7 +263,7 @@ app.controller('BlogController', function($scope, $http, $routeParams, auth, com
|
|||
$scope.blog = response.data.data;
|
||||
}, function errorCallback(response) {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
loadData($routeParams.id);
|
||||
|
||||
|
@ -280,7 +273,7 @@ app.controller('BlogController', function($scope, $http, $routeParams, auth, com
|
|||
$scope.formData = {comment: ''};
|
||||
loadData($routeParams.id);
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
app.filter('safeHtml', function ($sce) {
|
||||
|
|
Loading…
Reference in New Issue