<title>文章管理</title>
  
<div class="layui-card layadmin-header">
  <div class="layui-breadcrumb" lay-filter="breadcrumb">
    <a lay-href="">主页</a>
    <a><cite>问答管理</cite></a>
    <a><cite>文章管理</cite></a>
  </div>
</div>

  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">
        <div class="layui-card">
          <div class="layui-card-header">文章管理</div>

    <form class="layui-form layui-card-header layuiadmin-card-header-auto" lay-filter="J_ajaxForm">
      <div class="layui-form-item">

        <div class="layui-inline">
          <label class="layui-form-label">ID</label>
          <div class="layui-input-block">
            <input type="text" name="id" class="layui-input" autocomplete="off">
          </div>
        </div>
        
        <div class="layui-inline">
          <label class="layui-form-label">关键字</label>
          <div class="layui-input-block">
            <input type="text" name="keyword" placeholder="支持文章标题搜索" class="layui-input" autocomplete="off">
          </div>
        </div>
        
        <div class="layui-inline">
          <label class="layui-form-label">作者</label>
          <div class="layui-input-block">
            <input type="text" name="username" class="layui-input" autocomplete="off">
          </div>
        </div>

        <div class="layui-inline">
          <label class="layui-form-label">发布时间</label>
          <div class="layui-input-block">
            <div class="layui-input-inline" style="width: 120px;">
              <input type="text" name="min_time" class="layui-input J_dataTime" autocomplete="off">
            </div>
            <div class="layui-form-mid">-</div>
            <div class="layui-input-inline" style="width: 120px;">
              <input type="text" name="max_time" class="layui-input J_dataTime" autocomplete="off">
            </div>
          </div>
        </div>
        
        <div class="layui-inline">
          <label class="layui-form-label">分类</label>
          <div class="layui-input-block">
            <select class="layui-select" name="category">
              <option value="">全部</option>
            {volist name="category" id="item"}
                <option value="{$item.id}">{$item.name}</option>
            {/volist}
            </select>
          </div>
        </div>

        <div class="layui-inline">
          <label class="layui-form-label">状态</label>
          <div class="layui-input-block">
            <select class="layui-select" name="status">
              <option value="">全部</option>
              <option value="normal">正常</option>
              <option value="check">待审核</option>
            </select>
          </div>
        </div>
        
        <div class="layui-inline">
          <button class="layui-btn" lay-submit lay-filter="J_form_search">搜索</button>
        </div>
      </div>
    </form>
    
    <div class="layui-card-body">
      <table id="J_table_list" lay-filter="J_table_list" url="{:url('wendasns/article/edit')}"></table>
    </div>
    
  </div>
</div>
</div>
</div>
      <script type="text/html" id="J_table_status">
      {{# if(d.remove == 1){ }}
        <span style="color: #FF5722;">已删除</span>
      {{#  } else{ }}
        {{#  if(d.status == 'normal'){ }}
        	<span class="layui-badge layui-bg-green">正常</span>
        {{#  } else{ }}
          <span style="color: #FFB800;">待审核</span>
        {{#  } }}
      {{#  } }}
      </script>

<script type="text/html" id="J_table_close_tpl">
      <input type="checkbox" name="close" lay-skin="switch" lay-text="是|否" lay-filter="J_checkbox_enable" value="{{ d.id }}" {{ d.close == 1 ? 'checked' : '' }}>
</script>
      
            <script type="text/html" id="J_table_toolbar">
              <div class="layui-btn-container">
                <a href="wendasns/article/remove" class="layui-btn layui-btn-sm J_req" title="确定移除吗？"><i class="layui-icon layui-icon-delete"></i>删除</a>
                <a href="wendasns/article/del" class="layui-btn layui-btn-sm J_req" title="确定彻底删除吗？"><i class="layui-icon layui-icon-delete"></i>彻底删除</a>
                <a href="wendasns/article/check" class="layui-btn layui-btn-sm J_req" role="button"><i class="layui-icon layui-icon-ok"></i>审核通过</a>
              </div>
            </script>
            
      <script type="text/html" id="J_table_tool">
        <a lay-href="wendasns/article/edit?id={{d.id}}" class="layui-btn layui-btn-normal layui-btn-xs"><i class="layui-icon layui-icon-edit"></i>编辑</a>
        <a href="wendasns/article/remove" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="req" title="确定删除吗？"><i class="layui-icon layui-icon-delete"></i>删除</a>
      </script>

<script>
;!function(){
  var $ = layui.$
  ,table = layui.table
  ,laydate = layui.laydate
  ,form = layui.form;

  form.render();

    lay('.J_dataTime').each(function(){
      laydate.render({
        elem: this
      });
    });
    
  //执行渲染
table.render({
  elem: '#J_table_list'
  ,url: '{:url('wendasns/article/list')}'
  ,toolbar: '#J_table_toolbar'
  ,cols: [[
      {type: 'checkbox'}
      ,{field:'id',title:'ID',width:80,align:'center'}
      ,{field:'category',title:'分类',width:130}
      ,{field:'title',title:'标题',minWidth:150}
      ,{field:'username',title:'作者',width:150}
      ,{field:'visits',title:'浏览量',width:80,align:'center'}
      ,{field:'praise',title:'喜欢',width:80,align:'center'}
      ,{field:'report',title:'举报数',width:80,align:'center'}
      ,{field:'comment',title:'评论数',width:80,align:'center'}
      ,{field:'close',title:'禁止评论',width:100,templet:'#J_table_close_tpl',align:'center'}
      ,{field:'create_time',title:'发布时间',width:180}
      ,{field:'status',title:'状态',width:90,templet:'#J_table_status',align:'center'}
      ,{title:'操作',width:150,align:'center',toolbar:'#J_table_tool'}
  ]]
  ,limit: 20
  ,height: 'auto'
  ,text: {
    none: '暂无数据！'
  }
  ,page: true
});

}();
</script>