2016-06-14 16:03:10 +08:00
|
|
|
app.controller('IssueController', ['$scope', '$http', '$routeParams', 'auth', 'common', function($scope, $http, $routeParams, auth, common){
|
2016-06-14 14:24:39 +08:00
|
|
|
$scope.formData = {comment: ''};
|
|
|
|
|
|
|
|
var loadData = function(id){
|
|
|
|
common.loadCommonData(id, 'issues').then(function successCallback(response) {
|
|
|
|
console.log(response.data);
|
|
|
|
$scope.issue = response.data.data;
|
|
|
|
}, function errorCallback(response) {
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
auth.getOpenId().then(
|
|
|
|
function successCallback(response){
|
|
|
|
loadData($routeParams.id);
|
|
|
|
}, function errorCallback(response) {
|
|
|
|
alert("获取openid出错:"+response);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
$scope.addIssueReply = function(data){
|
|
|
|
console.log(data.comment);
|
|
|
|
common.addCommonReply($routeParams.id, 'Issue', data, function(){
|
|
|
|
$scope.formData = {comment: ''};
|
|
|
|
loadData($routeParams.id);
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.addPraise = function(act){
|
|
|
|
common.addCommonPraise(act);
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.decreasePraise = function(act){
|
|
|
|
common.decreaseCommonPraise(act);
|
|
|
|
};
|
2016-06-14 16:03:10 +08:00
|
|
|
}]);
|