{template nheader.html}
<link href="{THEME_PATH}admin/weixin/home/css/base.css" rel="stylesheet">
<link href="{THEME_PATH}admin/weixin/home/css/module.css" rel="stylesheet">
<link href="{THEME_PATH}admin/weixin/home/css/wei.css" rel="stylesheet">
<script type="text/javascript" src="{THEME_PATH}admin/weixin/static/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="{THEME_PATH}admin/weixin/static/uploadify/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="{THEME_PATH}admin/weixin/static/zclip/ZeroClipboard.min.js"></script>
<script type="text/javascript" src="{THEME_PATH}admin/weixin/home/js/dialog.js"></script>
<script type="text/javascript" src="{THEME_PATH}admin/weixin/home/js/admin_common.js"></script>
<script type="text/javascript" src="{THEME_PATH}admin/weixin/home/js/admin_image.js"></script>
<script type="text/javascript" src="{THEME_PATH}admin/weixin/static/masonry/masonry.pkgd.min.js"></script>
<script type="text/javascript" src="{THEME_PATH}admin/weixin/static/jquery.dragsort-0.5.2.min.js"></script>
<script type="text/javascript">
    var  IMG_PATH = "{THEME_PATH}admin/weixin/Home/images";
    var  STATIC = "{THEME_PATH}admin/weixin/static";
    var  ROOT = "{SITE_URL}";
    var  UPLOAD_FILE = "{dr_url('weixin/ajaxload')}";
</script>

<div class="page-bar">
    <ul class="page-breadcrumb mylink">
        {$menu.link}
    </ul>
    <ul class="page-breadcrumb myname">
        {$menu.name}
    </ul>

</div>

<div class="mytopsearch">
    <form class="row" method="post" action="" name="searchform" id="searchform">
        <input name="search" id="search" type="hidden" value="1" />
        <div class="col-md-12">
            <label>
                <select name="data[field]" class="form-control">
                    <option value="id" {if $param.field=='id'}selected{/if}>Id</option>
                    <option value="uid" {if $param.field=='uid'}selected{/if}>Uid</option>
                    {loop $field $t}
                    {if $t.ismain && $t.fieldname != 'inputtime'}
                    <option value="{$t.fieldname}" {if $param.field==$t.fieldname}selected{/if}>{$t.name}</option>
                    {/if}
                    {/loop}
                </select>
            </label>
            <label><i class="fa fa-caret-right"></i></label>
            <label style="padding-right: 20px;"><input type="text" class="form-control" placeholder="{fc_lang('多个Id可以用“,”分隔')}" value="{$param['keyword']}" name="data[keyword]" /></label>

            <label>{fc_lang('录入时间')} ：</label>
            <label>{dr_field_input('start', 'Date', array('option'=>array('format'=>'Y-m-d','width'=>'100')), (int)$param.start)}</label>
            <label><i class="fa fa-minus"></i></label>
            <label style="margin-right:10px">{dr_field_input('end', 'Date', array('option'=>array('format'=>'Y-m-d','width'=>'100')), (int)$param.end)}</label>
            <label><button type="submit" class="btn green btn-sm" name="submit" > <i class="fa fa-search"></i> {fc_lang('搜索')}</button></label>
        </div>
    </form>
</div>


<div class="portlet light bordered">
    <div class="portlet-body">
        <div class="table-scrollable v3table">



            <div class="data-table" style="margin-top:20px;">

                <div class="table-striped">




                    <ul class="picture_list">
                        <li>
                            <div class="controls uploadrow2" title="点击修改图片" rel="p_cover" style="width:210px">
                                <input type="file" id="upload_picture_p_cover">
                                <input type="hidden" name="p_cover" id="cover_id_p_cover" data-callback="uploadImgCallback" value=""/>
                                <div class="upload-img-box" rel="img" style="display:none">
                                    <div class="upload-pre-item2"><img width="100" height="100" src=""/></div>
                                    <em class="edit_img_icon">&nbsp;</em>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div style="padding-bottom: 20px;padding-top:50px;">
                                <a class="btn green btn-sm" href="{dr_url('wmaterial/tp', array('action'=> 'upload'))}"> <i class="fa fa-search"></i> 一键上传素材到微信素材库</a>
                                <a class="btn blue btn-sm" href="{dr_url('wmaterial/tp', array('action'=> 'download'))}"> <i class="fa fa-cloud-download"></i> 一键下载微信素材库到本地</a>
                            </div>
                            <p class="normal_tips"><b class="fa fa-info-circle"></b> 温馨提示：图片大小不超过5M,式:png, jpeg, jpg, gif</p>

                        </li>
                        </ul>

                    <ul class="picture_list" id="picture_list" style="margin-top: 20px">
                        {loop $list $t}
                            <li>
                                <div class="picture_item">
                                    <div class="main_img">
                                        <a href="{dr_get_file($t.file)}" target="_blank"><img src="{dr_get_file($t.file)}"/></a>
                                    </div>
                                    <div class="picture_action">
                                        <a href="javascript:;" data-clipboard-text="{dr_get_file($t.file)}" id="picture_{$t['id']}" title="复制链接"> <i class="fa fa-chain"></i> </a>
                                        <a href="javascript:;" onclick="del({$t.id}, this)" title="删除"> <i class="fa fa-trash"></i> </a>
                                    </div>
                                    <script type="application/javascript">
                                        $.Wei.initCopyBtn('picture_{$t.id}');
                                    </script>
                                </div>
                            </li>
                        {/loop}

                    </ul>

                </div>
            </div>



            <div id="pages" style="margin-top: 20px;"><a>{fc_lang('共%s条', $total)}</a>{$pages}</div>
        </div>

    </div>
</div>
<script type="text/javascript">
    $(function(){
        //t上传图片
        initUploadImg({width:210,height:192});
        $('.uploadify-button').css('background-color','#ddd')
    })
    function uploadImgCallback(name,id,src){
        $('.upload-img-box').hide();

        $.post("{dr_url('wmaterial/tp', array('action'=> 'add'))}",{id:id}, function(data){
            if(data.status==1){
                var imgHtml = $('<li>'+
                        '<div class="picture_item">'+
                        '<div class="main_img">'+
                        '<a href="'+src+'" target="_blank"><img src="'+src+'"/></a>'+
                        '</div>'+
                        '<div class="picture_action">'+
                        '<a href="javascript:;" data-clipboard-text="'+src+'" id="picture_'+id+'">复制链接</a>'+
                        '<a href="#" class="ajax-post" data-url="">删除</a>'+
                        '</div>'+
                        '</div>'+
                        '</li>');
                imgHtml.insertAfter($('#picture_list li').eq(0));
                $.Wei.initCopyBtn('picture_'+id);
            }else{
                updateAlert(data.code);
            }
        }, 'json');
    }
    function del(id, _this){
        if(!confirm('确认删除？')) return false;

        $(_this).parent().parent().parent().remove();
        $.post("{dr_url('wmaterial/tp', array('action'=> 'del'))}",{id:id});
    }
</script>
{template nfooter.html}