diff --git a/app/api/mobile/apis/new_comment.rb b/app/api/mobile/apis/new_comment.rb index 2c3cb3f82..7977a1e8a 100644 --- a/app/api/mobile/apis/new_comment.rb +++ b/app/api/mobile/apis/new_comment.rb @@ -12,7 +12,7 @@ module Mobile requires :type, type: String requires :content, type: String end - get ':id' do + post ':id' do type = params[:type] result = 1 current_user = User.find 8686 @@ -23,6 +23,7 @@ module Mobile feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], params[:id]) if (feedback.errors.empty?) homework_common.update_attributes(:updated_at => Time.now) + data = homework_common.journals_for_messages.last result = 2 else result = 3 @@ -109,7 +110,8 @@ module Mobile else result = 4 end - present :data, result + present :data, data, with: Mobile::Entities::Jours + present :result, result present :status, 0 end end diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index e114a7173..972c6113e 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -213,7 +213,7 @@ -
更多
+
更多
diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 3f05b1b8e..10ddd9d7a 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -40,7 +40,8 @@
回复 ()
()
- +
+ = 0; --j){ !>
@@ -54,6 +55,7 @@
+
@@ -66,6 +68,20 @@
+ + diff --git a/public/javascripts/wechat/homework_detail.js b/public/javascripts/wechat/homework_detail.js index 92796cf3f..094a1d432 100644 --- a/public/javascripts/wechat/homework_detail.js +++ b/public/javascripts/wechat/homework_detail.js @@ -10,6 +10,12 @@ $(document).ready(function(){ var apiUrl = '/api/v1/'; + var setReplyTemplate = function(data){ + console.log(data); + var html=bt('t:homework-detail-reply',{reply: data}); + $('#all_homework_reply').prepend(html); + }; + var setTemplate = function(data){ console.log(data); var html=bt('t:homework-detail',{homework: data}); @@ -51,10 +57,10 @@ $(document).ready(function(){ alert("请输入回复"); }else{ - //将用户输入内容插入最后一条回复 + /*//将用户输入内容插入最后一条回复 $(".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 @@ -75,6 +81,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 c921ed64d..6ed55c624 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(8686, 0); + loadDataFromServer(868, 0); });