<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>
        
        <div class="layui-card-body">
        
    <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">关键字</label>
          <div class="layui-input-block">
            <input type="text" name="keyword" placeholder="支持问题标题搜索" class="layui-input">
          </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">
          </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-inline">
            <select class="layui-select" name="status">
            	<option value="">全部</option>
              <option value="normal">正常</option>
              <option value="check">待审核</option>
              <option value="remove">已删除</option>
            </select>
          </div>
        </div>
        
        <div class="layui-inline">
          <input type="button" class="layui-btn" lay-submit lay-filter="J_form_search" value="搜索">
        </div>
        
        </div>
      </form>
    </div>

    
    <div class="layui-card-body">
      <table id="J_table_list" lay-filter="J_table_list" url="{:url('wendasns/question/edit')}"></table>
    </div>

      </div>
    </div>
  </div>
</div>
      
      <script type="text/html" id="J_table_adopt_tpl">
        {{#  if(d.adopt_id > 0){ }}
          <span style="color: #FF5722;font-weight: bold;">是</span>
        {{#  } else{ }}
          <span style="color: #5FB878;font-weight: bold;">否</span>
        {{#  } }}
      </script>
      
      <script type="text/html" id="J_table_status_tpl">
        {{#  if(d.status == 'normal'){ }}
          <span class="layui-badge layui-bg-green">正常</span>
          {{# if(d.remove==1){ }}
          	<span class="layui-badge">已删除</span>
          {{#  } }}
        {{#  } else{ }}
        	<span class="layui-badge layui-bg-orange">待审核</span>
        {{#  } }}
      </script>

    <script type="text/html" id="J_table_toolbar">
      <div class="layui-btn-container">
        <a href="wendasns/question/remove" class="layui-btn layui-btn-sm J_req" title="确定移除吗？"><i class="layui-icon layui-icon-delete"></i>删除</a>
        <a href="wendasns/question/del" class="layui-btn layui-btn-sm J_req" title="确定彻底删除吗？"><i class="layui-icon layui-icon-delete"></i>彻底删除</a>
        <a href="wendasns/question/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_top_tpl">
  <input type="checkbox" name="top" lay-skin="switch" lay-text="是|否" lay-filter="J_checkbox_enable" value="{{ d.id }}" {{ d.top == 1 ? 'checked' : '' }}>
</script>

<script type="text/html" id="J_table_recommend_tpl">
  <input type="checkbox" name="recommend" lay-skin="switch" lay-text="是|否" lay-filter="J_checkbox_enable" value="{{ d.id }}" {{ d.recommend == 1 ? 'checked' : '' }}>
</script>

<script type="text/html" id="J_table_tool">
  <a lay-href="wendasns/question/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/question/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.$
  ,form = layui.form
  ,laydate = layui.laydate
  ,table = layui.table;
  
  form.render();

    lay('.J_dataTime').each(function(){
      laydate.render({
        elem: this
      });
    });
    
  //执行渲染
table.render({
  elem: '#J_table_list'
  ,url: '{:url('wendasns/question/list')}'
  ,toolbar: '#J_table_toolbar'
  ,cols: [[
      {type: 'checkbox'}
      ,{field:'category',title:'分类',width:150}
      ,{field:'title',title:'标题',minWidth:150}
      ,{field:'username',title:'作者',width:120}
      ,{field:'visits',title:'浏览量',width:90,align:'center',sort: true}
      ,{field:'answer',title:'回答数',width:90,align:'center',sort: true}
      ,{field:'report',title:'举报数',width:90,align:'center',sort: true}
      ,{field:'collect',title:'收藏量',width:90,align:'center',sort: true}
      ,{field:'adopt',title:'采纳',width:60,align:'center',templet:'#J_table_adopt_tpl'}
      ,{field:'top',title:'置顶',width:80,align:'center',templet:'#J_table_top_tpl'}
      ,{field:'recommend',title:'推荐',width:80,align:'center',templet:'#J_table_recommend_tpl'}
      ,{field:'create_time',title:'发布时间',width:170}
      ,{field:'status',title:'状态',width:130,align:'center',templet:'#J_table_status_tpl'}
      ,{title:'操作',width:150,align:'center',toolbar:'#J_table_tool'}
  ]]
  ,page: true
  ,limit: 20
  ,height: 'auto'
  ,text: {
    none: '暂无数据！'
  }
});

}();

</script>