🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
``` <admintpl file="header"/> </head> <body> <style> .inputs{ width: 351px!important; } .inputl{ width: 420px!important; } .check { padding-bottom:10px;} .main { margin-top:10px;} .main .aa {display:none; } </style> <div class="wrap"> <ul class="nav nav-tabs"> <li ><a href="{:U('WechatMenu/index')}">菜单列表</a></li> <li class="active"><a href="{:U('WechatMenu/add')}">添加菜单</a></li> </ul> <form id="form1" class="form-horizontal"> <div class="control-group"> <label class="control-label" >上级分类</label> <div class="controls"> <select class="selectl" name="menu_pid" lay-verify="required" required> <option value="0">----默认顶级分类----</option> <foreach name="menus" item="vo"> <option <if condition="$info['menu_pid'] eq $vo['menu_id']"> selected </if> value="{$vo.menu_id}"><?php echo str_repeat('┗━',$vo['level']);?>{$vo.menu_name}</option> </foreach> </select> </div> </div> <div class="control-group"> <label class="control-label" >分类名</label> <div class="controls"> <input class="inputl" type="text" name="menu_name" value="{$info.menu_name}" placeholder="请输入分类名"> </div> </div> <div class="control-group boxs"> <label class="control-label" style="margin-right:15px;">菜单类型</label> <div class="boxs"> <div class="check"> <label class="radio inline"><input type="radio" id="aa1" name="menu_type" value="view" <if condition="$vo.menu_type eq view">checked</if> />URL</label> <label class="radio inline"><input type="radio" id="aa2" name="menu_type" value="click" <if condition="$vo.menu_type eq click">checked</if> />关键词</label> </div> <div class="main"> <!-- url --> <div class="aa"> <div class="control-group"> <label class="control-label" >菜单内容</label> <div class="controls"> <if condition="$info['menu_type'] eq 'view'"> <input class="inputl" type="text" name="menu_url" value="{$info.menu_url}" placeholder="请输入URL地址" > <else /> <input class="inputl" type="text" name="menu_url" placeholder="请输入URL地址" > </if> </div> </div> </div> <!-- end --> <!-- key 2 --> <div class="aa"> <div class="control-group"> <label class="control-label" >菜单内容</label> <div class="controls"> <if condition="$info['menu_type'] eq 'click'"> <input class="inputl" type="text" name="menu_key" value="{$info.menu_key}" placeholder="请输入关键词" > <else /> <input class="inputl" type="text" name="menu_key" placeholder="请输入关键词" > </if> </div> </div> </div> <!-- end --> </div> </div> </div> <input name="id" type="hidden" value="{$info.menu_id}"/> <div class="form-actions"> <button type="button" id="onSubmit" class="btn btn-primary js-ajax-submit">添加</button> <a class="btn" href="javascript:history.back(-1);">返回</a></div> </form> </div> </div> <script src="__PUBLIC__/js/common.js"></script> <script src="__PUBLIC__/js/global.js"></script> <script src="__PUBLIC__/js/PCASClass.js"></script> <!-- 省市县插件--> <script> $("#onSubmit").click(function () { $.post('{:U("WechatMenu/edit")}',$("#form1").serialize(),function (data) { if(data.code !=1){ alert(data.msg); return; }else{ alert(data.msg); location.href='{:U("WechatMenu/index")}'; } }); }); // radio单选框div 显/隐=>修改 $(function () { // input id var str1=$("#aa1:checked").val(); var str2=$("#aa2:checked").val(); if(str1=='view'){ $(".aa").eq(0).show(); } if(str2=='click'){ $(".aa").eq(1).show(); } $(".check label").click(function () { $(".aa").hide(); var theI = $(this).index(); $(".aa").eq(theI).show(); }); }); // radio单选框div 显/隐 // $(function () { // $(".aa").eq(0).show(); // $(".check label").click(function () { // $(".aa").hide(); // var theI = $(this).index(); // $(".aa").eq(theI).show(); // }); // }); </script> <style> input{width: 60%;} </style> </body> </html> ```