Authored by xuqi

country code -> area code

@@ -7,7 +7,7 @@ var $ = require('yoho.zepto'); @@ -7,7 +7,7 @@ var $ = require('yoho.zepto');
7 7
8 var $phoneNum = $('#phone-num'), 8 var $phoneNum = $('#phone-num'),
9 $countrySelect = $('#country-select'), 9 $countrySelect = $('#country-select'),
10 - $countryCode = $('#country-code'), 10 + $areaCode = $('#area-code'),
11 $btnNext = $('#btn-next'); 11 $btnNext = $('#btn-next');
12 12
13 var api = require('../api'); 13 var api = require('../api');
@@ -29,23 +29,23 @@ $phoneNum.bind('input', function() { @@ -29,23 +29,23 @@ $phoneNum.bind('input', function() {
29 }); 29 });
30 30
31 $countrySelect.change(function() { 31 $countrySelect.change(function() {
32 - $countryCode.text($countrySelect.val()); 32 + $areaCode.text($countrySelect.val());
33 }); 33 });
34 34
35 $btnNext.on('touchstart', function() { 35 $btnNext.on('touchstart', function() {
36 var pn = trim($phoneNum.val()), 36 var pn = trim($phoneNum.val()),
37 - country = $countrySelect.val(); 37 + area = $countrySelect.val();
38 38
39 if ($btnNext.hasClass('disable')) { 39 if ($btnNext.hasClass('disable')) {
40 return; 40 return;
41 } 41 }
42 42
43 - if (api.phoneRegx[country].test(pn)) { 43 + if (api.phoneRegx[area].test(pn)) {
44 $.ajax({ 44 $.ajax({
45 url: '/passport/back/sendcode', 45 url: '/passport/back/sendcode',
46 type: 'POST', 46 type: 'POST',
47 data: { 47 data: {
48 - areaCode: country.split('+')[1], 48 + areaCode: area.replace('+', ''),
49 phoneNum: pn 49 phoneNum: pn
50 }, 50 },
51 success: function(data) { 51 success: function(data) {
@@ -10,7 +10,7 @@ module.exports = function(useInRegister) { @@ -10,7 +10,7 @@ module.exports = function(useInRegister) {
10 $btnNext = $('#btn-next'), 10 $btnNext = $('#btn-next'),
11 $captchaTip = $('#captcha-tip'), 11 $captchaTip = $('#captcha-tip'),
12 phoneNum = $('#phone-num').val(), 12 phoneNum = $('#phone-num').val(),
13 - areaCode = $('#area-code').val().split('+')[1]; 13 + areaCode = $('#area-code').val().replace('+', '');
14 14
15 var api = require('./api'); 15 var api = require('./api');
16 var tip = require('../plugin/tip'); 16 var tip = require('../plugin/tip');
@@ -7,7 +7,7 @@ var $ = require('yoho.zepto'); @@ -7,7 +7,7 @@ var $ = require('yoho.zepto');
7 7
8 var $phoneNum = $('#phone-num'), 8 var $phoneNum = $('#phone-num'),
9 $countrySelect = $('#country-select'), 9 $countrySelect = $('#country-select'),
10 - $countryCode = $('#country-code'), 10 + $areaCode = $('#area-code'),
11 $pwd = $('#pwd'), 11 $pwd = $('#pwd'),
12 $loginBtn = $('#btn-login'), 12 $loginBtn = $('#btn-login'),
13 13
@@ -61,25 +61,25 @@ $pwd.bind('input', function() { @@ -61,25 +61,25 @@ $pwd.bind('input', function() {
61 }); 61 });
62 62
63 $countrySelect.change(function() { 63 $countrySelect.change(function() {
64 - $countryCode.text($countrySelect.val()); 64 + $areaCode.text($countrySelect.val());
65 }); 65 });
66 66
67 $loginBtn.on('touchstart', function() { 67 $loginBtn.on('touchstart', function() {
68 var pn = trim($phoneNum.val()), 68 var pn = trim($phoneNum.val()),
69 - country = $countrySelect.val(), 69 + areaCode = $countrySelect.val(),
70 pwd = trim($pwd.val()); 70 pwd = trim($pwd.val());
71 71
72 if ($loginBtn.hasClass('disable')) { 72 if ($loginBtn.hasClass('disable')) {
73 return; 73 return;
74 } 74 }
75 75
76 - if (api.phoneRegx[country].test(pn) && api.pwdValidate(pwd)) { 76 + if (api.phoneRegx[areaCode].test(pn) && api.pwdValidate(pwd)) {
77 $.ajax({ 77 $.ajax({
78 type: 'POST', 78 type: 'POST',
79 - url: '/passport/signin/auth', 79 + url: '/passport/login/auth',
80 data: { 80 data: {
81 - areaCode: country.split('+')[1],  
82 - phoneNum: pn, 81 + areaCode: areaCode.replace('+', ''),
  82 + account: pn,
83 password: pwd 83 password: pwd
84 }, 84 },
85 success: function(data) { 85 success: function(data) {
@@ -80,7 +80,7 @@ $loginBtn.on('touchstart', function() { @@ -80,7 +80,7 @@ $loginBtn.on('touchstart', function() {
80 if ((/^[0-9]+$/.test(acc) || api.emailRegx.test(acc)) && api.pwdValidate(pwd)) { 80 if ((/^[0-9]+$/.test(acc) || api.emailRegx.test(acc)) && api.pwdValidate(pwd)) {
81 $.ajax({ 81 $.ajax({
82 type: 'POST', 82 type: 'POST',
83 - url: '/passport/signin/auth', 83 + url: '/passport/login/auth',
84 data: { 84 data: {
85 account: acc, 85 account: acc,
86 password: pwd 86 password: pwd
@@ -45,7 +45,7 @@ $btnNext.on('touchstart', function() { @@ -45,7 +45,7 @@ $btnNext.on('touchstart', function() {
45 url: '/passport/reg/verifymobile', 45 url: '/passport/reg/verifymobile',
46 type: 'POST', 46 type: 'POST',
47 data: { 47 data: {
48 - areaCode: areaCode.split('+')[1], 48 + areaCode: areaCode.replace('+', ''),
49 phoneNum: pn 49 phoneNum: pn
50 }, 50 },
51 success: function(data) { 51 success: function(data) {
@@ -92,7 +92,7 @@ body.passport-body { @@ -92,7 +92,7 @@ body.passport-body {
92 padding-right: 30px; 92 padding-right: 30px;
93 } 93 }
94 94
95 - .country-code { 95 + .area-code {
96 position: absolute; 96 position: absolute;
97 left: 15px; 97 left: 15px;
98 line-height: 2.5; 98 line-height: 2.5;
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <div class="content"> 4 <div class="content">
5 {{> passport/country_list}} 5 {{> passport/country_list}}
6 <div class="input-container phone-container row has-clear"> 6 <div class="input-container phone-container row has-clear">
7 - <span id="country-code" class="country-code">{{countryCode}}</span> 7 + <span id="area-code" class="area-code">{{areaCode}}</span>
8 <input id="phone-num" class="input phone-num" type="text" placeholder="手机号"> 8 <input id="phone-num" class="input phone-num" type="text" placeholder="手机号">
9 </div> 9 </div>
10 <span id="btn-next" class="btn btn-next disable row">下一步</span> 10 <span id="btn-next" class="btn btn-next disable row">下一步</span>
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <div class="content"> 4 <div class="content">
5 {{> passport/country_list}} 5 {{> passport/country_list}}
6 <div class="input-container phone-container row has-clear"> 6 <div class="input-container phone-container row has-clear">
7 - <span id="country-code" class="country-code">{{countryCode}}</span> 7 + <span id="area-code" class="area-code">{{areaCode}}</span>
8 <input id="phone-num" class="input phone-num" type="text" placeholder="手机号" value={{phoneNum}}> 8 <input id="phone-num" class="input phone-num" type="text" placeholder="手机号" value={{phoneNum}}>
9 </div> 9 </div>
10 <div class="input-container row has-eye"> 10 <div class="input-container row has-eye">