<?
//$duoduo->get_table_desc("article");
 $cates=app("type")->cids(0);
 //$data['switch']['tj']=array("openvalue"=>2,"default"=>"close");
 //include(ADMINROOT.'/template/public/'.$act.'.tpl.php'); //公共模板

$row=$duoduo->select("type","*","id=".$_GET['id']);
?>
<br>
<div class="layui-form layuimini-main">

      

        <div class="layui-form-item">
            <label class="layui-form-label required">标题</label>
            <div class="layui-input-block">
                <input type="text" name="title" lay-verify="required" lay-reqtext="" placeholder="请输入名称" value="<?=$row['title']?>" class="layui-input">
              
            </div>
        </div>

         <div class="layui-form-item">
            <label class="layui-form-label required">短介绍</label>
            <div class="layui-input-block">
                <input type="text" name="desc" lay-verify="" lay-reqtext="" placeholder="" value="<?=$row['desc']?>" class="layui-input">
              
            </div>
        </div>
       <div class="layui-form-item">
		     <label class="layui-form-label">分类</label>
		     <div class="layui-input-block">
		          <?=select2($cates,$row['pid'],"pid")?>
		    </div>
       </div>

      <?
         $title="缩略图";
         $field="img";
         $name="img";
         $fvalue=$row['img'];
         include(ADMINROOT.'/template/tpl/img.tpl.php'); //
       ?>
       <div class="layui-form-item">
             <label class="layui-form-label">模块</label>
             <div class="layui-input-block">
                  <?=select3(app("model")->models(),$row['model_id'],"model_id")?>
            </div>
       </div>
       
        <div class="layui-form-item">
            <label class="layui-form-label required">跳转url</label>
            <div class="layui-input-block">
                <input type="text" name="url" lay-verify="" lay-reqtext="" placeholder="" value="<?=$row['url']?>" class="layui-input">
              
            </div>
        </div>
    
   

      
        
    

      
        <div class="layui-form-item">
            <label class="layui-form-label required">排序</label>
            <div class="layui-input-block">
                <input type="text" name="sort" lay-verify="required|number" lay-reqtext="" placeholder="" value="<?=$row['sort']?$row['sort']:0?>" class="layui-input">
              
            </div>
         </div>
            

             <div class="layui-form-item">
       <label class="layui-form-label">内容</label>
     <div class="layui-input-block">
         <textarea id="content" name="content" style="display: none;"><?=$row['content']?></textarea>
    </div>
  </div>

         <div class="layui-form-item">
            <div class="layui-input-block">
           
                <input type="hidden" value="<?=$row['id']?>" name="id">
                <button class="layui-btn layui-btn-normal jian_save" lay-submit lay-filter="saveBtn" >确认保存</button>
            </div>
        </div>
   


</div>
<script>
    layui.use(['form', 'table','miniAdmin','layedit'], function () {
        var form = layui.form,
            layer = layui.layer,
            miniAdmin = layui.miniAdmin,
            layedit = layui.layedit;
            table = layui.table,
            $ = layui.jquery;   
        /**
         * 初始化表单，要加上，不然刷新部分组件可能会不加载
         */
        form.render();

         form.on('select(node_id)', function(data){
     
               $('#nodevalue').val(data.value);
         })


  var edit_content=layedit.build('content'); //建立编辑器

  $(".jian_save").click(function(){

    if($("#content")[0]){
      $("#content").html(layedit.getContent(edit_content));
    }
     
  })

    });
</script>
