This commit is contained in:
chenyang
2022-06-30 16:48:42 +08:00
parent 03b914a0f0
commit c7cc3cc5c4
6 changed files with 44 additions and 10 deletions
+18 -7
View File
@@ -66,11 +66,11 @@
// 注册
$('#register_button').click(function () {
const inputEmail = $('#inputEmail').val();
const userName = $('#userName').val();
const inputPassword = $('#inputPassword').val();
const inputPassword_ = $('#inputPassword_').val();
if (!inputEmail) {
if (!userName) {
reg_alert('请输入用户名')
return
}
@@ -83,8 +83,19 @@
// 校验输入是否一致
const validate = validate_pw_eq(this, inputPassword, inputPassword_)
if (validate) {
$.ajax({
type: "post",
url: "register",
data: {userName: userName, inputPassword: inputPassword},
dataType: "json",
success: function (data) {
console.log(data)
},
async: false
});
}
//
});
function validate_pw_eq(obj, inputPassword, inputPassword_) {
@@ -138,8 +149,8 @@
<!--register start-->
<div class="modal-body register_group" style="display: none;height: 360px;">
<h1 class="h3 mb-3 font-weight-normal">请输入用户名和密码</h1>
<label for="inputEmail" class="sr-only"></label>
<input type="email" id="inputEmail" class="form-control" placeholder="用户名" autocomplete="off" required autofocus>
<label for="userName" class="sr-only"></label>
<input type="email" id="userName" class="form-control" placeholder="用户名" autocomplete="off" required autofocus>
<label for="inputPassword" class="sr-only"></label>
<input type="password" id="inputPassword" class="form-control" placeholder="密码" required>
@@ -154,8 +165,8 @@
<!--pw_login start-->
<div class="modal-body pw_login_group" style="display: none;height: 360px;">
<h1 class="h3 mb-3 font-weight-normal">请输入用户名和密码</h1>
<label for="inputEmail" class="sr-only">Email address</label>
<input type="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus>
<label for="userName" class="sr-only">Email address</label>
<input type="email" id="userName" class="form-control" placeholder="Email address" required autofocus>
<label for="inputPassword" class="sr-only">Password</label>
<input type="password" id="inputPassword" class="form-control" placeholder="Password" required>