diff --git a/app/api/mobile/apis/new_comment.rb b/app/api/mobile/apis/new_comment.rb index 7977a1e8a..cbd739e8c 100644 --- a/app/api/mobile/apis/new_comment.rb +++ b/app/api/mobile/apis/new_comment.rb @@ -24,6 +24,7 @@ module Mobile if (feedback.errors.empty?) homework_common.update_attributes(:updated_at => Time.now) data = homework_common.journals_for_messages.last + present :data, data, with: Mobile::Entities::Jours result = 2 else result = 3 @@ -81,7 +82,9 @@ module Mobile is_jour.notes = params[:content] is_jour.journalized = issue #is_jour.journalized_type = "Issue" - if issue.journals << is_jour + if is_jour.save + data = is_jour + present :data, data, with: Mobile::Entities::Journal result = 2 else result = 3 @@ -110,7 +113,6 @@ module Mobile else result = 4 end - present :data, data, with: Mobile::Entities::Jours present :result, result present :status, 0 end diff --git a/app/api/mobile/entities/activity.rb b/app/api/mobile/entities/activity.rb index 82d021248..8c6b07281 100644 --- a/app/api/mobile/entities/activity.rb +++ b/app/api/mobile/entities/activity.rb @@ -27,7 +27,7 @@ module Mobile elsif ac.act_type == "Message" || ac.act_type == "BlogComment" || ac.act_type == "JournalsForMessage" ac.nil? || ac.act.nil? ? 0 : ac.act.children.count elsif ac.act_type == "Issue" - ac.nil? || ac.act.nil? ? 0 : ac.act.journals.where("notes != null").count + ac.nil? || ac.act.nil? ? 0 : ac.act.journals.where("notes is not null and notes != ''").count end when :subject if ac.act_type == "HomeworkCommon" diff --git a/app/api/mobile/entities/issue.rb b/app/api/mobile/entities/issue.rb index 777bb1ce8..d0bb0fa0d 100644 --- a/app/api/mobile/entities/issue.rb +++ b/app/api/mobile/entities/issue.rb @@ -23,9 +23,11 @@ module Mobile when :issue_status IssueStatus.find(issue.status_id).name when :journals_count - issue.journals.where("notes != null").count + issue.journals.where("notes is not null and notes != ''").count when :project_name issue.project.name + when :issue_praise_count + get_activity_praise_num(issue) end end end @@ -41,9 +43,10 @@ module Mobile issue_expose :issue_status issue_expose :journals_count issue_expose :project_name + issue_expose :issue_praise_count expose :issue_journals, using: Mobile::Entities::Journal do |f, opt| if f.is_a?(::Issue) - f.journals.where("notes != null") + f.journals.where("notes is not null and notes != ''") end end end diff --git a/app/api/mobile/entities/journal.rb b/app/api/mobile/entities/journal.rb index 83dbb9e00..787cdf1a4 100644 --- a/app/api/mobile/entities/journal.rb +++ b/app/api/mobile/entities/journal.rb @@ -1,6 +1,7 @@ module Mobile module Entities class Journal -
更多
+
更多
diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index e1fc8aef8..fd9f93aa1 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -37,15 +37,16 @@
回复 ()
-
赞 ()
+
赞 ()
+
-
+
回复
@@ -53,6 +54,7 @@
+
@@ -67,6 +69,20 @@
+ + diff --git a/public/javascripts/wechat/issue_detail.js b/public/javascripts/wechat/issue_detail.js index dcd5ae723..3ddd03356 100644 --- a/public/javascripts/wechat/issue_detail.js +++ b/public/javascripts/wechat/issue_detail.js @@ -13,12 +13,19 @@ $(document).ready(function(){ var apiUrl = '/api/v1/'; + var setReplyTemplate = function(data){ + console.log(data); + var html=bt('t:issue-detail-reply',{reply: data}); + $('#all_issue_reply').prepend(html); + }; + + var setTemplate = function(data){ console.log(data); var html=bt('t:issue-detail',{issues: data}); $('#issue-container').prepend(html); $('.post-reply-submit').click(function(){ - replyInsert(); + IssueReplyInsert(); }); /*$('post-interactive-praise').click(function(){ praiseClick(); @@ -48,16 +55,16 @@ $(document).ready(function(){ loadDataFromServer(homeworkID); //点击回复按钮,插入回复内容 - var replyInsert = function(){ + var IssueReplyInsert = function(){ var replyContent = $("#postInput").val(); if (!replyContent){ alert("请输入回复"); }else{ //将用户输入内容插入最后一条回复 - $(".post-reply-wrap:last").after('
回复
'); + /*$(".post-reply-wrap:last").after('
回复
'); $(".post-reply-content:last").append(replyContent); - $(".post-reply-date:last").append(Date()); + $(".post-reply-date:last").append(Date());*/ var postInput = $("#postInput").val(); $("#postInput").val(""); //回复数目+1 @@ -78,6 +85,7 @@ $(document).ready(function(){ data: userInfo, //参数,如果没有,可以为null success: function (data) { //如果执行成功,那么执行此方法 alert(data.result); //用data.d来获取后台传过来的json语句,或者是单纯的语句 + setReplyTemplate(data.data); }, error: function (err) { //如果执行不成功,那么执行此方法 alert("err:" + err); diff --git a/public/javascripts/wechat/wechat_dev.js b/public/javascripts/wechat/wechat_dev.js index 6ed55c624..c921ed64d 100644 --- a/public/javascripts/wechat/wechat_dev.js +++ b/public/javascripts/wechat/wechat_dev.js @@ -2,5 +2,5 @@ * Created by root on 3/25/16. */ $(document).ready(function(){ - loadDataFromServer(868, 0); + loadDataFromServer(8686, 0); });