refactor: 文章详情留言

This commit is contained in:
2025-04-12 17:03:45 +08:00
parent 109e122d49
commit ac76ef1e6c
3 changed files with 70 additions and 3 deletions

View File

@@ -45,14 +45,14 @@
</div>
<div class="repply">
<h3>{:lang('article.detail_leave_reply')}</h3>
<form>
<form action="{:url('article/comment', ['id' => $detail.id])}" method="POST" autocomplete="off">
<span>{:lang('article.detail_leave_reply_name')}</span>
<input class="form-control itinp new_name" type="text" name="name" style="text-indent: 10px;">
<span>{:lang('article.detail_leave_reply_email')}</span>
<input class="form-control itinp new_email" type="email" name="email" style="text-indent: 10px; margin-bottom:0;">
<p style="color: #C6C7C9; font-size: 0.75rem; margin-bottom: 0.625rem;">{:lang('article.detail_leave_reply_email_tip')}</p>
<span>{:lang('article.detail_leave_reply_comment')}</span>
<textarea class="form-control itinp new_comment" rows="3" style="text-indent: 10px;width: 98%; margin-top: 0.625rem;margin-bottom: 0.625rem;border: 1px solid #DBDBDB;"name="comment"></textarea>
<textarea class="form-control itinp new_comment" name="content" rows="3" style="text-indent: 10px;width: 98%; margin-top: 0.625rem;margin-bottom: 0.625rem;border: 1px solid #DBDBDB;"></textarea>
<div class="comment_btn" style="color:#ffffff;">{:lang('article.detail_leave_reply_submit')}</div>
</form>
</div>
@@ -81,4 +81,26 @@
</div>
{/notempty}
</div>
{/block}
{block name="script"}
<script type="text/javascript">
$(document).ready(function() {
$('.comment_btn').click(function() {
var form = $(this).parents('form');
var form_data = form.serialize();
$.ajax({
url: form.attr('action'),
type: 'POST',
data: form_data,
dataType: 'json',
success: function(data) {
alert(data.msg);
if (data.code == 0) {
window.location.reload();
}
}
})
})
})
</script>
{/block}