Merge branch 'weixin_guange' of https://git.trustie.net/jacknudt/trustieforge into weixin_guange
# Conflicts: # public/javascripts/wechat/app.js
This commit is contained in:
commit
80f47476cb
|
@ -7,8 +7,9 @@ module Mobile
|
||||||
|
|
||||||
desc "get special topic"
|
desc "get special topic"
|
||||||
get ':id' do
|
get ':id' do
|
||||||
|
user = UserWechat.find_by_openid(params[:openid]).user
|
||||||
blog = BlogComment.find params[:id]
|
blog = BlogComment.find params[:id]
|
||||||
present :data, blog, with: Mobile::Entities::BlogComment
|
present :data, blog, with: Mobile::Entities::BlogComment,user: user
|
||||||
present :status, 0
|
present :status, 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,8 +8,9 @@ module Mobile
|
||||||
|
|
||||||
desc "get special issuse"
|
desc "get special issuse"
|
||||||
get ':id' do
|
get ':id' do
|
||||||
|
user = UserWechat.find_by_openid(params[:openid]).user
|
||||||
issue = Issue.find params[:id]
|
issue = Issue.find params[:id]
|
||||||
present :data, issue, with: Mobile::Entities::Issue
|
present :data, issue, with: Mobile::Entities::Issue,user: user
|
||||||
present :status, 0
|
present :status, 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,8 +7,9 @@ module Mobile
|
||||||
|
|
||||||
desc "get special journal"
|
desc "get special journal"
|
||||||
get ':id' do
|
get ':id' do
|
||||||
|
user = UserWechat.find_by_openid(params[:openid]).user
|
||||||
jour = JournalsForMessage.find params[:id]
|
jour = JournalsForMessage.find params[:id]
|
||||||
present :data, jour, with: Mobile::Entities::Jours
|
present :data, jour, with: Mobile::Entities::Jours,user: user
|
||||||
present :status, 0
|
present :status, 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,8 +7,9 @@ module Mobile
|
||||||
|
|
||||||
desc "get special topic"
|
desc "get special topic"
|
||||||
get ':id' do
|
get ':id' do
|
||||||
|
user = UserWechat.find_by_openid(params[:openid]).user
|
||||||
message = Message.find params[:id]
|
message = Message.find params[:id]
|
||||||
present :data, message, with: Mobile::Entities::Message
|
present :data, message, with: Mobile::Entities::Message,user: user
|
||||||
present :status, 0
|
present :status, 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,8 +7,9 @@ module Mobile
|
||||||
|
|
||||||
desc "get special news"
|
desc "get special news"
|
||||||
get ':id' do
|
get ':id' do
|
||||||
|
user = UserWechat.find_by_openid(params[:openid]).user
|
||||||
news = News.find params[:id]
|
news = News.find params[:id]
|
||||||
present :data, news, with: Mobile::Entities::News
|
present :data, news, with: Mobile::Entities::News,user: user
|
||||||
present :status, 0
|
present :status, 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,8 +7,9 @@ module Mobile
|
||||||
|
|
||||||
desc "get one homework"
|
desc "get one homework"
|
||||||
get ':id' do
|
get ':id' do
|
||||||
|
user = UserWechat.find_by_openid(params[:openid]).user
|
||||||
homework = HomeworkCommon.find params[:id]
|
homework = HomeworkCommon.find params[:id]
|
||||||
present :data, homework, with: Mobile::Entities::Whomework
|
present :data, homework, with: Mobile::Entities::Whomework,user: user
|
||||||
present :status, 0
|
present :status, 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -131,8 +131,11 @@ module Mobile
|
||||||
act_expose :course_project_name #课程/项目名字
|
act_expose :course_project_name #课程/项目名字
|
||||||
act_expose :activity_type_name #课程问答区/项目缺陷等
|
act_expose :activity_type_name #课程问答区/项目缺陷等
|
||||||
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||||
|
has_praise = false
|
||||||
current_user = options[:user]
|
current_user = options[:user]
|
||||||
false
|
obj = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",instance.act_id,instance.act_type.to_s,current_user.id)
|
||||||
|
has_praise = obj.empty? ? false : true
|
||||||
|
has_praise
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -45,6 +45,13 @@ module Mobile
|
||||||
c.children
|
c.children
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||||
|
has_praise = false
|
||||||
|
current_user = options[:user]
|
||||||
|
obj = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",instance.id,instance.class.to_s,current_user.id)
|
||||||
|
has_praise = obj.empty? ? false : true
|
||||||
|
has_praise
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -49,6 +49,13 @@ module Mobile
|
||||||
f.journals.where("notes is not null and notes != ''")
|
f.journals.where("notes is not null and notes != ''")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||||
|
has_praise = false
|
||||||
|
current_user = options[:user]
|
||||||
|
obj = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",instance.id,instance.class.to_s,current_user.id)
|
||||||
|
has_praise = obj.empty? ? false : true
|
||||||
|
has_praise
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -51,6 +51,13 @@ module Mobile
|
||||||
f.children
|
f.children
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||||
|
has_praise = false
|
||||||
|
current_user = options[:user]
|
||||||
|
obj = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",instance.id,instance.class.to_s,current_user.id)
|
||||||
|
has_praise = obj.empty? ? false : true
|
||||||
|
has_praise
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -52,6 +52,13 @@ module Mobile
|
||||||
c.children
|
c.children
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||||
|
has_praise = false
|
||||||
|
current_user = options[:user]
|
||||||
|
obj = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",instance.id,instance.class.to_s,current_user.id)
|
||||||
|
has_praise = obj.empty? ? false : true
|
||||||
|
has_praise
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -73,8 +73,13 @@ module Mobile
|
||||||
f.send(:comments)
|
f.send(:comments)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||||
|
has_praise = false
|
||||||
|
current_user = options[:user]
|
||||||
|
obj = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",instance.id,instance.class.to_s,current_user.id)
|
||||||
|
has_praise = obj.empty? ? false : true
|
||||||
|
has_praise
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -67,6 +67,13 @@ module Mobile
|
||||||
f.journals_for_messages
|
f.journals_for_messages
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||||
|
has_praise = false
|
||||||
|
current_user = options[:user]
|
||||||
|
obj = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",instance.id,instance.class.to_s,current_user.id)
|
||||||
|
has_praise = obj.empty? ? false : true
|
||||||
|
has_praise
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -116,7 +116,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive">
|
<div class="post-interactive">
|
||||||
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" ng-href="#/issues/{{act.act_id}}" class="c-grey"> 回复 ({{act.reply_count}})</a></div>
|
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" ng-href="#/issues/{{act.act_id}}" class="c-grey"> 回复 ({{act.reply_count}})</a></div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="!act.has_praise" ng-click="addPraise(act);">一赞 ({{act.activity_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="!act.has_praise" ng-click="addPraise(act);">已赞 ({{act.activity_praise_count}})</div>
|
||||||
<div class="post-interactive-column c-grey2" ng-if="act.has_praise">赞 ({{act.activity_praise_count}})</div>
|
<div class="post-interactive-column c-grey2" ng-if="act.has_praise">赞 ({{act.activity_praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive border-bottom">
|
<div class="post-interactive border-bottom">
|
||||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{blog.comments_count}})</span></div>
|
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{blog.comments_count}})</span></div>
|
||||||
<div class="post-interactive-praise c-grey2"><span class="paise-text">赞</span> <span class="praise-num">({{blog.blog_praise_count}})</span></div>
|
<div class="post-interactive-column c-grey2" ng-if="blog.has_praise" ng-click="addPraise(blog);">已赞 ({{blog.blog_praise_count}})</div>
|
||||||
|
<div class="post-interactive-column c-grey2" ng-if="!blog.has_praise">赞 ({{blog.blog_praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="all_blog_reply">
|
<div id="all_blog_reply">
|
||||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in blog.blog_comment_children">
|
<div class="post-reply-wrap border-bottom" ng-repeat="journal in blog.blog_comment_children">
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive border-bottom">
|
<div class="post-interactive border-bottom">
|
||||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{discussion.replies_count}})</span></div>
|
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{discussion.replies_count}})</span></div>
|
||||||
<div class="post-interactive-praise c-grey2"><span class="paise-text"> 赞 </span><span class="praise-num">({{discussion.message_praise_count}})</span></div>
|
<div class="post-interactive-column c-grey2" ng-if="discussion.has_praise" ng-click="addPraise(discussion);">已赞 ({{discussion.message_praise_count}})</div>
|
||||||
|
<div class="post-interactive-column c-grey2" ng-if="!discussion.has_praise">赞 ({{discussion.message_praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="all_course_message_reply">
|
<div id="all_course_message_reply">
|
||||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in discussion.message_children">
|
<div class="post-reply-wrap border-bottom" ng-repeat="journal in discussion.message_children">
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive border-bottom">
|
<div class="post-interactive border-bottom">
|
||||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{news.comments_count}})</span></div>
|
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{news.comments_count}})</span></div>
|
||||||
<div class="post-interactive-praise c-grey2"><span class="paise-text"> 赞 </span><span class="praise-num">({{news.news_praise_count}})</span></div>
|
<div class="post-interactive-column c-grey2" ng-if="news.has_praise" ng-click="addPraise(news);">已赞 ({{news.news_praise_count}})</div>
|
||||||
|
<div class="post-interactive-column c-grey2" ng-if="!news.has_praise">赞 ({{news.news_praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="all_news_reply">
|
<div id="all_news_reply">
|
||||||
<div class="post-reply-wrap border-bottom" ng-repeat="comments in news.comments">
|
<div class="post-reply-wrap border-bottom" ng-repeat="comments in news.comments">
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive border-bottom">
|
<div class="post-interactive border-bottom">
|
||||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{homework.whomework_journal_count}})</span></div>
|
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{homework.whomework_journal_count}})</span></div>
|
||||||
<div class="post-interactive-praise c-grey2"><span class="paise-text"> 赞 </span><span class="praise-num">({{homework.whomework_praise_count}})</span></div>
|
<div class="post-interactive-column c-grey2" ng-if="homework.has_praise" ng-click="addPraise(homework);">已赞 ({{homework.whomework_praise_count}})</div>
|
||||||
|
<div class="post-interactive-column c-grey2" ng-if="!homework.has_praise">赞 ({{homework.whomework_praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="all_homework_reply">
|
<div id="all_homework_reply">
|
||||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in homework.journals_for_messages">
|
<div class="post-reply-wrap border-bottom" ng-repeat="journal in homework.journals_for_messages">
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive border-bottom">
|
<div class="post-interactive border-bottom">
|
||||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{issue.journals_count}})</span></div>
|
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{issue.journals_count}})</span></div>
|
||||||
<div class="post-interactive-praise c-grey2"><span class="paise-text">赞</span> <span class="praise-num">({{issue.issue_praise_count}})</span></div>
|
<div class="post-interactive-column c-grey2" ng-if="!issue.has_praise" ng-click="addPraise(issue);">已赞 ({{issue.issue_praise_count}})</div>
|
||||||
|
<div class="post-interactive-column c-grey2" ng-if="issue.has_praise">赞 ({{issue.issue_praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="all_issue_reply">
|
<div id="all_issue_reply">
|
||||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in issue.issue_journals">
|
<div class="post-reply-wrap border-bottom" ng-repeat="journal in issue.issue_journals">
|
||||||
|
|
|
@ -13,7 +13,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive border-bottom">
|
<div class="post-interactive border-bottom">
|
||||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{message.reply_count}})</span></div>
|
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{message.reply_count}})</span></div>
|
||||||
<div class="post-interactive-praise c-grey2"><span class="paise-text">赞</span> <span class="praise-num">({{message.message_praise_count}})</span></div>
|
<div class="post-interactive-column c-grey2" ng-if="message.has_praise" ng-click="addPraise(message);">已赞 ({{message.message_praise_count}})</div>
|
||||||
|
<div class="post-interactive-column c-grey2" ng-if="!message.has_praise">赞 ({{message.message_praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="all_message_reply">
|
<div id="all_message_reply">
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive border-bottom">
|
<div class="post-interactive border-bottom">
|
||||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{discussion.replies_count}})</span></div>
|
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{discussion.replies_count}})</span></div>
|
||||||
<div class="post-interactive-praise c-grey2"><span class="paise-text"> 赞 </span><span class="praise-num">({{discussion.message_praise_count}})</span></div>
|
<div class="post-interactive-column c-grey2" ng-if="discussion.has_praise" ng-click="addPraise(discussion);">已赞 ({{discussion.message_praise_count}})</div>
|
||||||
|
<div class="post-interactive-column c-grey2" ng-if="!discussion.has_praise">赞 ({{discussion.message_praise_count}})</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="all_course_message_reply">
|
<div id="all_course_message_reply">
|
||||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in discussion.message_children">
|
<div class="post-reply-wrap border-bottom" ng-repeat="journal in discussion.message_children">
|
||||||
|
|
|
@ -135,7 +135,7 @@ app.factory('common', function($http, auth){
|
||||||
var loadCommonData = function(id, type){
|
var loadCommonData = function(id, type){
|
||||||
return $http({
|
return $http({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: apiUrl+ type + "/"+id
|
url: apiUrl+ type + "/" + id
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -155,238 +155,126 @@ app.controller('IssueController', function($scope, $http, $routeParams, auth, co
|
||||||
$scope.issue = response.data.data;
|
$scope.issue = response.data.data;
|
||||||
}, function errorCallback(response) {
|
}, function errorCallback(response) {
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
loadData($routeParams.id);
|
loadData($routeParams.id);
|
||||||
|
|
||||||
$scope.addIssueReply = function(data){
|
$scope.addIssueReply = function(data){
|
||||||
console.log("add issue reply");
|
console.log(data.comment);
|
||||||
common.addCommonReply($routeParams.id, 'Issue', data, function(){
|
common.addCommonReply($routeParams.id, 'Issue', data, function(){
|
||||||
$scope.formData = {comment: ''};
|
$scope.formData = {comment: ''};
|
||||||
loadData($routeParams.id);
|
loadData($routeParams.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.controller('HomeworkController', function($scope, $http, $routeParams, auth){
|
app.controller('HomeworkController', function($scope, $http, $routeParams, auth, common){
|
||||||
$scope.formData = {comment: ''};
|
$scope.formData = {comment: ''};
|
||||||
|
|
||||||
var loadData = function(id){
|
var loadData = function(id){
|
||||||
$http({
|
common.loadCommonData(id, 'whomeworks').then(function successCallback(response) {
|
||||||
method: 'GET',
|
|
||||||
url: apiUrl+ "whomeworks/"+id,
|
|
||||||
}).then(function successCallback(response) {
|
|
||||||
console.log(response.data);
|
console.log(response.data);
|
||||||
$scope.homework = response.data.data;
|
$scope.homework = response.data.data;
|
||||||
|
|
||||||
}, function errorCallback(response) {
|
}, function errorCallback(response) {
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
loadData($routeParams.id);
|
loadData($routeParams.id);
|
||||||
|
|
||||||
|
|
||||||
$scope.addHomeworkReply = function(data){
|
$scope.addHomeworkReply = function(data){
|
||||||
console.log(data.comment);
|
console.log(data.comment);
|
||||||
|
common.addCommonReply($routeParams.id, 'HomeworkCommon', data, function(){
|
||||||
if(!data.comment || data.comment.length<=0){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var userInfo = {
|
|
||||||
type: "HomeworkCommon",
|
|
||||||
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: ''};
|
$scope.formData = {comment: ''};
|
||||||
loadData($routeParams.id);
|
loadData($routeParams.id);
|
||||||
}, function errorCallback(response) {
|
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
app.controller('CourseNoticeController', function($scope, $http, $routeParams, auth){
|
app.controller('CourseNoticeController', function($scope, $http, $routeParams, auth, common){
|
||||||
$scope.formData = {comment: ''};
|
$scope.formData = {comment: ''};
|
||||||
|
|
||||||
var loadData = function(id){
|
var loadData = function(id){
|
||||||
$http({
|
common.loadCommonData(id, 'newss').then(function successCallback(response) {
|
||||||
method: 'GET',
|
|
||||||
url: apiUrl+ "newss/"+id,
|
|
||||||
}).then(function successCallback(response) {
|
|
||||||
console.log(response.data);
|
console.log(response.data);
|
||||||
$scope.news = response.data.data;
|
$scope.news = response.data.data;
|
||||||
|
|
||||||
}, function errorCallback(response) {
|
}, function errorCallback(response) {
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
loadData($routeParams.id);
|
loadData($routeParams.id);
|
||||||
|
|
||||||
|
|
||||||
$scope.addNoticeReply = function(data){
|
$scope.addNoticeReply = function(data){
|
||||||
console.log(data.comment);
|
console.log(data.comment);
|
||||||
|
common.addCommonReply($routeParams.id, 'News', data, function(){
|
||||||
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: ''};
|
$scope.formData = {comment: ''};
|
||||||
loadData($routeParams.id);
|
loadData($routeParams.id);
|
||||||
}, function errorCallback(response) {
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.controller('CourseDiscussionController', function($scope, $http, $routeParams, auth){
|
app.controller('DiscussionController', function($scope, $http, $routeParams, auth, common){
|
||||||
$scope.formData = {comment: ''};
|
$scope.formData = {comment: ''};
|
||||||
|
|
||||||
var loadData = function(id){
|
var loadData = function(id){
|
||||||
$http({
|
common.loadCommonData(id, 'messages').then(function successCallback(response) {
|
||||||
method: 'GET',
|
|
||||||
url: apiUrl+ "messages/"+id,
|
|
||||||
}).then(function successCallback(response) {
|
|
||||||
console.log(response.data);
|
console.log(response.data);
|
||||||
$scope.discussion = response.data.data;
|
$scope.discussion = response.data.data;
|
||||||
|
|
||||||
}, function errorCallback(response) {
|
}, function errorCallback(response) {
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
loadData($routeParams.id);
|
loadData($routeParams.id);
|
||||||
|
|
||||||
|
|
||||||
$scope.addDiscussionReply = function(data){
|
$scope.addDiscussionReply = function(data){
|
||||||
console.log(data.comment);
|
console.log(data.comment);
|
||||||
|
common.addCommonReply($routeParams.id, 'Message', data, function(){
|
||||||
if(!data.comment || data.comment.length<=0){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var userInfo = {
|
|
||||||
type: "Message",
|
|
||||||
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: ''};
|
$scope.formData = {comment: ''};
|
||||||
loadData($routeParams.id);
|
loadData($routeParams.id);
|
||||||
}, function errorCallback(response) {
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.controller('JournalsController', function($scope, $http, $routeParams, auth){
|
app.controller('JournalsController', function($scope, $http, $routeParams, auth, common){
|
||||||
$scope.formData = {comment: ''};
|
$scope.formData = {comment: ''};
|
||||||
|
|
||||||
var loadData = function(id){
|
var loadData = function(id){
|
||||||
$http({
|
common.loadCommonData(id, 'journal_for_messages').then(function successCallback(response) {
|
||||||
method: 'GET',
|
|
||||||
url: apiUrl+ "journal_for_messages/"+id,
|
|
||||||
}).then(function successCallback(response) {
|
|
||||||
console.log(response.data);
|
console.log(response.data);
|
||||||
$scope.message = response.data.data;
|
$scope.message = response.data.data;
|
||||||
}, function errorCallback(response) {
|
}, function errorCallback(response) {
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
loadData($routeParams.id);
|
loadData($routeParams.id);
|
||||||
|
|
||||||
|
|
||||||
$scope.addJournalReply = function(data){
|
$scope.addJournalReply = function(data){
|
||||||
console.log(data.comment);
|
console.log(data.comment);
|
||||||
|
common.addCommonReply($routeParams.id, 'JournalsForMessage', data, function(){
|
||||||
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: ''};
|
$scope.formData = {comment: ''};
|
||||||
loadData($routeParams.id);
|
loadData($routeParams.id);
|
||||||
}, function errorCallback(response) {
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.controller('BlogController', function($scope, $http, $routeParams, auth){
|
app.controller('BlogController', function($scope, $http, $routeParams, auth, common){
|
||||||
$scope.formData = {comment: ''};
|
$scope.formData = {comment: ''};
|
||||||
|
|
||||||
var loadData = function(id){
|
var loadData = function(id){
|
||||||
$http({
|
common.loadCommonData(id, 'blog_comments').then(function successCallback(response) {
|
||||||
method: 'GET',
|
|
||||||
url: apiUrl+ "blog_comments/"+id,
|
|
||||||
}).then(function successCallback(response) {
|
|
||||||
console.log(response.data);
|
console.log(response.data);
|
||||||
$scope.blog = response.data.data;
|
$scope.blog = response.data.data;
|
||||||
}, function errorCallback(response) {
|
}, function errorCallback(response) {
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
loadData($routeParams.id);
|
loadData($routeParams.id);
|
||||||
|
|
||||||
|
|
||||||
$scope.addBlogReply = function(data){
|
$scope.addBlogReply = function(data){
|
||||||
console.log(data.comment);
|
console.log(data.comment);
|
||||||
|
common.addCommonReply($routeParams.id, 'BlogComment', data, function(){
|
||||||
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: ''};
|
$scope.formData = {comment: ''};
|
||||||
loadData($routeParams.id);
|
loadData($routeParams.id);
|
||||||
}, function errorCallback(response) {
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -441,7 +329,7 @@ app.config(['$routeProvider',function ($routeProvider) {
|
||||||
})
|
})
|
||||||
.when('/project_discussion/:id', {
|
.when('/project_discussion/:id', {
|
||||||
templateUrl: 'project_discussion.html',
|
templateUrl: 'project_discussion.html',
|
||||||
controller: 'CourseDiscussionController'
|
controller: 'DiscussionController'
|
||||||
})
|
})
|
||||||
.when('/homework/:id', {
|
.when('/homework/:id', {
|
||||||
templateUrl: 'homework_detail.html',
|
templateUrl: 'homework_detail.html',
|
||||||
|
@ -453,7 +341,7 @@ app.config(['$routeProvider',function ($routeProvider) {
|
||||||
})
|
})
|
||||||
.when('/course_discussion/:id', {
|
.when('/course_discussion/:id', {
|
||||||
templateUrl: 'course_discussion.html',
|
templateUrl: 'course_discussion.html',
|
||||||
controller: 'CourseDiscussionController'
|
controller: 'DiscussionController'
|
||||||
})
|
})
|
||||||
.when('/journal_for_message/:id', {
|
.when('/journal_for_message/:id', {
|
||||||
templateUrl: 'jour_message_detail.html',
|
templateUrl: 'jour_message_detail.html',
|
||||||
|
|
Loading…
Reference in New Issue