Authored by 郭成尧

clear-input

... ... @@ -70,7 +70,7 @@ exports.validate = (req, res, next) => {
let jsonData = {
code: 400,
message: '请将图片旋转到正确方向',
message: '请将所有图片点击翻转至正向朝上',
captchaShow: true
};
... ...
... ... @@ -12,8 +12,8 @@
{{/ countrys}}
</select>
<i class="iconfont arrow-icon">&#xe613;</i>
<i class="line">|</i><input type="text" name="mobile" placeholder="请输入手机号/邮箱" class="mobile-input"><i id="clearMobile"
class="iconfont clear">&#xe72a;</i>
<i class="line">|</i><input type="text" name="mobile" placeholder="请输入手机号" class="mobile-input"><i id="clearMobile"
class="iconfont clear hide">&#xe72a;</i>
</div>
<div class="form-group password">
<label for="password" class="iconfont">&#xe723;</label><input type="password" name="password" placeholder="请输入密码">
... ...
... ... @@ -12,14 +12,14 @@
<div class="login-form">
<div class="form-group username">
<label for="username" class="iconfont">&#xe727;</label><input type="text" name="username" placeholder="请输入手机号/邮箱">
<i id="clearUsrname" class="iconfont clear">&#xe72a;</i>
<i id="clearUsrname" class="iconfont clear hide">&#xe72a;</i>
</div>
<div class="form-group password">
<label for="password" class="iconfont">&#xe723;</label><input type="password" name="password" placeholder="请输入密码">
<span id="passwordEyeIcon" class="eye"><i class="iconfont eye-close">&#xe716;</i><i class="iconfont eye-open hide">&#xe714;</i></span>
</div>
<div data-userverify="{{captchaShow}}" data-geetest="{{useGeetest}}" id="js-img-check" {{#unless useGeetest}} class="full-img-verify" {{/unless}}></div>
<button id="loginBtn" class="login-btn">登录</button>
<button id="loginBtn" class="login-btn disable">登录</button>
<div class="other-info">
<a href="{{internationalUrl}}">海外账号</a>
<a href="{{smsLoginUrl}}">手机验证码</a>
... ...
... ... @@ -13,7 +13,7 @@
</select>
<i class="iconfont arrow-icon">&#xe613;</i>
<i class="line">|</i><input type="text" name="mobile" placeholder="请输入手机号" class="mobile-input" autocomplete="off"><i id="clearMobile"
class="iconfont clear">&#xe72a;</i>
class="iconfont clear hide">&#xe72a;</i>
</div>
<div class="form-group verify-code">
<label for="verifyCode" class="iconfont">&#xe71c;</label><input type="text" name="verifyCode" placeholder="请输入验证码"
... ...
... ... @@ -19,7 +19,7 @@
</select>
<i class="iconfont arrow-icon">&#xe613;</i>
<i class="line">|</i><input type="text" name="mobile" placeholder="请输入手机号/邮箱" class="mobile-input"><i id="clearMobile"
class="iconfont clear">&#xe72a;</i>
class="iconfont clear hide">&#xe72a;</i>
</div>
<div class="form-group verify-code">
<label for="verifyCode" class="iconfont">&#xe71c;</label><input type="text" name="verifyCode" placeholder="请输入验证码"
... ...
... ... @@ -51,6 +51,13 @@ class InternationalNew extends Page {
* 改变登录按钮的状态
*/
changeLoginBtnStatus() {
// 清除手机号按钮
if (this.selector.mobileInput.val()) {
this.selector.clearMobile.removeClass('hide');
} else {
this.selector.clearMobile.addClass('hide');
}
// 登录按钮
if (this.selector.mobileInput.val() && this.selector.passwordInput.val()) {
this.selector.internationalLoginBtn.addClass('active');
... ... @@ -155,6 +162,7 @@ class InternationalNew extends Page {
*/
clearMobile() {
this.selector.mobileInput.val('');
this.selector.clearMobile.addClass('hide');
}
}
... ...
... ... @@ -34,6 +34,8 @@ class Login {
this.view.getPswrdBtn.on('click', this.showGetPasswordBox.bind(this));
this.view.getPasswordBox.on('click', this.hiddenGetPasswordBox.bind(this));
this.view.showYohoFamilyTip.on('click', this.showYohoFamilyTip.bind(this));
this.view.usernameInput.bind('input', this.changeBtnStatus.bind(this));
this.view.passwordInput.bind('input', this.changeBtnStatus.bind(this));
if ($captcha.data('userverify')) {
validate.init();
... ... @@ -41,6 +43,25 @@ class Login {
}
/**
* 输入监听,改变按钮状态
*/
changeBtnStatus() {
// 清除按钮
if (this.view.usernameInput.val()) {
this.view.clearUsrname.removeClass('hide');
} else {
this.view.clearUsrname.addClass('hide');
}
// 登录按钮
if (this.view.usernameInput.val() && this.view.passwordInput.val()) {
this.view.loginBtn.removeClass('disable');
} else {
this.view.loginBtn.addClass('disable');
}
}
/**
* 展示弹窗
*/
showYohoFamilyTip() {
... ... @@ -156,6 +177,7 @@ class Login {
*/
clearUsrname() {
this.view.usernameInput.val('');
this.view.clearUsrname.addClass('hide');
}
/**
... ...
... ... @@ -47,6 +47,7 @@ class RegisterNew {
*/
clearMobile() {
this.view.mobileInput.val('');
this.view.clearMobile.addClass('hide');
}
/**
... ... @@ -95,8 +96,10 @@ class RegisterNew {
// 获取验证码按钮
if (this.view.mobileInput.val()) {
this.view.getVerifyCodeBtn.addClass('active');
this.view.clearMobile.removeClass('hide');
} else {
this.view.getVerifyCodeBtn.removeClass('active');
this.view.clearMobile.addClass('hide');
}
// 登录按钮
... ...
... ... @@ -95,8 +95,10 @@ class SmsLoginNew extends Page {
// 获取验证码按钮
if (this.selector.mobileInput.val()) {
this.selector.getVerifyCodeBtn.addClass('active');
this.selector.clearMobile.removeClass('hide');
} else {
this.selector.getVerifyCodeBtn.removeClass('active');
this.selector.clearMobile.addClass('hide');
}
// 登录按钮
... ... @@ -181,6 +183,7 @@ class SmsLoginNew extends Page {
*/
clearMobile() {
this.selector.mobileInput.val('');
this.selector.clearMobile.addClass('hide');
}
/**
... ...
... ... @@ -92,7 +92,7 @@ class Validate {
let captcha = this.imgCheck.getResults();
if (captcha === '0000') {
tip.show(' 请将图片旋转到正确方向');
tip.show('请将所有图片点击旋转至正向朝上');
return Promise.reject();
}
return Promise.resolve({captcha});
... ...
... ... @@ -19,6 +19,7 @@
}
$top-bar-font-color: #fff;
$disable-gray: #b0b0b0;
.login-new-page {
input:-webkit-autofill {
... ... @@ -180,6 +181,10 @@ $top-bar-font-color: #fff;
font-size: 32px;
color: #fff;
}
.disable {
background-color: $disable-gray;
}
}
.third-party-login {
... ...