模态窗口插件之Jbox

$.jBox.tip("报损数量不能大于库存数!", 'error');
$.jBox.tip("请选择要报损的产品", "warn");
$.jBox.tip("报损单创建成功", "success");
$.jBox.info(result.d, "提示");
$.jBox.confirm("确定要删除吗?", "提示", submit);

 

var AccountSetting = {
    Add: function () {
        var submit = function (v, h, f) {
            if (v == true) {
                var userCode = h.find("#txtUserCode").val();
                var userName = h.find("#txtUserName").val();
                var realName = h.find("#txtRealName").val();
                var email = h.find("#txtEmail").val();
                var phone = h.find("#txtPhone").val();
                var mobile = h.find("#txtMobile").val();
                var roleNum = h.find("#ddlRole").val();
                var departNum = h.find("#ddlDepart").val();
                if (userName == undefined || userName == "") {
                    $.jBox.tip("请输入用户名", "warn");
                    return false;
                }
                var param = {};
                param["UserCode"] = userCode;
                param["UserName"] = userName;
                param["RealName"] = realName;
                param["Email"] = email;
                param["Phone"] = phone;
                param["Mobile"] = mobile;
                param["RoleNum"] = roleNum;
                param["DepartNum"] = departNum;
                $.gitAjax({
                    url: "/UserAjax/AddUser", type: "post", data: { "entity": JSON.stringify(param) }, success: function (result) {
                        if (result.d == "success") {
                            $.jBox.tip("编辑成功", "success");
                            User.PageClick(1, 10);
                        } else {
                            $.jBox.tip("编辑失败", "error");
                        }
                    }
                });
                return true;
            } else {
                return true;
            }
        }
        $.jBox.open("get:/Home/AccountSetting", "编辑用户", 500, 270, { buttons: { "确定": true, "关闭": false }, submit: submit });
    },
    Edit: function () {
        var submit = function (v, h, f) {
            if (v == true) {
                var currentPassword = h.find("#currentPassword").val();
                var passWord = h.find("#txtPassword").val();
                var confirm = h.find("#txtConfirm").val();

                if (currentPassword == undefined || currentPassword == "") {
                    $.jBox.tip("请输入当前密码", "warn");
                    return false;
                }
                if (passWord == undefined || passWord == "") {
                    $.jBox.tip("请输入密码", "warn");
                    return false;
                }
                if (confirm == undefined || confirm == "") {
                    $.jBox.tip("请输入确认密码", "warn");
                    return false;
                }
                if (passWord != confirm) {
                    $.jBox.tip("密码和确认密码不一致", "warn");
                    return false;
                }
                var param = {};
                param["currentPassword"] = currentPassword;
                param["PassWord"] = passWord;

                $.gitAjax({
                    url: "/UserAjax/ChangePwd", type: "post", data: param, success: function (result) {
                        if (result.d == "success") {
                            $.jBox.tip("修改成功", "success");

                        } else {
                            $.jBox.tip("修改失败,当前密码不正确!", "error");

                        }
                    }
                });
                return true;
            } else {
                return true;
            }
        }
        $.jBox.open("get:/Home/ChangePwd", "修改密码", 350, 200, { buttons: { "确定": true, "关闭": false }, submit: submit });
    }
};

 <li><a href="javascript:void(0)" onclick="AccountSetting.Add();"><i class="icon-user"></i>&nbsp;&nbsp;@ViewBag.CurrentLoginUser.UserName</a></li>
                            <li><a href="javascript:void(0)" onclick="AccountSetting.Edit();"><i class="icon-wrench"></i>&nbsp;&nbsp;修改密码</a></li>

 

posted @ 2016-03-17 22:38  BloggerSb  阅读(706)  评论(0编辑  收藏  举报