⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 user.js

📁 Ajax 无刷新检测用户名是否占用。适合新手学习。
💻 JS
📖 第 1 页 / 共 2 页
字号:
						Ext.Msg.alert("提示!","新用户注册成功!",function(btn){
							if(btn=='ok')
							{
								GetList('FistList','FistUser');
								Ext.getCmp("RegWin").close();
							}
						});
                    } 
			}, 
			failure : function(form, action) { 
				Ext.MessageBox.alert('提示', action.result.message,function(btn){
					if(btn=='ok')
					{
						Ext.getCmp("UserName").reset(); 
						Ext.getCmp("UserName").focus(true);return;
					}
				});
			}, scope:this }); }}, 
	initComponent : function(){ 
		this.keys={ key: Ext.EventObject.ENTER, fn: this.save, scope: this}; 
		UserRegWindow.superclass.initComponent.call(this); 
		this.fp=this.createFormPanel(); 
		this.add(this.fp); 
		this.addButton('提交',this.save,this); 
		this.addButton('取消', function(){this.close();},this); this.on("close",function(){}) } }); 

//弹出单一用户注册的层
function FistUserReg()
{
	var UserRegWin = new UserRegWindow();
	UserRegWin.show();
}
function AllUserReg(e)
{
	var AllUserRegWin = new Ext.Window({
			id:'RegWin',
			title : '新用户注册', 
			width : 500, 
			iconCls:"icon-AddUser", 
			modal:true,										//启用遮罩
			height : 420, 
			defaults : { border : false }, 
			buttonAlign : 'center', 
			createFormPanel : function(){
				return new Ext.form.FormPanel({
					bodyStyle : 'padding-top:6px', 
					defaultType : 'textfield', 
					labelAlign : 'right', 
					labelWidth : 100, 
					labelPad : 0, 
					frame : true, 
					defaults : { 
						allowBlank : false, 
						width : 228, 
						selectOnFocus:true 
					}, 
					items : [{
						xtype:"combo",
						name:'UserType',
						fieldLabel:'会员类型',
						displayField:'name',
						valueField:'code',
						store:new Ext.data.SimpleStore({
						fields:['name','code'],	
						data:[["机构",0],["企业",1],["专家",2],["医生",3],["个人",4],["记者",5]]
						}),
						triggerAction:'all',
						mode:'local',
						selectOnFocus:true,
						forceSelection: true,
						allowBlank:false,
						//editable: false,
						hiddenName:'UserType',
						emptyText:'请选择会员类型',
						blankText : '请选择会员类型',
						listeners:{   
							select:function(combo, record,index){
								if(this.value==2 || this.value==3)
								{
									Ext.getCmp('SButton').show(); 
								}
								else
								{
									Ext.getCmp('SButton').hide();
								}
							}   
						}
					},
					{
						xtype:"textfield",
						name:'UserName',
						id:'UserName',
						fieldLabel:'用户名',
						emptyText:'填写用户名',
						blankText : '用户名不能为空' 
						//readOnly:true 		//设置input属性为只读
					},
					{
						xtype:"textfield",
						name : 'RealName', 
						fieldLabel : '姓名', 
						emptyText:'填写真实姓名',
						blankText : '姓名不能为空'
						
					}, 
					new Ext.ux.PasswordMeter({
					fieldLabel: '用户密码',
					name: 'PaddWord',
					blankText : '密码不能为空', 
					inputType : 'password'
					}), 
					{
						xtype:"combo",
						name : 'UserAdd', 
						id:'sheng',
						fieldLabel : '选择省',
						displayField:'name',
						valueField:'code',
						store:store,
						triggerAction:'all',
						mode:'local',
						selectOnFocus:true,
						forceSelection: true,
						allowBlank:false,
						editable: false,
						hiddenName:'UserAdd',
						emptyText:'请选择省',
						blankText : '请选择省',
						listeners:{   
							select:function(combo, record,index){
							 try{
								 userAdd = record.data.name;
								 var parent=Ext.getCmp('shi');
								 parent.clearValue();
								 parent.store.reload({params:{action:this.value}});
							 }
							 catch(ex)
							 {
								 Ext.MessageBox.alert(ex);
							 }
							}
						}
					}, 
					{
						xtype:"combo",
						name : 'shi1',
						id : 'shi',
						fieldLabel : '选择市',
						displayField:'name',
						valueField:'code',
						triggerAction:'all',
						store:comstore,
						mode:'local',
						selectOnFocus:true,
						forceSelection: true,
						allowBlank:false,
						editable: false,
						hiddenName:'shi1',
						emptyText:'请选择市',
						blankText : '请选择市',
						listeners:{   
							select:function(combo, record,index){
							try{
								userAdd = userAdd + record.data.name;
								 var parent=Ext.getCmp('qu');
								 parent.clearValue();
								 //alert(record.data.name);
								 parent.store.reload({params:{action:this.value}});
							}
							catch(ex)
							{
								Ext.MessageBox.alert(ex);
							}
							}
						}
					}, 
					{
						xtype:"combo",
						name : 'qu1',
						id : 'qu',
						fieldLabel : '选择区',
						displayField:'name',
						valueField:'code',
						triggerAction:'all',
						store:Threestore,
						mode:'local',
						selectOnFocus:true,
						forceSelection: true,
						allowBlank:false,
						editable: false,
						hiddenName:'qu1',
						emptyText:'请选择区',
						blankText : '请选择区',
						listeners:{   
							select:function(combo, record,index){
								userAdd = userAdd + record.data.name;
								Ext.getCmp("Usertxdz").setValue(userAdd);
							}   
						}
					}, 
					{
						xtype:"textfield",
						name : 'UserUnits',
						id : 'UserUnits',
						fieldLabel : '单位', 
						emptyText:'填写您的单位名称',
						itemCls:'code-male', //向左边浮动,处理控件横排
						clearCls:'allow-float', 
						blankText : '单位名称不能为空'
					}, 
					new Ext.Button({
						id : "SButton",
						text:"选择医院",
						itemCls:'code-female',
						clearCls:'allow-float', 
						hidden : true,
						handler : function(){
							var hospitalWin = new Ext.Window({
								id:'HWin',
								title : '选择医院',
								width : 400,
								height:180,
								modal:true,
								createFormPanel:function(){
									return new Ext.form.FormPanel({
										bodyStyle : 'padding-top:6px', 
										defaultType : 'textfield', 
										labelAlign : 'right', 
										labelWidth : 65, 
										labelPad : 0, 
										frame : true, 
										defaults : { 
											allowBlank : false, 
											width : 300, 
											selectOnFocus:true 
										},
										items : [{
												xtype:"combo",
												name:'sheng',
												id : 'hosp_sheng',
												fieldLabel:'请选择省',
												displayField:'name',
												valueField:'code',
												store:store,
												triggerAction:'all',
												mode:'local',
												selectOnFocus:true,
												forceSelection: true,
												allowBlank:false,
												editable: false,
												hiddenName:'sheng',
												emptyText:'请选择省',
												blankText : '请选择省',
												listeners:{   
													select:function(combo, record,index){
													 try{
														 //userAdd = record.data.name;
														 var parent=Ext.getCmp('hosp_shi');
														 parent.clearValue();
														 parent.store.reload({params:{action:this.value}});
													 }
													 catch(ex)
													 {
														 Ext.MessageBox.alert(ex);
													 }
													}
												}
											},
											{
												xtype:"combo",
												name:'shi',
												id : 'hosp_shi',
												fieldLabel:'请选择市',
												displayField:'name',
												valueField:'code',
												store:comstore,
												triggerAction:'all',
												mode:'local',
												selectOnFocus:true,
												forceSelection: true,
												allowBlank:false,
												editable: false,
												hiddenName:'shi',
												emptyText:'请选择市',
												blankText : '请选择市',
												listeners:{   
													select:function(combo, record,index){
													try{
														 var parent=Ext.getCmp('hosp_qu');
														 parent.clearValue();
														 //alert(record.data.name);
														 parent.store.reload({params:{action:this.value}});
													}
													catch(ex)
													{
														Ext.MessageBox.alert(ex);
													}
													}
												}
											},
											{
												xtype:"combo",
												name:'qu',
												id : 'hosp_qu',
												fieldLabel:'请选择区',
												displayField:'name',
												valueField:'code',
												store:Threestore,
												triggerAction:'all',
												mode:'local',
												selectOnFocus:true,
												forceSelection: true,
												allowBlank:false,
												editable: false,
												hiddenName:'qu',
												emptyText:'请选择区',
												blankText : '请选择区',
												listeners:{   
													select:function(combo, record,index){
														Ext.getCmp('gjz').focus();
													}   
												}
											},
											{
												xtype:"textfield",
												itemCls:'stop-float',
												name : 'gjz',
												id : 'gjz',
												fieldLabel : '关键字', 
												emptyText:'关键字',
												allowBlank : true,
												listeners :{
													blur : function(){
														var parent=Ext.getCmp('select_hosp');
														var shengValue; 
														var shiValue; 
														var quValue;
														if(typeof(Ext.getCmp('sheng').value)=="undefined")
														{
															shengValue = Ext.getCmp('hosp_sheng').value;
														}
														else
														{
															shengValue = Ext.getCmp('sheng').value;
														}
														if(typeof(Ext.getCmp('shi').value)=="undefined")
														{
															shiValue = Ext.getCmp('hosp_shi').value;
														}
														else
														{
															shiValue = Ext.getCmp('shi').value;
														}
														if(typeof(Ext.getCmp('qu').value)=="undefined")
														{
															quValue = Ext.getCmp('hosp_qu').value;
														}
														else
														{
															quValue = Ext.getCmp('qu').value;
														}
														var gjzValue = this.getValue();
														parent.clearValue();
														parent.store.reload({
															params:{
																Param1:shengValue,
																Param2:shiValue,
																Param3:quValue,
																Param4:gjzValue
															}
														});
													}
												}
											}, 
											{
												xtype:"combo",
												name:'hospital',
												id : 'select_hosp',
												fieldLabel:'请选择医院',
												displayField:'name',
												valueField:'code',
												store:hospital,
												triggerAction:'all',
												mode:'local',
												selectOnFocus:true,
												forceSelection: true,
												allowBlank:false,
												//editable: false,
												hiddenName:'hospital',
												emptyText:'请选择医院',
												blankText : '请选择医院',
												listeners:{   
													select:function(combo, record,index){
														userDw = record.data.name;
														Ext.getCmp("UserUnits").setValue(userDw);
														Ext.getCmp("HWin").close();
													}   
												}
											}]
									});
								},
								initComponent : function(){  
									//AllUserRegWindow.superclass.initComponent.call(this); 
									this.fp=this.createFormPanel(); 
									this.add(this.fp); 
								}
							});
							if(store1!="")
							{
								Ext.getCmp('hosp_sheng').setValue(store1);
							}
							if(comstore1!="")
							{
								Ext.getCmp('hosp_shi').setValue(comstore1);
							}
							if(Threestore1!="")
							{
								Ext.getCmp('hosp_qu').setValue(Threestore1);	
							}
							hospitalWin.show();
						}
					}),
					{
						xtype:"textfield",
						itemCls:'stop-float',
						name : 'UserDuty', 
						fieldLabel : '职务', 
						emptyText:'填写您的职务名称',
						blankText : '职务不能为空'
					}, 
					{
						xtype:"textfield",
						name : 'UserTitle', 
						fieldLabel : '职称', 
						emptyText:'填写您的职称',
						blankText : '职称不能为空'
					}, 
					{
						xtype:"textfield",
						id:'Usertxdz',
						name : 'Usertxdz', 
						fieldLabel : '通讯地址', 
						emptyText:'填写您的通讯地址',
						//readOnly:true,
						blankText : '通讯地址不能为空'
					}, 
					{
						xtype:"textfield",
						name : 'JoinTime', 
						fieldLabel : '添加时间',
						readOnly:true,
						emptyText:'选择您的加入时间',
						value:new Date().format('Y-m-d'),
						blankText : '添加时间不能为空'
					}]
				});
			},
		save:function() { 
		if(this.fp.form.isValid()){
		this.fp.form.submit({
			waitTitle:"请稍候", 
			waitMsg : "正在保存...", 
			url : 'service.asp?cmd=save', 
			success : function(form, action) {
				var Result = action.result.success; 
				if(Result == false){
					Ext.Msg.alert('提示', action.result.message,function(btn){
						if(btn=='ok')
						{
							Ext.getCmp("UserName").reset(); 
							Ext.getCmp("UserName").focus(true);return;
						}
					});
                    } else if(Result == true){
						Ext.Msg.alert("提示!","新用户注册成功!",function(btn){
							if(btn=='ok')
							{
								GetAllList('AllList',e);
								Ext.getCmp("RegWin").close();
							}
						});
                    } 
			}, 
			failure : function(form, action) { 
				Ext.MessageBox.alert('提示', action.result.message,function(btn){
					if(btn=='ok')
					{
						Ext.getCmp("UserName").reset(); 
						Ext.getCmp("UserName").focus(true);return;
					}
				});
			}, scope:this }); }
		}, 
		initComponent : function(){ 
		this.keys={ key: Ext.EventObject.ENTER, fn: this.save, scope: this}; 
		//AllUserRegWindow.superclass.initComponent.call(this); 
		this.fp=this.createFormPanel(); 
		this.add(this.fp); 
		this.addButton('提交',this.save,this); 
		this.addButton('取消', function(){this.close();},this); this.on("close",function(){}) }
		});
	//var AllUserRegWin = new AllUserRegWindow();
	AllUserRegWin.show();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -