diff --git a/static/html/dashboard.html b/static/html/dashboard.html index a3527a0..12398cf 100644 --- a/static/html/dashboard.html +++ b/static/html/dashboard.html @@ -69,6 +69,17 @@ const inputEmail = $('#inputEmail').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_) if (validate) { @@ -78,23 +89,28 @@ function validate_pw_eq(obj, inputPassword, inputPassword_) { if (inputPassword !== inputPassword_) { - const alert_component = ` - - ` - $(obj).after(alert_component) - setTimeout(function () { - $('#register_alert').fadeOut(1200) - }, 1000) + reg_alert('两次密码输入不一样,请确认!') return false } 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 = ` + + ` + $('#register_button').after(alert_component) + setTimeout(function () { + $('#' + uuid).fadeOut(1200) + }, 1000) + } + // js end })