SignupForm=function(a){Ext.apply(this,{defaults:{xtype:"textfield",msgTarget:"under",width:200},items:[{fieldLabel:"用户名*",name:"login",itemCls:"required",allowBlank:false,emptyText:"请输入用户名",regex:/^[_a-zA-Z0-9\u4e00-\u9fa5]{2,20}$/,regexText:"用户名只能由字母、数字以及中文字符构成",minLength:2,minLengthText:"用户名长度为2-20个字符",maxLength:20,maxLengthText:"用户名长度为2-20个字符",listeners:{blur:{fn:this.uniqueLogin,scope:this}}},{fieldLabel:"姓名*",name:"party_name",itemCls:"required",allowBlank:false,emptyText:"请输入您的真实姓名"},{name:"password",fieldLabel:"密码*",allowBlank:false,itemCls:"required",inputType:"password",listeners:{blur:{fn:this.validatePassword,scope:this}},minLength:6,minLengthText:"密码长度为6-12个字符",maxLength:12,maxLengthText:"密码长度为6-12个字符"},{name:"verify",fieldLabel:"重复密码*",submitValue:false,allowBlank:false,itemCls:"required",inputType:"password",listeners:{blur:{fn:this.validatePassword,scope:this}},minLength:6,minLengthText:"密码长度为6-12个字符",maxLength:12,maxLengthText:"密码长度为6-12个字符"},{xtype:"textfield",name:"email",itemCls:"required",fieldLabel:"E-Mail*",emptyText:"请输入您的常用电子邮件地址",allowBlank:false,vtype:"email",listeners:{blur:{fn:this.uniqueEmail,scope:this}}},{xtype:"numberfield",minLength:11,maxLength:11,fieldLabel:"手机",name:"mobile"},{xtype:"box",autoEl:{style:"margin-top: 10px;",cn:"* 以上带星号的为必须输入的项目。"}}],plugins:new Ext.ux.plugins.InfoPlugin({width:"auto"}),buttons:[{text:"注册",iconCls:"x-icon-signup",listeners:{click:{fn:this.signup,scope:this}}},{text:"取消",iconCls:"btn-cancel",handler:function(){location="/"}}]});Ext.apply(this,a);SignupForm.superclass.constructor.call(this)};Ext.extend(SignupForm,Ext.FormPanel,{id:"signup-form",frame:true,iconCls:"x-icon-signup",title:"请输入注册信息",bodyStyle:"padding:5px 5px 0",width:770,signup:function(){var a=this.getForm();if(!a.isValid()||!this.validatePassword()){this.showInfo({icon:Ext.ux.InfoPanel.ERROR,msg:"输入数据仍有错误，请更正后继续。出错字段由红色边框标识，出错字段下可以看到出错原因。"});return}a.doAction("jsonsubmit",{url:"/auth",jsonmethod:"signup",asSingleArgs:true,success:function(b,c){if(c.result.success){this.hide();Ext.getCmp("signup-success").show().expand()}},scope:this})},validatePassword:function(){var b=this.form.findField("password");var a=this.form.findField("verify");if(b.isValid()&&a.isValid()){if(b.getValue()!==a.getValue()){this.form.markInvalid({password:"密码和重复输入的密码不一致",verify:"密码和重复输入的密码不一致"})}else{b.clearInvalid();a.clearInvalid();return true}}},uniqueLogin:function(){var a=this.form.findField("login");if(!a.isValid()){return}Ext.Ajax.request({url:"/auth",jsonData:{version:"1.1",method:"checkUnique",params:{login:a.getValue()}},success:function(b){var c=Ext.decode(b.responseText);if(!c.result){a.markInvalid("该用户名已存在，请选择其他用户名!")}},nocache:true})},uniqueEmail:function(){var a=this.form.findField("email");if(!a.isValid()){return}Ext.Ajax.request({url:"/auth",jsonData:{version:"1.1",method:"checkUnique",params:{email:a.getValue()}},success:function(b){var c=Ext.decode(b.responseText);if(!c.result){a.markInvalid("已有用户使用了该邮件地址，请核实!")}},nocache:true})}});Ext.onReady(function(){var b=new SignupForm({renderTo:"content"});var a=new Ext.Panel({id:"signup-success",collapsed:true,border:true,frame:true,autoHeight:true,applyTo:"signup-success"})});
