(function(){
    X.pageLogic['updatepas'] = {
        init : function(parms){

            var me = this;
            this.parms = parms;
            this.callback = parms.callback; //选择后执行的回调
            var data = parms.extData;//获取到上层弹窗传的数据

            $(".updatepas-but-box .updatepas-qx").click(function(){
                layer.closeAll();
            })

            $(".updatepas-top-box img").click(function(){
                layer.closeAll();
            })
            
            $(".updatepas-but-box .updatepas-qd").click(function(){
                var fromdata = layui.form.val("updatepasexample");
                var password = fromdata['password'];
                var password2 = fromdata['password2'];
                if(password != password2){
                    layer.msg("密码不一致!!!");
                    return;
                }
               X.api('user/reset_password',"post",{username: data.name,password:password2},function(d){
                    layer.msg('修改成功');
                    me.callback && me.callback(d);
                    layer.closeAll();
               })
            })
        }
    };
})();
