Authored by 王水玲

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

@@ -23,7 +23,7 @@ const indexEmailPage = (req, res) => { @@ -23,7 +23,7 @@ const indexEmailPage = (req, res) => {
23 page: 'back-email', 23 page: 'back-email',
24 title: '找回密码-通过邮箱' 24 title: '找回密码-通过邮箱'
25 }, { 25 }, {
26 - backUrl: SIGN_IN, 26 + // backUrl: SIGN_IN,
27 headerText: '找回密码', 27 headerText: '找回密码',
28 isPassportPage: true, 28 isPassportPage: true,
29 backEmail: true 29 backEmail: true
@@ -100,7 +100,7 @@ const backSuccessByEmailPage = (req, res) => { @@ -100,7 +100,7 @@ const backSuccessByEmailPage = (req, res) => {
100 page: 'back-email-success', 100 page: 'back-email-success',
101 title: '找回密码-通过邮箱' 101 title: '找回密码-通过邮箱'
102 }, { 102 }, {
103 - backUrl: helpers.urlFormat('/passport/back/email'), 103 + // backUrl: helpers.urlFormat('/passport/back/email'),
104 headerText: '找回密码', 104 headerText: '找回密码',
105 isPassportPage: true, 105 isPassportPage: true,
106 backEmailSuccess: true, 106 backEmailSuccess: true,
@@ -145,7 +145,7 @@ const indexMobilePage = (req, res, next) => { @@ -145,7 +145,7 @@ const indexMobilePage = (req, res, next) => {
145 page: 'back-mobile', 145 page: 'back-mobile',
146 title: '找回密码-通过手机号' 146 title: '找回密码-通过手机号'
147 }, { 147 }, {
148 - backUrl: SIGN_IN, 148 + // backUrl: SIGN_IN,
149 headerText: '找回密码', 149 headerText: '找回密码',
150 isPassportPage: true, 150 isPassportPage: true,
151 backMobile: true, 151 backMobile: true,
@@ -203,7 +203,7 @@ const verifyCodeByMobilePage = (req, res) => { @@ -203,7 +203,7 @@ const verifyCodeByMobilePage = (req, res) => {
203 page: 'back-code', 203 page: 'back-code',
204 title: '找回密码-通过手机号' 204 title: '找回密码-通过手机号'
205 }, { 205 }, {
206 - backUrl: helpers.urlFormat('/passport/back/mobile'), 206 + // backUrl: helpers.urlFormat('/passport/back/mobile'),
207 headerText: '找回密码', 207 headerText: '找回密码',
208 isPassportPage: true, 208 isPassportPage: true,
209 backCode: true, 209 backCode: true,
@@ -261,7 +261,7 @@ const setNewPasswordByMobilePage = (req, res) => { @@ -261,7 +261,7 @@ const setNewPasswordByMobilePage = (req, res) => {
261 page: 'back-new-password', 261 page: 'back-new-password',
262 title: '找回密码-输入新密码' 262 title: '找回密码-输入新密码'
263 }, { 263 }, {
264 - backUrl: SIGN_IN, 264 + // backUrl: SIGN_IN,
265 headerText: '找回密码', 265 headerText: '找回密码',
266 isPassportPage: true, 266 isPassportPage: true,
267 backNewPwd: true, 267 backNewPwd: true,
@@ -29,7 +29,7 @@ const _step1 = (req, res, next) => { @@ -29,7 +29,7 @@ const _step1 = (req, res, next) => {
29 let viewData = { 29 let viewData = {
30 module: 'passport', 30 module: 'passport',
31 page: 'sms-login', 31 page: 'sms-login',
32 - backUrl: '/passport/login', 32 + title: '手机短信登录',
33 isPassportPage: true, 33 isPassportPage: true,
34 headerText: '手机号码快捷登录', 34 headerText: '手机号码快捷登录',
35 areaCode: '+86', // 默认的区号 35 areaCode: '+86', // 默认的区号
@@ -49,7 +49,7 @@ const _step2 = (req, res, next) => { @@ -49,7 +49,7 @@ const _step2 = (req, res, next) => {
49 const viewData = { 49 const viewData = {
50 module: 'passport', 50 module: 'passport',
51 page: 'sms-check', 51 page: 'sms-check',
52 - backUrl: '/passport/sms_login?step=1', 52 + title: '手机短信登录',
53 isPassportPage: true, 53 isPassportPage: true,
54 headerText: '手机号码快捷登录', 54 headerText: '手机号码快捷登录',
55 canResend: interval < Date.now(), 55 canResend: interval < Date.now(),
@@ -66,7 +66,7 @@ const _step3 = (req, res, next) => { @@ -66,7 +66,7 @@ const _step3 = (req, res, next) => {
66 const viewData = { 66 const viewData = {
67 module: 'passport', 67 module: 'passport',
68 page: 'sms-password', 68 page: 'sms-password',
69 - backUrl: '/passport/sms_login?step=2', 69 + title: '设置密码',
70 isPassportPage: true, 70 isPassportPage: true,
71 headerText: '设置密码' 71 headerText: '设置密码'
72 }; 72 };
@@ -5,7 +5,8 @@ @@ -5,7 +5,8 @@
5 <div class="input-container phone-container row has-clear"> 5 <div class="input-container phone-container row has-clear">
6 <span id="area-code" class="area-code">{{areaCode}}</span> 6 <span id="area-code" class="area-code">{{areaCode}}</span>
7 <input id="phone-num" class="input phone-num" type="text" placeholder="手机号"> 7 <input id="phone-num" class="input phone-num" type="text" placeholder="手机号">
  8 + <button class="clear-input" type="button"></button>
8 </div> 9 </div>
9 - <span id="btn-next" class="btn btn-next disable row">获取短信验证码</span> 10 + <button id="btn-next" class="btn btn-next disable row" disabled>获取短信验证码</button>
10 </div> 11 </div>
11 </div> 12 </div>
@@ -18,4 +18,8 @@ @@ -18,4 +18,8 @@
18 {{/data}} 18 {{/data}}
19 </ul> 19 </ul>
20 {{/if}} 20 {{/if}}
  21 + <div class="swiper-pagination">
  22 + <div class="pagination-inner">
  23 + </div>
  24 + </div>
21 </div> 25 </div>
@@ -116,6 +116,7 @@ if ($('.banner-center-swiper').find('li').size() > 1) { @@ -116,6 +116,7 @@ if ($('.banner-center-swiper').find('li').size() > 1) {
116 autoplayDisableOnInteraction: false, 116 autoplayDisableOnInteraction: false,
117 paginationClickable: true, 117 paginationClickable: true,
118 slideElement: 'li', 118 slideElement: 'li',
  119 + pagination: '.banner-center .pagination-inner'
119 }); 120 });
120 } 121 }
121 122
@@ -41,21 +41,29 @@ var page = { @@ -41,21 +41,29 @@ var page = {
41 $smsCode.on('input', function() { 41 $smsCode.on('input', function() {
42 var hasVal = Boolean($.trim(this.value)); 42 var hasVal = Boolean($.trim(this.value));
43 43
44 - $nextBtn.toggleClass('disable', !hasVal);  
45 - $nextBtn.prop('disabled', !hasVal); 44 + $nextBtn.trigger('toggleDisable', !hasVal);
46 $resetBtn.toggle(hasVal); 45 $resetBtn.toggle(hasVal);
47 }); 46 });
48 47
49 $nextBtn.on('click', function() { 48 $nextBtn.on('click', function() {
50 - !self.disableAjax && self.submit(); 49 + self.submit();
51 }); 50 });
52 51
53 $resetBtn.on('click', function() { 52 $resetBtn.on('click', function() {
54 $smsCode.val(''); 53 $smsCode.val('');
55 $resetBtn.hide(); 54 $resetBtn.hide();
  55 + $nextBtn.trigger('toggleDisable');
56 }); 56 });
57 - },  
58 57
  58 + $nextBtn.on('toggleDisable', function(event, bool) {
  59 + if (bool === void 0) {
  60 + bool = true;
  61 + }
  62 +
  63 + $nextBtn.toggleClass('disable', bool);
  64 + $nextBtn.prop('disabled', bool);
  65 + });
  66 + },
59 67
60 countDown: function() { 68 countDown: function() {
61 var self = this; 69 var self = this;
@@ -65,7 +73,8 @@ var page = { @@ -65,7 +73,8 @@ var page = {
65 return; 73 return;
66 } 74 }
67 75
68 - $resendBtn.prop('disable', true); 76 + $resendBtn.prop('disabled', true);
  77 + $resendBtn.text('重新发送(' + second + ')');
69 this.timerId = setInterval(function() { 78 this.timerId = setInterval(function() {
70 var txt = self.resendText; 79 var txt = self.resendText;
71 80
@@ -74,7 +83,7 @@ var page = { @@ -74,7 +83,7 @@ var page = {
74 if (second < 0) { 83 if (second < 0) {
75 clearInterval(self.timerId); 84 clearInterval(self.timerId);
76 self.timerId = null; 85 self.timerId = null;
77 - $resendBtn.prop('disable', false); 86 + $resendBtn.prop('disabled', false);
78 } else { 87 } else {
79 txt = '重新发送(' + second + '秒)'; 88 txt = '重新发送(' + second + '秒)';
80 } 89 }
@@ -88,7 +97,7 @@ var page = { @@ -88,7 +97,7 @@ var page = {
88 resendSMS: function() { 97 resendSMS: function() {
89 var self = this; 98 var self = this;
90 99
91 - if ($resendBtn.prop('disable')) { 100 + if ($resendBtn.prop('disabled')) {
92 return; 101 return;
93 } 102 }
94 103
@@ -110,17 +119,20 @@ var page = { @@ -110,17 +119,20 @@ var page = {
110 }, 119 },
111 120
112 submit: function() { 121 submit: function() {
113 - var self = this;  
114 var code = $.trim($smsCode.val()); 122 var code = $.trim($smsCode.val());
115 123
116 - $nextBtn.prop('disabled', this.disableAjax = true); 124 + if ($nextBtn.prop('disabled')) {
  125 + return;
  126 + }
  127 +
  128 + $nextBtn.prop('disabled', true);
117 $.get('/passport/sms_login/check.json', { 129 $.get('/passport/sms_login/check.json', {
118 code: code 130 code: code
119 }) 131 })
120 .done(function(res) { 132 .done(function(res) {
121 if (res.code === 200) { 133 if (res.code === 200) {
122 location.href = res.redirect; 134 location.href = res.redirect;
123 - self.disableAjax = true; // 成功后 disabled, 执行跳转 135 + $nextBtn.off();
124 return; 136 return;
125 } 137 }
126 138
@@ -128,10 +140,9 @@ var page = { @@ -128,10 +140,9 @@ var page = {
128 }) 140 })
129 .fail(function() { 141 .fail(function() {
130 tip.show('出错了, 请重试'); 142 tip.show('出错了, 请重试');
131 - self.disableAjax = false; // 失败后 允许再次 请求  
132 }) 143 })
133 .always(function() { 144 .always(function() {
134 - $nextBtn.prop('disabled', self.disableAjax); 145 + $nextBtn.prop('disabled', false);
135 }); 146 });
136 } 147 }
137 }; 148 };
@@ -6,21 +6,20 @@ var api = require('./api'); @@ -6,21 +6,20 @@ var api = require('./api');
6 var $countrySelect, 6 var $countrySelect,
7 $areaCode, 7 $areaCode,
8 $nextBtn, 8 $nextBtn,
  9 + $resetBtn,
9 $phoneNum; 10 $phoneNum;
10 11
11 var page = { 12 var page = {
12 - disableAjax: false,  
13 init: function() { 13 init: function() {
14 this.domInit(); 14 this.domInit();
15 this.bindEvent(); 15 this.bindEvent();
16 -  
17 - this.toggleNextBtn();  
18 }, 16 },
19 domInit: function() { 17 domInit: function() {
20 $countrySelect = $('#country-select'); 18 $countrySelect = $('#country-select');
21 $areaCode = $('#area-code'); 19 $areaCode = $('#area-code');
22 $nextBtn = $('#btn-next'); 20 $nextBtn = $('#btn-next');
23 $phoneNum = $('#phone-num'); 21 $phoneNum = $('#phone-num');
  22 + $resetBtn = $('.clear-input');
24 }, 23 },
25 bindEvent: function() { 24 bindEvent: function() {
26 var self = this; 25 var self = this;
@@ -33,7 +32,15 @@ var page = { @@ -33,7 +32,15 @@ var page = {
33 }); 32 });
34 33
35 $nextBtn.on('click', function() { 34 $nextBtn.on('click', function() {
36 - !self.disableAjax && self.goNext(); 35 + self.goNext();
  36 + });
  37 +
  38 + $resetBtn.on('click', function() {
  39 + $phoneNum.val('');
  40 + $nextBtn
  41 + .prop('disabled', true)
  42 + .toggleClass('disable', true);
  43 + $resetBtn.hide();
37 }); 44 });
38 }, 45 },
39 46
@@ -43,16 +50,17 @@ var page = { @@ -43,16 +50,17 @@ var page = {
43 50
44 $nextBtn 51 $nextBtn
45 .toggleClass('disable', !bool) 52 .toggleClass('disable', !bool)
46 - .prop('disable', !bool); 53 + .prop('disabled', !bool);
  54 +
  55 + $resetBtn.toggle(bool);
47 }, 56 },
48 57
49 // 提交按钮 58 // 提交按钮
50 goNext: function() { 59 goNext: function() {
51 var areaCode = $countrySelect.val(); 60 var areaCode = $countrySelect.val();
52 var phone = $.trim($phoneNum.val()); 61 var phone = $.trim($phoneNum.val());
53 - var self = this;  
54 62
55 - if ($nextBtn.hasClass('disable')) { 63 + if ($nextBtn.prop('disabled')) {
56 return; 64 return;
57 } 65 }
58 66
@@ -61,13 +69,14 @@ var page = { @@ -61,13 +69,14 @@ var page = {
61 return; 69 return;
62 } 70 }
63 71
64 - this.disableAjax = true; 72 + $nextBtn.prop('disabled', true);
65 $.get('/passport/sms_login/token.json', { 73 $.get('/passport/sms_login/token.json', {
66 area: areaCode.replace('+', ''), 74 area: areaCode.replace('+', ''),
67 mobile: phone 75 mobile: phone
68 }) 76 })
69 .done(function(data) { 77 .done(function(data) {
70 if (data.code === 200) { 78 if (data.code === 200) {
  79 + $nextBtn.off();
71 location.href = data.redirect; 80 location.href = data.redirect;
72 } else { 81 } else {
73 tip.show(data.message); 82 tip.show(data.message);
@@ -77,7 +86,7 @@ var page = { @@ -77,7 +86,7 @@ var page = {
77 tip.show('出错了, 请重试'); 86 tip.show('出错了, 请重试');
78 }) 87 })
79 .always(function() { 88 .always(function() {
80 - self.disableAjax = false; 89 + $nextBtn.prop('disabled', false);
81 }); 90 });
82 91
83 92
@@ -5,8 +5,6 @@ var $eyeBtn, @@ -5,8 +5,6 @@ var $eyeBtn,
5 $nextBtn; 5 $nextBtn;
6 6
7 var page = { 7 var page = {
8 - disableAjax: false,  
9 -  
10 init: function() { 8 init: function() {
11 this.domInit(); 9 this.domInit();
12 this.bindEvent(); 10 this.bindEvent();
@@ -24,7 +22,7 @@ var page = { @@ -24,7 +22,7 @@ var page = {
24 }); 22 });
25 23
26 $nextBtn.on('click', function() { 24 $nextBtn.on('click', function() {
27 - !self.disableAjax && self.setPasswordAndLogin(); 25 + self.setPasswordAndLogin();
28 }); 26 });
29 27
30 $pwd.on('input', function() { 28 $pwd.on('input', function() {
@@ -32,7 +30,7 @@ var page = { @@ -32,7 +30,7 @@ var page = {
32 30
33 $nextBtn 31 $nextBtn
34 .toggleClass('disable', !bool) 32 .toggleClass('disable', !bool)
35 - .prop('disable', !bool); 33 + .prop('disabled', !bool);
36 }); 34 });
37 }, 35 },
38 36
@@ -46,15 +44,19 @@ var page = { @@ -46,15 +44,19 @@ var page = {
46 }, 44 },
47 45
48 setPasswordAndLogin: function() { 46 setPasswordAndLogin: function() {
49 - var self = this;  
50 var password = $.trim($pwd.val()); 47 var password = $.trim($pwd.val());
51 48
52 - this.disableAjax = true; 49 + if ($nextBtn.prop('disabled')) {
  50 + return;
  51 + }
  52 +
  53 + $nextBtn.prop('disabled', true);
53 $.post('/passport/sms_login/password.json', { 54 $.post('/passport/sms_login/password.json', {
54 password: password 55 password: password
55 }) 56 })
56 .done(function(res) { 57 .done(function(res) {
57 if (res.code === 200) { 58 if (res.code === 200) {
  59 + $nextBtn.off();
58 location.href = res.redirect; 60 location.href = res.redirect;
59 return; 61 return;
60 } 62 }
@@ -65,7 +67,7 @@ var page = { @@ -65,7 +67,7 @@ var page = {
65 tip.show('出错了, 请重试'); 67 tip.show('出错了, 请重试');
66 }) 68 })
67 .always(function() { 69 .always(function() {
68 - self.disableAjax = false; 70 + $nextBtn.prop('disabled', false);
69 }); 71 });
70 } 72 }
71 }; 73 };
1 .banner-center { 1 .banner-center {
  2 + position: relative;
2 margin: 30px 0 0; 3 margin: 30px 0 0;
3 height: 200px; 4 height: 200px;
4 overflow: hidden; 5 overflow: hidden;
@@ -8,6 +9,34 @@ @@ -8,6 +9,34 @@
8 width: 100%; 9 width: 100%;
9 height: 100%; 10 height: 100%;
10 } 11 }
  12 +
  13 + .swiper-pagination {
  14 + position: absolute;
  15 + left: 0;
  16 + right: 0;
  17 + bottom: 20px;
  18 + text-align: center;
  19 + z-index: 1;
  20 +
  21 + .pagination-inner {
  22 + display: inline-block;
  23 +
  24 + span {
  25 + display: inline-block;
  26 + width: 14px;
  27 + height: 14px;
  28 + background: #fff;
  29 + opacity: 0.5;
  30 + margin: 0 9px;
  31 + border-radius: 50%;
  32 +
  33 + &.swiper-pagination-bullet-active {
  34 + background: #fff;
  35 + opacity: 1;
  36 + }
  37 + }
  38 + }
  39 + }
11 } 40 }
12 41
13 .banner-center-swiper { 42 .banner-center-swiper {
@@ -138,7 +138,10 @@ body.passport-body { @@ -138,7 +138,10 @@ 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, &[disabled] { 141 + border: none;
  142 + outline: none;
  143 +
  144 + &.disable, &:disabled {
142 background-color: #a2a2a2; 145 background-color: #a2a2a2;
143 } 146 }
144 } 147 }
@@ -154,6 +157,9 @@ body.passport-body { @@ -154,6 +157,9 @@ body.passport-body {
154 height: 16PX; 157 height: 16PX;
155 background: resolve('passport/clear-input.png') no-repeat; 158 background: resolve('passport/clear-input.png') no-repeat;
156 background-size: 100% 100%; 159 background-size: 100% 100%;
  160 + outline: none;
  161 + border: none;
  162 + padding: 0; /* button has padding in default */
157 } 163 }
158 .eye { 164 .eye {
159 position: absolute; 165 position: absolute;
@@ -12,6 +12,11 @@ @@ -12,6 +12,11 @@
12 border-radius: 20PX; 12 border-radius: 20PX;
13 font-size: 16PX; 13 font-size: 16PX;
14 color: #36a74c; 14 color: #36a74c;
  15 +
  16 + &:disabled {
  17 + color: #a2a2a2;
  18 + border-color: #a2a2a2;
  19 + }
15 } 20 }
16 21
17 button { 22 button {