除了issue 和news都增加了二级回复显示

This commit is contained in:
yuanke 2016-07-22 15:37:25 +08:00
parent d975067e13
commit cdb7782849
21 changed files with 471 additions and 89 deletions

View File

@ -13,8 +13,14 @@ module Mobile
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
homework = HomeworkCommon.find params[:id]
present :data, homework, with: Mobile::Entities::Whomework,user: user,type: type,page: page
if type == 0
homework = HomeworkCommon.find params[:id]
present :data, homework, with: Mobile::Entities::Whomework,user: user,type: type,page: page,comment_type: "homework"
else
jour = JournalsForMessage.find params[:id]
present :data, jour, with: Mobile::Entities::Jours,user: user,type: type,page: page,comment_type: "homework"
end
present :type, type
present :page, page
present :status, 0

View File

@ -51,9 +51,8 @@ module Mobile
blog_comment_expose :id
blog_comment_expose :locked
blog_comment_expose :praise_count
expose :blog_comment_children, using:Mobile::Entities::BlogComment do |c,opt|
expose :all_children, using:Mobile::Entities::BlogComment do |c,opt|
if c.is_a? (::BlogComment)
##自己的父回复为空 才有子回复
if !opt[:children]
if c.parent.nil? && opt[:type] == 0
opt[:children] = true
@ -86,7 +85,7 @@ module Mobile
#取二级回复的底楼层
parents_reply = []
parents_reply = get_reply_parents_no_root(parents_reply, c)
if parents_reply.count > 0 && !opt[:bottom]
if parents_reply.count > 0 && parents_reply.count != 2 && !opt[:bottom]
if opt[:type] == 1
# opt[:bottom] = true
# parents_reply[opt[:page]..opt[:page]]
@ -105,7 +104,7 @@ module Mobile
#取二级回复的顶楼层
parents_reply = []
parents_reply = get_reply_parents_no_root(parents_reply, c)
if parents_reply.count > 0 && !opt[:top]
if parents_reply.count >= 2 && !opt[:top]
if opt[:type] == 1
opt[:bottom] = true
tStart = (opt[:page]-1)*5+2

View File

@ -22,10 +22,10 @@ module Mobile
(get_user(issue.assigned_to_id)).login
when :issue_status
IssueStatus.find(issue.status_id).name
when :journals_count
# issue.journals.where("notes is not null and notes != ''").count
all_comments = []
get_all_children(all_comments, f).count
when :comment_count
issue.journals.where("notes is not null and notes != ''").count
# all_comments = []
# get_all_children(all_comments, f).count
when :project_name
issue.project.name
when :praise_count
@ -49,7 +49,7 @@ module Mobile
issue_expose :issue_priority
issue_expose :issue_assigned_to
issue_expose :issue_status
issue_expose :journals_count
issue_expose :comment_count
issue_expose :project_name
issue_expose :praise_count
expose :issue_journals, using: Mobile::Entities::Journal do |f, opt|

View File

@ -17,7 +17,7 @@ module Mobile
case field
when :lasted_comment
time_from_now f.created_on
when :reply_count
when :comment_count
# f.children.count
all_comments = []
get_all_children(all_comments, f).count
@ -27,6 +27,8 @@ module Mobile
'JournalsForMessage'
when :act_id
f.id
when :content
f.notes
end
end
end
@ -42,10 +44,10 @@ module Mobile
end
jours_expose :created_on
jours_expose :lasted_comment
jours_expose :notes
jours_expose :content
jours_expose :m_reply_id
jours_expose :m_parent_id
jours_expose :reply_count
jours_expose :comment_count
jours_expose :praise_count
expose :course,using:Mobile::Entities::Course do |f,opt|
if f.is_a?(::JournalsForMessage) && f[:jour_type] == "Course"
@ -55,9 +57,20 @@ module Mobile
expose :reply_user,using: Mobile::Entities::User do |f, opt|
f.at_user
end
expose :child_reply,using: Mobile::Entities::Jours do |f, opt|
expose :all_children,using: Mobile::Entities::Jours do |f, opt|
if f.is_a?(::JournalsForMessage)
f.children.reverse
# f.children.reverse
if !opt[:children] && opt[:comment_type].nil?
if f.parent.nil? && opt[:type] == 0
opt[:children] = true
all_comments = []
tStart = opt[:page]*5
tEnd = (opt[:page]+1)*5 - 1
all_comments = get_all_children(all_comments, f)[tStart..tEnd]
all_comments
end
end
end
end
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
@ -67,6 +80,78 @@ module Mobile
has_praise = obj.empty? ? false : true
has_praise
end
expose :parents_count, if: lambda { |instance, options| options[:user] } do |instance, options|
parents_reply = []
if options[:comment_type].nil?
parents_reply = get_reply_parents_no_root(parents_reply, instance)
elsif options[:comment_type] == "homework"
parents_reply = get_reply_parents(parents_reply, instance)
end
parents_reply.count
end
expose :parents_reply_bottom, using:Mobile::Entities::Jours do |f,opt|
if f.is_a? (::JournalsForMessage)
#取二级回复的底楼层
parents_reply = []
if opt[:comment_type].nil?
parents_reply = get_reply_parents_no_root(parents_reply, f)
elsif opt[:comment_type] == "homework"
parents_reply = get_reply_parents(parents_reply, f)
end
if parents_reply.count > 0 && parents_reply.count != 2 && !opt[:bottom]
if opt[:type] == 1
# opt[:bottom] = true
# parents_reply[opt[:page]..opt[:page]]
else
opt[:bottom] = true
parents_reply[0..0]
end
else
[]
end
end
end
expose :parents_reply_top, using:Mobile::Entities::Jours do |f,opt|
if f.is_a? (::JournalsForMessage)
#取二级回复的顶楼层
parents_reply = []
if opt[:comment_type].nil?
parents_reply = get_reply_parents_no_root(parents_reply, f)
elsif opt[:comment_type] == "homework"
parents_reply = get_reply_parents(parents_reply, f)
end
if parents_reply.count >= 2 && !opt[:top]
if opt[:type] == 1
opt[:bottom] = true
tStart = (opt[:page]-1)*5+2
tEnd = (opt[:page])*5+2 - 1
if tEnd >= parents_reply.count - 1
tEnd = parents_reply.count - 2
end
if tStart <= parents_reply.count - 2
parents_reply = parents_reply.reverse[tStart..tEnd]
parents_reply.reverse
else
[]
end
else
opt[:top] = true
parents_reply = parents_reply.reverse[0..1]
parents_reply.reverse
end
else
[]
end
end
end
end
end
end

View File

@ -30,7 +30,7 @@ module Mobile
'Message'
when :act_id
u.id
when :replies_count
when :comment_count
all_comments = []
get_all_children(all_comments, u).count
end
@ -51,15 +51,26 @@ module Mobile
message_expose :board_id
message_expose :subject
message_expose :content
message_expose :replies_count
message_expose :comment_count
message_expose :praise_count
message_expose :created_on
message_expose :locked
message_expose :id
message_expose :lasted_comment
expose :message_children,using:Mobile::Entities::Message do |c,opt|
expose :all_children,using:Mobile::Entities::Message do |c,opt|
if c.is_a? (::Message)
c.children.reverse
# c.children.reverse
if !opt[:children]
if c.parent.nil? && opt[:type] == 0
opt[:children] = true
all_comments = []
tStart = opt[:page]*5
tEnd = (opt[:page]+1)*5 - 1
all_comments = get_all_children(all_comments, c)[tStart..tEnd]
all_comments
end
end
end
end
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
@ -69,6 +80,63 @@ module Mobile
has_praise = obj.empty? ? false : true
has_praise
end
expose :parents_count, if: lambda { |instance, options| options[:user] } do |instance, options|
parents_reply = []
parents_reply = get_reply_parents_no_root(parents_reply, instance)
parents_reply.count
end
expose :parents_reply_bottom, using:Mobile::Entities::Message do |c,opt|
if c.is_a? (::Message)
#取二级回复的底楼层
parents_reply = []
parents_reply = get_reply_parents_no_root(parents_reply, c)
if parents_reply.count > 0 && parents_reply.count != 2 && !opt[:bottom]
if opt[:type] == 1
# opt[:bottom] = true
# parents_reply[opt[:page]..opt[:page]]
else
opt[:bottom] = true
parents_reply[0..0]
end
else
[]
end
end
end
expose :parents_reply_top, using:Mobile::Entities::Message do |c,opt|
if c.is_a? (::Message)
#取二级回复的顶楼层
parents_reply = []
parents_reply = get_reply_parents_no_root(parents_reply, c)
if parents_reply.count >= 2 && !opt[:top]
if opt[:type] == 1
opt[:bottom] = true
tStart = (opt[:page]-1)*5+2
tEnd = (opt[:page])*5+2 - 1
if tEnd >= parents_reply.count - 1
tEnd = parents_reply.count - 2
end
if tStart <= parents_reply.count - 2
parents_reply = parents_reply.reverse[tStart..tEnd]
parents_reply.reverse
else
[]
end
else
opt[:top] = true
parents_reply = parents_reply.reverse[0..1]
parents_reply.reverse
end
else
[]
end
end
end
end
end
end

View File

@ -24,7 +24,7 @@ module Mobile
'News'
when :act_id
f.id
when :comments_count
when :comment_count
all_comments = []
get_all_children(all_comments, f).count
end
@ -70,7 +70,7 @@ module Mobile
#发布时间
news_expose :created_on
#评论数量
news_expose :comments_count
news_expose :comment_count
news_expose :praise_count
#课程名字
news_expose :course_name

View File

@ -26,7 +26,7 @@ module Mobile
wh.nil? || wh.homework_detail_manual.nil? ? nil : convert_to_time(wh.homework_detail_manual.evaluation_end, 1)
when :praise_count
get_activity_praise_num(wh)
when :whomework_journal_count
when :comment_count
wh.journals_for_messages.count
when :course_name
wh.course.name
@ -58,6 +58,7 @@ module Mobile
expose :anonymous_comment
expose :quotes
expose :is_open
expose :id
whomework_expose :act_type
whomework_expose :act_id
whomework_expose :course_name
@ -66,11 +67,19 @@ module Mobile
whomework_expose :evaluation_start
whomework_expose :evaluation_end
whomework_expose :praise_count
whomework_expose :whomework_journal_count
expose :journals_for_messages, using: Mobile::Entities::Jours do |f, opt|
whomework_expose :comment_count
expose :all_children, using: Mobile::Entities::Jours do |f, opt|
#f[:journals_for_messages] if f.is_a?(Hash) && f.key?(:journals_for_messages)
if f.is_a?(::HomeworkCommon)
f.journals_for_messages.reverse
# f.journals_for_messages.reverse
if !opt[:children] && opt[:type] == 0
opt[:children] = true
tStart = opt[:page]*5
tEnd = (opt[:page]+1)*5 - 1
all_comments = f.journals_for_messages.reorder("created_on desc")
all_comments[tStart..tEnd]
end
end
end
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|

View File

@ -634,8 +634,11 @@ class CoursesController < ApplicationController
end
if @course
#发送微信消息
ss = SyllabusesService.new
ss.send_wechat_create_class_notice User.current,@course
count = ShieldWechatMessage.where("container_type='User' and container_id=#{User.current.id} and shield_type='Course' and shield_id=#{@course.id}").count
if count == 0
ss = SyllabusesService.new
ss.send_wechat_create_class_notice User.current,@course
end
respond_to do |format|
flash[:notice] = l(:notice_successful_create)
format.html {redirect_to course_url(@course)}

View File

@ -31,8 +31,8 @@
</div>
<div class="mb50" id="all_blog_reply">
<div ng-if="blog.blog_comment_children == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in blog.blog_comment_children">
<div ng-if="blog.all_children == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in blog.all_children">
<div class="post-reply-row">
<div class="post-avatar fl mr10"><img ng-src="{{journal.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
@ -44,35 +44,8 @@
<div class="cl"></div>
<!--<div class="post-reply-content c-grey2 mt12" ng-bind-html="journal.content|safeHtml"></div>-->
<div ng-show="journal.parents_count > 0" class="mult-reply-container mt10">
<!--<div ng-repeat="reply_top in journal.parents_reply_top" >-->
<div class="mult-reply-container mt2">
<ul ng-if="journal.parents_reply_top[1]" ng-include="'comment_reply'" ng-init="i=1;journal=journal"></ul>
<div class="post-avatar fl mr10"><img ng-src="{{journal.parents_reply_top[0].user.img_url}}" class="border-radius img-circle" height="30" width="30"></div>
<div class="post-dynamic-author hidden fl ng-binding">
{{journal.parents_reply_top[0].user.realname}}
<img ng-if="journal.parents_reply_top[0].user.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="journal.parents_reply_top[0].user.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="post-dynamic-time fr f13">{{journal.parents_reply_top[0].lasted_comment}}</div>
<div class="cl"></div>
<div class="post-reply-content c-grey2 mt12 border-bottom-none" ng-bind-html="journal.parents_reply_top[0].content|safeHtml"></div>
<div class="cl"></div>
</div>
<!--</div>-->
<!--['weixin-tab', {'class-tab-active': currentTab == $index+1}]-->
<!--一层end-->
<!--<div class="mt10">-->
<!--<div class="post-avatar fl mr10"><img src="images/pic01.jpg" ng-src="/images/avatars/User/0" class="border-radius img-circle" height="30" width="30"></div>-->
<!--<div class="post-dynamic-author hidden fl ng-binding">yixin<img src="images/female.png" class="ml5" width="14"></div>-->
<!--<div class="post-dynamic-time fr f13">5分钟前</div>-->
<!--<div class="cl"></div>-->
<!--<div class="post-reply-content c-grey2 mt12 border-bottom-none">烤活牛你见过似的,美国那边吃人你怎么不信?</div>-->
<!--<div class="cl"></div>-->
<!--</div>-->
<!--二层end-->
<ul ng-if="journal.parents_reply_top[0]" ng-include="'comment_reply'" ng-init="i=0;journal=journal"></ul>
<div ng-click="showMoreReply(1,journal)" ng-show="journal.parents_reply_top.length + journal.parents_reply_bottom.length < journal.parents_count" class="mult-reply-hide"><span class="mult-reply-arrow" >&darr; </span><span class="mult-reply-arrow" style="display:none;" > &uarr;</span>点击展开更多楼层</div>
<div class="mt10" ng-repeat="reply_bottom in journal.parents_reply_bottom">
<div class="post-avatar fl mr10"><img ng-src="{{reply_bottom.user.img_url}}" class="border-radius img-circle" height="30" width="30"></div>
<div class="post-dynamic-author hidden fl ng-binding">

View File

@ -22,8 +22,8 @@
<div ng-if="news.has_praise" ng-click="decreasePraise(news);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{news.praise_count}}</span></div>
</div>
<div class="fr mr25 f13">
<a ng-if="!news.comments_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="news.comments_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{news.comments_count}}</span></a>
<a ng-if="!news.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="news.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{news.comment_count}}</span></a>
</div>
<div class="cl"></div>
</div>

View File

@ -26,15 +26,15 @@
<div ng-if="homework.has_praise" ng-click="decreasePraise(homework);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{homework.praise_count}}</span></div>
</div>
<div class="fr mr25 f13">
<a ng-if="!homework.whomework_journal_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="homework.whomework_journal_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{homework.whomework_journal_count}}</span></a>
<a ng-if="!homework.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="homework.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{homework.comment_count}}</span></a>
</div>
<div class="cl"></div>
</div>
<div class="mb50" id="all_homework_reply">
<div ng-if="homework.journals_for_messages == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in homework.journals_for_messages">
<div ng-if="homework.all_children == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in homework.all_children">
<div class="post-reply-row">
<div class="post-avatar fl mr10"><img ng-src="{{journal.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
@ -44,11 +44,32 @@
</div>
<div class="post-dynamic-time fr f13">{{journal.lasted_comment}}</div>
<div class="cl"></div>
<div class="post-reply-content c-grey2 mt12" ng-bind-html="journal.notes|safeHtml"></div>
<div ng-show="journal.parents_count > 0" class="mult-reply-container mt10">
<ul ng-if="journal.parents_reply_top[0]" ng-include="'comment_reply'" ng-init="i=0;journal=journal"></ul>
<!--<comment-reply i="0" journal="journal" ></comment-reply>-->
<div ng-click="showMoreReply(1,journal)" ng-show="journal.parents_reply_top.length + journal.parents_reply_bottom.length < journal.parents_count" class="mult-reply-hide"><span class="mult-reply-arrow" >&darr; </span><span class="mult-reply-arrow" style="display:none;" > &uarr;</span>点击展开更多楼层</div>
<div class="mt10" ng-repeat="reply_bottom in journal.parents_reply_bottom">
<div class="post-avatar fl mr10"><img ng-src="{{reply_bottom.user.img_url}}" class="border-radius img-circle" height="30" width="30"></div>
<div class="post-dynamic-author hidden fl ng-binding">
{{reply_bottom.user.realname}}
<img ng-if="reply_bottom.user.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="reply_bottom.user.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="post-dynamic-time fr f13">{{reply_bottom.lasted_comment}}</div>
<div class="cl"></div>
<div class="post-reply-content c-grey2 mt12 border-bottom-none" ng-bind-html="reply_bottom.content|safeHtml"></div>
<div class="cl"></div>
</div>
</div>
<div class="post-reply-content c-grey2 mt12" ng-bind-html="journal.content|safeHtml"></div>
<div class="cl"></div>
</div>
</div>
<div ng-if="has_more">
<div id="more_reply" class="more-events mt10" ng-click="showMoreReply(0,homework);">更多</div>
</div>
</div>
<div id="post_input_1" class="post-input-wrap post-box-shadow">
@ -65,4 +86,20 @@
</div>
</div>
</div>
</div>
<script id="comment_reply" type="text/ng-template">
<div class="mult-reply-container mt2">
<ul ng-if="journal.parents_reply_top[i+1]" ng-include="'comment_reply'" ng-init="i=i+1;journal=journal"></ul>
<div class="post-avatar fl mr10"><img ng-src="{{journal.parents_reply_top[i].user.img_url}}" class="border-radius img-circle" height="30" width="30"></div>
<div class="post-dynamic-author hidden fl ng-binding">
{{journal.parents_reply_top[i].user.realname}}
<img ng-if="journal.parents_reply_top[i].user.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="journal.parents_reply_top[i].user.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="post-dynamic-time fr f13">{{journal.parents_reply_top[i].lasted_comment}}</div>
<div class="cl"></div>
<div class="post-reply-content c-grey2 mt12 border-bottom-none" ng-bind-html="journal.parents_reply_top[i].content|safeHtml"></div>
<div class="cl"></div>
</div>
</script>

View File

@ -28,8 +28,8 @@
<div ng-if="issue.has_praise" ng-click="decreasePraise(issue);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{issue.praise_count}}</span></div>
</div>
<div class="fr mr25 f13">
<a ng-if="!issue.journals_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="issue.journals_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{issue.journals_count}}</span></a>
<a ng-if="!issue.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="issue.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{issue.comment_count}}</span></a>
</div>
<div class="cl"></div>
</div>

View File

@ -22,15 +22,15 @@
<div ng-if="message.has_praise" ng-click="decreasePraise(message);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{message.praise_count}}</span></div>
</div>
<div class="fr mr25 f13">
<a ng-if="!message.reply_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="message.reply_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{message.reply_count}}</span></a>
<a ng-if="!message.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="message.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{message.comment_count}}</span></a>
</div>
<div class="cl"></div>
</div>
<div class="mb50" id="all_message_reply">
<div ng-if="message.child_reply == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in message.child_reply">
<div class="post-reply-wrap" ng-repeat="journal in message.all_children">
<div class="post-reply-row">
<div class="post-avatar fl mr10"><img ng-src="{{journal.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
@ -40,11 +40,31 @@
</div>
<div class="post-dynamic-time fr f13">{{journal.lasted_comment}}</div>
<div class="cl"></div>
<div class="post-reply-content c-grey2 mt12" ng-bind-html="journal.notes|safeHtml"></div>
<div ng-show="journal.parents_count > 0" class="mult-reply-container mt10">
<ul ng-if="journal.parents_reply_top[0]" ng-include="'comment_reply'" ng-init="i=0;journal=journal"></ul>
<div ng-click="showMoreReply(1,journal)" ng-show="journal.parents_reply_top.length + journal.parents_reply_bottom.length < journal.parents_count" class="mult-reply-hide"><span class="mult-reply-arrow" >&darr; </span><span class="mult-reply-arrow" style="display:none;" > &uarr;</span>点击展开更多楼层</div>
<div class="mt10" ng-repeat="reply_bottom in journal.parents_reply_bottom">
<div class="post-avatar fl mr10"><img ng-src="{{reply_bottom.user.img_url}}" class="border-radius img-circle" height="30" width="30"></div>
<div class="post-dynamic-author hidden fl ng-binding">
{{reply_bottom.user.realname}}
<img ng-if="reply_bottom.user.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="reply_bottom.user.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="post-dynamic-time fr f13">{{reply_bottom.lasted_comment}}</div>
<div class="cl"></div>
<div class="post-reply-content c-grey2 mt12 border-bottom-none" ng-bind-html="reply_bottom.content|safeHtml"></div>
<div class="cl"></div>
</div>
</div>
<div class="post-reply-content c-grey2 mt12" ng-bind-html="journal.content|safeHtml"></div>
<div class="cl"></div>
</div>
</div>
<div ng-if="has_more">
<div id="more_reply" class="more-events mt10" ng-click="showMoreReply(0,message);">更多</div>
</div>
</div>
<div id="post_input_1" class="post-input-wrap post-box-shadow">
@ -61,4 +81,20 @@
</div>
</div>
</div>
</div>
<script id="comment_reply" type="text/ng-template">
<div class="mult-reply-container mt2">
<ul ng-if="journal.parents_reply_top[i+1]" ng-include="'comment_reply'" ng-init="i=i+1;journal=journal"></ul>
<div class="post-avatar fl mr10"><img ng-src="{{journal.parents_reply_top[i].user.img_url}}" class="border-radius img-circle" height="30" width="30"></div>
<div class="post-dynamic-author hidden fl ng-binding">
{{journal.parents_reply_top[i].user.realname}}
<img ng-if="journal.parents_reply_top[i].user.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="journal.parents_reply_top[i].user.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="post-dynamic-time fr f13">{{journal.parents_reply_top[i].lasted_comment}}</div>
<div class="cl"></div>
<div class="post-reply-content c-grey2 mt12 border-bottom-none" ng-bind-html="journal.parents_reply_top[i].content|safeHtml"></div>
<div class="cl"></div>
</div>
</script>

View File

@ -23,15 +23,15 @@
<div ng-if="discussion.has_praise" ng-click="decreasePraise(discussion);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{discussion.praise_count}}</span></div>
</div>
<div class="fr mr25 f13">
<a ng-if="!discussion.replies_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="discussion.replies_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{discussion.replies_count}}</span></a>
<a ng-if="!discussion.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="discussion.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{discussion.comment_count}}</span></a>
</div>
<div class="cl"></div>
</div>
<div class="mb50" id="all_course_message_reply">
<div ng-if="discussion.message_children == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in discussion.message_children">
<div ng-if="discussion.all_children == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in discussion.all_children">
<div class="post-reply-row">
<div class="post-avatar fl mr10"><img ng-src="{{journal.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
@ -41,10 +41,31 @@
</div>
<div class="post-dynamic-time fr f13">{{journal.lasted_comment}}</div>
<div class="cl"></div>
<div ng-show="journal.parents_count > 0" class="mult-reply-container mt10">
<ul ng-if="journal.parents_reply_top[0]" ng-include="'comment_reply'" ng-init="i=0;journal=journal"></ul>
<div ng-click="showMoreReply(1,journal)" ng-show="journal.parents_reply_top.length + journal.parents_reply_bottom.length < journal.parents_count" class="mult-reply-hide"><span class="mult-reply-arrow" >&darr; </span><span class="mult-reply-arrow" style="display:none;" > &uarr;</span>点击展开更多楼层</div>
<div class="mt10" ng-repeat="reply_bottom in journal.parents_reply_bottom">
<div class="post-avatar fl mr10"><img ng-src="{{reply_bottom.user.img_url}}" class="border-radius img-circle" height="30" width="30"></div>
<div class="post-dynamic-author hidden fl ng-binding">
{{reply_bottom.user.realname}}
<img ng-if="reply_bottom.user.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="reply_bottom.user.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="post-dynamic-time fr f13">{{reply_bottom.lasted_comment}}</div>
<div class="cl"></div>
<div class="post-reply-content c-grey2 mt12 border-bottom-none" ng-bind-html="reply_bottom.content|safeHtml"></div>
<div class="cl"></div>
</div>
</div>
<div class="post-reply-content c-grey2 mt12" ng-bind-html="journal.content|safeHtml"></div>
<div class="cl"></div>
</div>
</div>
<div ng-if="has_more">
<div id="more_reply" class="more-events mt10" ng-click="showMoreReply(0,discussion);">更多</div>
</div>
</div>
<div ng-if="!discussion.locked" id="post_input_1" class="post-input-wrap post-box-shadow">
<div class="post-reply-row">
@ -59,4 +80,20 @@
</div>
</div>
</div>
</div>
</div>
<script id="comment_reply" type="text/ng-template">
<div class="mult-reply-container mt2">
<ul ng-if="journal.parents_reply_top[i+1]" ng-include="'comment_reply'" ng-init="i=i+1;journal=journal"></ul>
<div class="post-avatar fl mr10"><img ng-src="{{journal.parents_reply_top[i].user.img_url}}" class="border-radius img-circle" height="30" width="30"></div>
<div class="post-dynamic-author hidden fl ng-binding">
{{journal.parents_reply_top[i].user.realname}}
<img ng-if="journal.parents_reply_top[i].user.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="journal.parents_reply_top[i].user.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="post-dynamic-time fr f13">{{journal.parents_reply_top[i].lasted_comment}}</div>
<div class="cl"></div>
<div class="post-reply-content c-grey2 mt12 border-bottom-none" ng-bind-html="journal.parents_reply_top[i].content|safeHtml"></div>
<div class="cl"></div>
</div>
</script>

View File

@ -0,0 +1,13 @@
<div class="mult-reply-container mt2">
<ul ng-if="journal.parents_reply_top[i+1]" ng-include="'comment_reply'" ng-init="i=i+1;journal=journal"></ul>
<div class="post-avatar fl mr10"><img ng-src="{{journal.parents_reply_top[i].user.img_url}}" class="border-radius img-circle" height="30" width="30"></div>
<div class="post-dynamic-author hidden fl ng-binding">
{{journal.parents_reply_top[i].user.realname}}
<img ng-if="journal.parents_reply_top[i].user.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="journal.parents_reply_top[i].user.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="post-dynamic-time fr f13">{{journal.parents_reply_top[i].lasted_comment}}</div>
<div class="cl"></div>
<div class="post-reply-content c-grey2 mt12 border-bottom-none" ng-bind-html="journal.parents_reply_top[i].content|safeHtml"></div>
<div class="cl"></div>
</div>

View File

@ -20,15 +20,15 @@ app.controller('BlogController',
$scope.page = 0;
}
else{
$scope.blog.blog_comment_children = $scope.blog.blog_comment_children.concat(data.data.blog_comment_children);
$scope.blog.all_children = $scope.blog.all_children.concat(data.data.all_children);
}
$scope.has_more = $scope.blog.blog_comment_children.length < $scope.blog.comment_count;
$scope.has_more = $scope.blog.all_children.length < $scope.blog.comment_count;
console.log($scope.has_more);
}
else{
comment_id = data.data.id;
for (var i in $scope.blog.blog_comment_children) {
var comment = $scope.blog.blog_comment_children[i];
for (var i in $scope.blog.all_children) {
var comment = $scope.blog.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);

View File

@ -6,7 +6,33 @@ app.controller('DiscussionController', ['$scope', '$http', '$routeParams', 'auth
type: 'messages',
replyType: 'Message',
loadCallback: function(data){
$scope.discussion = data.data;
console.log(data.data);
//回复级别 0 一级回复 1 二级回复
replytype = data.type;
page = data.page;
if (replytype == 0){
if (page == 0){
$scope.discussion = data.data;
$scope.page = 0;
}
else{
$scope.discussion.all_children = $scope.discussion.all_children.concat(data.data.all_children);
}
$scope.has_more = $scope.discussion.all_children.length < $scope.discussion.comment_count;
console.log($scope.has_more);
}
else{
comment_id = data.data.id;
for (var i in $scope.discussion.all_children) {
var comment = $scope.discussion.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(){
}

View File

@ -6,8 +6,33 @@ app.controller('HomeworkController', ['$scope', '$http', '$routeParams', 'auth',
type: 'whomeworks',
replyType: 'HomeworkCommon',
loadCallback: function(data){
console.log(data);
$scope.homework = data.data;
console.log(data.data);
//回复级别 0 一级回复 1 二级回复
replytype = data.type;
page = data.page;
if (replytype == 0){
if (page == 0){
$scope.homework = data.data;
$scope.page = 0;
}
else{
$scope.homework.all_children = $scope.homework.all_children.concat(data.data.all_children);
}
$scope.has_more = $scope.homework.all_children.length < $scope.homework.comment_count;
console.log($scope.has_more);
}
else{
comment_id = data.data.id;
for (var i in $scope.homework.all_children) {
var comment = $scope.homework.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(){
}

View File

@ -5,7 +5,34 @@ app.controller('JournalsController', ['$scope', '$http', '$routeParams', 'auth',
type: 'journal_for_messages',
replyType: 'JournalsForMessage',
loadCallback: function(data){
$scope.message = data.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(){
}

View File

@ -0,0 +1,9 @@
app.directive('commentReply', ['config', function(config){
return {
templateUrl: config.rootPath+ 'templates/comment_reply.html',
scope: {
i: "=",
journal: "="
}
}
}]);

View File

@ -89,7 +89,7 @@ app.factory('rms', function(){
return {save: save, get: get};
});
app.factory('common', ['$http', 'auth', '$routeParams','rms', function($http, auth, $routeParams,rms){
app.factory('common', ['$http', 'auth', '$routeParams','rms','config', function($http, auth, $routeParams,rms,config){
var addCommonReply = function(id, type, data, cb){
if(!data.comment || data.comment.length<=0){
@ -117,6 +117,33 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms', function($http, au
if(typeof cb === 'function'){
cb();
}
//保证内外回复数一致
activities = rms.get("activities") || [];
course_activities = rms.get("course_activities") || [];
project_activities = rms.get("project_activities") || [];
for(var i in activities){
if(activities[i].act_id == id){
activities[i].reply_count += 1;
break;
}
}
for(var i in course_activities){
if(course_activities[i].act_id == id){
course_activities[i].reply_count += 1;
break;
}
}
for(var i in project_activities){
if(project_activities[i].act_id == id){
project_activities[i].reply_count += 1;
break;
}
}
rms.save("activities",activities);
rms.save("course_activities",course_activities);
rms.save("project_activities",project_activities);
}, function errorCallback(response) {
});
};
@ -268,6 +295,8 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms', function($http, au
});
};
args.scope.commentreply_path = config.rootPath+ 'templates/comment_reply.html';
}
return {init: init, addCommonReply: addCommonReply, loadCommonData: loadCommonData, addCommonPraise: addCommonPraise, decreaseCommonPraise: decreaseCommonPraise};