socialforge/public/javascripts/wechat/controllers/journals.js

37 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-06-14 14:24:39 +08:00
app.controller('JournalsController', function($scope, $http, $routeParams, auth, common){
$scope.formData = {comment: ''};
var loadData = function(id){
common.loadCommonData(id, 'journal_for_messages').then(function successCallback(response) {
console.log(response.data);
$scope.message = response.data.data;
}, function errorCallback(response) {
});
};
auth.getOpenId().then(
function successCallback(response){
loadData($routeParams.id);
}, function errorCallback(response) {
alert("获取openid出错:"+response);
}
);
$scope.addJournalReply = function(data){
console.log(data.comment);
common.addCommonReply($routeParams.id, 'JournalsForMessage', data, function(){
$scope.formData = {comment: ''};
loadData($routeParams.id);
});
};
$scope.addPraise = function(act){
console.log(act);
common.addCommonPraise(act);
};
$scope.decreasePraise = function(act){
console.log(act);
common.decreaseCommonPraise(act);
};
});