<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>密码修改</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <form class="layui-form" >
            <div class="layui-form-item">
                <label class="layui-form-label required">旧密码</label>
                <div class="layui-input-inline">
                    <input type="password" name="old_pwd" lay-verify="required" lay-verType="tips" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">新密码</label>
                <div class="layui-input-inline">
                    <input type="password" name="new_pwd" lay-verify="pass" lay-verType="tips" autocomplete="off" id="LAY_password" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">8个以上字符，包含数字和非数字</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">确认新密码</label>
                <div class="layui-input-inline">
                    <input type="password" name="re_pwd" lay-verify="repass" lay-verType="tips" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认修改</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script src="../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form'], function () {
        var form = layui.form,
            $ = layui.$;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            $.ajax({
                type:"POST",
                url:"/personal/update_pwd",
                contentType: "application/json;charset=UTF-8",
                data: JSON.stringify(data.field),
                success: function (result) {
                    var obj = JSON.parse(result);
                    layer.alert(obj.msg);
                },
                error: function () {
                    console.log("ajax error");
                }
            });
            return false;
        });

    });
</script>

</body>
</html>