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

$row = $duoduo->select(MOD, "*", "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'];
    $desc = "尺寸750*400";
    include(ADMINROOT . '/template/tpl/inputimg.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 required">推荐</label>
		<div class="layui-input-block">
			<?= html_radio1(array(1 => "不推荐", 2 => "推荐"), $row['tj'] ? $row['tj'] : 1, "tj") ?>
		</div>
	</div>

    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-block">
            <?= html_radio1(array(1 => "正常", 2 => "禁用"), $row['status'] ? $row['status'] : 1, "status") ?>
        </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>