<?php 
use backend\widgets\YHGImage\Common\Images as CommonImages;
?>
<div class="col-md-6">
    <form id="form" method="POST" action="">
        <div class="panel panel-default">

            <div class="panel-body">
                <div class="row">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">视频ID: </label>
                        <div class="col-sm-9">
                            <?php echo $video->id;?>
                            <input type="hidden" name="id"  value="<?php echo $video->id;?>">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">视频标题: <span class="asterisk">*</span></label>
                        <div class="col-sm-5">
                            <input type="text" name="title" class="form-control" required="required" value="<?php echo $video->title;?>">
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label class="col-sm-3 control-label">头图: <span class="asterisk">*</span></label>
                        <div class="col-sm-5">
                          <div class="col-sm-9">
                          <?=$uploader?>
                          <?php if ($video->pic):?>
                            <div class="file-item thumbnail upload-state-done">
                                <img src="<?php echo CommonImages::getImageUrl($video->pic, 200, 200)?>">
                                <div class="info">当前图片</div>
                            </div>
                          <?php endif;?>
                        </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">腾讯链接 </label>
                        <div class="col-sm-8">
         					<input type="text" name="url" class="form-control"  value="<?php echo $video->url;?>">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">直播中排序: </label>
                        <div class="col-sm-3">
                            <input type="text" name="sort" class="form-control" value="<?=$video->sort?>">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">分享主图: </label>
                        <div class="col-sm-9">
                            <?=$sharePicUploader?>
                            <?php if ($video->id && $videoShare['pic']):?>
                                <div class="file-item thumbnail upload-state-done" id="share_pic"><img src="<?=CommonImages::getImageUrl($videoShare['pic'], 110, 110)?>"><div class="info">当前图片</div></div>
                            <?php endif;?>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">分享标题: </label>
                        <div class="col-sm-9">
                            <input type="text" name="share_title" class="form-control" value="<?php echo ($video->id && $videoShare['title']) ? $videoShare['title']:''?>">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">分享内容: </label>
                        <div class="col-sm-9">
                            <textarea rows="5" name="share_content" class="form-control"><?php echo ($video->id && $videoShare['content']) ? $videoShare['content']:''?></textarea>
                        </div>
                    </div>
                </div><!-- row -->
            </div><!-- panel-body -->
            <div class="panel-footer">
                <div class="row">
                    <div class="col-sm-9 col-sm-offset-3">
                        <button class="btn btn-primary mr5" id="upload_button">保存</button>
                        <a href="/live/video" class="btn btn-dark">取消</a>
                    </div>
                </div>
            </div><!-- panel-footer -->
        </div><!-- panel -->
    </form>

</div>
<script>
$(function(){
	$("#upload_button").on("click", function()
	{
		var pic = $("input[name=pic]").val();
		if(pic == "")
		{
			alert("头图不能为空");
			return false;
		}
	});	
});
</script>