您的位置: 首页 >日志>用户体验>详细内容

用户体验

便民咨询内容页增加评论列表显示

来源:本站原创 发布时间:2025-06-03 15:13:04 浏览次数: 【字体:

便民咨询内容页开启评论,评论后内页界面不会显示评论列表,只在评论框右上角显示多少条评论,需要点击后才进入到评论列表。

1

不和文章-内容页一样,审核的评论在当前页显示列表。改造显示同文章效果:

新增标签【发表评论带评论列表.cshtml】,在咨询评论列表页.cshtml 标签基础上调整。名称自定义。

@*评论列表页模板*@
@inject LetterCommentService LetterCommentService
@inject NodeService NodeService
@{
    int sourceId = Param.sourceId;
    var service = LetterCommentService;
    int commentCount = service.GetAllCommentCount(sourceId);
}

<div class="commentForm">
    <div class="tips">
        <a href="nojavascript...void(0)" class="count" hidefocus="true"><span>@(commentCount)条评论</span></a>
        <span>文明上网理性发言</span>
    </div>
    <div class="comments postComment">
        @Html.AntiForgeryToken()
        @Power.Partial("发表评论", new { commentId = 0, sourceId })
    </div>
    <div class="hotComments">
        <h3 class="title">热门评论</h3>
        <div class="comments commentlist">
            @Power.Partial("评论回复列表", new { sourceId, outputcount = 5, replyId = 0, usedpage = false })
        </div>
    </div>
    <div class="newComments">
        <h3 class="title">最新评论</h3>
        <div class="comments treecomment">
            @Power.Partial("评论回复列表", new { sourceId, outputcount = 5, replyId = 0, usedpage = true, order = 3 })
        </div>
    </div>
</div>
<input type="hidden" id="urls" data-deletecomment="@Url.Action("AjaxDeleteComment", "LetterComment")"
       data-addcomment="@Url.Action("AjaxAddComment", "LetterComment")" />
<input type="hidden" id="letterid" value="@sourceId" />
<input type="hidden" id="modulename" value="LetterBox" />
<input type="hidden" name="RefreshPage" />
<!-- content E -->
<script src="~/content/_common/base/js/power-commentlist.js" asp-append-version="true"></script>
<script src="~/content/_common/assets/scripts/jquery.validate.js" asp-append-version="true"></script>
<script src="~/content/_common/assets/scripts/jquery.validate.unobtrusive.js" asp-append-version="true"></script>
<script src="~/content/_common/assets/scripts/i18n/jquery.validate.locale_zh.js" asp-append-version="true"></script>
<script src="~/content/_common/base/js/jquery.validate_custom.js" asp-append-version="true"></script>
<script src="~/content/_common/base/js/power.ui.captcha.js" asp-append-version="true"></script>

再把命名的标签替换到公开咨询内容页中

原来部分:

@if (commentLoginShow)
{
    <div class="commentForm">
        <h3 class="tips">
            <a href="@Url.Action("Comment", "LetterComment", new { id = Model.LetterId })" 
            class="count" hidefocus="true"><span>@(commentCount)条评论</span></a>
            <span>文明上网理性发言</span>
        </h3>
        <div class="comments postComment">
            @Html.AntiForgeryToken()
            @Power.Partial("发表评论")
        </div>
    </div>
}

修改后:

@if (commentLoginShow)
{
    @Power.Partial("发表评论带评论列表",new{sourceId=Model.LetterId})

可在当前页面显示评论列表内容。

2


×

用户登录