<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" 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="mode">
                <option value="">全部</option>
                <option value="answer">回答评论</option>
                 <option value="article">文章评论</option>
                 <option value="comment">评论回复</option>
            </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>
            </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_type_tpl">
        {{#  if(d.type=='article'){ }}
          <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'){ }}
          <button class="layui-btn layui-btn-xs">正常</button>
        {{#  } else{ }}
          <button class="layui-btn layui-btn-danger layui-btn-xs">待审核</button>
        {{#  } }}
      </script>

            <script type="text/html" id="J_table_toolbar">
              <div class="layui-btn-container">
                <a href="wendasns/comment/remove" class="layui-btn layui-btn-sm J_req" title="确定移除吗？"><i class="layui-icon layui-icon-delete"></i>删除</a>
                <a href="wendasns/comment/delete" class="layui-btn layui-btn-sm J_req" title="确定彻底删除吗？"><i class="layui-icon layui-icon-delete"></i>彻底删除</a>
                <a href="wendasns/comment/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_tool">
  <a href="#J_view" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="popup" title="编辑评论"><i class="layui-icon layui-icon-edit"></i>编辑</a>
  <a href="wendasns/comment/remove" class="layui-btn layui-btn-danger layui-btn-xs btn_del" lay-event="req" title="确定删除吗？"><i class="layui-icon layui-icon-delete"></i>删除</a>
 </script>

<script>
layui.data.done = function(){
      layui.laydate.render({
        elem: '#J_create_time'
        ,type: 'datetime'
      });
};
;!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/comment/list')}'
  ,toolbar: '#J_table_toolbar'
  ,cols: [[
      {type: 'checkbox'}
      ,{field:'id',title:'ID',align:'center',width:100}
      ,{field:'type',title:'类型',align:'center',width:80,templet:'#J_type_tpl'}
      ,{field:'source_id',title:'来源ID',width:100,align:'center'}
      ,{field:'username',title:'评论者',width:150}
      ,{field:'content',title:'评论内容',minWidth:200}
      ,{field:'praise',title:'点赞次数',width:100,align:'center'}
      ,{field:'report',title:'举报次数',width:100,align:'center'}
      ,{field:'create_time',title:'评论时间',width:170}
      ,{field:'status',title:'状态',width:80,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>

<script type="text/html" id="J_view" lay-done="layui.data.done()">
<form class="layui-form" action="{:url('wendasns/comment/edit')}" method="post">
   <input type="hidden" name="id" value="{{d.id||0}}">
   
            <div class="layui-form-item">
              <label class="layui-form-label">作者</label>
              <div class="layui-input-inline">
                <input type="text" value="{{d.username||''}}" class="layui-input layui-disabled" disabled>
              </div>
            </div>
            
            <div class="layui-form-item">
              <label class="layui-form-label">内容</label>
              <div class="layui-input-inline">
                <textarea name="content" placeholder="请输入内容" class="layui-textarea">{{d.content||''}}</textarea>
              </div>
            </div>
 
             <div class="layui-form-item">
              <label class="layui-form-label">点赞数</label>
              <div class="layui-input-inline">
                <input type="text" name="praise" value="{{d.praise||0}}" lay-verify="number" class="layui-input">
              </div>
            </div>

             <div class="layui-form-item">
              <label class="layui-form-label">举报数</label>
              <div class="layui-input-inline">
                <input type="text" value="{{d.report||0}}" class="layui-input layui-disabled" disabled>
              </div>
            </div>

  <div class="layui-form-item">
    <label class="layui-form-label">发布时间</label>
    <div class="layui-input-inline">
          <input id="J_create_time" type="text" name="create_time" value="{{d.create_time||''}}" class="layui-input">
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">删除评论</label>
    <div class="layui-input-inline">
        <input type="radio" name="remove" value="1" title="是" {{d.remove===1?'checked':''}}>
        <input type="radio" name="remove" value="0" title="否" {{d.remove===0?'checked':''}}>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">状态</label>
    <div class="layui-input-inline">
        <input type="radio" name="status" value="1" title="正常" {{d.status==='normal'?'checked':''}}>
        <input type="radio" name="status" value="0" title="待审核" {{d.status==='check'?'checked':''}}>
    </div>
  </div>
  
            <div class="layui-form-item">
              <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="J_ajax_submit_btn"><i class="layui-icon layui-icon-ok-circle"></i>提交</button>
              </div>
            </div>
            
          </form>
</script>