注册逻辑修改 code review by liuyue
Showing
1 changed file
with
22 additions
and
16 deletions
@@ -538,29 +538,35 @@ exports.init = function(page) { | @@ -538,29 +538,35 @@ exports.init = function(page) { | ||
538 | 538 | ||
539 | var time = 0, | 539 | var time = 0, |
540 | t, | 540 | t, |
541 | - refer = data.href; | 541 | + refer; |
542 | 542 | ||
543 | - t = setTimeout(function() { | ||
544 | - time++; | ||
545 | - }, 1000); | 543 | + if (data.code === 200) { |
546 | 544 | ||
547 | - $.ajax({ | ||
548 | - type: 'POST', | ||
549 | - url: '/passport/register/mobileregister', | ||
550 | - data: { | ||
551 | - session: data.session | ||
552 | - } | ||
553 | - }).then(function(data) { | 545 | + refer = data.data.href; |
546 | + | ||
547 | + t = setTimeout(function() { | ||
548 | + time++; | ||
549 | + }, 1000); | ||
550 | + | ||
551 | + $.ajax({ | ||
552 | + type: 'GET', | ||
553 | + url: data.data.session | ||
554 | + }).then(function(data) { | ||
555 | + | ||
556 | + if (data.code === 200 && t < 3) { | ||
557 | + clearInterval(t); | ||
558 | + location.href = refer; | ||
559 | + } | ||
560 | + }); | ||
554 | 561 | ||
555 | - if (data.code === 200 && t < 3) { | 562 | + if (t >= 3) { |
556 | clearInterval(t); | 563 | clearInterval(t); |
557 | location.href = refer; | 564 | location.href = refer; |
558 | } | 565 | } |
559 | - }); | 566 | + } else { |
560 | 567 | ||
561 | - if (t >= 3) { | ||
562 | - clearInterval(t); | ||
563 | - location.href = refer; | 568 | + //todo |
569 | + console.log('网络超时~'); | ||
564 | } | 570 | } |
565 | 571 | ||
566 | }); | 572 | }); |
-
Please register or login to post a comment