Showing
3 changed files
with
29 additions
and
18 deletions
@@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
6 | 6 | ||
7 | 7 | ||
8 | const api = global.yoho.API; | 8 | const api = global.yoho.API; |
9 | +const logger = global.yoho.logger; | ||
9 | const aes = require('./aes-pwd'); | 10 | const aes = require('./aes-pwd'); |
10 | 11 | ||
11 | const YOHOBUY_URL = 'http://www.yohobuy.com/'; | 12 | const YOHOBUY_URL = 'http://www.yohobuy.com/'; |
@@ -17,20 +18,25 @@ const getAreaDataAsync = () => { | @@ -17,20 +18,25 @@ const getAreaDataAsync = () => { | ||
17 | return api.get('', { | 18 | return api.get('', { |
18 | method: 'app.passport.getArea' | 19 | method: 'app.passport.getArea' |
19 | }).then(result => { | 20 | }).then(result => { |
20 | - result.data = result.data.map(value => { | ||
21 | - value.areaCode = `+${value.area}`; | ||
22 | - | ||
23 | - if (value.areaCode === '+86') { | ||
24 | - value.selected = true; | ||
25 | - } else { | ||
26 | - value.selected = false; | ||
27 | - } | ||
28 | - | ||
29 | - delete value.area; | ||
30 | - return value; | ||
31 | - }); | ||
32 | - | ||
33 | - return result; | 21 | + if (result && result.code === 200) { |
22 | + result.data = result.data.map(value => { | ||
23 | + value.areaCode = `+${value.area}`; | ||
24 | + | ||
25 | + if (value.areaCode === '+86') { | ||
26 | + value.selected = true; | ||
27 | + } else { | ||
28 | + value.selected = false; | ||
29 | + } | ||
30 | + | ||
31 | + delete value.area; | ||
32 | + return value; | ||
33 | + }); | ||
34 | + | ||
35 | + return result; | ||
36 | + } else { | ||
37 | + logger.error('获取地区数据返回 code 不是 200'); | ||
38 | + return []; | ||
39 | + } | ||
34 | }); | 40 | }); |
35 | }; | 41 | }; |
36 | 42 |
@@ -15,8 +15,11 @@ module.exports = { | @@ -15,8 +15,11 @@ module.exports = { | ||
15 | port: 6001, | 15 | port: 6001, |
16 | siteUrl: '//m.yohobuy.com', | 16 | siteUrl: '//m.yohobuy.com', |
17 | domains: { | 17 | domains: { |
18 | - api: 'http://devapi.yoho.cn:58078/', | ||
19 | - service: 'http://devservice.yoho.cn:58077/' | 18 | + // api: 'http://devapi.yoho.cn:58078/', |
19 | + // service: 'http://devservice.yoho.cn:58077/' | ||
20 | + | ||
21 | + api: 'http://testapi.yoho.cn:28078/', | ||
22 | + service: 'http://testservice.yoho.cn:28077/' | ||
20 | }, | 23 | }, |
21 | subDomains: { | 24 | subDomains: { |
22 | host: '.m.yohobuy.com', | 25 | host: '.m.yohobuy.com', |
@@ -35,13 +35,13 @@ $countrySelect.change(function() { | @@ -35,13 +35,13 @@ $countrySelect.change(function() { | ||
35 | 35 | ||
36 | $btnNext.on('touchstart', function() { | 36 | $btnNext.on('touchstart', function() { |
37 | var pn = trim($phoneNum.val()), | 37 | var pn = trim($phoneNum.val()), |
38 | - area = $countrySelect.val(); | 38 | + area = trim($countrySelect.val()); |
39 | 39 | ||
40 | if ($btnNext.hasClass('disable')) { | 40 | if ($btnNext.hasClass('disable')) { |
41 | return; | 41 | return; |
42 | } | 42 | } |
43 | 43 | ||
44 | - if (api.phoneRegx[area].test(pn)) { | 44 | + if (area && pn && api.phoneRegx[area].test(pn)) { |
45 | $.ajax({ | 45 | $.ajax({ |
46 | url: '/passport/back/sendcode', | 46 | url: '/passport/back/sendcode', |
47 | type: 'POST', | 47 | type: 'POST', |
@@ -57,6 +57,8 @@ $btnNext.on('touchstart', function() { | @@ -57,6 +57,8 @@ $btnNext.on('touchstart', function() { | ||
57 | } | 57 | } |
58 | } | 58 | } |
59 | }); | 59 | }); |
60 | + } else if (!area) { | ||
61 | + showErrTip('出错了,请重新刷新页面'); | ||
60 | } else { | 62 | } else { |
61 | showErrTip('手机号格式不正确,请重新输入'); | 63 | showErrTip('手机号格式不正确,请重新输入'); |
62 | } | 64 | } |
-
Please register or login to post a comment