{include file="public/header" /}
<style>
    .layui-table-view .layui-table[lay-size=lg] .layui-table-cell {height: 58px;line-height: 58px;}
    .wx-audio-content{padding:0px;border:0px;}
    .wx-audio-content .wx-audio-left .wx-audio-state{margin-bottom:15px;}
    .wx-audio-content .wx-audio-right .wx-audio-time{padding-top:0px;position: relative;bottom:6px;}
    .wx-audio-content .wx-audio-right .wx-audio-progrees{top:6px;}
</style>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <div class="layui-input-inline">
                        <input type="text" id="fileName" class="layui-input" name="fileName" placeholder="请输入文件名称"/>
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-inline">
                        <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                        <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                    </div>
                </div>
            </div>
        </div>

        <div class="layui-card-body">
            <table id="LAY-table-manage" lay-filter="LAY-table-manage"></table>
            <!--操作模板-->
            <script type="text/html" id="opeBar">
            {{# if(d.fileType !== '文件夹'){ }}
				{{# if(d.fileType.match(/(mp4|mkv|ts)$/i)){ }}
				<a class="layui-btn layui-btn-xs layui-btn-primary" title="播放预览" lay-event="look"><i class="layui-icon layui-icon-play"></i></a>
				
				{{# }else if(d.fileType.match(/(gif|jpg|jpeg|png|bmp|webp)$/i)){ }}
				<a class="layui-btn layui-btn-xs layui-btn-primary" title="预览图片" lay-event="look"><i class="layui-icon layui-icon-picture"></i></a>
				{{# }else{ }}
				<a class="layui-btn layui-btn-xs layui-btn-primary" title="下载" lay-event="look"><i class="layui-icon layui-icon-download-circle"></i></a>
				<a class="layui-btn layui-btn-xs layui-btn-normal" title="复制链接" lay-event="copy"><i class="layui-icon layui-icon-link"></i>  </a>
				{{# } }}
				<a class="layui-btn layui-btn-xs " title="分享文件" lay-event="share"><i class="layui-icon layui-icon-share"></i></a>
                
			{{# }else{ }}

			{{# } }}
            </script>
			<!--所属账号模板-->
			<script type="text/html" id="userBar">
				{{# if(d.panType == '1'){ }}
					{{ d.username }}
				{{# }else if(d.panType == '2'){ }}
					[企业云]{{ d.username }}
				{{# }else{ }}
					{{ d.username }}
				{{# } }}
			</script>
			<!--批量操作模板-->
			<script type="text/html" id="toolBar">
				<a class="layui-btn layui-btn-xs " lay-event="copyAll"><i class="layui-icon layui-icon-link"></i>批量复制</a>
				<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delAll"><i class="layui-icon layui-icon-delete"></i>删除</a>
			</script>
        </div>
    </div>
</div>
{$pan_data}
{include file="public/footer" /}
{include file="public/copy" /}
<script>
    layui.use(['index','table','form','util'], function () {
        var $ = layui.$
            , form = layui.form
            , table = layui.table
		var load = layer.load();		
        table.render({
            elem: '#LAY-table-manage'
            , url: window.location.href
			, toolbar: '#toolBar'
			, defaultToolbar: ''
            , page: true
            , limits: [15, 30, 50]
            , limit: "15"
            , loading: true
            , id: 'LAY-table'
            , cols: [[
                {type: 'checkbox', fixed: 'left',}
                , {field: 'username', width: 120, title: '所属账号', toolbar: '#userBar'}
                , {field: 'fileName', minWidth: 300, title: '文件名'}
                , {field: 'fileId', width: 200, title: '文件ID'}
                , {field: 'fileSize', width: 110, title: '文件大小', align: 'center',templet: function (d){
					return d.fileSize ? bytesToSize(d.fileSize) : '';
				}}
                , {field: 'fileType', width: 110, title: '文件类型',sort: true, align: 'center'}
				, {field: 'visits', width: 110, title: '访问次数',sort: true, align: 'center'}
				, {field: 'status', width: 110, title: '是否违规',align: 'center',templet: function (d){
					return d.status ? '<font color="red">已违规</font>' : '否';
				}}
                , {field: 'update_time', width: 180, title: '更新时间',sort: true, align: 'center'}
                , {fixed: 'right', width: 150, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            ,done: function (res, curr, count) {
				layer.close(load);
				for (var i=0;i<res.data.length;i++) 
				{
					if(res.data[i].punish_flag==2)
					{
						$("table tbody tr").eq(i).css('color','red');
					}
				}
            }
        });
    });
</script>
</body>
</html>