后台添加会员弹窗

Original 2019-03-12 17:06:07 287
abstract:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <link rel="stylesheet" type="text/css" h
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="layui/css/layui.css">
<script src="layui/layui.js"></script>
<title>管理员列表</title>
<style>
    .header{border-bottom:2px solid RGB(0,150,136);}
    .header span{
        background:RGB(0,150,136); 
        color:#fff;padding: 10px;
        margin-left: 10px; 
        line-height:32px;
    }
    .header button{
        background:RGB(0,150,136); 
        color:#fff; float:right;
    }
    </style>
</head>
<body style="padding: 10px;">
    <!-- 页眉 -->
    <div class="header">
        <span>管理员列表</span>
        <button class="layui-btn layui-btn-primary layui-btn-sm" onclick="add()">添加</button>
    </div>
    <!-- 插入数据操作的表格 -->
    <table class="layui-table">
        <thead>
            <tr>
                <th >ID</th>
                <th>用户名</th>
                <th>性别</th>
                <th>城市</th>
                <th>签名</th>
                <th>积分</th>
                <th>操作</th>      
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>贤心</td>
                <td>汉族</td>
                <td>1989-10-14</td>
                <td>北京</td>
                <td>汉朝</td>
                <td>32232323</td>
                <td>
                    <button class="layui-btn layui-btn-xs" onclick="add()">编辑</button>
                    <button class="layui-btn layui-btn-danger layui-btn-xs" onclick="del()">删除</button>
                </td>
            </tr>
            <tr>
                <td>张爱玲</td>
                <td>汉族</td>
                <td>1989-10-14</td>
                <td>北京</td>
                <td>汉朝</td>
                <td>32232323</td>
                <td>
                    <button class="layui-btn layui-btn-xs" onclick="add()" >编辑</button>
                    <button class="layui-btn layui-btn-danger layui-btn-xs">删除</button>
                </td>
            </tr>
            <tr>
                <td>Helen Keller</td>
                <td>汉族</td>
                <td>1989-10-14</td>
                <td>北京</td>
                <td>汉朝</td>
                <td>32232323</td>
                <td>
                    <button class="layui-btn layui-btn-xs"onclick="add()" >编辑</button>
                    <button class="layui-btn layui-btn-danger layui-btn-xs">删除</button>
                    </td>
            </tr>
            <tr>
                    <td>岳飞</td>
                    <td>汉族</td>
                    <td>1989-10-14</td>
                    <td>北京</td>
                    <td>汉朝</td>
                    <td>32232323</td>
                    <td>
                        <button class="layui-btn layui-btn-xs" onclick="add()">编辑</button>
                        <button class="layui-btn layui-btn-danger layui-btn-xs">删除</button>
                    </td>
            </tr>
            <tr>
                    <td>孟子</td>
                    <td>汉族</td>
                    <td>1989-10-14</td>
                    <td>北京</td>
                    <td>汉朝</td>
                    <td>32232323</td>
                    <td>
                        <button class="layui-btn layui-btn-xs"onclick="add()" >编辑</button>
                        <button class="layui-btn layui-btn-danger layui-btn-xs">删除</button>
                        </td>
                    </tr>
        </tbody>
    </table>
<script>
    //layui.use定义js外部引用函数
    layui.use([ 'layer'], function(){
        var element = layui.element;
        var layer = layui.layer;
    });
    //删除
    function del(){
        layer.confirm('确定要删除吗', {
            icon:2,                        //图标0-6
            btn: ['确定', '取消'] //可以无限个按钮
        }, function(index, layero){
            //按钮【按钮一】的回调
            }, function(index){
            //按钮【按钮二】的回调
            });
    }
    //添加/编辑会员 使用弹出层2(iframe层)框架层
    function add(){
        layer.open({
            type: 2,
            area:['480px', '420px'],  //使用数组字符串的方式定义高度和宽度
            title:'添加/编辑会员',
            content: 'add.html' //这里content是一个普通的String
        });
    }
</script>
</body>
</html>
-------------------------------新增会员部分--------------------
<body>
    <form class="layui-form" action="" style="margin-top:20px">
        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-inline">
            <input type="text" name="password"  class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">真实姓名</label>
            <div class="layui-input-inline">
            <input type="text" name="password"  class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">性别</label>
            <div class="layui-input-block">
            <input type="radio" name="sex" value="男" title="男">
            <input type="radio" name="sex" value="女" title="女" checked>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">城市</label>
            <div class="layui-input-inline"> <!-- layui-input-inline选择框短 layui-input-inlineblock长选择框 -->
            <select name="city" lay-verify="required">
                <option value=""></option>
                <option value="0">北京</option>
                <option value="1">上海</option>
                <option value="2">广州</option>
                <option value="3">深圳</option>
                <option value="4">杭州</option>
            </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">禁用</label>
            <div class="layui-input-block">
            <input type="checkbox" name="" title="写作" lay-skin="primary">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
  
    </form>
    <script>
    //layui.use定义js外部引用函数  
    layui.use('form', function(){
        var form = layui.form;
    });
    </script>  
    <!-- 注意有些引用过来后,注意内部class名或者属性修改成正确的即可
        引用时也要注意有没有行区块结构,没有先复制过来。 -->
</body>


Correcting teacher:韦小宝Correction time:2019-03-12 17:53:56
Teacher's summary:写的很不错 layui中的弹出层还是比较好用的 而且样式也很多 使用起来很灵活 没事的时候可以去研究研究

Release Notes

Popular Entries