Upgrade Nuget
大石头 authored at 2024-11-20 14:22:34
4.42 KiB
YuQue
@model NewLife.YuqueWeb.Models.InfoView
@{
    Layout = "~/Views/Shared/_Layout_yq.cshtml";

    var inf = Model.Document;
    var navs = Model.Navs ?? [];
}
@section css {
    @* 当前页面单独使用的样式,后续再考虑放到整体样式文件中去 *@
    <style>
        .bs-docs-sidebar .nav > li > a {
            display: block;
            padding: 4px 20px;
            font-size: 13px;
            color: #333333;
        }

            .bs-docs-sidebar .nav > li > a:focus, .bs-docs-sidebar .nav > li > a:hover {
                padding-left: 19px;
                color: #111111;
                font-weight: bold;
                text-decoration: none;
                background-color: transparent;
                border-left: 1px solid #CCCCCC;
                font-size: 14px;
            }

        .bs-docs-sidebar .nav .nav {
            display: inherit;
            padding-left: 10px;
        }

            .bs-docs-sidebar .nav .nav > li > a {
                padding-top: 3px;
                padding-bottom: 3px;
                padding-left: 30px;
                font-size: 12px;
            }

        .content h1, .content h2, .content h3, .content h4, .content h5 {
            padding-top: 65px !important;
        }

        .bs-docs-sidebar{
            height: calc(100% - 190px);
            overflow-y:auto;
        }
    </style>
}
<div class="container">
    <div class="row">
        <div class="page-header">
            <h2 class="text-center">
                @inf.Title
            </h2>
        </div>
        <div class="content bs-docs-container">
            <div class="row">
                <div class="col-md-9" role="main">
                    @Html.Raw(inf.Html)
                </div>
                @if (navs.Count > 0)
                {
                    <div class="col-md-3" role="complementary">
                        <!--正文目录 开始-->
                        @* 目前未完成问题:无法响应页面滚动到相关标题处时,左侧高亮对应标题项,如果标题很多,超过浏览器高度,会显示不全 *@
                        <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix">
                            <ul class="nav bs-docs-sidenav">
                                @foreach (var nav in navs)
                                {
                                    <li>
                                        <a href="#@nav.Id">@nav.Title</a>
                                        @if (nav.Children.Count > 0)
                                        {
                                            <ul class="nav">
                                                @foreach (var child in nav.Children)
                                                {
                                                    <li>
                                                        <a href="#@child.Id">@child.Title</a>
                                                        @if (child.Children.Count > 0)
                                                        {
                                                            <ul class="nav">
                                                                @foreach (var sub in child.Children)
                                                                {
                                                                    <li>
                                                                        <a href="#@sub.Id">@sub.Title</a>
                                                                    </li>
                                                                }
                                                            </ul>
                                                        }
                                                    </li>
                                                }
                                            </ul>
                                        }
                                    </li>
                                }
                            </ul>
                        </nav>
                        <!--正文目录 结束-->
                    </div>
                }
            </div>
        </div>
        <p></p>
        <span class="text-center">
            <em class="e e1">作者:@inf.UserName</em>
            <em class="e e2">发布:@inf.PublishTime.ToFullString()</em>
            <em class="e e3">浏览:@inf.TotalHits.ToString("n0"))</em>
        </span>
    </div>
</div>