Merge branch 'weixin_guange' of https://git.trustie.net/jacknudt/trustieforge into weixin_guange
This commit is contained in:
commit
5987659145
|
@ -10,7 +10,7 @@ app.factory('auth', function($http,$routeParams, $cookies, $q){
|
|||
var _openid = '';
|
||||
|
||||
if(debug===true){
|
||||
_openid = "1";
|
||||
_openid = "2";
|
||||
}
|
||||
|
||||
var getOpenId = function() {
|
||||
|
@ -61,7 +61,7 @@ app.factory('rms', function(){
|
|||
return {save: save, get: get};
|
||||
});
|
||||
|
||||
app.controller('ActivityController',function($scope, $http, auth, rms){
|
||||
app.controller('ActivityController',function($scope, $http, auth, rms, common){
|
||||
$scope.replaceUrl = function(url){
|
||||
return "http://www.trustie.net/" + url;
|
||||
};
|
||||
|
@ -90,23 +90,22 @@ app.controller('ActivityController',function($scope, $http, auth, rms){
|
|||
}
|
||||
);
|
||||
|
||||
$scope.addPraise = function(act){
|
||||
act.activity_praise_count += 1;
|
||||
act.has_praise = true;
|
||||
|
||||
//$http
|
||||
|
||||
};
|
||||
$scope.decreasePraise = function(act){
|
||||
act.activity_praise_count -= 1;
|
||||
act.has_praise = false;
|
||||
};
|
||||
|
||||
$scope.loadActData = loadActData;
|
||||
|
||||
$scope.addPraise = function(act){
|
||||
console.log(act);
|
||||
common.addCommonPraise(act,'activities');
|
||||
}
|
||||
|
||||
$scope.decreasePraise = function(act){
|
||||
console.log(act);
|
||||
common.decreaseCommonPraise(act,'activities');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
app.factory('common', function($http, auth){
|
||||
app.factory('common', function($http, auth, $routeParams){
|
||||
var addCommonReply = function(id, type, data, cb){
|
||||
console.log(data.comment);
|
||||
|
||||
|
@ -140,7 +139,36 @@ app.factory('common', function($http, auth){
|
|||
})
|
||||
};
|
||||
|
||||
return {addCommonReply: addCommonReply, loadCommonData: loadCommonData};
|
||||
var addCommonPraise = function(act, type){
|
||||
act.activity_praise_count += 1;
|
||||
act.has_praise = true;
|
||||
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: apiUrl,
|
||||
data:{openid:auth.openid(),type:type,id:$routeParams.id}
|
||||
}).then(function successCallback(response) {
|
||||
console.log("点赞成功");
|
||||
}, function errorCallback(response) {
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
var decreaseCommonPraise = function(act, type){
|
||||
act.activity_praise_count -= 1;
|
||||
act.has_praise = false;
|
||||
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: apiUrl ,
|
||||
data:{openid:auth.openid(),type:type,id:$routeParams.id}
|
||||
}).then(function successCallback(response) {
|
||||
console.log("取消赞成功");
|
||||
}, function errorCallback(response) {
|
||||
});
|
||||
};
|
||||
|
||||
return {addCommonReply: addCommonReply, loadCommonData: loadCommonData, addCommonPraise: addCommonPraise, decreaseCommonPraise: decreaseCommonPraise};
|
||||
});
|
||||
|
||||
app.controller('IssueController', function($scope, $http, $routeParams, auth, common){
|
||||
|
|
Loading…
Reference in New Issue