You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							97 lines
						
					
					
						
							3.1 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							97 lines
						
					
					
						
							3.1 KiB
						
					
					
				| var Register = function () { | |
|     this.passwordVisible = false; | |
| 
 | |
|     this.Startup = function () { | |
|         this.InitOrgList(); | |
|         $(".sex-select span").on("click", this.OnSexButtonClick.bind(this)); | |
|         $(".password-toggle").on("click", this.OnPasswordToggle.bind(this)); | |
|         $('#register-button').on('click', this.OnRegisterButtonClick.bind(this)); | |
|     }; | |
| 
 | |
|     this.InitOrgList = function () { | |
|         $.ajax({ | |
|             type: "POST", | |
|             dataType: 'text', | |
|             url: '/OrgManagement/Query', | |
|             data: { | |
|                 page: 1, | |
|                 rows: 10000 | |
|             }, | |
|             success: function (result) { | |
|                 $('#org-list').combobox({ | |
|                     valueField: 'Id', | |
|                     textField: 'Name', | |
|                     editable: false, | |
|                     panelHeight: 'auto', | |
|                     data: JSON.parse(result).rows | |
|                 }); | |
|             }.bind(this) | |
|         }); | |
|     }; | |
| 
 | |
|     this.OnPasswordToggle = function () { | |
|         this.passwordVisible = !this.passwordVisible; | |
| 
 | |
|         if (this.passwordVisible) { | |
|             $('#password').attr('type', 'text'); | |
|             $('.password-toggle').addClass('password-open'); | |
|         } | |
|         else { | |
|             $('#password').attr('type', 'password'); | |
|             $('.password-toggle').removeClass('password-open'); | |
|         } | |
|     }; | |
| 
 | |
|     this.OnSexButtonClick = function (event) { | |
|         $('.sex-select span').removeClass("active"); | |
|         $(event.target).addClass("active"); | |
|     } | |
| 
 | |
|     this.OnRegisterButtonClick = function () { | |
|         this.validation(); | |
|     }; | |
| 
 | |
|     this.validation = function () { | |
|         if ($("#username").val().trim() === '' || $("#username").val().trim === null) { | |
|             alert('请输入用户名'); | |
|             return | |
|         } else if ($('#org-list').combobox('getValue') === '') { | |
|             alert('请选择机构'); | |
|             return; | |
|         } else if ($("#login-account").val().trim() === '' || $("#login-account").val().trim === null) { | |
|             alert('请输入登录账户'); | |
|             return | |
|         } else if ($("#password").val().trim() === '' || $("#password").val().trim === null) { | |
|             alert('请输入密码'); | |
|             return | |
|         } else if ($("#password").val().length < 6) { | |
|             alert('密码长度至少为6位'); | |
|             return | |
|         } else { | |
|             this.RegisterUser(); | |
|         } | |
|     }; | |
| 
 | |
|     this.RegisterUser = function () { | |
|         $.ajax({ | |
|             type: "POST", | |
|             dataType: 'text', | |
|             url: '/UserManagement/Add', | |
|             data: { | |
|                 OrgId: $('#org-list').combobox('getValue'), | |
|                 Gender: parseInt($('.sex-select span.active').attr('gender')), | |
|                 RealName: $("#username").val().trim(), | |
|                 LoginName: $("#login-account").val().trim(), | |
|                 LoginPassword: $("#password").val().trim() | |
|             }, | |
|             success: function () { | |
|                 window.location.href = '/User/Login'; | |
|             }.bind(this) | |
|         }); | |
|     }; | |
| }; | |
| 
 | |
| $(document).ready(function () { | |
|     var register = new Register(); | |
|     register.Startup(); | |
| }); |