```
<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 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" placeholder="请输入分类名">
<br>
<span style="color: red;">提示:如果该分类有子菜单可忽略下面选项!</span>
</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" name="menu_type" value="view" />URL</label>
<label class="radio inline"><input type="radio" name="menu_type" value="click"/>关键词</label>
</div>
<div class="main">
<!-- url -->
<div class="aa">
<div class="control-group">
<label class="control-label" >URL地址</label>
<div class="controls">
<input class="inputl" type="text" name="menu_url" placeholder="请输入URL地址" >
</div>
</div>
</div>
<!-- end -->
<!-- key 2 -->
<div class="aa">
<div class="control-group">
<label class="control-label" >关键词</label>
<div class="controls">
<input class="inputl" type="text" name="menu_key" placeholder="请输入关键词" >
</div>
</div>
</div>
<!-- end -->
</div>
</div>
</div>
<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/add")}',$("#form1").serialize(),function (data) {
console.log(data)
if(data.code !=1){
alert(data.msg);
return;
}else if(data.code == 11){
alert(data.msg);
}else {
alert(data.msg);
location.href='{:U("WechatMenu/index")}';
}
});
});
// 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>
```