<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">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-inline">
            <select class="layui-select" name="status">
              <option value="">全部</option>
              <option value="normal">正常</option>
              <option value="check">待审核</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"></table>
    </div>

      </div>
    </div>
  </div>
</div>
      
      <script type="text/html" id="J_table_adopt_tpl">
        {{#  if(d.adopt == 1){ }}
          <span class="layui-badge layui-bg-green">是</span>
        {{#  } else{ }}
          <span class="layui-badge">否</span>
        {{#  } }}
      </script>

      <script type="text/html" id="J_table_status_tpl">
        {{#  if(d.status == 'normal'){ }}
          <span class="layui-badge layui-bg-green">正常</span>
        {{#  } else{ }}
          <span class="layui-badge">待审核</span>
        {{#  } }}
      </script>
      
    <script type="text/html" id="J_table_toolbar">
      <div class="layui-btn-container">
        <a href="wendasns/answer/remove" class="layui-btn layui-btn-sm J_req" title="确定移除吗？"><i class="layui-icon layui-icon-delete"></i>删除</a>
        <a href="wendasns/answer/del" class="layui-btn layui-btn-sm J_req" title="确定彻底删除吗？"><i class="layui-icon layui-icon-delete"></i>彻底删除</a>
        <a href="wendasns/answer/check" class="layui-btn layui-btn-sm J_req"><i class="layui-icon layui-icon-ok"></i>审核通过</a>
      </div>
    </script>
    
<script type="text/html" id="J_table_content_tpl">
	{{ d.content.replace(/<.*?>/g,"") }}
</script>
 
<script type="text/html" id="J_table_tool">
  <a lay-href="wendasns/answer/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/answer/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/answer/list')}'
  ,toolbar: '#J_table_toolbar'
  ,cols: [[
      {type: 'checkbox'}
      ,{field:'id',title:'ID',width:80,align:'center'}
      ,{field:'title',title:'问题',minWidth:150}
      ,{field:'content',title:'回答',minWidth:150,templet:'#J_table_content_tpl'}
      ,{field:'username',title:'回答者',width:120}
      ,{field:'praise',title:'点赞数',width:90,align:'center',sort: true}
      ,{field:'comment',title:'评论数',width:90,align:'center',sort: true}
      ,{field:'report',title:'举报数',width:90,align:'center',sort: true}
      ,{field:'adopt',title:'最佳答案',width:90,align:'center',templet:'#J_table_adopt_tpl'}
      ,{field:'create_time',title:'发布时间',width:170}
      ,{field:'status',title:'状态',width:100,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>