@model CommentPage
@if (!Model.Page.Any())
{
<blockquote class="comment-item no-reply">暂无评论,来抢沙发吧</blockquote>
}
else
{
@foreach (var item in Model.Page)
{
<blockquote class="comment-item" id="@item.Id">
<partial name="_AvatarPartial" model="item.Commenter"/>
<div class="detail">
<div class="comment-head">
<partial name="_NickNamePartial" model="item.Commenter"/>
<time class="timeago" datetime="@item.PublishTime" title="@item.PublishTime">@item.PublishTime</time>
@if (item.IsDelete != true)
{
<button class="btn-reply" title="回复" data-reply-id="@item.Id">
<i class="fa fa-reply fa-fw"></i>
</button>
}
</div>
<div class="comment-content">
@{
var commentContent = new CommentContent
{
CommentText = item.CommentText
};
}
<partial name="_CommentTextPartial" model="commentContent"/>
</div>
@if (item.Children != null && item.Children.Any())
{
<div class="replies">
@foreach (var reply in item.Children)
{
var replier =
Model.Page.FirstOrDefault(x => x.Id == reply.Replies.Last());
var replier2 = item.Children.FirstOrDefault(x => x.Id == reply.Replies.Last());
<blockquote class="comment-item" id="@reply.Id" data-id="@reply.Id">
<partial name="_AvatarPartial" model="reply.Commenter"/>
<div class="detail">
<div class="comment-head">
<partial name="_NickNamePartial" model="reply.Commenter"/>
<time class="timeago" datetime="@reply.PublishTime" title="@reply.PublishTime">@reply.PublishTime</time>
@if (reply.IsDelete != true)
{
<button class="btn-reply" title="回复" data-reply-id="@reply.Id">
<i class="fa fa-reply fa-fw"></i>
</button>
}
</div>
<div class="comment-content">
@{
var content = new CommentContent
{
CommentText = reply.CommentText
};
if (replier != null)
{
content.ReplyId = replier.Id;
content.ReplyNickName = replier.Commenter.NickName;
}
else if (replier2 != null)
{
content.ReplyId = replier2.Id;
content.ReplyNickName = replier2.Commenter.NickName;
}
}
<partial name="_CommentTextPartial" model="content"/>
</div>
</div>
</blockquote>
}
</div>
}
</div>
</blockquote>
}
@if (Model.Page.CurrentPageIndex < Model.Page.TotalPageCount)
{
<div class="load-more" data-loading-ico="@($"{Program.CdnBaseAddress}/images/loading-dark.gif")">
<button
data-page-index="@Model.Page.CurrentPageIndex"
data-page-size="@Model.Page.PageSize"
data-item-count="@Model.Page.TotalItemCount"
data-page-count="@Model.Page.TotalPageCount"
data-page-request="@Url.Action("Page", new {node = ViewData["node"], relation = ViewData["relation"]})"
class="layui-btn layui-btn-lg layui-btn-normal">
加载更多...
</button>
</div>
}
}