|
|
@ -10,6 +10,12 @@ $(document).ready(function(){
|
|
|
|
|
|
|
|
|
|
|
|
var apiUrl = '/api/v1/';
|
|
|
|
var apiUrl = '/api/v1/';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var setReplyTemplate = function(data){
|
|
|
|
|
|
|
|
console.log(data);
|
|
|
|
|
|
|
|
var html=bt('t:c-message-detail-reply',{reply: data});
|
|
|
|
|
|
|
|
$('#all_course_message_reply').prepend(html);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var setTemplate = function(data){
|
|
|
|
var setTemplate = function(data){
|
|
|
|
console.log(data);
|
|
|
|
console.log(data);
|
|
|
|
var html=bt('t:course-discussion',{discussion: data});
|
|
|
|
var html=bt('t:course-discussion',{discussion: data});
|
|
|
@ -17,9 +23,9 @@ $(document).ready(function(){
|
|
|
|
$('.post-reply-submit').click(function(){
|
|
|
|
$('.post-reply-submit').click(function(){
|
|
|
|
replyInsert();
|
|
|
|
replyInsert();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$('post-interactive-praise').click(function(){
|
|
|
|
/*$('post-interactive-praise').click(function(){
|
|
|
|
praiseClick();
|
|
|
|
praiseClick();
|
|
|
|
});
|
|
|
|
});*/
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var loadDataFromServer = function(id){
|
|
|
|
var loadDataFromServer = function(id){
|
|
|
@ -52,9 +58,9 @@ $(document).ready(function(){
|
|
|
|
}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="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-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);
|
|
|
|
$(".post-reply-date:last").append(Date());
|
|
|
|
$(".post-reply-date:last").append(Date());*/
|
|
|
|
var postInput = $("#postInput").val();
|
|
|
|
var postInput = $("#postInput").val();
|
|
|
|
$("#postInput").val("");
|
|
|
|
$("#postInput").val("");
|
|
|
|
//回复数目+1
|
|
|
|
//回复数目+1
|
|
|
@ -71,10 +77,11 @@ $(document).ready(function(){
|
|
|
|
$.ajax({
|
|
|
|
$.ajax({
|
|
|
|
type: "POST", //提交方式
|
|
|
|
type: "POST", //提交方式
|
|
|
|
dataType: "json", //类型
|
|
|
|
dataType: "json", //类型
|
|
|
|
url: "前台地址/后台方法", //提交的页面,方法名
|
|
|
|
url: apiUrl + 'new_comment/' + homeworkID, //提交的页面,方法名
|
|
|
|
data: userInfo, //参数,如果没有,可以为null
|
|
|
|
data: userInfo, //参数,如果没有,可以为null
|
|
|
|
success: function (data) { //如果执行成功,那么执行此方法
|
|
|
|
success: function (data) { //如果执行成功,那么执行此方法
|
|
|
|
alert(data.d); //用data.d来获取后台传过来的json语句,或者是单纯的语句
|
|
|
|
setReplyTemplate(data.data);
|
|
|
|
|
|
|
|
alert("6");
|
|
|
|
},
|
|
|
|
},
|
|
|
|
error: function (err) { //如果执行不成功,那么执行此方法
|
|
|
|
error: function (err) { //如果执行不成功,那么执行此方法
|
|
|
|
alert("err:" + err);
|
|
|
|
alert("err:" + err);
|
|
|
@ -84,12 +91,12 @@ $(document).ready(function(){
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//点赞效果
|
|
|
|
/*//点赞效果
|
|
|
|
var praiseClick = function(){
|
|
|
|
var praiseClick = function(){
|
|
|
|
var praiseNum = $(".post-interactive-praise").text().match(/\d+/g);
|
|
|
|
var praiseNum = $(".post-interactive-praise").text().match(/\d+/g);
|
|
|
|
praiseNum++;
|
|
|
|
praiseNum++;
|
|
|
|
$(".praise-num").text("(" + praiseNum + ")");
|
|
|
|
$(".praise-num").text("(" + praiseNum + ")");
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|