<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="keys" 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" id="J_timeDate_min" class="layui-input test-laydate-item">
            </div>
            <div class="layui-form-mid">-</div>
            <div class="layui-input-inline" style="width: 120px;">
              <input type="text" name="max_time" id="J_timeDate_max" class="layui-input test-laydate-item">
            </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="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 class="layui-inline">
          <a class="J_senior_search J_popup" href="../question/search" title="高级搜索" role="button">高级搜索</a>
        </div>
        
        </div>
      </form>
    </div>

    
    <div class="layui-card-body">
      <div style="padding-bottom: 10px;">
        <a href="#J_view" class="layui-btn J_popup" title="发送私信">发送私信</a>
        <a href="" class="layui-btn J_req" title="确定要删除吗？">删除</a>
      </div>
      
      <table id="J_table_list" lay-filter="J_table_list" url="{:url('wendasns/message/edit')}"></table>
    </div>

      </div>
    </div>
  </div>
</div>

<script type="text/html" id="J_status_tpl">
  <input type="checkbox" name="status" lay-skin="switch" lay-text="是|否" lay-filter="J_checkbox_enable" value="{{ d.id }}" data-json="{{ encodeURIComponent(JSON.stringify(d)) }}" {{ d.status == 1 ? 'checked' : '' }}>
</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="编辑私信">编辑</a>
  <a href="wendasns/message/remove" class="layui-btn layui-btn-danger layui-btn-xs btn_del" lay-event="req" title="确定删除吗？">删除</a>
 </script>

<script>
;!function(){
  var $ = layui.$
  ,form = layui.form
  ,laydate = layui.laydate
  ,table = layui.table;
  
  form.render();
  
  //执行渲染
table.render({
  elem: '#J_table_list'
  ,url: '{:url('wendasns/message/list')}'
  ,cols: [[
      {type: 'checkbox'}
      ,{field:'id',title:'ID',width:100,align:'center'}
      ,{field:'sendname',title:'发件人',width:150}
      ,{field:'recename',title:'收件人',width:150}
      ,{field:'content',title:'信件内容',minWidth:200}
      ,{field:'create_time',title:'发送时间',width:170}
      ,{field:'status',title:'是否已读',width:100,align:'center',templet:'#J_status_tpl'}
      ,{title:'操作',width:120,align:'center',toolbar:'#J_table_tool'}
  ]]
  ,page: true
  ,limit: 20
  ,height: 'auto'
  ,text: {
    none: '暂无数据！'
  }
});


  //执行一个laydate实例
  laydate.render({
    elem: '#J_dataTime' //指定元素
  });
  
}();

</script>

<script type="text/html" id="J_view">
<form class="layui-form" style="padding: 0 50px 0 0;width: 500px;" action="{:url('wendasns/message/dorun')}" 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" name="sendname" value="{{d.sendname||''}}" lay-verify="required" class="layui-input">
              </div>
              <div class="layui-form-mid layui-word-aux">不填写，默认是当前管理员</div>
            </div>

            <div class="layui-form-item">
              <label class="layui-form-label">收件人</label>
              <div class="layui-input-inline">
                <input type="text" name="recename" value="{{d.recename||''}}" lay-verify="required" class="layui-input">
              </div>
            </div>
            
        <div class="layui-form-item layui-form-text">
          <label class="layui-form-label">信件内容</label>
          <div class="layui-input-block">
            <textarea name="content" placeholder="请输入内容" class="layui-textarea" lay-verify="required">{{d.content||''}}</textarea>
          </div>
        </div>

            <div class="layui-form-item">
              <label class="layui-form-label">发送时间</label>
              <div class="layui-input-block">
                <input id="J_dataTime" 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-block">
                <input type="radio" name="status" value="1" title="已读" {{d.status==1?'checked':''}}>
                <input type="radio" name="status" value="0" title="未读" {{d.status==0?'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">提交</button>
              </div>
            </div>
            
          </form>
</script>