

<div class="layui-form" lay-filter="layuiadmin-form-announcementmadmin" style="padding: 20px 0 0 0;">
  <script type="text/html" template>
    <input type="hidden" name="id" value="{{ d.params.id || '' }}" class="layui-input">
  </script>

  <div class="layui-form-item">
    <label class="layui-form-label">标题</label>
    <div class="layui-input-block">
      <script type="text/html" template>
        <input type="text" name="title" value="{{ d.params.title || '' }}" placeholder="请输入标题" autocomplete="off" class="layui-input">
      </script>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">形式</label>
    <div class="layui-input-block">
      <input type="radio" lay-filter="show-mode" name="is_external" value="0" title="显示内容" checked>
      <input type="radio" lay-filter="show-mode" name="is_external" value="1" title="跳转链接" >
    </div>
  </div>

  <div class="layui-form-item content">
    <label class="layui-form-label">内容</label>
    <div class="layui-input-block">
        <textarea rows=10 name="content" placeholder="请输入html内容" class="layui-textarea"></textarea>
    </div>
  </div>

  <div class="layui-form-item url layui-hide">
    <label class="layui-form-label">链接</label>
    <div class="layui-input-block">
      <script type="text/html" template>
        <input type="text" name="url" value="{{ d.params.url || '' }}" autocomplete="off" class="layui-input">    
      </script>
    </div>    

  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">显示</label>
    <div class="layui-input-inline">
      <script type="text/html" template>
        <input type="checkbox" name="is_show" {{ d.params.id || 'checked' }}  {{ d.params.is_show && 'checked' }} lay-skin="switch" lay-text="是|否">
      </script>
    </div>
    <label class="layui-form-label">样式</label>
    <div class="layui-input-inline">
      <script type="text/html" template>
        <input type="checkbox" name="style" value="red" title="加红" lay-skin="primary">
        <input type="checkbox" name="style" value="bold" title="加粗" lay-skin="primary"> 
      </script>
    </div>

  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">弹窗</label>
    <div class="layui-input-inline">
      <script type="text/html" template>
        <input type="checkbox" name="is_popup" {{ d.params.is_popup && 'checked' }} lay-skin="switch" lay-text="是|否">
      </script>
    </div>
    <label class="layui-form-label">排序</label>
    <div class="layui-input-inline">
      <script type="text/html" template>
        <input type="text" name="sort" value="{{ d.params.sort || '100' }}" autocomplete="off" class="layui-input">    
      </script>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label"></label>
    <div class="layui-input-inline">
      <input type="button" lay-submit lay-filter="LAY-message-front-submit" value="确认" class="layui-btn">
    </div>
  </div>
</div>

<script type="text/html" template lay-done="layui.data.sendParams(d.params)">
  
</script>

<script>
layui.data.sendParams = function(params){
  var cname_id = params.cname_id

  layui.use(['admin', 'form'], function(){
    var $ = layui.$
    ,form = layui.form
    ,admin = layui.admin

    form.on('radio(show-mode)', function(data){
      if (data.value == "0") {
        $(".url").addClass("layui-hide")
        $(".content").removeClass("layui-hide")
      } else {
        $(".content").addClass("layui-hide")
        $(".url").removeClass("layui-hide")
      }
    });      

  })
};
</script>

