37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
|
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);
|
||
|
};
|
||
|
});
|