update
This commit is contained in:
+28
-12
@@ -69,6 +69,17 @@
|
|||||||
const inputEmail = $('#inputEmail').val();
|
const inputEmail = $('#inputEmail').val();
|
||||||
const inputPassword = $('#inputPassword').val();
|
const inputPassword = $('#inputPassword').val();
|
||||||
const inputPassword_ = $('#inputPassword_').val();
|
const inputPassword_ = $('#inputPassword_').val();
|
||||||
|
|
||||||
|
if (!inputEmail) {
|
||||||
|
reg_alert('请输入用户名')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!inputPassword) {
|
||||||
|
reg_alert('请输入密码')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 校验输入是否一致
|
// 校验输入是否一致
|
||||||
const validate = validate_pw_eq(this, inputPassword, inputPassword_)
|
const validate = validate_pw_eq(this, inputPassword, inputPassword_)
|
||||||
if (validate) {
|
if (validate) {
|
||||||
@@ -78,23 +89,28 @@
|
|||||||
|
|
||||||
function validate_pw_eq(obj, inputPassword, inputPassword_) {
|
function validate_pw_eq(obj, inputPassword, inputPassword_) {
|
||||||
if (inputPassword !== inputPassword_) {
|
if (inputPassword !== inputPassword_) {
|
||||||
const alert_component = `
|
reg_alert('两次密码输入不一样,请确认!')
|
||||||
<div class="alert alert-danger .alert-dismissible fade show" role="alert" id="register_alert">
|
|
||||||
两次密码输入不一样!
|
|
||||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
`
|
|
||||||
$(obj).after(alert_component)
|
|
||||||
setTimeout(function () {
|
|
||||||
$('#register_alert').fadeOut(1200)
|
|
||||||
}, 1000)
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reg_alert(text) {
|
||||||
|
// 清除之前的弹窗
|
||||||
|
$('.alert').alert('close')
|
||||||
|
//
|
||||||
|
const uuid = '' + (new Date().getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16)
|
||||||
|
const alert_component = `
|
||||||
|
<div class="alert alert-danger .alert-dismissible fade show" role="alert" id="${uuid}" style="margin-top: 3px;margin-bottom: 3px;height: 30px;padding-top: 2px;padding-bottom: 2px;">
|
||||||
|
${text}
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
$('#register_button').after(alert_component)
|
||||||
|
setTimeout(function () {
|
||||||
|
$('#' + uuid).fadeOut(1200)
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
|
||||||
// js end
|
// js end
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user