diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index 895b77999..1ffc10941 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -184,7 +184,7 @@
-
回复 ({{act.reply_count}})
+
回复 ({{act.reply_count}})
赞 ({{act.activity_praise_count}})
@@ -208,7 +208,7 @@
-
回复 ({{act.reply_count}})
+
回复 ({{act.reply_count}})
赞 ({{act.activity_praise_count}})
diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html index dd40df5ab..d9c4f5835 100644 --- a/public/assets/wechat/blog_detail.html +++ b/public/assets/wechat/blog_detail.html @@ -1,73 +1,44 @@ - - - - 博客 - - - - - - - - - - -
- - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index e0ef85ecd..867616441 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -22,7 +22,7 @@
-
+
{{journal.lasted_comment}}
回复
diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index f7c076852..7fb1fc6df 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -271,6 +271,92 @@ app.controller('CourseDiscussionController', function($scope, $http, $routeParam } }); +app.controller('JournalsController', function($scope, $http, $routeParams, auth){ + $scope.formData = {comment: ''}; + + var loadData = function(id){ + $http({ + method: 'GET', + url: apiUrl+ "journal_for_messages/"+id, + }).then(function successCallback(response) { + console.log(response.data); + $scope.message = response.data.data; + }, function errorCallback(response) { + }); + }; + + loadData($routeParams.id); + + + $scope.addJournalReply = function(data){ + console.log(data.comment); + + if(!data.comment || data.comment.length<=0){ + return; + } + + var userInfo = { + type: "JournalsForMessage", + content: data.comment, + openid: auth.openid(), + }; + + $http({ + method: 'POST', + url: apiUrl+ "new_comment/"+$routeParams.id, + data: userInfo, + }).then(function successCallback(response) { + alert("提交成功"); + $scope.formData = {comment: ''}; + loadData($routeParams.id); + }, function errorCallback(response) { + }); + } +}); + +app.controller('BlogController', function($scope, $http, $routeParams, auth){ + $scope.formData = {comment: ''}; + + var loadData = function(id){ + $http({ + method: 'GET', + url: apiUrl+ "blog_comments/"+id, + }).then(function successCallback(response) { + console.log(response.data); + $scope.blog = response.data.data; + }, function errorCallback(response) { + }); + }; + + loadData($routeParams.id); + + + $scope.addBlogReply = function(data){ + console.log(data.comment); + + if(!data.comment || data.comment.length<=0){ + return; + } + + var userInfo = { + type: "BlogComment", + content: data.comment, + openid: auth.openid(), + }; + + $http({ + method: 'POST', + url: apiUrl+ "new_comment/"+$routeParams.id, + data: userInfo, + }).then(function successCallback(response) { + alert("提交成功"); + $scope.formData = {comment: ''}; + loadData($routeParams.id); + }, function errorCallback(response) { + }); + } +}); + app.filter('safeHtml', function ($sce) { return function (input) { return $sce.trustAsHtml(input); @@ -303,6 +389,14 @@ app.config(['$routeProvider',function ($routeProvider) { templateUrl: 'project_discussion.html', controller: 'CourseDiscussionController' }) + .when('/journal_for_message/:id', { + templateUrl: 'jour_message_detail.html', + controller: 'JournalsController' + }) + .when('/blog_comment/:id', { + templateUrl: 'blog_detail.html', + controller: 'BlogController' + }) .otherwise({ redirectTo: '/activities' });