<title>修改密码</title>

<div class="layui-card layadmin-header">
  <div class="layui-breadcrumb" lay-filter="breadcrumb">
    <a lay-href="">主页</a>
    <a><cite>修改密码</cite></a>
  </div>
</div>

<div class="layui-fluid">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md12">
      <div class="layui-card">
        <div class="layui-card-header">修改密码</div>
        <div class="layui-card-body" pad15>
          <div class="layui-form" wid100 lay-filter="LAY-info-form">
            <div class="layui-fields">

            </div>
            <div class="layui-card">
              <div class="layui-form-item">
                <div class="layui-input-block">
                  <label class="layui-form-label">
                    <button class="layui-btn mb" lay-submit lay-filter="submit">确认修改</button>
                  </label>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<script>
    var api = '/manage/user/modifyPassword.json';
    layui.use(['form', 'upload'], function () {
        var $ = layui.$
            , layer = layui.layer
            , laytpl = layui.laytpl
            , admin = layui.admin
            , form = layui.form;

        var $body = $('body');

        form.render();

        admin.req({
            url: api,
            success: function (res) {
                layui.each(res.data.fields, function (k, v) {
                    laytpl(tplField.innerHTML).render(v, function (html) {
                        $body.find('.layui-form .layui-fields').append(html);
                    });
                });
                form.val('LAY-info-form', res.data.values);
            }
        });


        form.on('submit(submit)', function (obj) {
            if (!layui.$(this).hasClass('layui-btn-disabled')) {
                admin.req({
                    url: api,
                    data: obj.field,
                    method: 'POST',
                    success: function (res) {
                        layer.open({
                            icon: 1,
                            title: '操作成功',
                            content: '修改成功',
                        });
                        admin.exit()
                    }
                });
            }
            return false;
        });
    });
</script>