Authored by xuqi

country code -> area code

... ... @@ -7,7 +7,7 @@ var $ = require('yoho.zepto');
var $phoneNum = $('#phone-num'),
$countrySelect = $('#country-select'),
$countryCode = $('#country-code'),
$areaCode = $('#area-code'),
$btnNext = $('#btn-next');
var api = require('../api');
... ... @@ -29,23 +29,23 @@ $phoneNum.bind('input', function() {
});
$countrySelect.change(function() {
$countryCode.text($countrySelect.val());
$areaCode.text($countrySelect.val());
});
$btnNext.on('touchstart', function() {
var pn = trim($phoneNum.val()),
country = $countrySelect.val();
area = $countrySelect.val();
if ($btnNext.hasClass('disable')) {
return;
}
if (api.phoneRegx[country].test(pn)) {
if (api.phoneRegx[area].test(pn)) {
$.ajax({
url: '/passport/back/sendcode',
type: 'POST',
data: {
areaCode: country.split('+')[1],
areaCode: area.replace('+', ''),
phoneNum: pn
},
success: function(data) {
... ...
... ... @@ -10,7 +10,7 @@ module.exports = function(useInRegister) {
$btnNext = $('#btn-next'),
$captchaTip = $('#captcha-tip'),
phoneNum = $('#phone-num').val(),
areaCode = $('#area-code').val().split('+')[1];
areaCode = $('#area-code').val().replace('+', '');
var api = require('./api');
var tip = require('../plugin/tip');
... ...
... ... @@ -7,7 +7,7 @@ var $ = require('yoho.zepto');
var $phoneNum = $('#phone-num'),
$countrySelect = $('#country-select'),
$countryCode = $('#country-code'),
$areaCode = $('#area-code'),
$pwd = $('#pwd'),
$loginBtn = $('#btn-login'),
... ... @@ -61,25 +61,25 @@ $pwd.bind('input', function() {
});
$countrySelect.change(function() {
$countryCode.text($countrySelect.val());
$areaCode.text($countrySelect.val());
});
$loginBtn.on('touchstart', function() {
var pn = trim($phoneNum.val()),
country = $countrySelect.val(),
areaCode = $countrySelect.val(),
pwd = trim($pwd.val());
if ($loginBtn.hasClass('disable')) {
return;
}
if (api.phoneRegx[country].test(pn) && api.pwdValidate(pwd)) {
if (api.phoneRegx[areaCode].test(pn) && api.pwdValidate(pwd)) {
$.ajax({
type: 'POST',
url: '/passport/signin/auth',
url: '/passport/login/auth',
data: {
areaCode: country.split('+')[1],
phoneNum: pn,
areaCode: areaCode.replace('+', ''),
account: pn,
password: pwd
},
success: function(data) {
... ...
... ... @@ -80,7 +80,7 @@ $loginBtn.on('touchstart', function() {
if ((/^[0-9]+$/.test(acc) || api.emailRegx.test(acc)) && api.pwdValidate(pwd)) {
$.ajax({
type: 'POST',
url: '/passport/signin/auth',
url: '/passport/login/auth',
data: {
account: acc,
password: pwd
... ...
... ... @@ -45,7 +45,7 @@ $btnNext.on('touchstart', function() {
url: '/passport/reg/verifymobile',
type: 'POST',
data: {
areaCode: areaCode.split('+')[1],
areaCode: areaCode.replace('+', ''),
phoneNum: pn
},
success: function(data) {
... ...
... ... @@ -92,7 +92,7 @@ body.passport-body {
padding-right: 30px;
}
.country-code {
.area-code {
position: absolute;
left: 15px;
line-height: 2.5;
... ...
... ... @@ -4,7 +4,7 @@
<div class="content">
{{> passport/country_list}}
<div class="input-container phone-container row has-clear">
<span id="country-code" class="country-code">{{countryCode}}</span>
<span id="area-code" class="area-code">{{areaCode}}</span>
<input id="phone-num" class="input phone-num" type="text" placeholder="手机号">
</div>
<span id="btn-next" class="btn btn-next disable row">下一步</span>
... ...
... ... @@ -4,7 +4,7 @@
<div class="content">
{{> passport/country_list}}
<div class="input-container phone-container row has-clear">
<span id="country-code" class="country-code">{{countryCode}}</span>
<span id="area-code" class="area-code">{{areaCode}}</span>
<input id="phone-num" class="input phone-num" type="text" placeholder="手机号" value={{phoneNum}}>
</div>
<div class="input-container row has-eye">
... ...