{extend name="public/container"}
{block name="content"}
<link href="{__ADMIN_PATH}module/wechat/news_category/css/style.css" type="text/css" rel="stylesheet">
<div class="row">
    <div class="col-sm-12">
        <div class="ibox">
            <div class="ibox-title">
                <div class="row">
                    <div class="col-sm-8 m-b-xs">
                        <form action="" class="form-inline">
                            <i class="fa fa-search" style="margin-right: 10px;"></i>
                            <div class="input-group">
                                <input type="text" name="cate_name" value="{$where.cate_name}" placeholder="请输入关键词" class="input-sm form-control" />
                                <span class="input-group-btn">
                                    <button type="submit" class="btn btn-sm btn-primary"> 搜索</button>
                                </span>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            <div class="ibox-content">
                <div id="news_box">
                {volist name="list" id="vo"}
                    <div class="news_item category_one" style="float: left;cursor: pointer" {if $type eq 1} data-id="{$vo.new[0]['id']}" {else /} data-id="{$vo.id}" {/if}>
<!--                    <div class="news_item category_one" style="float: left;cursor: pointer" data-id="{$vo.new[0]['id']}">-->
                        <div class="title"><span>图文名称：{$vo.cate_name}</span></div>
                    {volist name="$vo['new']" id="vvo" key="k"}
                        {if condition="$k == 1"}
                        <div class="news_articel_item" style="background-image:url({$vvo.image_input})">
                            <p>{$vvo.title}</p>
                        </div>
                        <div class="hr-line-dashed"></div>
                        {else/}
                        <div class="news_articel_item other">
                            <div class="right-text">{$vvo.title}</div>
                            <div class="left-image" style="background-image:url({$vvo.image_input});">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        {/if}
                    {/volist}
                    </div>
                {/volist}
                </div>
            </div>
        </div>
    </div>
</div>
<div style="margin-left: 10px">
    {include file="public/inner_page"}
</div>
{/block}
{block name="script"}
<script>
    var _new =  <?php echo json_encode($newList);?>;
</script>
<script>
    $('.category_one').on('click',function (e) {
        var callback = "{$callback}";
        var type = {$type};
        var id = $(this).data('id');
        $.each(_new,function (key,value) {
            if (type ==1){
                if(value['new'][0]['id'] == id){
                    parent[callback](_new[key])
                }
            }else {
                if(value['id'] == id){
                    parent[callback](_new[key])
                }
            }
        })
    })
</script>
{/block}