52 lines
1.8 KiB
JavaScript
52 lines
1.8 KiB
JavaScript
app.controller('CourseNoticeController', ['$scope', '$http', '$routeParams', 'auth', 'common',
|
|
function($scope, $http, $routeParams, auth, common){
|
|
|
|
common.init({
|
|
id: $routeParams.id,
|
|
scope: $scope,
|
|
type: 'newss',
|
|
replyType: 'News',
|
|
urlName: 'course_notice',
|
|
loadCallback: function(data){
|
|
console.log(data.data);
|
|
|
|
if(data.status == -1){
|
|
$scope.showtip = true;
|
|
return;
|
|
}
|
|
|
|
//回复级别 0 一级回复 1 二级回复
|
|
replytype = data.type;
|
|
page = data.page;
|
|
|
|
if (replytype == 0){
|
|
if (page == 0){
|
|
$scope.news = data.data;
|
|
$scope.page = 0;
|
|
$scope.is_public = data.is_public;
|
|
}
|
|
else{
|
|
$scope.news.all_children = $scope.news.all_children.concat(data.data.all_children);
|
|
}
|
|
$scope.has_more = $scope.news.all_children.length < $scope.news.comment_count;
|
|
console.log($scope.has_more);
|
|
}
|
|
else{
|
|
comment_id = data.data.id;
|
|
for (var i in $scope.news.all_children) {
|
|
var comment = $scope.news.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(){
|
|
}
|
|
});
|
|
|
|
}]); |