Merge branch 'weixin_guange' of https://git.trustie.net/jacknudt/trustieforge into weixin_guange

This commit is contained in:
txz 2016-04-01 23:21:25 +08:00
commit d45604c4a0
5 changed files with 32 additions and 7 deletions

View File

@ -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

View File

@ -213,7 +213,7 @@
<! } !>
<! } !>
<! if ((count + page * 10) < all_count) {!>
<div id="more_activities" class="more-events mt10" onclick="loadDataFromServer(8686, <!= page+1 !>);">更多</div>
<div id="more_activities" class="more-events mt10" onclick="loadDataFromServer(868, <!= page+1 !>);">更多</div>
<! } !>
</script>

View File

@ -39,7 +39,8 @@
<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>
<! for(var j =0; j < homework.journals_for_messages.length; ++j){ !>
<div id="all_homework_reply">
<! for(var j = (homework.journals_for_messages.length - 1); j >= 0; --j){ !>
<div class="post-reply-wrap border-bottom">
<div class="post-reply-row">
<div class="post-reply-avatar fl"><img src="<!=homework.journals_for_messages[j].user.img_url!>" width="45" height="45" class="border-radius" /></div>
@ -53,6 +54,7 @@
</div>
</div>
<! } !>
</div>
<div class="post-input-wrap">
<div class="post-reply-row">
<!--<div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="30" height="30" /></div>-->
@ -65,6 +67,20 @@
</div>
</script>
<script id="t:homework-detail-reply" type="text/html">
<div class="post-reply-wrap border-bottom">
<div class="post-reply-row">
<div class="post-reply-avatar fl"><img src="<!=reply.user.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="ml55">
<div class="post-reply-user hidden"><!=reply.user.realname!></div>
<div class="post-reply-content c-grey2 mb10"><!:=reply.notes!></div>
<div class="post-reply-date fl"><!=reply.lasted_comment!></div>
</div>
<div class="cl"></div>
</div>
</div>
</script>
<script src="/javascripts/jquery-1.3.2.js"></script>
<script src="/javascripts/baiduTemplate.js"></script>
<script src="/javascripts/wechat/homework_detail.js"></script>

View File

@ -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('<div class="post-reply-wrap border-bottom"><div class="post-reply-row"><div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="45" height="45" /></div><div class="ml55"><div class="post-reply-user hidden">Mrs. Ashford</div><div class="post-reply-content c-grey2 mb10"></div><div class="post-reply-date fl"></div><div class="post-reply-trigger fr undis">回复</div></div><div class="cl"></div></div> </div>');
$(".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);

View File

@ -2,5 +2,5 @@
* Created by root on 3/25/16.
*/
$(document).ready(function(){
loadDataFromServer(8686, 0);
loadDataFromServer(868, 0);
});