From c9687a8764b4490c73b97043e26b87bb1e6a7dbc Mon Sep 17 00:00:00 2001 From: txz Date: Wed, 6 Apr 2016 14:44:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/activities.html | 2 +- public/assets/wechat/course_discussion.html | 44 +--------- public/assets/wechat/course_notice.html | 77 ++++------------- public/javascripts/wechat/app.js | 92 +++++++++++---------- 4 files changed, 65 insertions(+), 150 deletions(-) diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index 88db4eeb5..63c9c0833 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -47,7 +47,7 @@
-
回复 ({{act.reply_count}})
+
回复 ({{act.reply_count}})
赞 ({{act.activity_praise_count}})
diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index d5572b9f8..33bcf9471 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -1,24 +1,5 @@ - - - - 课程问答区 - - - - - - - - - - -
- - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index 33ea6fe4b..2e8caf15a 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -1,91 +1,44 @@ - - - - 课程通知 - - - - - - - - - - -
- - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index 1ab4301e3..b465dfcf6 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -120,50 +120,6 @@ app.controller('IssueController', function($scope, $http, $routeParams, auth){ } }); -app.controller('IssueController', function($scope, $http, $routeParams, auth){ - $scope.formData = {comment: ''}; - - var loadData = function(id){ - $http({ - method: 'GET', - url: apiUrl+ "issues/"+id, - }).then(function successCallback(response) { - console.log(response.data); - $scope.issue = response.data.data; - - }, function errorCallback(response) { - }); - } - - loadData($routeParams.id); - - - $scope.addIssueReply = function(data){ - console.log(data.comment); - - if(!data.comment || data.comment.length<=0){ - return; - } - - var userInfo = { - type: "Issue", - 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('HomeworkController', function($scope, $http, $routeParams, auth){ $scope.formData = {comment: ''}; @@ -208,6 +164,50 @@ app.controller('HomeworkController', function($scope, $http, $routeParams, auth) } }); +app.controller('CourseNoticeController', function($scope, $http, $routeParams, auth){ + $scope.formData = {comment: ''}; + + var loadData = function(id){ + $http({ + method: 'GET', + url: apiUrl+ "newss/"+id, + }).then(function successCallback(response) { + console.log(response.data); + $scope.news = response.data.data; + + }, function errorCallback(response) { + }); + } + + loadData($routeParams.id); + + + $scope.addIssueReply = function(data){ + console.log(data.comment); + + if(!data.comment || data.comment.length<=0){ + return; + } + + var userInfo = { + type: "News", + 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); @@ -228,6 +228,10 @@ app.config(['$routeProvider',function ($routeProvider) { templateUrl: 'homework_detail.html', controller: 'HomeworkController' }) + .when('/course_notice/:id', { + templateUrl: 'course_notice.html', + controller: 'CourseNoticeController' + }) .otherwise({ redirectTo: '/activities' });