Authored by xuqi

build register

/**
* 注册-验证码
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
require('../code')(true);
\ No newline at end of file
... ...
/**
* 注册-密码
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
var $ = require('yoho.zepto');
var $pwd = $('#pwd'),
$btnSure = $('#btn-sure');
var api = require('../api');
var trim = $.trim;
var showErrTip = api.showErrTip;
api.initErrTip();
api.bindEyesEvt();
$pwd.bind('input', function() {
if (trim($pwd.val()) === '') {
$btnSure.addClass('disable');
} else {
$btnSure.removeClass('disable');
}
});
$btnSure.on('touchstart', function() {
var pwd = trim($pwd.val());
if ($btnSure.hasClass('disable')) {
return;
}
if (api.pwdValidate(pwd) === false) {
showErrTip('密码6-20位,请重新输入');
} else {
$.ajax({
type: 'POST',
url: '/passport/register/regmobile',
data: {
password: pwd
}
}).then(function(data) {
if (data.code === 200) {
showErrTip('注册成功');
//1000ms后跳转页面
setTimeout(function() {
location.href = data.data;
}, 1000);
} else {
if (data.code === 401 || data.code === 404 || data.code === 505) {
showErrTip(data.message);
} else {
showErrTip(data.message);
setTimeout(function() {
location.href = data.data;
}, 1000);
}
}
});
}
});
\ No newline at end of file
... ...
/**
* 注册
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
var $ = require('yoho.zepto');
var $phoneNum = $('#phone-num'),
$countrySelect = $('#country-select'),
$countryCode = $('#country-code'),
$btnNext = $('#btn-next');
var api = require('../api');
var trim = $.trim;
var showErrTip = api.showErrTip;
api.initErrTip();
api.bindClearEvt();
$phoneNum.bind('input', function() {
if (trim($phoneNum.val()) === '') {
$btnNext.addClass('disable');
} else {
$btnNext.removeClass('disable');
}
});
$countrySelect.change(function() {
$countryCode.text($countrySelect.val());
});
$btnNext.on('touchstart', function() {
var pn = trim($phoneNum.val()),
country = $countrySelect.val();
if ($btnNext.hasClass('disable')) {
return;
}
if (api.phoneRegx[country].test(pn)) {
$.ajax({
url: '/passport/register/sendphone',
type: 'POST',
data: {
area: country.split('+')[1],
profile: pn
}
}).then(function(data) {
if (data.code === 200) {
location.href = '/passport/register/code';
} else {
showErrTip(data.message);
}
});
} else {
showErrTip('手机号格式不正确,请重新输入');
}
});
\ No newline at end of file
... ...
.reg-page .register-tip {
color: #fff;
font-size: 15px;
}
.reg-code-page {
.captcha-tip {
position: absolute;
width: 148px;
text-align: center;
right: 15px;
top: 8px;
color: #36a74c;
padding: 5px 0;
border: 1px solid #36a74c;
border-radius: 20px;
font-size: 16px;
&.disable {
color: #8f8f8f;
border-color: #8f8f8f;
}
}
.input-container {
padding-right: 190px;
}
.text-container {
color: #fff;
font-size: 16px;
margin-bottom: 20px;
}
.phone {
color: #4ecae8;
}
.clear {
right: 170px;
}
}
\ No newline at end of file
... ...
<div class="reg-code-page passport-page yoho-page">
{{> passport/code}}
</div>
\ No newline at end of file
... ...
<div class="reg-page passport-page yoho-page">
{{> passport/header}}
<div class="content">
<div class="select-container row">
<span class="select-title">国家和地区</span>
<select id="country-select" class="country-select select in-android-uc">
{{# countrys}}
<option value={{val}} {{#if selected}}selected{{/if}}>{{name}}</option>
{{/ countrys}}
</select>
<div class="arrow-right"></div>
</div>
<div class="input-container phone-container row has-clear">
<span id="country-code" class="country-code">{{countryCode}}</span>
<input id="phone-num" class="input phone-num" type="text" placeholder="手机号" value={{phoneNum}}>
</div>
<span id="btn-next" class="btn btn-next disable row">下一步</span>
<p class="register-tip">YOHO!Family账号可登录YOHO!有货、YOHO!Boys、YOHO!Girls及SHOW</p>
</div>
</div>
\ No newline at end of file
... ...
<div class="reg-password-page passport-page yoho-page">
{{> passport/header}}
<div class="content">
<div class="input-container row has-eye">
<input id="pwd" class="input pwd" type="text" placeholder="请输入密码" autocomplete="off" maxlength="20">
</div>
<span id="btn-sure" class="btn btn-sure disable row">确定</span>
</div>
</div>
\ No newline at end of file
... ...