课程作业详情页面
This commit is contained in:
parent
03abdbb68b
commit
4088fb9cb4
|
@ -22,7 +22,7 @@ module Mobile
|
||||||
activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
|
activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
|
||||||
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
|
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
|
||||||
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{user.id}) " +
|
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{user.id}) " +
|
||||||
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(200).offset(page * 10)
|
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(50).offset(page * 10)
|
||||||
present :data, activities, with: Mobile::Entities::Activity
|
present :data, activities, with: Mobile::Entities::Activity
|
||||||
present :status, 0
|
present :status, 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -95,6 +95,7 @@ module Mobile
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
expose :act_type #缺陷/作业/讨论区/留言等类型
|
expose :act_type #缺陷/作业/讨论区/留言等类型
|
||||||
|
expose :act_id
|
||||||
expose :container_type #课程/项目/博客/个人
|
expose :container_type #课程/项目/博客/个人
|
||||||
expose :author, using: Mobile::Entities::User do |a, opt| #用户信息
|
expose :author, using: Mobile::Entities::User do |a, opt| #用户信息
|
||||||
if a.is_a? ::UserActivity
|
if a.is_a? ::UserActivity
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive">
|
<div class="post-interactive">
|
||||||
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" onclick="window.open('homework_detail.html?id=<!=i!>');" class="c-grey">回复 (<!=activities[i].reply_count!>)</a></div>
|
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" onclick="window.open('homework_detail.html?id=<!=activities[i].act_id!>');" class="c-grey">回复 (<!=activities[i].reply_count!>)</a></div>
|
||||||
<div class="post-interactive-column c-grey2">赞 (<!=activities[i].activity_praise_count!>)</div>
|
<div class="post-interactive-column c-grey2">赞 (<!=activities[i].activity_praise_count!>)</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
<!-- 模板1开始,可以使用script(type设置为text/html)来存放模板片段,并且用id标示 -->
|
<!-- 模板1开始,可以使用script(type设置为text/html)来存放模板片段,并且用id标示 -->
|
||||||
<script id="t:homework-detail" type="text/html">
|
<script id="t:homework-detail" type="text/html">
|
||||||
<div class="undis homework-id"><!=homeworkID!></div>
|
<div id="check"></div>
|
||||||
<div class="post-container">
|
<div class="post-container">
|
||||||
<div class="post-wrapper">
|
<div class="post-wrapper">
|
||||||
<div class="post-main">
|
<div class="post-main">
|
||||||
|
@ -37,29 +37,29 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="post-interactive border-bottom">
|
<div class="post-interactive border-bottom">
|
||||||
<div class="post-interactive-column c-grey2">回复 (<!=homework.whomework_journal_count!>)</div>
|
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">(<!=homework.whomework_journal_count!>)</span></div>
|
||||||
<div class="post-interactive-column c-grey2">赞 (<!=homework.whomework_praise_count!>)</div>
|
<div class="post-interactive-praise c-grey2"><span class="paise-text"> 赞 </span><span class="praise-num">(<!=homework.whomework_praise_count!>)</span></div>
|
||||||
</div>
|
</div>
|
||||||
|
<! for(var j =0; j < homework.journals_for_messages.length; ++j){ !>
|
||||||
<div class="post-reply-wrap border-bottom">
|
<div class="post-reply-wrap border-bottom">
|
||||||
<div class="post-reply-row">
|
<div class="post-reply-row">
|
||||||
<div class="post-reply-avatar fl"><img src="<!=homework.journals_for_messages[0].user.img_url!>" width="45" height="45" class="border-radius" /></div>
|
<div class="post-reply-avatar fl"><img src="<!=homework.journals_for_messages[j].user.img_url!>" width="45" height="45" class="border-radius" /></div>
|
||||||
<div class="ml55">
|
<div class="ml55">
|
||||||
<div class="post-reply-user hidden"><!=homework.journals_for_messages[0].user.realname!></div>
|
<div class="post-reply-user hidden"><!=homework.journals_for_messages[j].user.realname!></div>
|
||||||
<div class="post-reply-content c-grey2 mb10"><!=homework.journals_for_messages[0].notes!></div>
|
<div class="post-reply-content c-grey2 mb10"><!:=homework.journals_for_messages[j].notes!></div>
|
||||||
<div class="post-reply-date fl"><!=homework.journals_for_messages[0].lasted_comment!></div>
|
<div class="post-reply-date fl"><!=homework.journals_for_messages[j].lasted_comment!></div>
|
||||||
<div class="post-reply-trigger fr undis">回复</div>
|
<div class="post-reply-trigger fr undis">回复</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<! } !>
|
||||||
<div class="post-input-wrap">
|
<div class="post-input-wrap">
|
||||||
<div class="post-reply-row">
|
<div class="post-reply-row">
|
||||||
<div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="30" height="30" /></div>
|
<!--<div class="post-reply-avatar fl" id = "100"><img src="images/post-avatar.jpg" width="30" height="30" /></div>-->
|
||||||
<div class="ml55">
|
<div class="mr55"><input type="text" class="post-reply-input" id="postInput" /></div>
|
||||||
<input type="text" class="post-reply-input" id="postInput" />
|
<input type="submit" value="回复" class="post-reply-submit fr mt10" onclick="replyInsert()" />
|
||||||
<input type="submit" value="回复" class="post-reply-submit fr mt10" onclick="replyInsert()" />
|
<div class="cl"></div>
|
||||||
<div class="cl"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -17,6 +17,9 @@ $(document).ready(function(){
|
||||||
$('.post-reply-submit').click(function(){
|
$('.post-reply-submit').click(function(){
|
||||||
replyInsert();
|
replyInsert();
|
||||||
});
|
});
|
||||||
|
$('post-interactive-praise').click(function(){
|
||||||
|
praiseClick();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var loadDataFromServer = function(id){
|
var loadDataFromServer = function(id){
|
||||||
|
@ -36,7 +39,10 @@ $(document).ready(function(){
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
loadDataFromServer(808);
|
var homeworkUrl = window.location.search;
|
||||||
|
var homeworkID = homeworkUrl.split("=")[1];
|
||||||
|
|
||||||
|
loadDataFromServer(homeworkID);
|
||||||
|
|
||||||
//点击回复按钮,插入回复内容
|
//点击回复按钮,插入回复内容
|
||||||
var replyInsert = function(){
|
var replyInsert = function(){
|
||||||
|
@ -44,14 +50,46 @@ $(document).ready(function(){
|
||||||
if (!replyContent){
|
if (!replyContent){
|
||||||
alert("请输入回复");
|
alert("请输入回复");
|
||||||
}else{
|
}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="30" height="30" /></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">1分钟前</div><div class="post-reply-trigger fr">回复</div></div><div class="cl"></div></div> </div>');
|
|
||||||
|
//将用户输入内容插入最后一条回复
|
||||||
|
$(".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-content:last").append(replyContent);
|
||||||
$("#postInput").val("");}
|
$(".post-reply-date:last").append(Date());
|
||||||
|
var postInput = $("#postInput").val();
|
||||||
|
$("#postInput").val("");
|
||||||
|
//回复数目+1
|
||||||
|
var replyNum = $(".post-interactive-reply").text().match(/\d+/g);
|
||||||
|
replyNum++;
|
||||||
|
$(".reply-num").text("(" + replyNum + ")");
|
||||||
|
|
||||||
|
//获取并传送回复用户数据
|
||||||
|
var userInfo = {
|
||||||
|
"replyType" : "homework_assignment",
|
||||||
|
"replyContent" : postInput
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST", //提交方式
|
||||||
|
dataType: "json", //类型
|
||||||
|
url: "前台地址/后台方法", //提交的页面,方法名
|
||||||
|
data: userInfo, //参数,如果没有,可以为null
|
||||||
|
success: function (data) { //如果执行成功,那么执行此方法
|
||||||
|
alert(data.d); //用data.d来获取后台传过来的json语句,或者是单纯的语句
|
||||||
|
},
|
||||||
|
error: function (err) { //如果执行不成功,那么执行此方法
|
||||||
|
alert("err:" + err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var getID = function(){
|
//点赞效果
|
||||||
var homeworkID = $("#homework-id").html();
|
var praiseClick = function(){
|
||||||
alert(homeworkID);
|
var praiseNum = $(".post-interactive-praise").text().match(/\d+/g);
|
||||||
return homeworkID;
|
praiseNum++;
|
||||||
|
$(".praise-num").text("(" + praiseNum + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
|
@ -37,7 +37,7 @@ $(document).ready(function(){
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
loadDataFromServer(8686);
|
loadDataFromServer(1);
|
||||||
|
|
||||||
//内容全部显示与部分隐藏
|
//内容全部显示与部分隐藏
|
||||||
var descToggle = function(){
|
var descToggle = function(){
|
||||||
|
@ -56,14 +56,5 @@ $(document).ready(function(){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//点击回复按钮,插入回复内容
|
|
||||||
var replyInsert = function(){
|
|
||||||
var replyContent = $("#postInput").val();
|
|
||||||
if (!replyContent){
|
|
||||||
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="30" height="30" /></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">1分钟前</div><div class="post-reply-trigger fr">回复</div></div><div class="cl"></div></div> </div>');
|
|
||||||
$(".post-reply-content:last").append(replyContent);
|
|
||||||
$("#postInput").val("");}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,10 +16,12 @@ h1,h2,h3,h4,h5,p {padding:0px; margin:0px;}
|
||||||
.ml15 {margin-left:15px;}
|
.ml15 {margin-left:15px;}
|
||||||
.mr15 {margin-right:15px;}
|
.mr15 {margin-right:15px;}
|
||||||
.ml55 {margin-left:55px;}
|
.ml55 {margin-left:55px;}
|
||||||
|
.mr55 {margin-right:55px;}
|
||||||
.c-blue {color:#269ac9;}
|
.c-blue {color:#269ac9;}
|
||||||
.c-grey {color:#9a9a9a;}
|
.c-grey {color:#9a9a9a;}
|
||||||
.c-grey2 {color:#707070;}
|
.c-grey2 {color:#707070;}
|
||||||
.c-grey3 {color:#555555;}
|
.c-grey3 {color:#555555;}
|
||||||
|
a {color:#707070;}
|
||||||
a.c-grey {color:#707070;}
|
a.c-grey {color:#707070;}
|
||||||
a:link,a:visited{text-decoration:none;}
|
a:link,a:visited{text-decoration:none;}
|
||||||
a:hover,a:active{cursor:pointer;}
|
a:hover,a:active{cursor:pointer;}
|
||||||
|
@ -43,6 +45,8 @@ a.link-blue {color:#269ac9;}
|
||||||
.post-content {width:100%; font-size:13px; line-height:18px; height:90px; overflow:hidden;}
|
.post-content {width:100%; font-size:13px; line-height:18px; height:90px; overflow:hidden;}
|
||||||
.post-interactive {width:100%; height:35px; line-height:35px; vertical-align:middle; border-top:1px solid #e6e6e6; background-color:#f8f9fb;}
|
.post-interactive {width:100%; height:35px; line-height:35px; vertical-align:middle; border-top:1px solid #e6e6e6; background-color:#f8f9fb;}
|
||||||
.post-interactive-column {width:50%; text-align:center; float:left; font-size:13px;}
|
.post-interactive-column {width:50%; text-align:center; float:left; font-size:13px;}
|
||||||
|
.post-interactive-reply {width:50%; text-align:center; float:left; font-size:13px;}
|
||||||
|
.post-interactive-praise {width:50%; text-align:center; float:left; font-size:13px;}
|
||||||
.more-wrap {width:100%;}
|
.more-wrap {width:100%;}
|
||||||
.more-events {width:98%; font-size:13px; text-align:center; margin:0px auto; padding: 5px 0px; border:1px solid #e6e6e6; border-radius:3px; background-color:#f8f9fb; }
|
.more-events {width:98%; font-size:13px; text-align:center; margin:0px auto; padding: 5px 0px; border:1px solid #e6e6e6; border-radius:3px; background-color:#f8f9fb; }
|
||||||
.border-bottom {border-bottom:1px solid #e6e6e6;}
|
.border-bottom {border-bottom:1px solid #e6e6e6;}
|
||||||
|
|
Loading…
Reference in New Issue