微信新闻、issue增加二级回复等

This commit is contained in:
yuanke 2016-08-25 09:45:23 +08:00
parent e0957113d8
commit f35c3e8528
18 changed files with 553 additions and 59 deletions

View File

@ -29,7 +29,7 @@ module Mobile
if container_type == "All" || container_type == "Course"
shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Course'").map(&:shield_id)
user_course_ids = (user.courses.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (user.courses.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")"
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')"
end
page = params[:page] ? params[:page] : 0

View File

@ -297,7 +297,7 @@ module Mobile
user = current_user
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')"
activities = UserActivity.where("(container_type = 'Course' and container_id = #{params[:id]} and act_type in #{course_types})").order('updated_at desc')
page = params[:page] ? params[:page] : 0

View File

@ -17,11 +17,21 @@ module Mobile
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
issue = Issue.find params[:id]
present :data, issue, with: Mobile::Entities::Issue,user: user,type: type,page: page
is_public = 1
if type == 0
issue = Issue.find params[:id]
issue.project.is_public
present :data, issue, with: Mobile::Entities::Issue,user: user,type: type,page: page
else
jour = Journal.find params[:id]
present :data, jour, with: Mobile::Entities::Issue,user: user,type: type,page: page
end
present :type, type
present :page, page
present :is_public, issue.project.is_public
present :is_public,is_public
present :status, 0
rescue Exception=>e
present :status, -1

View File

@ -14,14 +14,19 @@ module Mobile
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
news = News.find params[:id]
is_public = 1
if news.project
is_public = news.project.is_public
elsif news.course
is_public = news.course.is_public
if type == 0
news = News.find params[:id]
if news.project
is_public = news.project.is_public
elsif news.course
is_public = news.course.is_public
end
else
news = Comment.find params[:id]
end
present :data, news, with: Mobile::Entities::News,user: user,type: type,page: page

View File

@ -40,6 +40,8 @@ module Mobile
ac.act.subject unless ac.nil? || ac.act.nil?
elsif ac.act_type == "JournalsForMessage"
ac.act.private == 0 ? "留言" : "私信" unless ac.nil? || ac.act.nil?
elsif ac.act_type == "Poll"
ac.act.polls_name unless ac.nil? || ac.act.nil?
end
when :description
if ac.act_type == "HomeworkCommon" || ac.act_type == "Issue" || ac.act_type == "News"
@ -48,6 +50,8 @@ module Mobile
strip_html(ac.act.content) unless ac.nil? || ac.act.nil?
elsif ac.act_type == "JournalsForMessage"
strip_html(ac.act.notes) unless ac.nil? || ac.act.nil?
elsif ac.act_type == "Poll"
ac.act.polls_description unless ac.nil? || ac.act.nil?
end
when :latest_update
time_from_now ac.updated_at unless ac.nil?

View File

@ -36,15 +36,42 @@ module Mobile
issue.id
when :title
issue.subject
when :subject
issue.subject
when :description
issue.description
when :done_ratio
issue.done_ratio
end
end
elsif issue.is_a?(::Journal)
case f
when :content
issue[:notes]
when :lasted_comment
time_from_now issue.created_on
when :act_id
issue.id
end
end
end
end
expose :subject
expose :description
expose :author, using: Mobile::Entities::User
expose :done_ratio
issue_expose :subject
issue_expose :description
expose :author, using: Mobile::Entities::User do |f, opt|
if f.is_a?(::Issue)
f.send(:author)
end
end
expose :user,using: Mobile::Entities::User do |f, opt|
if f.is_a?(::Journal)
f.send(:user)
end
end
issue_expose :content
issue_expose :lasted_comment
issue_expose :done_ratio
issue_expose :title
issue_expose :act_type
issue_expose :act_id
@ -55,11 +82,29 @@ module Mobile
issue_expose :comment_count
issue_expose :project_name
issue_expose :praise_count
expose :issue_journals, using: Mobile::Entities::Journal do |f, opt|
expose :id
# expose :issue_journals, using: Mobile::Entities::Journal do |f, opt|
# if f.is_a?(::Issue)
# f.journals.where("notes is not null and notes != ''").reverse
# end
# end
expose :all_children, using: Mobile::Entities::Issue do |f, opt|
#f[:journals_for_messages] if f.is_a?(Hash) && f.key?(:journals_for_messages)
if f.is_a?(::Issue)
f.journals.where("notes is not null and notes != ''").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.where("notes is not null and notes != ''").reorder("created_on desc")
all_comments[tStart..tEnd]
end
end
end
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
has_praise = false
current_user = options[:user]
@ -67,6 +112,69 @@ module Mobile
has_praise = obj.empty? ? false : true
has_praise
end
expose :parents_count, if: lambda { |instance, options| options[:user] } do |instance, options|
if instance.is_a?(::Journal)
parents_reply = []
parents_reply = get_reply_parents(parents_reply, instance)
parents_reply.count
end
end
expose :parents_reply_bottom, using:Mobile::Entities::Issue do |f,opt|
if f.is_a? (::Journal)
#取二级回复的底楼层
parents_reply = []
parents_reply = get_reply_parents(parents_reply, f)
if parents_reply.count > 0 && !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::Issue do |f,opt|
if f.is_a? (::Journal)
#取二级回复的顶楼层
parents_reply = []
parents_reply = get_reply_parents(parents_reply, f)
if parents_reply.count > 2 && !opt[:top]
if opt[:type] == 1
opt[:top] = 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
elsif parents_reply.count == 2 && !opt[:top]
opt[:top] = true
parents_reply = parents_reply.reverse[0..0]
parents_reply.reverse
else
[]
end
end
end
end
end
end

View File

@ -28,6 +28,16 @@ module Mobile
f.comments.count
end
end
elsif f.is_a?(::Comment)
case field
when :content
f[:comments]
when :lasted_comment
time_from_now f.created_on
when :act_id
f.id
end
elsif f.is_a?(Hash) && !f.key?(field)
n = f[:news]
comments = f[:comments]
@ -43,14 +53,16 @@ module Mobile
end
end
end
news_expose :id
expose :id
#新闻标题
news_expose :title
expose :author,using: Mobile::Entities::User do |f, opt|
expose :user,using: Mobile::Entities::User do |f, opt|
obj = nil
if f.is_a?(::News) && f.respond_to?(:author)
obj = f.send(:author)
elsif f.is_a?(::Comment) && f.respond_to?(:author)
obj = f.send(:author)
elsif f.is_a?(Hash) && f.key?(:author)
obj = f[:author]
end
@ -73,14 +85,34 @@ module Mobile
news_expose :praise_count
#课程名字
news_expose :course_name
news_expose :lasted_comment
#评论
expose :comments, using: Mobile::Entities::Comment do |f, opt|
if f.is_a?(Hash) && f.key?(:comments)
f[:comments]
elsif f.is_a?(::News) && f.respond_to?(:comments)
f.comments.reverse
# expose :comments, using: Mobile::Entities::Comment do |f, opt|
# if f.is_a?(Hash) && f.key?(:comments)
# f[:comments]
# elsif f.is_a?(::News) && f.respond_to?(:comments)
# f.comments.reverse
# end
# end
news_expose :content
expose :all_children, using: Mobile::Entities::News do |f, opt|
#f[:journals_for_messages] if f.is_a?(Hash) && f.key?(:journals_for_messages)
if f.is_a?(::News)
# 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.comments.reorder("created_on desc")
all_comments[tStart..tEnd]
end
end
end
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
has_praise = false
current_user = options[:user]
@ -88,6 +120,69 @@ module Mobile
has_praise = obj.empty? ? false : true
has_praise
end
expose :parents_count, if: lambda { |instance, options| options[:user] } do |instance, options|
if instance.is_a?(::Comment)
parents_reply = []
parents_reply = get_reply_parents(parents_reply, instance)
parents_reply.count
end
end
expose :parents_reply_bottom, using:Mobile::Entities::News do |f,opt|
if f.is_a? (::Comment)
#取二级回复的底楼层
parents_reply = []
parents_reply = get_reply_parents(parents_reply, f)
if parents_reply.count > 0 && !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::News do |f,opt|
if f.is_a? (::Comment)
#取二级回复的顶楼层
parents_reply = []
parents_reply = get_reply_parents(parents_reply, f)
if parents_reply.count > 2 && !opt[:top]
if opt[:type] == 1
opt[:top] = 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
elsif parents_reply.count == 2 && !opt[:top]
opt[:top] = true
parents_reply = parents_reply.reverse[0..0]
parents_reply.reverse
else
[]
end
end
end
end
end
end

View File

@ -340,13 +340,13 @@ class ProjectsService
case priority_id
when 1
priority = ""
when
when 2
priority = "正常"
when
when 3
priority = ""
when
when 4
priority = "紧急"
when
when 5
priority = "立刻"
end

View File

@ -127,6 +127,78 @@
</div>
</div>
<div ng-if="act.act_type=='Poll'">
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div dataID = "{{act.act_id}}" id="act_{{act.id}}">
<div class="post-avatar fl mr10"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
<span>{{act.author.real_name}}</span>
<img ng-if="act.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="act.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="post-dynamic-time fr f13">{{act.latest_update}}</div>
<div class="cl"></div>
<div class="post-dynamic-title c-grey3 hidden mt12 fb">【问卷】{{act.subject|safeHtml}}</div>
<div class="post-content c-grey3 mt10 mb10">
<div class="post-all-content" ng-bind-html="act.description|safeHtml" ellipsis-show></div>
</div>
<!--<a herf="javascript:void(0);" class="c-grey2 f13 fr mt5 mb10 post-more mr20 undis" text-auto-height>点击展开</a>-->
<div class="cl"></div>
</div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
<!--<div class="fr f13">-->
<!--<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>赞</span></div>-->
<!--<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>-->
<!--<div ng-if="act.has_praise" ng-click="decreasePraise(act);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>-->
<!--</div>-->
<!--<div class="fr mr25 f13">-->
<!--<a ng-if="!act.reply_count" ng-click="goDetail('course_discussion',act.act_id, act.id)"><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="act.reply_count" ng-click="goDetail('course_discussion',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{act.reply_count}}</span></a>-->
<!--</div>-->
<div class="cl"></div>
</div>
</div>
</div>
</div>
<div ng-if="act.act_type=='JournalsForMessage'">
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div dataID = "{{act.act_id}}" ng-click="goDetail('journal_for_message',act.act_id, act.id)" id="act_{{act.id}}">
<div class="post-avatar fl mr10"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
<span>{{act.author.real_name}}</span>
<img ng-if="act.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="act.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="post-dynamic-time fr f13">{{act.latest_update}}</div>
<div class="cl"></div>
<div class="post-dynamic-title c-grey3 hidden mt12 fb">【班级留言】{{act.subject|safeHtml}}</div>
<div class="post-content c-grey3 mt10 mb10">
<div class="post-all-content" ng-bind-html="act.description|safeHtml" ellipsis-show></div>
</div>
<!--<a herf="javascript:void(0);" class="c-grey2 f13 fr mt5 mb10 post-more mr20 undis" text-auto-height>点击展开</a>-->
<div class="cl"></div>
</div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
<div class="fr f13">
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
<div ng-if="act.has_praise" ng-click="decreasePraise(act);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
</div>
<div class="fr mr25 f13">
<a ng-if="!act.reply_count" ng-click="goDetail('journal_for_message',act.act_id, act.id)"><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="act.reply_count" ng-click="goDetail('journal_for_message',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{act.reply_count}}</span></a>
</div>
<div class="cl"></div>
</div>
</div>
</div>
</div>
<div ng-if="act.act_type=='Course'">
<div class="post-container">

View File

@ -41,7 +41,7 @@
</div>
<div class="cl"></div>
</div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
<!--<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>-->
<div class="fr f13">
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
@ -76,7 +76,7 @@
</div>
<div class="cl"></div>
</div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
<!--<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>-->
<div class="fr f13">
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
@ -112,7 +112,7 @@
<!--<a herf="javascript:void(0);" class="c-grey2 f13 fr mt5 mb10 post-more mr20 undis" text-auto-height>点击展开</a>-->
<div class="cl"></div>
</div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
<!--<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>-->
<div class="fr f13">
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
@ -128,6 +128,77 @@
</div>
</div>
<div ng-if="act.act_type=='Poll'">
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div dataID = "{{act.act_id}}" id="act_{{act.id}}">
<div class="post-avatar fl mr10"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
<span>{{act.author.real_name}}</span>
<img ng-if="act.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="act.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="post-dynamic-time fr f13">{{act.latest_update}}</div>
<div class="cl"></div>
<div class="post-dynamic-title c-grey3 hidden mt12 fb">【问卷】{{act.subject|safeHtml}}</div>
<div class="post-content c-grey3 mt10 mb10">
<div class="post-all-content" ng-bind-html="act.description|safeHtml" ellipsis-show></div>
</div>
<!--<a herf="javascript:void(0);" class="c-grey2 f13 fr mt5 mb10 post-more mr20 undis" text-auto-height>点击展开</a>-->
<div class="cl"></div>
</div>
<!--<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>-->
<!--<div class="fr f13">-->
<!--<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>赞</span></div>-->
<!--<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>-->
<!--<div ng-if="act.has_praise" ng-click="decreasePraise(act);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>-->
<!--</div>-->
<!--<div class="fr mr25 f13">-->
<!--<a ng-if="!act.reply_count" ng-click="goDetail('course_discussion',act.act_id, act.id)"><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="act.reply_count" ng-click="goDetail('course_discussion',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{act.reply_count}}</span></a>-->
<!--</div>-->
<div class="cl"></div>
</div>
</div>
</div>
</div>
<div ng-if="act.act_type=='JournalsForMessage'">
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div dataID = "{{act.act_id}}" ng-click="goDetail('journal_for_message',act.act_id, act.id)" id="act_{{act.id}}">
<div class="post-avatar fl mr10"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
<span>{{act.author.real_name}}</span>
<img ng-if="act.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="act.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="post-dynamic-time fr f13">{{act.latest_update}}</div>
<div class="cl"></div>
<div class="post-dynamic-title c-grey3 hidden mt12 fb">【班级留言】{{act.subject|safeHtml}}</div>
<div class="post-content c-grey3 mt10 mb10">
<div class="post-all-content" ng-bind-html="act.description|safeHtml" ellipsis-show></div>
</div>
<!--<a herf="javascript:void(0);" class="c-grey2 f13 fr mt5 mb10 post-more mr20 undis" text-auto-height>点击展开</a>-->
<div class="cl"></div>
</div>
<!--<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>-->
<div class="fr f13">
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
<div ng-if="act.has_praise" ng-click="decreasePraise(act);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
</div>
<div class="fr mr25 f13">
<a ng-if="!act.reply_count" ng-click="goDetail('journal_for_message',act.act_id, act.id)"><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="act.reply_count" ng-click="goDetail('journal_for_message',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{act.reply_count}}</span></a>
</div>
<div class="cl"></div>
</div>
</div>
</div>
</div>
<div ng-if="act.act_type=='Course'">
<div class="post-container">
@ -144,7 +215,7 @@
</div>
</div>
<div ng-if="course_has_more" class="mb50">
<div id="more_course_activities" class="more-events mt10" ng-click="getActivities(course_activities_page+1);">更多</div>
<div id="more_course_activities" class="more-events mt10" ng-click="getClassActivities(course_activities_page+1);">更多</div>
</div>
<div class="bottom-tab-wrap mt10">
<a ng-show="isTeacher" ng-click="goPublishNotice()" class="weixin-tab link-blue2 border-top">发布通知</a>

View File

@ -6,11 +6,11 @@
<div class="post-wrapper" style="margin-top:0;">
<div ng-show="is_public == 0 || is_public == false" class="tac f16 fb c-black" style="padding-top:10px;">私有内容,请谨慎传播</div>
<div class="post-main">
<div class="post-avatar fl mr10"><img ng-src="{{news.author.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-avatar fl mr10"><img ng-src="{{news.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
{{news.author.real_name}}
<img ng-if="news.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="news.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
{{news.user.real_name}}
<img ng-if="news.user.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="news.user.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="cl"></div>
<div class="ml40">
@ -30,20 +30,55 @@
<div class="cl"></div>
</div>
</div>
<div class="mb50" id="all_news_reply" at-delete-link>
<div ng-if="news.comments == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="comments in news.comments">
<!--<div class="mb50" id="all_news_reply" at-delete-link>-->
<!--<div ng-if="news.comments == ''" style="border-top:1px solid #ccc;"></div>-->
<!--<div class="post-reply-wrap" ng-repeat="comments in news.comments">-->
<!--<div class="post-reply-row">-->
<!--<div class="post-avatar fl mr10"><img ng-src="{{comments.author.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>-->
<!--<div class="post-reply-author hidden fl">-->
<!--{{comments.author.real_name}}-->
<!--</div>-->
<!--<div class="post-reply-time fr f12">{{comments.created_on}}</div>-->
<!--<div class="cl"></div>-->
<!--<div class="post-reply-content c-grey3 ml40 mb15" ng-bind-html="comments.comments|safeHtml"></div>-->
<!--<div class="cl"></div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<div class="mb50" id="all_course_message_reply" at-delete-link>
<div ng-if="news.all_children == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in news.all_children">
<div class="post-reply-row">
<div class="post-avatar fl mr10"><img ng-src="{{comments.author.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<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-reply-author hidden fl">
{{comments.author.real_name}}
{{journal.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{comments.created_on}}</div>
<div class="post-reply-time fr f12">{{journal.lasted_comment}}</div>
<div class="cl"></div>
<div class="post-reply-content c-grey3 ml40 mb15" ng-bind-html="comments.comments|safeHtml"></div>
<div ng-show="journal.parents_count > 0" class="mult-reply-container ml40 mb5">
<!--<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-reply-author hidden fl ng-binding">
{{reply_bottom.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{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-grey3 ml40 mb15" 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,news);">更多</div>
</div>
</div>
<div id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>

View File

@ -36,20 +36,55 @@
<div class="cl"></div>
</div>
</div>
<div class="mb50" id="all_issue_reply" at-delete-link>
<div ng-if="issue.issue_journals == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in issue.issue_journals">
<!--<div class="mb50" id="all_issue_reply" at-delete-link>-->
<!--<div ng-if="issue.issue_journals == ''" style="border-top:1px solid #ccc;"></div>-->
<!--<div class="post-reply-wrap" ng-repeat="journal in issue.issue_journals">-->
<!--<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-reply-author hidden fl">-->
<!--{{journal.user.real_name}}-->
<!--</div>-->
<!--<div class="post-reply-time fr f12">{{journal.created_on}}</div>-->
<!--<div class="cl"></div>-->
<!--<div class="post-reply-content c-grey3 ml40 mb15" ng-bind-html="journal.notes|safeHtml"></div>-->
<!--<div class="cl"></div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<div class="mb50" id="all_course_message_reply" at-delete-link>
<div ng-if="issue.all_children == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in issue.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-reply-author hidden fl">
{{journal.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{journal.created_on}}</div>
<div class="post-reply-time fr f12">{{journal.lasted_comment}}</div>
<div class="cl"></div>
<div class="post-reply-content c-grey3 ml40 mb15" ng-bind-html="journal.notes|safeHtml"></div>
<div ng-show="journal.parents_count > 0" class="mult-reply-container ml40 mb5">
<!--<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-reply-author hidden fl ng-binding">
{{reply_bottom.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{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-grey3 ml40 mb15" 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,issue);">更多</div>
</div>
</div>
<div id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>

View File

@ -23,7 +23,7 @@
</div>
<div ng-class="{'undis': currentTab!=2}">
<div ng-repeat="r in homeworks|filter:{homework_name: searchText}" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><img src="/images/wechat/homework.png" width="15" class="ml10 fl" /><span class="fl ml10 resource-width">{{r.homework_name}}</span><a ng-show="r.current_user_is_teacher" ng-click="sendFile(r,2)" class="fr mr10 link-blue2 ">发送</a><div class="cl"></div>
<div ng-repeat="r in homeworks|filter:{homework_name: searchText}" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><img src="/images/wechat/homework.png" width="15" class="ml10 fl" /><span ng-click="goHomeworkDetail(r.id)" class="fl ml10 resource-width">{{r.homework_name}}</span><a ng-show="r.current_user_is_teacher" ng-click="sendFile(r,2)" class="fr mr10 link-blue2 ">发送</a><div class="cl"></div>
<span class="f12 mt5 ml35 c-grey4 fl other-from-width hidden">作业来源:{{r.coursename}}</span><div class="cl"></div>
</div>
<div ng-if="homework_has_more">

View File

@ -4,7 +4,7 @@
<ul ng-if="journal.parents_reply_top[i+1]" ng-include="'comment_reply'" ng-init="i=i+1;journal=journal"></ul>
<div class="ml5 mr5">
<div class="post-reply-author hidden fl ng-binding">
{{journal.parents_reply_top[i].user.realname}}
{{journal.parents_reply_top[i].user.real_name}}
</div>
<div class="post-reply-time fr f12">{{journal.parents_reply_top[i].lasted_comment}}</div>
<div class="cl"></div>
@ -19,7 +19,7 @@
<ul ng-if="journal.parents_reply_top[i+1]" ng-include="'comment_reply'" ng-init="i=i+1;journal=journal"></ul>
<div class="ml5 mr5">
<div class="post-reply-author hidden fl ng-binding">
{{journal.parents_reply_top[i].user.realname}}
{{journal.parents_reply_top[i].user.real_name}}
</div>
<div class="post-reply-time fr f12">{{journal.parents_reply_top[i].lasted_comment}}</div>
<div class="cl"></div>

View File

@ -11,7 +11,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
vm.course = rms.get("course") || null;
var getClassActivities = function(page){
vm.getClassActivities = function(page){
$http({
method: 'POST',
url: apiUrl + "courses/activities?id=" + courseid,
@ -22,7 +22,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
vm.class_activities_page = response.data.page;
if(response.data.page > 0)
{
vm.course_activities = vm.class_activities.concat(response.data.data);
vm.course_activities = vm.course_activities.concat(response.data.data);
}
else{
vm.course_activities = response.data.data;
@ -123,7 +123,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
if(vm.isTeacher){
if(index == 1){
if(vm.course_activities.length <= 0){
getClassActivities(0);
vm.getClassActivities(0);
}
vm.showActivities = true;
}
@ -143,7 +143,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
} else {
if(index == 1){
if(vm.course_activities.length <= 0){
getClassActivities(0);
vm.getClassActivities(0);
}
vm.showActivities = true;
}

View File

@ -8,8 +8,37 @@ app.controller('CourseNoticeController', ['$scope', '$http', '$routeParams', 'au
replyType: 'News',
urlName: 'course_notice',
loadCallback: function(data){
$scope.news = data.data;
$scope.is_public = data.is_public;
console.log(data.data);
//回复级别 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(){
}

View File

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

@ -147,4 +147,9 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l
vm.tab(currentTab);
vm.goHomeworkDetail = function(id){
rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop);
$location.path("/homework").search({id: id});
}
}] );