<!doctype html>
<html class="no-js">
<head>

<include file="Common/head" />

</head>
<body>

<include file="Common/header" />

<div class="am-cf admin">

    <!-- sidebar start -->
    <include file="Common/sidebar" nav="zixun"/>
    <!-- sidebar end -->

    <!-- Start right Content here -->
        <div class="content-page" style="background: white;">
            <!-- Start content -->
            <div class="content">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf">
                    <strong class="am-text-primary am-text-lg">资讯管理</strong> / <small>资讯列表</small>
                </div>
            </div>
            <hr style="margin-top:0px;">
            
            <div class="am-g">
                  <div class="am-u-sm-12 am-u-md-4">
                    <div class="am-btn-toolbar">
                      <div class="am-btn-group am-btn-group-xs">
                        <a class="am-btn am-btn-secondary" href="{:U('add')}">
                          <span class="am-icon-plus"> 新增 </span></a>
                      </div>

                    </div>
                  </div>
                  <form class="am-form-group am-u-sm-12 am-u-md-8">
                    <div class="am-input-group am-input-group-sm search-div">
                      <input type="text" class="am-form-field" name="search" placeholder="搜索标题" value="{$search}" style="width:300px; float:right;">
                      <select name="hot" style="width:100px; height: 32px;float:right;">
                        <option value="">筛选</option>
                        <option value="1" <?php if ($_GET['hot'] == 1) : ?>selected<?php endif;?>>推荐</option>
                        <option value="2" <?php if ($_GET['hot'] == 2) : ?>selected<?php endif;?>>不推荐</option>
                      </select>
                      <span class="am-input-group-btn">
                        <button class="am-btn am-btn-default" type="submit">搜索</button>
                        <button class="am-btn am-btn-default" type="button" onclick="javascript:location.href='{:U('index')}'">
                                    全部
                                </button>
                      </span>
                    </div>
                  </form>
                </div>

            <div class="am-g">
                <div class="am-u-sm-12">
                    <table class="am-table am-table-hover table-main am-text-nowrap">
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>排序</th>
                                <th>标题</th>
                                <th>缩略图</th>
                                <th>浏览量</th>
                                <th>是否推荐</th>
                                <th>状态</th>
                                <th>添加时间</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <volist name="list" id="vo">
                                <tr>
                                    <td>{$vo.id}</td>
                                    <td>{$vo.sort}</td>
                                    <td>{$vo.title}</td>
                                    <td><img src="{$vo.img}" style="width:100px; height: 80px"></td>
                                    <td>{$vo.browse_num}</td>
                                    <td>
                                        <?php if ($vo['is_hot'] == 1) : ?>
                                            推荐
                                        <?php else : ?>
                                            不推荐
                                        <?php endif;?>
                                    </td>
                                    <td>
                                        <?php if ($vo['status'] == 1) : ?>
                                            上架
                                        <?php else : ?>
                                            下架
                                        <?php endif;?>
                                    </td>
                                    <td>
                                        <if condition="$vo[create_time] gt 0">
                                            {$vo.create_time|date="Y-m-d H:i:s", ###}
                                        </if>
                                    </td>
                                    <td>
                                        <div class="am-dropdown" data-am-dropdown>
                                            <button class="am-btn am-btn-default am-btn-xs am-dropdown-toggle" data-am-dropdown-toggle>
                                                <span class="am-icon-cog"></span>
                                                <span class="am-icon-caret-down"></span>
                                            </button>
                                            <ul class="am-dropdown-content">
                                                <li>
                                                    <a href="{:U('edit',array('id' => $vo['id']))}">编辑</a>
                                                </li>
                                                <li>
                                                    <a class="del_link" data-name="{$vo.nickname}" data-url="{:U('delete', array('id' => $vo[id]))}" href="javascript:;">
                                                        删除
                                                    </a>
                                                </li>
                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                            </volist>
                        </tbody>
                    </table>
                    {$page}
                </div>
            </div>
        </div>
    </div>
    <!-- content end -->
</div>

<include file="Common/footer" />

<script type="text/javascript">
    $(function(){
        // 删除
        $(".del_link").on("click",function(){
            var name=$(this).attr("data-name");
            var the_link=$(this).attr("data-url");
            var bool = confirm("确认删除文章“"+name+"”吗？");
            if (bool) {
                location.href = the_link;
            };
        });
    });
</script>
</body>
</html>