```
<admintpl file="header" />
<script src="__PUBLIC__/js/layer/layer.js"></script>
</head>
<style>
.cent{
text-align: center!important;
}
.inputor{
width: 65px;
height: 35px;
text-align: center;
}
</style>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li class="active"><a href="{:U('WechatMenu/index')}">菜单列表</a></li>
<li><a href="{:U('WechatMenu/add')}">添加菜单</a></li>
</ul>
<form class="js-ajax-form" id="form1">
<!--<div class="table-actions">-->
<!--<button class="btn btn-primary btn-small js-ajax-submit" id="submit" type="submit">排序</button>-->
<!--</div>-->
<table class="table table-hover table-bordered table-list" id="menus-table">
<thead>
<tr>
<th class="cent" width="50">ID</th>
<th class="cent">菜单名称</th>
<th class="cent">菜单类型</th>
<th class="cent">菜单内容</th>
<th class="cent" width="180">操作</th>
</tr>
</thead>
<tbody>
<!--{$categorys}-->
<foreach name="list" item="vo">
<tr>
<td class="cent">{$vo.menu_id}</td>
<td > <?php echo str_repeat('┗━',$vo['level']); ?>{$vo.menu_name}</td>
<td class="cent">{$vo.menu_type}</td>
<if condition="$vo['menu_type'] eq 'view'">
<td class="cent" style="800px;">{$vo.menu_url}</td>
<else />
<td class="cent" style="800px;">{$vo.menu_key}</td>
</if>
<!--<td>11</td>-->
<td class="cent">
<a href="{:U('WechatMenu/edit',array('id'=>$vo['menu_id']))}">编辑</a>
|
<a href='javascript:;' class="deletewx" data-id="{$vo.menu_id}">删除</a>
</td>
</tr>
</foreach>
</tbody>
</table>
</form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script>
$("#submit").click(function () {
$.post('{:U("WechatMenu/sort")}',$("#form1").serialize(),function (data) {
if(data.code !=1){
alert(data.msg);
return;
}else{
alert(data.msg);
location.href='{:U("WechatMenu/index")}';
}
});
});
$(function () {
$(".deletewx").on("click", function () {
if(confirm("确定要删除吗?")){
var obj = $(this);
var id = obj.data('id');
var url = "{:U('WechatMenu/delete')}";
var locaturl = "{:U('WechatMenu/index')}";
$.post(url,{id:id},function (res) {
console.log(res);
if (res.code ==1){
alert(res.msg);
window.location.href = locaturl;
}else if(res.code ==2){
alert(res.msg);
window.location.href = locaturl;
}else{
alert(res.msg);
window.location.href = locaturl;
}
});
}
});
})
$(document).ready(function() {
Wind.css('treeTable');
Wind.use('treeTable', function() {
$("#menus-table").treeTable({
indent : 20
});
});
});
setInterval(function() {
var refersh_time = getCookie('refersh_time_admin_menu_index');
if (refersh_time == 1) {
reloadPage(window);
}
}, 1000);
setCookie('refersh_time_admin_menu_index', 0);
</script>
</body>
</html>
```