<style>
.index-adup{width:120px;float:left;padding-left:110px; margin-top:10px;overflow: hidden;}
.index-adpic{float: left;width: 120px;margin-top:32px;}
.index-adpicc{margin-top:32px;}
.jianque { height: 80px;width: 100px; margin-bottom: 5px;}
</style>
<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-tab layui-tab-brief layadmin-latestData" lay-filter="atb">
            <ul class="layui-tab-title">
              <li><a lay-href="wendasns/advert/index">广告管理</a></li>
              <li class="layui-this"><a lay-href="wendasns/advert/category">广告位管理</a></li>
            </ul>
            <div class="layui-tab-content">
              <div class="layui-tab-item layui-show">
                  <!-- 广告位置 -->      
                  <div style="padding-bottom: 10px;">
                    <a href="#J_view" class="layui-btn J_popup" title="增加广告位置"><i class="layui-icon layui-icon-add-circle"></i>添加</a>
                    <a href="wendasns/advert/goremove" class="layui-btn J_req" title="确定要删除吗？"><i class="layui-icon layui-icon-delete"></i>删除</a>
                    <a href="javascript:;" id="adup"></a> 
                  </div>               
                     <table id="J_table_list" lay-filter="J_table_list"></table>
              </div>
            </div>
          </div>  
          
        </div>
      </div>
    </div>
  </div>

  <script type="text/html" id="J_table_type">
    {{# if(d.adver_type == 'pic'){}}
        图片广告
    {{# } else if(d.adver_type == 'code') {}}
        广告代码
    {{# } else {}}
        文字广告
    {{# }}}
  </script>

  <script type="text/html" id="adtime">
    {{# 
        if(d.adver_days != 10000){
           var tmp = Date.parse( new Date() ).toString();
            tmp = tmp.substr(0,10);
            var endtime = d.adver_date - tmp;
             var result = endtime / 86400;
            var link_status = result > 0 ? '<i class="layui-icon layui-icon-tips" style="color: #FF5722" title="广告还有 '+Math.ceil(result) +' 天过期！"> <span style="color: #1E9FFF;">'+Math.ceil(result) +'天 后过期</span></i>' : '<span style="color: #FF5722;">已过期</span>';
        }}   
    {{# }else { }}

    {{# var link_status  = '<span style="color: #009688">长期有效</span>';}}
    {{# } }}
    {{ link_status }}
  </script> 

  <script type="text/html" id="Jad_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/advert/goremove" 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.$
    ,table =layui.table
    ,form = layui.form;
    
    form.render();

    table.render({
      elem: '#J_table_list'
      ,height: 'auto'
      ,url: '{:url('wendasns/advert/place')}'
      ,page: true
      ,limit: 16
      ,cols: [[
      	{type:'checkbox'}
      	,{field:'id',title:'ID',width:80,align:'center'}
        ,{field:'name',title:'名称',minWidth:120}
        ,{field:'tips',title:'说明',minWidth:150}
        ,{field:'status',title:'启用',width:80,align:'center',templet: '<div>{{d.status==1?"是":"否"}}</div>'}
        ,{field:'adver_cz',title:'操作',width:150,align:'center',toolbar: '#Jad_table_tool'}
      ]]
      ,text: {
        none: '无任何广告位！'
      }
    });

}();
</script>

  <script type="text/html" id="J_view">

          <form class="layui-form" action="{:url('wendasns/advert/goedit')}" 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="name" value="{{d.name||''}}" placeholder="请输入位名称" 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="tips" value="{{d.tips||''}}" placeholder="请输入位名称" 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="status" value="1" title="是"{{ typeof d.status=='undefined'?' checked':(d.status==1?' checked':'') }}>
                <input type="radio" name="status" value="0" title="否"{{ typeof d.status=='undefined'?'':(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"><i class="layui-icon layui-icon-ok-circle"></i>提交</button>
                </div>
              </div>
          </form>
  
    </script>