Authored by htoooth

tips调整,登录页

... ... @@ -17,19 +17,39 @@
<input id="account" class="account input phone-num va" name="account" value="{{bindMobile}}"
type="text"
placeholder="Phone Number" autocomplete="off">
<div class="tips phone-num-tips hide">
<div class="triangle"></div>
<div class="rectangle"></div>
</div>
</div>
</li>
<li class="clearfix">
<input id="password" class="input password va needTip" name="password" type="password"
placeholder="Password"
autocomplete="off" maxlength="20">
<div class="pwd-wrapper">
<input id="password" class="input password va needTip" name="password" type="password"
placeholder="Password"
autocomplete="off" maxlength="20">
<div class="tips pwd-tips hide">
<div class="triangle"></div>
<div class="rectangle"></div>
</div>
</div>
</li>
<li class="clearfix captcha-wrap hide">
<div class="img-captcha-wrapper">
<input id="captcha" class="input va captcha needTip" type="text" name="captcha" placeholder="图形验证码"
autocomplete="off" maxlength="4">
<input id="captcha" class="input va captcha needTip" type="text" name="captcha" placeholder="图形验证码"
autocomplete="off" maxlength="4">
<div class="tips img-captcha-tips hide">
<div class="triangle"></div>
<div class="rectangle"></div>
</div>
</div>
<div class="left captcha-component">
<img id="captcha-img" class="left captcha-img" alt="">
... ... @@ -82,12 +102,6 @@
<a class="blue" href="{{fastReg}}">快速注册</a>
</span>
</li>
<div class="tips hide">
<div class="triangle"></div>
<div class="rectangle"></div>
</div>
</ul>
<input id="country-code-hide" name="countryCode" type="hidden" value="{{countryCode}}">
{{/ passport}}
... ...
... ... @@ -37,21 +37,18 @@ var checkbox = {
unchecked: '&#xe601;'
};
var $errTip = $('.tips');
var $errMsg = $errTip.find('.rectangle');
require('yoho-jquery-placeholder');
function errTip(ele, msg) {
var topLeft = ele.offset();
var $errTip = ele.next('.tips');
var $errMsg = $errTip.find('.rectangle');
$errMsg.text(msg);
return $errTip.css({
top: topLeft.top + ele.height() - 2,
left: topLeft.left,
width: ele.width() + 2,
height: ele.height
}).removeClass('hide');
return $errTip.removeClass('hide');
}
function hideTip(ele) {
return ele.next('.tips').addClass('hide');
}
// 验证账户名
... ... @@ -67,7 +64,7 @@ function validateAccountLocal() {
if (phoneNum.length === 11 && mailPhoneRegx.phoneRegx['+86'].test(phoneNum)) {
return true;
} else {
errTip($phone, '手机号码不正确,请重新输入');
errTip($phoneNumInput, '手机号码不正确,请重新输入');
return false;
}
}
... ... @@ -79,13 +76,13 @@ function validateAccountLocal() {
if (mailPhoneRegx.emailRegx.test(phoneNum)) {
return true;
} else {
errTip($phone, '邮箱格式不正确,请重新输入');
errTip($phoneNumInput, '邮箱格式不正确,请重新输入');
return false;
}
}
} else {
errTip($phone, '请输入账号');
errTip($phoneNumInput, '请输入账号');
return false;
}
}
... ... @@ -102,7 +99,7 @@ function validateAccountAsync() {
if (data.code && data.code === 200) {
return true;
} else {
errTip($phone, '账号不存在');
errTip($phoneNumInput, '账号不存在');
return false;
}
});
... ... @@ -128,6 +125,7 @@ function validateAccount() {
}
return validate().then(function() {
hideTip($phoneNumInput);
ep.emit('phone', true);
}).fail(function() {
ep.emit('phone', false);
... ... @@ -252,6 +250,7 @@ mailAc($phoneNumInput, function() {
});
$phoneNumInput.on('focus', function() {
hideTip($phoneNumInput);
$phone.addClass('focus');
}).on('blur', function() {
$phone.removeClass('focus');
... ... @@ -272,6 +271,8 @@ $passwordInput.on('blur', function() {
validatePasswordLocal();
}).on('focus', function() {
$passwordInput.addClass('focus');
hideTip($passwordInput);
});
// 验证码
... ... @@ -322,19 +323,19 @@ ep.tail('phone', 'password', 'captcha', function(phoneAuth, passwordAuth, captch
ep.on('phone', function(auth) {
if (auth) {
$errTip.addClass('hide');
hideTip($phoneNumInput);
}
});
ep.on('password', function(auth) {
if (auth) {
$errTip.addClass('hide');
hideTip($passwordInput);
}
});
ep.on('captcha', function(auth) {
if (auth && !$captchaWrap.hasClass('hide')) {
$errTip.addClass('hide');
hideTip($imgCaptchaInput);
}
});
... ...
... ... @@ -109,4 +109,12 @@
text-align: center;
}
}
.pwd-wrapper {
width: 100%;
}
.img-captcha-wrapper {
width: $captcha;
}
}
... ...