LAYUI小结

原创2019-08-09 12:58:0311
摘要:<!DOCTYPE html><html><head> <title>角色添加</title> <link rel="stylesheet" type="text/css" href="static/plugins/layui/css/layui.css"> <

<!DOCTYPE html>

<html>

<head>

<title>角色添加</title>

<link rel="stylesheet" type="text/css" href="static/plugins/layui/css/layui.css">

<script type="text/javascript" src="static/plugins/layui/layui.js"></script>

</head>

<body style="padding: 10px;">

<form class="layui-form">

<input type="hidden" name="gid" value="">

<div class="layui-form-item">

<label class="layui-form-label">角色名称</label>

<div class="layui-input-block">

<input type="text" class="layui-input" name="title" value="">

</div>

</div>


<div class="layui-form-itme">

<label class="layui-form-label">权限菜单</label>

<hr>

<div class="layui-input-block">

<input type="checkbox" name="menu[1]" lay-skin="primary" title="管理员管理" >

<hr>

<input type="checkbox" name="menu[4]" lay-skin="primary" title="管理员列表" >

<input type="checkbox" name="menu[7]" lay-skin="primary" title="角色测试" >

<input type="checkbox" name="menu[5]" lay-skin="primary" title="管理员添加" >

<input type="checkbox" name="menu[6]" lay-skin="primary" title="管理员保存" >

</div>

<hr>

<div class="layui-input-block">

<input type="checkbox" name="menu[2]" lay-skin="primary" title="权限管理" >

<hr>

<input type="checkbox" name="menu[8]" lay-skin="primary" title="菜单管理" >

<input type="checkbox" name="menu[9]" lay-skin="primary" title="菜单添加" >

<input type="checkbox" name="menu[10]" lay-skin="primary" title="菜单保存" >

<input type="checkbox" name="menu[11]" lay-skin="primary" title="角色管理" >

<input type="checkbox" name="menu[12]" lay-skin="primary" title="角色保存" >

<input type="checkbox" name="menu[30]" lay-skin="primary" title="角色添加" >

</div>

<hr>

<div class="layui-input-block">

<input type="checkbox" name="menu[3]" lay-skin="primary" title="系统设置" >

<hr>

<input type="checkbox" name="menu[13]" lay-skin="primary" title="网站设置" >

<input type="checkbox" name="menu[14]" lay-skin="primary" title="保存设置" >

</div>

<hr>

<div class="layui-input-block">

<input type="checkbox" name="menu[15]" lay-skin="primary" title="商品分类" >

<hr>

<input type="checkbox" name="menu[16]" lay-skin="primary" title="分类列表" >

<input type="checkbox" name="menu[17]" lay-skin="primary" title="分类保存" >

</div>

<hr>

<div class="layui-input-block">

<input type="checkbox" name="menu[19]" lay-skin="primary" title="产品管理" >

<hr>

<input type="checkbox" name="menu[20]" lay-skin="primary" title="产品列表" >

<input type="checkbox" name="menu[21]" lay-skin="primary" title="添加产品" >

<input type="checkbox" name="menu[22]" lay-skin="primary" title="保存产品" >

<input type="checkbox" name="menu[23]" lay-skin="primary" title="图片上传" >

<input type="checkbox" name="menu[29]" lay-skin="primary" title="获取sku" >

</div>

<hr>

<div class="layui-input-block">

<input type="checkbox" name="menu[24]" lay-skin="primary" title="幻灯片管理" >

<hr>

<input type="checkbox" name="menu[25]" lay-skin="primary" title="首页首屏" >

<input type="checkbox" name="menu[26]" lay-skin="primary" title="幻灯片保存" >

</div>

<hr>

<div class="layui-input-block">

<input type="checkbox" name="menu[27]" lay-skin="primary" title="主页" >

<hr>

<input type="checkbox" name="menu[28]" lay-skin="primary" title="欢迎" >

</div>

</div>

</form>


<div class="layui-form-item" style="margin-top:10px;">

<div class="layui-input-block">

<button class="layui-btn" onclick="save()">保存</button>

</div>

</div>

</body>

</html>

<script type="text/javascript">

layui.use(['layer','form'],function(){

var form = layui.form;

layer = layui.layer;

$ = layui.jquery;

});


function save(){

var title = $.trim($('input[name="title"]').val());

if(title==''){

layer.msg('请填写角色名称',{'icon':2});

return;

}

$.post('/index.php/admins/roles/save',$('form').serialize(),function(res){

if(res.code>0){

layer.msg(res.msg,{'icon':2});

}else{

layer.msg(res.msg,{'icon':1});

setTimeout(function(){parent.window.location.reload();},1000);

}

},'json');

}

</script>


批改老师:Peter-Zhu批改时间:2019-08-15 10:43:36
老师总结:setTimeout(function(){parent.window.location.reload();},1000); 应该分与多行书写

发布手记

热门词条

第九期线上培训班