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

41 lines
1.6 KiB
JavaScript
Raw Normal View History

app.controller('JournalsController', ['$scope', '$http', '$routeParams', 'auth', 'common', function($scope, $http, $routeParams, auth, common){
common.init({
id: $routeParams.id,
scope: $scope,
type: 'journal_for_messages',
replyType: 'JournalsForMessage',
2016-08-09 17:01:06 +08:00
urlName: 'journal_for_message',
loadCallback: function(data){
console.log(data.data);
//回复级别 0 一级回复 1 二级回复
replytype = data.type;
page = data.page;
if (replytype == 0){
if (page == 0){
$scope.message = data.data;
$scope.page = 0;
}
else{
$scope.message.all_children = $scope.message.all_children.concat(data.data.all_children);
}
$scope.has_more = $scope.message.all_children.length < $scope.message.comment_count;
console.log($scope.has_more);
}
else{
comment_id = data.data.id;
for (var i in $scope.message.all_children) {
var comment = $scope.message.all_children[i];
if(comment.id == comment_id){
// comment.parents_reply_top = comment.parents_reply_top.concat(data.data.parents_reply_top);
comment.parents_reply_top = data.data.parents_reply_top.concat(comment.parents_reply_top);
}
}
}
},
replyCallback: function(){
2016-06-14 14:24:39 +08:00
}
});
}]);