admin 管理员组文章数量: 1086019
社区
var type = 0; //默认是发表评论 // 点击评论$(document).on("click", ".content_title", function () {$(".commented").css("display", "none");$(".commitment").css("display", "block");$(".mask").css("display", "block");$(".content").trigger("click").focus()});//点击遮罩层$(document).on("click", ".mask", function () {$(".commented").css("display", "block");$(".commitment").css("display", "none");$(".mask").css("display", "none");$(".content").attr("placeholder", "在此处输入评论内容...");});// 回复话题评论$(document).on("click", ".content_user", function () {ruserid = $(this).data("id");//用户idcommentsid = $(this).data("commentsid");//评论iduser_name = $(this).find(".store_name").html();$(".content").attr("placeholder", "回复 @" + user_name);type = 1;$(".commented").css("display", "none");$(".commitment").css("display", "block");$(".mask").css("display", "block");$(".content").trigger("click").focus();});
$(document).on("click", ".comments", function () {var content = $(".content").val();//评论内容if (type == 0) {$.Ajax({url: baseUrl + "PCommunity/client/users/commentTopic",is_login: true,data: {topic_id: topic_id,content: content},success: function (res) {console.log(res)if (res.code == 1) {$(".good ").find("span").html(res.result.comments_count);//评论数$(".commented").css("display", "block");$(".commitment").css("display", "none");$(".mask").css("display", "none");$(".content").val(''); //清空评论内容var html = '<div class="new_user_comment">\n' +' <div class="go_back"><span class="withdraw" data-id="' + res.result.comment_id + '">删除</span> </div>\n' +' <div class="user_info">\n' +' <div class="user_info1">\n' +' <div class="info_img"><img src="' + res.result.user_avatar + '" alt=""></div>\n' +' <div class="content_user">\n' +' <div class="store_name">' + res.result.user_nickname + '</div>\n' +' <div class="time">' + res.result.created_at + '</div>\n' +' <div class="content_comment">' + res.result.content + '</div>\n' +' </div>\n' +' </div>\n' +' <span> <i class="iconfont icon-dianzan2" ></i> 0</span>\n' +' </div>\n' +' </div>';$(".comment_list").prepend(html);} else {$.toast(res.result, "text");}}})} else {$.Ajax({url: baseUrl + "PCommunity/client/users/commentTopic",is_login: true,data: {topic_id: topic_id,//话题idcontent: content,ruserid: ruserid,//用户idcommentsid: commentsid,//评论id},success: function (res) {console.log(res);if (res.code == 1) {$(".good ").find("span").html(res.result.comments_count);//评论数$(".commented").css("display", "block");$(".commitment").css("display", "none");$(".mask").css("display", "none");$(".content").val(''); //清空评论内容$(".content").attr("placeholder", "在此处输入评论内容...");var user_name1 = user_name;var html = '<div class="new_user_comment">\n' +'<div class="go_back"><span class="withdraw" data-id="' + res.result.id + '">删除</span></div>\n' +' <div class="user_info">\n' +' <div class="user_info1">\n' +' <div class="info_img"><img src="' + res.result.user_avatar + '" alt=""></div>\n' +' <div class="content_user">\n' +' <div class="store_name">' + res.result.user_nickname + '</div>\n' +' <div class="time">' + res.result.created_at + '</div>\n' +' <div class="content_comment">回复 <span style="color: #007aff">@' + user_name1 + '</span>: <span style="white-space: pre-wrap;\n' +' word-break: break-all;">' + res.result.content + '</span></div>\n' +' </div>\n' +' </div>\n' +' <span class="comment">\n' +' <i class="iconfont icon-dianzan2"></i>\n' +' <span>0</span>\n' +' </span>\n' +' </div>\n' +' </div>\n' +' </div>';type = 0;$(".comment_list").prepend(html);} else {$.toast(res.result, "text");}}})}});
本文标签: 社区
版权声明:本文标题:社区 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/b/1686862556a43000.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论