//声明变量
var Register = function () {
//提交
this.btnSubmit = null;
//获得省份ID
this.provinceID = null;
//省份名称
this.province = null;
//获得城市ID
this.cityID = null;
//区县ID
this.countyID = null
//城市名称
this.cityName = null;
//区县名称
this.countyName = null;
//用户名
this.loginName = null;
//密码
this.Pwd = null;
//确认密码
this.confirmPwd = null;
//联系人姓名
this.relation = null;
//Email
this.email = null;
//手机号码
this.mobile = null;
//身份证号码
this.idCard = null;
//主营行业信息
this.industryID = null;
//性别信息
this.gender = null;
this.countryNo = null;
this.countyNo = null;
this.telephonec = null;
this.countryNoc = null;
this.countyNoc = null;
this.telephonec = null;
this.msn = null;
this.qq = null;
this.Address = null;
//邮政编码
this.emailCode = null;
this.protocol = null;
}
//初始化方法
Register.prototype.init = function () {
var _this = this,
_d = this.d;
this.btnSubmit = this.$("btnSubmit");
this.provinceID = this.$("ProvinceID");
//省份名称
this.province = this.$("ProvinceID");
//获得城市ID
this.cityID = this.$("CityID");
//区县ID
this.countyID = this.$("CountyID");
//城市名称
this.cityName = this.$("CityID");
//区县名称
this.countyName = $("#sltCounty").find("option:selected").text();
//用户名
this.loginName = this.$("LoginName");
//密码
this.Pwd = this.$("Pwd");
//确认密码
this.confirmPwd = this.$("ConfirmPwd");
//联系人姓名
this.relation = this.$("Relation");
//Email
this.email = this.$("Email");
//手机号码
this.mobile = this.$("Mobile");
//身份证号码
this.idCard = this.$("IDCard");
//主营行业信息
this.industryID = this.$("Industry");
//性别信息
this.gender = this.$("Gender");
this.countryNo = this.$("CountryNo");
this.countyNo = this.$("CountyNo");
this.telephonec = this.$("Telephone");
this.countryNoc = this.$("CountryNoc");
this.countyNoc = this.$("CountyNoc");
this.telephonec = this.$("Telephonec");
this.msn = this.$("MSN");
this.qq = this.$("QQ");
this.Address = this.$("Address");
//邮政编码
this.emailCode = this.$("EmailCode");
this.bindEvent(_d);
}
//绑定事件
Register.prototype.bindEvent = function (d) {
var _this = this;
_this.provinceID.change(function (e) {
_this.Register(e);
});
_this.cityID.change(function (e) {
_this.countyData(e);
});
_this.btnSubmit.click(function (e) {
_this.submitRegistrData(e);
});
}
//回传区县信息的方法
Register.prototype.countyData = function (e) {
var _this = this;
var aj = 1;
var postData = {};
postData["cityID"] = this.cityID.attr('value');
if (aj == 1) {
aj = 0;
$.ajax({
type: "post",
url: "/Home/RegisterCountyData",
dataType: 'json',
data: postData,
success: function (x) {
if (x) {
$("#sltCounty").empty();
for (var i = 0; i < x.length; i++) {
var op = $("<option value="+x[i].CountyId+">" + x[i].CountyName + "</option>");
$("#sltCounty").append(op);
}
}
},
complete: function () { aj = 1; }
});
return false;
}
}
//回传城市信息
Register.prototype.Register = function (e) {
var _this = this;
var aj = 1;
var postData = {};
postData["provinceID"] = this.provinceID.attr('value');
if (aj == 1) {
aj = 0;
$.ajax({
type: "post",
url: "/Home/RegisterData",
dataType: 'json',
data: postData,
success: function (x) {
if (x) {
$("#sltCity").empty();
for (var i = 0; i < x.length; i++) {
var op = $("<option value="+x[i].CityId+">" + x[i].CityName + "</option>");
$("#sltCity").append(op);
}
}
},
complete: function () { aj = 1; }
});
return false;
}
}
//获得页面数据
Register.prototype.submitRegistrData = function (e) {
var _this = this;
var aj = 1;
var postData = {};
postData["ProvinceID"] = this.provinceID.attr('value');
//省份名称
postData["Province"] = $("#sltProvince").find("option:selected").text();
//获得城市ID
postData["CityID"] = this.cityID.attr('value');
//区县ID
postData["CountyID"] = this.countyID.attr('value');
//城市名称
postData["CityName"] = $("#sltCity").find("option:selected").text();
//区县名称
postData["CountyName"] = $("#sltCounty").find("option:selected").text();
//用户名
postData["LoginName"] = this.loginName.attr('value');
//密码
postData["Pwd"] = this.Pwd.attr('value');
//确认密码
postData["ConfirmPwd"] = this.confirmPwd.attr('value');
//联系人姓名
postData["Relation"] = this.relation.attr('value');
//Email
postData["Email"] = this.email.attr('value');
//手机号码
postData["Mobile"] = this.mobile.attr('value');
//身份证号码
postData["IDCard"] = this.idCard.attr('value');
//主营行业信息
postData["Industry"] = this.industryID.attr('value');
//性别信息
postData["Gender"] = this.gender.attr('value');
postData["CountryNo"] = this.countryNo.attr('value');
postData["CountyNo"] = this.countyNo.attr('value');
postData["Telephone"] = this.telephonec.attr('value');
postData["CountryNoc"] = this.countryNoc.attr('value');
postData["CountyNoc"] = this.countyNoc.attr('value');
postData["Telephonec"] = this.telephonec.attr('value');
postData["MSN"] = this.msn.attr('value');
postData["QQ"] = this.qq.attr('value');
postData["Address"] = this.Address.attr('value');
//邮政编码
postData["EmailCode"] = this.emailCode.attr('value');
if (aj == 1) {
aj = 0;
$.ajax({
type: "post",
url: "/Home/RegisterAllData",
dataType: 'json',
data: postData,
success: function (x) {
if (x) {
if (x.code) {
if ("ok" === x.code || "OK" === x.code) {
alert("成功!!");
}
else {
$(x.code).tooltip({ html: x.msg, isFocus: 1, isSelect: 1 });
return false;
}
}
}
},
complete: function () { aj = 1; }
});
return false;
}
}
//获得控件对象
Register.prototype.$ = function (componentName) {
return $('[name="' + componentName + '"]')
}
var register = new Register();
register.init();
jquery页面注册模版
最新推荐文章于 2023-10-25 15:53:28 发布