@using GBLab.Common.Expand;
@using System.Text;
@{
    Layout = "~/Views/School_Pre/Shared/_Layout.cshtml";
    var data = ViewData["data"] as GBLab.Entities.T_CmsDownload;
    var pre = ViewData["pre"] as GBLab.Entities.T_CmsDownload;
    var next = ViewData["next"] as GBLab.Entities.T_CmsDownload;
    var top10data = ViewData["top10data"] as List<GBLab.Entities.T_CmsDownload>;

    StringBuilder sb = new StringBuilder();
    int count = 0;
}
@section HeadStyle{
}
@section HeadScript{
}
@section JavaScript{
    <script>
        seajs.use(
            [
                @* 可放大和触控的相册 *@
                , "/App_Themes/Skin_Manage/Extend/helper/plus/plus_images.js?v=@(ViewBag.Version)"
            ]
            , function (main) {
                // Photoswipe - 相册1
                var imagesdetail = new gblab_images.func();
                imagesdetail.controls.$imgs = $(".detailimage>div>a>img");
                imagesdetail.config.bgOpacity = 1.0;
                imagesdetail.init();
            }
        );

        $(function () {
            addOne();
        });

        function addOne() {
            // 获取分类信息
            $.ajax({
                type: "POST",
                url: "@(Url.Domain_RouteUrl("Site.CmsDownloads.Download_AddOne", new { }))",
                data: "infoId=" +"@(data.F_Id)",
                success: function (data) {
                    var result = $.parseJSON(data);
                    console.log(result);
                },
                error: function (data) {
                    alert('数据提交失败，请联系管理员。')
                }
            });
        }
    </script>
}
@{Html.RenderPartial("~/Views/School_Pre/Shared/_Part/_HeaderAd.cshtml");}
@{Html.RenderPartial("~/Views/School_Pre/Views/Module/Common/HeadPath.cshtml");}

<div class="box">
    <div class="col-md-8" id="imagesdetail">
        @{
            sb.AppendFormat(@"
            <div class='detailhead'>
                <div>
                    <a href='#this' target='_blank' class='thumbnail'>
                        <img src='{0}' alt='{1}' data-bd-imgshare-binded='1'>
                    </a>
                    <div>
                        <a href='#this' class='fs14'>{1}</a>
                        <br>
                        <a href='#this' class='minfo'>{2}</a>
                        <div>
                            <span>更新：{3}</span>
                            <span>点击：{4}</span>
                        </div>
                    </div>
                </div>
            </div>"
, data.F_Logo.ChangeToImageUrl("")
, data.F_Name
, data.F_Info.RemoveHTML().SubstringEllipsis(30, "...")
, data.F_UpdateDate.ToString("yyyy-MM-dd")
, data.F_ViewNum.ToString()
);
        }
        @Html.Raw(sb.ToString())

        <div class="container-detail-head">下载列表</div>
        <div class="detailFilesDownload col-xs-12 col-md-12">
            @{
                sb.Clear();
                count = 0;
                string[] fileList = data.F_Files.Split('|');
                foreach (var item in fileList) {
                    count++;
                    if (!string.IsNullOrWhiteSpace(item)) {
                        sb.AppendFormat(@"
<div><a href='{0}' target='_blank'>{1}</a></div>"
                                , item
                                , "文件" + count.ToString()
                            );
                    }
                }
            }
            @Html.Raw(sb.ToString())
        </div>

        <div class="container-detail-head">下载相册</div>
        <div class="detailimage col-xs-12 col-md-12">
            @{
                StringBuilder sbImgHead = new StringBuilder();
                string[] imgList = data.F_Imgs.Split('|');
                foreach (var item in imgList) {
                    if (!string.IsNullOrWhiteSpace(item)) {
                        sbImgHead.AppendFormat(@"
<div class='col-xs-6 col-md-4'>
    <a href='#this' class='thumbnail'>
        <img src='{0}' alt='{1}' data-bd-imgshare-binded='1'>
    </a>
    <h5>{1}</h5>
</div>"
                            , item
                            , "图片" + count.ToString()
                        );
                    }
                }
            }
            @Html.Raw(sbImgHead.ToString())
        </div>

        <div class="container-detail-head">下载介绍</div>
        <div class="container-detail-info col-xs-12 col-md-12">
            @Html.Raw(data.F_Info.DefaultIsNullOrEmpty(""))
        </div>

        <div class="container-detail-head">更多下载</div>
        <div class="detailimage col-xs-12 col-md-12">
            @{
                sbImgHead.Clear();
                sbImgHead = new StringBuilder();
                foreach (var item in top10data) {
                    sbImgHead.AppendFormat(@"
<div class='col-xs-6 col-md-4'>
    <a href='{2}' class='thumbnail'>
        <img src='{0}' alt='{1}' data-bd-imgshare-binded='1'>
    </a>
    <h5>{1}</h5>
</div>"
                        , item.F_Logo.ChangeToImageUrl("")
                        , item.F_Name
                        , Url.Domain_RouteUrl("Site.CmsDownloads.Node.Detail", new { typeId = item.F_TypeId, id = item.F_Id })
                    );
                }
            }
            @Html.Raw(sbImgHead.ToString())
        </div>
    </div>
    <div class="col-xs-12 col-md-4">
        @{Html.RenderPartial("~/Views/School_Pre/Views/Module/Common/Menu.cshtml");}
        @{Html.RenderPartial("~/Views/School_Pre/Views/Module/CmsDownloads/_Part/Top10.cshtml");}
        <div class="container-right-head bs-info">相关下载</div>
        <div class="container-right-info col-xs-12 col-md-12">
            @{sb.Clear();}
            @if (pre != null) {
                sb.AppendFormat(@"
<div class='col-xs-12 col-sm-6 col-md-12'>
<a href='{0}'>上一篇：{1}</a>
</div>"
        , Url.Domain_RouteUrl("Site.CmsDownloads.Node.Detail", new { typeId = pre.F_TypeId, id = pre.F_Id })
        , pre.F_Name
        );
            }
            @if (next != null) {
                sb.AppendFormat(@"
<div class='col-xs-12 col-sm-6 col-md-12'>
<a href='{0}'>下一篇：{1}</a>
</div>"
        , Url.Domain_RouteUrl("Site.CmsDownloads.Node.Detail", new { typeId = next.F_TypeId, id = next.F_Id })
        , next.F_Name
        );
            }
            @Html.Raw(sb.ToString())
        </div>
    </div>
</div>