<!--{include file="<!--{$oetplpath}-->block_head.tpl"}-->

<!--{if $a == "run"}-->
<div class="layui-fluid oe_fluid">

  <form class="layui-form" id="mysearch" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post">
  <div class="oe_breadcrumb_box clearfix">
    <div class="layui-breadcrumb fl" lay-filter="breadcrumb" style="visibility: visible;">
      <a href="javascript:;">博客管理</a><span lay-separator="">/</span>
      <a><cite>博客列表</cite></a>
    </div>    
  </div>
  <!--//top end -->
  
  <div class="oe_searchbar layui-form">
    <div class="more_search_open"></div>
    <div class="layui-form-item">
      <div class="layui-inline">
        <div class="layui-form-label">红娘ID：</div>
        <div class="layui-input-inline input-120">
          <input type="text" name="smkid" id="smkid" class="layui-input" value="<!--{if $smkid > 0}--><!--{$smkid}--><!--{/if}-->" />
        </div>
      </div>
      <div class="layui-inline">
        <div class="layui-form-label">红娘帐号：</div>
        <div class="layui-input-inline input-150">
          <input type="text" name="smkname" id="smkname" class="layui-input" value="<!--{$smkname}-->" />
        </div>
      </div>
      <div class="layui-inline">
        <div class="layui-form-label">分类：</div>
        <div class="layui-input-inline input-150">
          <!--{hook mod="var" item="blogcat" type="select" name="scatid" text="=不限=" value=$scatid}-->
        </div>
      </div>
      <div class="layui-inline">
        <div class="layui-form-label">标题：</div>
        <div class="layui-input-inline input-150">
          <input type="text" name="stitle" id="stitle" class="layui-input" value="<!--{$stitle}-->" />
        </div>
      </div>
      <div class="layui-inline">
        <button class="layui-btn layui-btn-sm search" id="but_submit_search2" lay-submit lay-filter="searchform2">
          <i class="layui-icon layui-icon-search"></i>
          搜索
          <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
        </button>
      </div>
    </div>
    <div class="layui-form-item">
      <div class="layui-form-label">状&#12288;态：</div>
      <div class="label_box">
        <input type="hidden" name="sflag" id="sflag" value="<!--{$sflag}-->" />
        <span f="but_search_cat" data-val="0" data-input="sflag"<!--{if $sflag == '0'}--> class="current"<!--{/if}-->>不限</span>
        <span f="but_search_cat" data-val="1" data-input="sflag"<!--{if $sflag == '1'}--> class="current"<!--{/if}-->>已通过</span>
        <span f="but_search_cat" data-val="2" data-input="sflag"<!--{if $sflag == '2'}--> class="current"<!--{/if}-->>未通过</span>
        <span f="but_search_cat" data-val="3" data-input="sflag"<!--{if $sflag == '3'}--> class="current"<!--{/if}-->>待审核</span>
      </div>
    </div>
  </div>
  <!--//search End -->
  </form>

  <div class="oe_table_wrap layui-form">
    <div class="oe_tbl_tool clearfix">
      <div class="oe_gnbar clearfix">
        <div class="select btn fl">
          <input type="checkbox" id="id[]" name="allid[]" lay-skin="primary" title="全选" lay-filter="selectAll">
        </div>
        <div class="btn del fl" f="handle-array" data-form="myform">
          <i class="layui-icon layui-icon-delete"></i>
          <span>删除</span>
        </div>
        <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=add" class="btn add fl">
          <i class="layui-icon layui-icon-add-1"></i>
          <span>添加博客</span>
        </a>
      </div>
      <div class="oe_tongji_bar clearfix current">
        <span><b><!--{$total}--></b> 条记录</span>
      </div>
    </div>
    
    <form class="layui-form" id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post">
    <input type="hidden" name="a" id="a" value="del" />
    <table class="layui-table">
      <thead>
        <tr>
          <th width="2%">选</th>
          <th width="7%">ID</th>
          <th width="16%">所属红娘</th>
          <th width="8%">分类</th>
          <th>标题</th>
          <th width="6%">图文</th>
          <th width="14%">添加时间</th>
          <th width="5%">状态</th>
          <th width="5%">推荐</th>
          <th width="6%">浏览</th>
          <th width="10%">操作</th>
        </tr>
      </thead>
      <!--{if empty($blog)}-->
      <tr>
        <td class="text_center" colspan="11">没有符合条件的信息！</td>
      </tr>
      <!--{else}-->
      <!--{foreach $blog as $volist}-->
      <tr>
        <td class="check text_center">
          <input type="checkbox" name="id[]" lay-skin="primary" value="<!--{$volist.blogid}-->" />
        </td>
        <td class="text_center"><!--{$volist.blogid}--></td>
        <td>
          <!--{if $volist.makerid > 0}-->
          <img src="<!--{$volist.headimg}-->" width="20px" height="20px" f="viewimg" />
          <!--{$volist.loginname}--> / <!--{$volist.lastname}-->
          <!--{else}-->
          --
          <!--{/if}-->
        </td>
        <td class="text_center">
          <!--{if $volist.catid > 0}-->
          <!--{hook mod="var" item="blogcat" type="text" value=$volist.catid}-->
          <!--{else}-->
          --
          <!--{/if}-->
        </td>
        <td class="text_center">
          <a href="<!--{$urlpath}-->index.php?c=blog&a=detail&id=<!--{$volist.blogid}-->" target="_blank"><!--{$volist.title}--></a>
        </td>
        <td class="text_center">
          <!--{if !empty($volist.thumbimg)}-->
          <img src="<!--{$volist.thumbimg}-->" width="20px" height="20px" data-img="<!--{$volist.drawimg}-->" f="viewimg" />
          <!--{else}-->
          --
          <!--{/if}-->
        </td>
        <td class="text_center"><!--{$volist.addtime|date_format:"%Y-%m-%d %H:%M:%S"}--></td>
        <td class="text_center">
          <input type="checkbox" name="flag" lay-skin="primary" value="1" lay-filter="updatestatus" data-id="<!--{$volist.blogid}-->" data-type="flag"<!--{if $volist.flag == '1'}--> checked<!--{/if}--> />
        </td>
        <td class="text_center">
          <input type="checkbox" name="elite" lay-skin="primary" value="1" lay-filter="updatestatus" data-id="<!--{$volist.blogid}-->" data-type="elite"<!--{if $volist.elite == '1'}--> checked<!--{/if}--> />
        </td>
        <td class="text_center"><!--{$volist.hits}--></td>
        <td class="text_center">
          <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit&id=<!--{$volist.blogid}-->&<!--{$comeurl}-->" class="layui-btn layui-btn-xs layui-btn-normal">编辑</a>
          <a href="javascript:;" f="handle-one" data-url="<!--{$oefile}-->&c=<!--{$c}-->&a=del&id[]=<!--{$volist.blogid}-->&<!--{$comeurl}-->" class="layui-btn layui-btn-xs layui-btn-danger">删除</a>
         </td>
      </tr>
      <!--{/foreach}-->
      <!--{/if}-->
    </table>
    </form>
    <div class="oe_page_box"><!--{$showpage}--></div>
  </div>
</div>
<!--{/if}-->


<!--{if $a == 'add'}-->
<div class="layui-fluid oe_fluid">

  <div class="oe_breadcrumb_box clearfix">
    <div class="layui-breadcrumb fl" lay-filter="breadcrumb" style="visibility: visible;">
      <a href="javascript:;">博客管理</a><span lay-separator="">/</span>
      <a><cite>添加博客</cite></a>
    </div>
    <div class="oe_tool_bar ft">
      <button class="layui-btn layui-btn-sm layui-btn-radius" id="but_submit_post2" lay-submit lay-filter="addform">
        添加保存
        <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
      </button>
      <a href="<!--{$oefile}-->&c=<!--{$c}-->" class="layui-btn layui-btn-sm layui-btn-primary layui-btn-radius">返回列表</a>
    </div> 
  </div>
  
  <div class="layui-card">
    <div class="layui-card-header">添加博客</div>
    <div class="layui-card-body">
    	<form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post" />
        <input type="hidden" name="a" id="a" value="saveadd" /> 
        <table class="oe_tbl_form layui-form oe_edit_table">
          <tr>
            <th width="15%"><font color="red">*</font>标题：</th>
            <td width="35%">
              <input type="text" name="title" id="title" class="layui-input" />
              <span class="oe_trap"></span>
            </td>
            <th width="15%"><font color="red">*</font>发布红娘ID：</th>
            <td width="35%">
              <input type="text" name="makerid" id="makerid" class="layui-input input-150" />
              &nbsp;&nbsp;<span id="makerid_tips"></span>&nbsp;&nbsp;
            </td>
          </tr>
          
          <tr>
            <th>分类：</th>
            <td>
              <div class="tbl_input input-150"> <!--{hook mod="var" item="blogcat" type="select" name="catid" text="=请选择="}--></div>
            </td>
            <th>封面图片：<span class="f_red"></span> </th>
            <td>
              <div class="layui-btn">
                <i class="layui-icon layui-icon-upload"></i>
                点击上传
                <input type="file" name="img" id="img" f="but_upload_image" data-mod="blog" data-thumb="1">
              </div>
              <div class="upload_loading" id="img_loading" style="display:none;"></div>
              <input type="hidden" id="img_thumb" name="thumbimg" value="">
              <input type="hidden" id="img_url" name="drawimg" value="">
              <div class="upload_pic upload_pic_md" style="width:30px;height:30px;">
                <img src="<!--{$urlpath}-->tpl/static/images/waitimg.jpg" id="img_preview" f="viewimg">
              </div>
              <a href="javascript:;" class="oe_deluploadimg" f="removeimg" data-preview="img" data-input="img">移除</a>
            </td>
          </tr>
          
          <tr>
            <th>作者：</th>
            <td><input type="text" name="author" id="author" class="layui-input input-150" /></td>
            <th>浏览次数：</th>
            <td><input type="text" name="hits" id="hits" class="layui-input input-150" /></td>
          </tr>
          <tr>
            <th>状态：<span class="f_red"></span> </th>
            <td>
              <div class="tbl_input input-150">
                <select name="flag" id="flag">
                  <option value="">=请选择=</option>
                  <option value="1" selected>通过</option>
                  <option value="2">未通过</option>
                  <option value="0">待审核</option>
                </select>
              </div>
            </td>
            <th>推荐：</th>
            <td>
              <input type="radio" name="elite" id="elite" value="1" title="是" lay-skin="primary"/>
              <input type="radio" name="elite" id="elite" value="0" checked title="否" lay-skin="primary"/>
            </td>
          </tr>
          <tr>
            <th>摘要：</th>
            <td colspan="3">
              <textarea name="intro" id="intro" class="layui-textarea" style="width:40%;height:90px;"></textarea>
            </td>
          </tr>
          <tr>
            <th><font color="red">*</font>博客内容：</th>
            <td colspan="3">
              <textarea name="content"  class="layui-textarea" id="content" style="width:98%;height:350px;display:none;"></textarea>
            </td>
          </tr>
        </table>
      </form>
    </div>
    <!--//body End -->
  </div>
  <!--{include file="<!--{$oetplpath}-->widget_editor.tpl"}-->
  <div class="oe_kong"></div>
  <div class="oe_tbl_form_btn current">
    <button class="layui-btn" id="but_submit_post" lay-submit lay-filter="addform">
      添加保存
      <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
    </button>
  </div>
</div>
<script type="text/javascript">
$(function(){
  layui.use('form', function(){
      $form = layui.form;
      //保存...
      $form.on('submit(addform)', function(data){
          $obj_id = data.elem.getAttribute("id");
          if (!$("#"+$obj_id).hasClass("forbid_submit")) {
          
              if ($("#title").val().length  == 0) {
                  layer.msg("请填写标题");
                  return false;
              }
              if ($("#makerid").val().length  == 0) {
                  layer.msg("请填写红娘ID");
                  return false;
              }
              if (OEeditor.html().length == 0) {
                  layer.msg("请填写博客内容");
                  return false;
              }
              
              $("#"+$obj_id).addClass("forbid_submit");
              if ($("#"+$obj_id).find("span").length > 0) {
                  $("#"+$obj_id).find("span").show();
              }
              $("#content").text(OEeditor.html());
              $("#myform").submit();
          }
      });   
  });
});
</script>
<!--{/if}-->

<!--{if $a == 'edit'}-->
<div class="layui-fluid oe_fluid">

  <div class="oe_breadcrumb_box clearfix">
    <div class="layui-breadcrumb fl" lay-filter="breadcrumb" style="visibility: visible;">
      <a href="javascript:;">博客管理</a><span lay-separator="">/</span>
      <a><cite>编辑博客</cite></a>
    </div>
    <div class="oe_tool_bar ft">
      <button class="layui-btn layui-btn-sm layui-btn-radius" id="but_submit_post2" lay-submit lay-filter="editform">
        编辑保存
        <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
      </button>
      <a href="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->" class="layui-btn layui-btn-sm layui-btn-primary layui-btn-radius">返回列表</a>
    </div> 
  </div>
  
  <div class="layui-card">
    <div class="layui-card-header">编辑博客</div>
    <div class="layui-card-body">
    	<form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post" />
        <input type="hidden" name="a" id="a" value="saveedit" />
        <input type="hidden" name="id" id="id" value="<!--{$id}-->" />
    
        <table class="oe_tbl_form layui-form oe_edit_table">
          <tr>
            <th width="15%"><font color="red">*</font>标题：</th>
            <td width="35%">
              <input type="text" name="title" id="title" class="layui-input" value="<!--{$blog.title}-->"/>
              <span class="oe_trap"></span>
            </td>
            <th width="15%"><font color="red">*</font>发布红娘ID：</th>
            <td width="35%">
              <input type="text" name="makerid" id="makerid" class="layui-input input-150" value="<!--{$blog.makerid}-->" />
              &nbsp;&nbsp;<span id="makerid_tips"></span>&nbsp;&nbsp;
            </td>
          </tr>
          
          <tr>
            <th>分类：</th>
            <td>
              <div class="tbl_input input-150"><!--{hook mod="var" item="blogcat" type="select" name="catid" text="=请选择=" value=$blog.catid}--></div>
            </td>
            <th>封面图片：<span class="f_red"></span> </th>
            <td>
              <div class="layui-btn">
                <i class="layui-icon layui-icon-upload"></i>
                点击上传
                <input type="file" name="img" id="img" f="but_upload_image" data-mod="blog" data-thumb="1">
              </div>
              <div class="upload_loading" id="img_loading" style="display:none;"></div>
              <input type="hidden" id="img_thumb" name="thumbimg" value="<!--{$blog.thumbimg}-->">
              <input type="hidden" id="img_url" name="drawimg" value="<!--{$blog.drawimg}-->">
              <div class="upload_pic upload_pic_md" style="width:30px;height:30px;">
                <!--{if !empty($blog.thumbimg)}-->
                <img src="<!--{$blog.thumbimg}-->" id="img_preview" f="viewimg" />
                <!--{else}-->
                <img src="<!--{$urlpath}-->tpl/static/images/waitimg.jpg" id="img_preview" f="viewimg" />
                <!--{/if}-->
              </div>
              <a href="javascript:;" class="oe_deluploadimg" f="removeimg" data-preview="img" data-input="img">移除</a>
            </td>
          </tr>
          
          <tr>
            <th>作者：</th>
            <td><input type="text" name="author" id="author" class="layui-input input-150" value="<!--{$blog.author}-->"/></td>
            <th>浏览次数：</th>
            <td><input type="text" name="hits" id="hits" class="layui-input input-150" value="<!--{$blog.hits}-->"/></td>
          </tr>
          <tr>
            <th>状态：<span class="f_red"></span> </th>
            <td>
              <div class="tbl_input input-150">
                <select name="flag" id="flag">
                  <option value="">=请选择=</option>
                  <option value="1" <!--{if $blog.flag == '1'}--> selected<!--{/if}-->>通过</option>
                  <option value="2" <!--{if $blog.flag == '2'}--> selected<!--{/if}-->>未通过</option>
                  <option value="0" <!--{if $blog.flag == '0'}--> selected<!--{/if}-->>待审核</option>
                </select>
              </div>
            </td>
            <th>推荐：</th>
            <td>
              <input type="radio" name="elite" id="elite" value="1" title="是" lay-skin="primary"<!--{if $blog.elite == '1'}--> checked<!--{/if}-->/>
              <input type="radio" name="elite" id="elite" value="0" checked title="否" lay-skin="primary"<!--{if $blog.elite == '0'}--> checked<!--{/if}-->/>
            </td>
          </tr>
          <tr>
            <th>摘要：</th>
            <td colspan="3">
              <textarea name="intro" id="intro" class="layui-textarea" style="width:40%;height:90px;"><!--{$blog.intro}--></textarea>
            </td>
          </tr>
          <tr>
            <th><font color="red">*</font>博客内容：</th>
            <td colspan="3">
              <textarea name="content"  class="layui-textarea" id="content" style="width:98%;height:350px;display:none;"><!--{$blog.content}--></textarea>
            </td>
          </tr>
        </table>
      </form>
    </div>
    <!--//body End -->
  </div>
  <!--{include file="<!--{$oetplpath}-->widget_editor.tpl"}-->
  <div class="oe_kong"></div>
  <div class="oe_tbl_form_btn current">
    <button class="layui-btn" id="but_submit_post" lay-submit lay-filter="editform">
      编辑保存
      <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
    </button>
  </div>
</div>
<script type="text/javascript">
$(function(){
  layui.use('form', function(){
      $form = layui.form;
      //保存...
      $form.on('submit(editform)', function(data){
          $obj_id = data.elem.getAttribute("id");
          if (!$("#"+$obj_id).hasClass("forbid_submit")) {
          
              if ($("#title").val().length  == 0) {
                  layer.msg("请填写标题");
                  return false;
              }
              if ($("#makerid").val().length  == 0) {
                  layer.msg("请填写红娘ID");
                  return false;
              }
              if (OEeditor.html().length == 0) {
                  layer.msg("请填写博客内容");
                  return false;
              }
              $("#"+$obj_id).addClass("forbid_submit");
              if ($("#"+$obj_id).find("span").length > 0) {
                  $("#"+$obj_id).find("span").show();
              }
              $("#content").text(OEeditor.html());
              $("#myform").submit();
          }
      });   
  });
});
</script>
<!--{/if}-->


</body>
</html>