评论优化

This commit is contained in:
2020-09-10 17:01:30 +08:00
parent 96c065c0a2
commit f70c890b4d
38 changed files with 470 additions and 459 deletions
@@ -9,20 +9,22 @@ $("#addPost").click(function () {
console.log("点击 addPost");
console.log(username);
console.log(discussionsId);
let postId = $("#postId").val();
console.log(postId);
if(username && username!=null){
var token = $("meta[name='_csrf']").attr("content");
var header = $("meta[name='_csrf_header']").attr("content");
console.warn(header)
console.warn(token)
var content = $("#postcontent").val();
var content = $("#postContent").val();
console.log(content);
$.ajax({
type: "POST",
url: "/newpost",
data: JSON.stringify({
content: content,
discussion_id: discussionsId
discussionId: discussionsId,
parentId: postId
}),
contentType: 'application/json',
beforeSend: function(request) {
@@ -32,7 +34,7 @@ $("#addPost").click(function () {
success: function (data) {
console.log(data);
if(data.flag){
massage(title+',添加成功!','');
massage(content+',添加成功!','');
location.reload();
}else{
massage(data.msg,'');
@@ -46,4 +48,16 @@ $("#addPost").click(function () {
}
});
// 回复
function replyThis(username, postId) {
console.warn(username)
console.warn(postId)
$("#postId").val(postId);
var content = $("#postContent").val();
if (content) content += '\n';
$("#postContent").val(content + "@" + username + " ");
$("#postContent").focus();
}