{layout name="manager/layout" /}
<style>
    .layui-table-cell{
        text-align: center;
        height: auto;
        white-space: normal;
    }
    .layui-table img{
        max-height: 100%;
        object-fit: cover;
        margin-left: auto;
        margin-right: auto;
        display: block;
        max-width: 150px;
        vertical-align: middle;
        border: 0;
    }
</style>
<div class="layuimini-container location-index-page">
    <div class="layuimini-main">
        <div>
            <blockquote class="layui-elem-quote layui-quote-nm">
                <div class="layui-row">
                    <div class="layui-col-md11">
                        <div class="dir-path">/storage/</div>
                    </div>

                    <div class="layui-col-md1">
                        <button type="button" class="back-to-previous  layui-btn layui-btn-xs">返回上一级</button>
                    </div>
                </div>
            </blockquote>
            <a id="upload-btn-div" style="display: none" href="javascript:;" data-notice-exists="true" data-callback="refreshBtn()"
               data-url="/manager/upload/video"  data-multiple="true" data-field="video_video" data-accept="video" data-mimetype="video/*" data-exts="mp4|ogg|webm"><i class="fa fa-plus"></i> 添加</a>
            <table id="table-container" class="layui-table" data-url="/manager/attachment/video?type={$type}&multiple={$multiple}" lay-filter="table-container-image"></table>
        </div>
    </div>
</div>

<!-- 隐藏列 -->
<!-- 编辑单元格提交url -->
<input type="hidden" id="row-modify" data-url="/manager/attachment/modify">
<!-- oss URL -->
<input type="hidden" id="oss-url" data-url="{$oss ?? ''}">
<input type="hidden" id="domain-url" data-url="{$ ?? ''}">
<input type="hidden" id="upload-path" value="/storage">

<!-- 列 类型 -->
<script type="text/html" id="row-type">
    {{# if (d.type == 'dir') { }}
    <i class="fa fa-folder"></i> 文件夹
    {{# } }}
    {{# if (d.type == 'image') { }}
    <i class="fa fa-image"></i> 图片
    {{# } }}
    {{# if (d.type == 'video') { }}
    <i class="fa fa-youtube-play"></i> 视频
    {{# } }}
    {{# if (d.type == 'file') { }}
    <i class="fa fa-file"></i> 文件
    {{# } }}
</script>

<!-- 列 文件大小 -->
<script type="text/html" id="row-size">
    {{# if (d.type == 'dir') { }}
    <i class="layui-icon layui-icon-refresh" data-href="/manager/attachment/get-size.html" data-type="video" lay-event="count" style="cursor: pointer"> 统计</i>
    {{# } else { }}
    {{ d.size_text }}
    {{# } }}
</script>

<!-- 列 轮播图 -->
<script type="text/html" id="row-src">
    <div class="layui-layer-photos">
        {{# if (d.is_dir) { }}
        <img style="padding: 5px;" height="50px" src="/static/manager/image/folder.png" alt="">
        {{# } }}

        {{# if (d.type == 'video') { }}
        <img style="padding: 5px;" height="50px" src="/static/manager/image/video.png" alt="">
        {{# } }}
    </div>
</script>

<!-- 操作列 -->
<script type="text/html" id="row-operate">
    {{# if (d.type == 'dir') { }}
    <a class="layui-btn layui-btn-primary layui-btn-xs" data-href="/manager/attachment/video.html?id={{d.id}}" lay-event="enter"><i class="fa fa-folder-open"></i> 进入</a>
    {{# } else { }}
    <a class="layui-btn layui-btn-primary layui-btn-xs" data-href="/manager/attachment/show.html?id={{d.id}}" lay-event="show"><i class="fa fa-search-plus"></i> 查看</a>
    {if $selected}
    <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="select"><i class="fa fa-check"></i> 选择</a>
    {/if}
    {{# } }}
</script>

<!-- toolbar -->
<script type="text/html" id="toolbar-tpl">
    <a class="layui-btn layui-btn-sm layui-btn-sm" data-table-refresh lay-event="refresh"><i class="fa fa-refresh"></i></a>
    {if $selected}
    <a class="layui-btn layui-btn-normal layui-btn-sm" href="javascript:;" lay-event="multiple"><i class="fa fa-check"></i> 选择</a>
    {else /}
    <a class="layui-btn layui-btn-normal layui-btn-sm" href="javascript:;" lay-event="upload"><i class="fa fa-plus"></i> 添加</a>
    <a class="layui-btn layui-btn-normal layui-btn-sm add-folder" data-href="/manager/attachment/add-folder.html" data-title="新建文件夹" data-width="60%" data-height="50%" lay-event="add-folder"><i class="fa fa-folder-o"></i> 新建文件夹</a>
    <a class="layui-btn layui-btn-danger layui-btn-sm" data-href="/manager/attachment/del.html" lay-event="del"><i class="fa fa-trash-o"></i> 删除</a>
    {/if}
</script>
<script src="__MANAGER__/js/attachment.js?v={:mt_rand()}"></script>