Authored by zzzzzzz

Merge branch 'release/4.9.2' of git.yoho.cn:fe/yohobuywap-node into release/4.9.2

@@ -476,7 +476,9 @@ const postAccount = (params) => { @@ -476,7 +476,9 @@ const postAccount = (params) => {
476 return api.get('', _.assign({ 476 return api.get('', _.assign({
477 method: 'user.instalment.bindingCards', 477 method: 'user.instalment.bindingCards',
478 debug: 'XYZ' 478 debug: 'XYZ'
479 - }, params)); 479 + }, params), {
  480 + timeout: 6000
  481 + });
480 }; 482 };
481 483
482 module.exports = { 484 module.exports = {
1 -<div class="installment-page add-account-page"> 1 +<div class="installment-page add-account-page yoho-page">
2 {{#bindCard}} 2 {{#bindCard}}
3 <ul class="add-form"> 3 <ul class="add-form">
4 <li> 4 <li>
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 <input id="list-{{key}}" type="checkbox" class="installment-check-btn" {{#if isChecked}}checked{{/if}}/> 13 <input id="list-{{key}}" type="checkbox" class="installment-check-btn" {{#if isChecked}}checked{{/if}}/>
14 <label for="list-{{key}}"> 14 <label for="list-{{key}}">
15 <div class="cont"> 15 <div class="cont">
16 - <p>¥{{currNoFeeAmt}}</p> 16 + <p>¥{{currAmt}}</p>
17 <p>【全{{stage}}期】{{billInfo}}</p> 17 <p>【全{{stage}}期】{{billInfo}}</p>
18 </div> 18 </div>
19 </label> 19 </label>
@@ -9,6 +9,7 @@ const AuthHelper = require('../models/auth-helper'); @@ -9,6 +9,7 @@ const AuthHelper = require('../models/auth-helper');
9 // constrant 9 // constrant
10 const CODE_REQUIRED = '请输入校验码'; 10 const CODE_REQUIRED = '请输入校验码';
11 const PASSWORD_REQUIRED = '请输入密码'; 11 const PASSWORD_REQUIRED = '请输入密码';
  12 +const PASSWORD_LENGTH_ERROR = '密码6-20位,请重新输入';
12 const BAD_PASSWORD = '密码格式不正确'; 13 const BAD_PASSWORD = '密码格式不正确';
13 const TOO_MANY = '请求太频繁'; 14 const TOO_MANY = '请求太频繁';
14 const LOGIN_SUCCSS = '登录成功'; 15 const LOGIN_SUCCSS = '登录成功';
@@ -28,6 +29,7 @@ const _step1 = (req, res, next) => { @@ -28,6 +29,7 @@ const _step1 = (req, res, next) => {
28 let viewData = { 29 let viewData = {
29 module: 'passport', 30 module: 'passport',
30 page: 'sms-login', 31 page: 'sms-login',
  32 + backUrl: '/passport/login',
31 isPassportPage: true, 33 isPassportPage: true,
32 headerText: '手机号码快捷登录', 34 headerText: '手机号码快捷登录',
33 areaCode: '+86', // 默认的区号 35 areaCode: '+86', // 默认的区号
@@ -270,6 +272,11 @@ exports.password = (req, res, next) => { @@ -270,6 +272,11 @@ exports.password = (req, res, next) => {
270 return res.json(data); 272 return res.json(data);
271 } 273 }
272 274
  275 + if (password.length < 6 || password.length > 20) {
  276 + data.message = PASSWORD_LENGTH_ERROR;
  277 + return res.json(data);
  278 + }
  279 +
273 if (!helpers.verifyPassword(password)) { 280 if (!helpers.verifyPassword(password)) {
274 return res.json(data); 281 return res.json(data);
275 } 282 }
1 -<div class="sms-login passport-page yoho-page"> 1 +<div class="sms-login sms-login-check passport-page yoho-page">
2 {{> passport/header}} 2 {{> passport/header}}
3 <div class="content"> 3 <div class="content">
4 <p class="sms-login-msg">验证码已发至&nbsp;<span class="tel">+{{area}} {{mobile}}</span></p> 4 <p class="sms-login-msg">验证码已发至&nbsp;<span class="tel">+{{area}} {{mobile}}</span></p>
5 <div class="input-container input-group sms-input row"> 5 <div class="input-container input-group sms-input row">
6 <input id="sms-code" class="input" type="text" placeholder="验证码"> 6 <input id="sms-code" class="input" type="text" placeholder="验证码">
7 - <span class="input-addon"> 7 + <div class="input-addon">
8 <button type="button" id="resend-sms">重发验证码</button> 8 <button type="button" id="resend-sms">重发验证码</button>
9 - </span> 9 + </div>
  10 + <button class="clear-input" type="button"></button>
10 </div> 11 </div>
11 <button id="btn-next" class="btn btn-next disable row" type="button">登录</button> 12 <button id="btn-next" class="btn btn-next disable row" type="button">登录</button>
12 </div> 13 </div>
@@ -3,8 +3,8 @@ @@ -3,8 +3,8 @@
3 <div class="content"> 3 <div class="content">
4 <p class="sms-login-msg small">你以后还可以使用手机号码 + 密码的形式登录有货哦!</p> 4 <p class="sms-login-msg small">你以后还可以使用手机号码 + 密码的形式登录有货哦!</p>
5 <div class="input-container row has-eye"> 5 <div class="input-container row has-eye">
6 - <input id="pwd" class="pwd input" type="password" placeholder="密码">  
7 - <div class="eye close" id="eye"></div> 6 + <input id="pwd" class="pwd input" type="text" placeholder="密码">
  7 + <div class="eye" id="eye"></div>
8 </div> 8 </div>
9 <span id="btn-next" class="btn btn-next disable row">确定</span> 9 <span id="btn-next" class="btn btn-next disable row">确定</span>
10 </div> 10 </div>
@@ -46,6 +46,7 @@ $('input').on('input', function() { @@ -46,6 +46,7 @@ $('input').on('input', function() {
46 46
47 applyButton.on('click', function() { 47 applyButton.on('click', function() {
48 var self = this; 48 var self = this;
  49 + var ret = false;
49 50
50 if (!flag || $(this).hasClass('disabled') || !validateForm()) { 51 if (!flag || $(this).hasClass('disabled') || !validateForm()) {
51 return false; 52 return false;
@@ -74,17 +75,24 @@ applyButton.on('click', function() { @@ -74,17 +75,24 @@ applyButton.on('click', function() {
74 75
75 if (data.code === 200) { 76 if (data.code === 200) {
76 params.params.status = 1; 77 params.params.status = 1;
  78 + ret = true;
  79 + } else if (data.code === 500) {
  80 + tip.show('连接超时');
  81 + flag = true;
  82 + } else {
  83 + params.params.message = data.message;
  84 + ret = true;
77 } 85 }
78 86
79 url += encodeURIComponent(JSON.stringify(params)); 87 url += encodeURIComponent(JSON.stringify(params));
80 88
81 $(self).attr('href', url); 89 $(self).attr('href', url);
82 - return true;  
83 }, 90 },
84 error: function() { 91 error: function() {
85 tip.show('网络断开连接了~'); 92 tip.show('网络断开连接了~');
86 flag = true; 93 flag = true;
87 - return false;  
88 } 94 }
89 }); 95 });
  96 +
  97 + return ret;
90 }); 98 });
@@ -227,7 +227,11 @@ $('#apply-button').click(function() { @@ -227,7 +227,11 @@ $('#apply-button').click(function() {
227 var params; 227 var params;
228 228
229 if (!result) { 229 if (!result) {
230 - return; 230 + // return;
  231 +
  232 + result = {
  233 + code: 500
  234 + };
231 } 235 }
232 236
233 params = { 237 params = {
@@ -19,7 +19,7 @@ var repayment = new Repayment({ @@ -19,7 +19,7 @@ var repayment = new Repayment({
19 index: li.index(), 19 index: li.index(),
20 orderCode: li.data('billNo'), 20 orderCode: li.data('billNo'),
21 termNo: li.data('currterm'), 21 termNo: li.data('currterm'),
22 - amount: parseFloat(li.data('currnofeeamt')), 22 + amount: parseFloat(li.data('curramt')),
23 fee: parseFloat(li.data('currfee')) + 0 23 fee: parseFloat(li.data('currfee')) + 0
24 }; 24 };
25 25
@@ -49,10 +49,10 @@ $(CHECKBOX_SELECTOR + ':checkbox').click(function() { @@ -49,10 +49,10 @@ $(CHECKBOX_SELECTOR + ':checkbox').click(function() {
49 billNo = $(self).parent().data('billNo'), 49 billNo = $(self).parent().data('billNo'),
50 li = $('li[data-bill-no=' + billNo + ']'), 50 li = $('li[data-bill-no=' + billNo + ']'),
51 selection = li.find('input:checked'), 51 selection = li.find('input:checked'),
52 - lastIndex = li.eq(0).index(); 52 + lastIndex = li.eq(0).data('currterm');
53 53
54 selection.parent().each(function(index, sel) { 54 selection.parent().each(function(index, sel) {
55 - var key = $(sel).index(); 55 + var key = $(sel).data('currterm');
56 56
57 if ((key + 1) - lastIndex > 1) { 57 if ((key + 1) - lastIndex > 1) {
58 isSkipped = true; 58 isSkipped = true;
@@ -3,6 +3,7 @@ var tip = require('plugin/tip'); @@ -3,6 +3,7 @@ var tip = require('plugin/tip');
3 var $resendBtn, 3 var $resendBtn,
4 $nextBtn, 4 $nextBtn,
5 $smsCode, 5 $smsCode,
  6 + $resetBtn,
6 mobile, area; 7 mobile, area;
7 8
8 var page = { 9 var page = {
@@ -23,6 +24,7 @@ var page = { @@ -23,6 +24,7 @@ var page = {
23 domInit: function() { 24 domInit: function() {
24 $resendBtn = $('#resend-sms'); 25 $resendBtn = $('#resend-sms');
25 $nextBtn = $('#btn-next'); 26 $nextBtn = $('#btn-next');
  27 + $resetBtn = $('.clear-input');
26 $smsCode = $('#sms-code'); 28 $smsCode = $('#sms-code');
27 mobile = $('#mobile').val(); 29 mobile = $('#mobile').val();
28 area = $('#area').val(); 30 area = $('#area').val();
@@ -40,11 +42,18 @@ var page = { @@ -40,11 +42,18 @@ var page = {
40 var hasVal = Boolean($.trim(this.value)); 42 var hasVal = Boolean($.trim(this.value));
41 43
42 $nextBtn.toggleClass('disable', !hasVal); 44 $nextBtn.toggleClass('disable', !hasVal);
  45 + $nextBtn.prop('disabled', !hasVal);
  46 + $resetBtn.toggle(hasVal);
43 }); 47 });
44 48
45 $nextBtn.on('click', function() { 49 $nextBtn.on('click', function() {
46 !self.disableAjax && self.submit(); 50 !self.disableAjax && self.submit();
47 }); 51 });
  52 +
  53 + $resetBtn.on('click', function() {
  54 + $smsCode.val('');
  55 + $resetBtn.hide();
  56 + });
48 }, 57 },
49 58
50 59
@@ -67,7 +76,7 @@ var page = { @@ -67,7 +76,7 @@ var page = {
67 self.timerId = null; 76 self.timerId = null;
68 $resendBtn.prop('disable', false); 77 $resendBtn.prop('disable', false);
69 } else { 78 } else {
70 - txt = second + 's'; 79 + txt = '重新发送(' + second + '秒)';
71 } 80 }
72 81
73 $resendBtn.text(txt); 82 $resendBtn.text(txt);
@@ -104,13 +113,14 @@ var page = { @@ -104,13 +113,14 @@ var page = {
104 var self = this; 113 var self = this;
105 var code = $.trim($smsCode.val()); 114 var code = $.trim($smsCode.val());
106 115
107 - this.disableAjax = true; 116 + $nextBtn.prop('disabled', this.disableAjax = true);
108 $.get('/passport/sms_login/check.json', { 117 $.get('/passport/sms_login/check.json', {
109 code: code 118 code: code
110 }) 119 })
111 .done(function(res) { 120 .done(function(res) {
112 if (res.code === 200) { 121 if (res.code === 200) {
113 location.href = res.redirect; 122 location.href = res.redirect;
  123 + self.disableAjax = true; // 成功后 disabled, 执行跳转
114 return; 124 return;
115 } 125 }
116 126
@@ -118,9 +128,10 @@ var page = { @@ -118,9 +128,10 @@ var page = {
118 }) 128 })
119 .fail(function() { 129 .fail(function() {
120 tip.show('出错了, 请重试'); 130 tip.show('出错了, 请重试');
  131 + self.disableAjax = false; // 失败后 允许再次 请求
121 }) 132 })
122 .always(function() { 133 .always(function() {
123 - self.disableAjax = false; 134 + $nextBtn.prop('disabled', self.disableAjax);
124 }); 135 });
125 } 136 }
126 }; 137 };
@@ -10,4 +10,9 @@ @@ -10,4 +10,9 @@
10 display: table-cell; 10 display: table-cell;
11 vertical-align: middle; 11 vertical-align: middle;
12 } 12 }
  13 +
  14 + .input-addon {
  15 + width: 1%;
  16 + overflow: hidden;
  17 + }
13 } 18 }
@@ -138,7 +138,7 @@ body.passport-body { @@ -138,7 +138,7 @@ body.passport-body {
138 background-color: #36a74c; 138 background-color: #36a74c;
139 border-radius: 5PX; 139 border-radius: 5PX;
140 color: #fff; 140 color: #fff;
141 - &.disable { 141 + &.disable, &[disabled] {
142 background-color: #a2a2a2; 142 background-color: #a2a2a2;
143 } 143 }
144 } 144 }
@@ -4,14 +4,13 @@ @@ -4,14 +4,13 @@
4 } 4 }
5 5
6 #resend-sms { 6 #resend-sms {
7 - display: block;  
8 background-color: transparent; 7 background-color: transparent;
9 - width: 190px;  
10 - margin-right: 15px;  
11 - border: 1px solid #36a74c;  
12 - border-radius: 26px;  
13 - font-size: 20px;  
14 - line-height: 30px; 8 + width: 148PX;
  9 + margin: 0 15PX 0 28PX;
  10 + border: 1PX solid #36a74c;
  11 + padding: 5PX 0;
  12 + border-radius: 20PX;
  13 + font-size: 16PX;
15 color: #36a74c; 14 color: #36a74c;
16 } 15 }
17 16
@@ -20,6 +19,12 @@ @@ -20,6 +19,12 @@
20 } 19 }
21 } 20 }
22 21
  22 +.sms-login-check {
  23 + .clear-input {
  24 + right: 175PX;
  25 + }
  26 +}
  27 +
23 .sms-login-msg { 28 .sms-login-msg {
24 font-size: 28px; 29 font-size: 28px;
25 color: #fff; 30 color: #fff;