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

    StringBuilder sb = new StringBuilder();
    int count = 0;
}
<link href="~/App_Themes/Skin_Manage/Extend/libs/vedio/css/video-js.min.css" rel="stylesheet" />
<script src="~/App_Themes/Skin_Manage/Extend/libs/vedio/js/video.min.js"></script>
@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();
            }
        );


        //设置中文
        videojs.addLanguage('zh-CN', {
            "Play": "播放",
            "Pause": "暂停",
            "Current Time": "当前时间",
            "Duration": "时长",
            "Remaining Time": "剩余时间",
            "Stream Type": "媒体流类型",
            "LIVE": "直播",
            "Loaded": "加载完毕",
            "Progress": "进度",
            "Fullscreen": "全屏",
            "Non-Fullscreen": "退出全屏",
            "Mute": "静音",
            "Unmute": "取消静音",
            "Playback Rate": "播放速度",
            "Subtitles": "字幕",
            "subtitles off": "关闭字幕",
            "Captions": "内嵌字幕",
            "captions off": "关闭内嵌字幕",
            "Chapters": "节目段落",
            "Close Modal Dialog": "关闭弹窗",
            "Descriptions": "描述",
            "descriptions off": "关闭描述",
            "Audio Track": "音轨",
            "You aborted the media playback": "视频播放被终止",
            "A network error caused the media download to fail part-way.": "网络错误导致视频下载中途失败。",
            "The media could not be loaded, either because the server or network failed or because the format is not supported.": "视频因格式不支持或者服务器或网络的问题无法加载。",
            "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.": "由于视频文件损坏或是该视频使用了你的浏览器不支持的功能，播放终止。",
            "No compatible source was found for this media.": "无法找到此视频兼容的源。",
            "The media is encrypted and we do not have the keys to decrypt it.": "视频已加密，无法解密。",
            "Play Video": "播放视频",
            "Close": "关闭",
            "Modal Window": "弹窗",
            "This is a modal window": "这是一个弹窗",
            "This modal can be closed by pressing the Escape key or activating the close button.": "可以按ESC按键或启用关闭按钮来关闭此弹窗。",
            ", opens captions settings dialog": ", 开启标题设置弹窗",
            ", opens subtitles settings dialog": ", 开启字幕设置弹窗",
            ", opens descriptions settings dialog": ", 开启描述设置弹窗",
            ", selected": ", 选择",
            "captions settings": "字幕设定",
            "Audio Player": "音频播放器",
            "Video Player": "视频播放器",
            "Replay": "重播",
            "Progress Bar": "进度小节",
            "Volume Level": "音量",
            "subtitles settings": "字幕设定",
            "descriptions settings": "描述设定",
            "Text": "文字",
            "White": "白",
            "Black": "黑",
            "Red": "红",
            "Green": "绿",
            "Blue": "蓝",
            "Yellow": "黄",
            "Magenta": "紫红",
            "Cyan": "青",
            "Background": "背景",
            "Window": "视窗",
            "Transparent": "透明",
            "Semi-Transparent": "半透明",
            "Opaque": "不透明",
            "Font Size": "字体尺寸",
            "Text Edge Style": "字体边缘样式",
            "None": "无",
            "Raised": "浮雕",
            "Depressed": "压低",
            "Uniform": "均匀",
            "Dropshadow": "下阴影",
            "Font Family": "字体库",
            "Proportional Sans-Serif": "比例无细体",
            "Monospace Sans-Serif": "单间隔无细体",
            "Proportional Serif": "比例细体",
            "Monospace Serif": "单间隔细体",
            "Casual": "舒适",
            "Script": "手写体",
            "Small Caps": "小型大写字体",
            "Reset": "重启",
            "restore all settings to the default values": "恢复全部设定至预设值",
            "Done": "完成",
            "Caption Settings Dialog": "字幕设定视窗",
            "Beginning of dialog window. Escape will cancel and close the window.": "开始对话视窗。离开会取消及关闭视窗",
            "End of dialog window.": "结束对话视窗"
        });

        $(function () {
            addOne();

            var myPlayer = videojs('vedioInfo');
            videojs("vedioInfo").ready(function () {
                var myPlayer = this;
                myPlayer.play();
            });
        });

        function addOne() {
            // 获取分类信息
            $.ajax({
                type: "POST",
                url: "@(Url.Domain_RouteUrl("Site.CmsVedios.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.DefaultIsNullOrEmpty("/App_Themes/Skin_Site/School_Pre/cmsIcon/视频.png").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">
            <video id="vedioInfo" class="video-js col-xs-12 col-md-12" controls preload="auto" data-setup="{}">
                <source src="@(Request.Url.Scheme+"://"+Request.Url.Authority+data.F_Files.DefaultIsNullOrEmpty("").Replace("|",""))" type="video/mp4">
            </video>
        </div>

        <div class="container-detail-head">视频相册</div>
        <div class="detailimage col-xs-12 col-md-12">
            @{
                StringBuilder sbImgHead = new StringBuilder();
                string[] imgList = data.F_Logo.DefaultIsNullOrEmpty("").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.DefaultIsNullOrEmpty("/App_Themes/Skin_Site/School_Pre/cmsIcon/视频.png").ChangeToImageUrl("")
                        , item.F_Name
                        , Url.Domain_RouteUrl("Site.CmsVedios.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/CmsVedios/_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.CmsVedios.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.CmsVedios.Node.Detail", new { typeId = next.F_TypeId, id = next.F_Id })
        , next.F_Name
        );
            }
            @Html.Raw(sb.ToString())
        </div>
    </div>
</div>