Merge branch 'release/1.0' of http://git.yoho.cn/fe/yoho-blk into release/1.0
Showing
8 changed files
with
49 additions
and
84 deletions
@@ -272,12 +272,12 @@ const qq = { | @@ -272,12 +272,12 @@ const qq = { | ||
272 | login: (req, res) => { | 272 | login: (req, res) => { |
273 | let authState = req.session.authState = uuid.v4(); | 273 | let authState = req.session.authState = uuid.v4(); |
274 | 274 | ||
275 | - return res.redirect(`//www.yohobuy.com/passport/autosign/qq?type=yohoblk&state=${authState}`) | 275 | + return res.redirect(`//www.yohobuy.com/passport/autosign/qq?type=yohoblk&state=${authState}`); |
276 | }, | 276 | }, |
277 | callback: (req, res, next) => { | 277 | callback: (req, res, next) => { |
278 | if (req.session && req.session.authState && req.session.authState === req.query.state) { | 278 | if (req.session && req.session.authState && req.session.authState === req.query.state) { |
279 | if (req.query.err) { | 279 | if (req.query.err) { |
280 | - log.error(`qq authenticate error : ${JSON.stringify(err)}`); | 280 | + log.error(`qq authenticate error : ${JSON.stringify(req.query.err)}`); |
281 | return res.redirect(loginPageURL); | 281 | return res.redirect(loginPageURL); |
282 | } | 282 | } |
283 | 283 |
@@ -3,6 +3,8 @@ var confirmReceive = require('./order/confirm-receive'); | @@ -3,6 +3,8 @@ var confirmReceive = require('./order/confirm-receive'); | ||
3 | var editOrder = require('./order/edit-order'); | 3 | var editOrder = require('./order/edit-order'); |
4 | var countDown = require('./order/countdown'); | 4 | var countDown = require('./order/countdown'); |
5 | 5 | ||
6 | +var Confirm = require('../plugins/dialog').Confirm; | ||
7 | + | ||
6 | var lazyLoad = require('yoho-jquery-lazyload'); | 8 | var lazyLoad = require('yoho-jquery-lazyload'); |
7 | 9 | ||
8 | // 个人中心共用代码加载 | 10 | // 个人中心共用代码加载 |
@@ -32,6 +34,8 @@ $('.order .edit-btn').on('click', function() { | @@ -32,6 +34,8 @@ $('.order .edit-btn').on('click', function() { | ||
32 | var mobile = $userInfo.find('.user-mo-sel').data('mobile'); | 34 | var mobile = $userInfo.find('.user-mo-sel').data('mobile'); |
33 | var phone = $userInfo.find('.user-ph-sel').data('phone'); | 35 | var phone = $userInfo.find('.user-ph-sel').data('phone'); |
34 | 36 | ||
37 | + $this.removeClass('white'); // 我不知道为啥产品会有这样的需求,点一次按钮后颜色变掉,按钮颜色和可不可点状态一毛钱关系都没 | ||
38 | + | ||
35 | editOrder.start({ | 39 | editOrder.start({ |
36 | data: { | 40 | data: { |
37 | orderCode: code, | 41 | orderCode: code, |
@@ -47,8 +51,12 @@ $('.order .edit-btn').on('click', function() { | @@ -47,8 +51,12 @@ $('.order .edit-btn').on('click', function() { | ||
47 | $('.complete-btn').on('click', function() { | 51 | $('.complete-btn').on('click', function() { |
48 | var code = $(this).closest('.order').data('code'); | 52 | var code = $(this).closest('.order').data('code'); |
49 | 53 | ||
50 | - confirmReceive.done(code); | ||
51 | - | 54 | + new Confirm({ |
55 | + content: '<h1 class="title">确认收货</h1><p>您确定要确认收货么?</p>', | ||
56 | + cb: function() { | ||
57 | + confirmReceive.done(code); | ||
58 | + } | ||
59 | + }).show(); | ||
52 | }); | 60 | }); |
53 | 61 | ||
54 | if ($('.left-time').length) { | 62 | if ($('.left-time').length) { |
@@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
7 | var dialog = require('../plugins/dialog'); | 7 | var dialog = require('../plugins/dialog'); |
8 | var _dialog = dialog.Dialog; | 8 | var _dialog = dialog.Dialog; |
9 | var _alert = dialog.Alert; | 9 | var _alert = dialog.Alert; |
10 | +var _confirm = dialog.Confirm; | ||
10 | 11 | ||
11 | var expressTpl = require('../../tpl/me/express.hbs'); | 12 | var expressTpl = require('../../tpl/me/express.hbs'); |
12 | 13 | ||
@@ -335,7 +336,12 @@ function bindConfirmReceiveEvent() { | @@ -335,7 +336,12 @@ function bindConfirmReceiveEvent() { | ||
335 | $('.confirm-receive').on('click', function() { | 336 | $('.confirm-receive').on('click', function() { |
336 | var code = $(this).closest('.order').data('code'); | 337 | var code = $(this).closest('.order').data('code'); |
337 | 338 | ||
338 | - confirmReceive.done(code); | 339 | + new _confirm({ |
340 | + content: '<h1 class="title">确认收货</h1><p>您确定要确认收货么?</p>', | ||
341 | + cb: function() { | ||
342 | + confirmReceive.done(code); | ||
343 | + } | ||
344 | + }).show(); | ||
339 | }); | 345 | }); |
340 | } | 346 | } |
341 | 347 |
@@ -10,10 +10,6 @@ var $passwordInput = $('#pwd'), | @@ -10,10 +10,6 @@ var $passwordInput = $('#pwd'), | ||
10 | $repasswordInput = $('#re-input'), | 10 | $repasswordInput = $('#re-input'), |
11 | $next = $('#reset-pwd-btn'); | 11 | $next = $('#reset-pwd-btn'); |
12 | 12 | ||
13 | -var EventProxy = require('yoho-eventproxy'); | ||
14 | - | ||
15 | -var ep = new EventProxy(); | ||
16 | - | ||
17 | var pwdRegx = require('../common/mail-phone-regx').pwdValidateRegx; | 13 | var pwdRegx = require('../common/mail-phone-regx').pwdValidateRegx; |
18 | 14 | ||
19 | function errTip(ele, msg) { | 15 | function errTip(ele, msg) { |
@@ -34,75 +30,65 @@ require('yoho-jquery-placeholder'); | @@ -34,75 +30,65 @@ require('yoho-jquery-placeholder'); | ||
34 | // IE8 placeholder | 30 | // IE8 placeholder |
35 | $('input').placeholder(); | 31 | $('input').placeholder(); |
36 | 32 | ||
37 | -// 同时监听 pwd 和 repwd 事件 | ||
38 | -ep.tail('pwd', 'repwd', function(pwd, repwd) { | ||
39 | - if (pwd && repwd) { | ||
40 | - $next.removeClass('disable').prop('disabled', false); | ||
41 | - } else { | ||
42 | - $next.addClass('disable').prop('disabled', true); | ||
43 | - } | ||
44 | -}); | ||
45 | - | ||
46 | -$passwordInput.on('keyup blur', function() { | 33 | +function validatePassword() { |
47 | var length = $passwordInput.val().length; | 34 | var length = $passwordInput.val().length; |
48 | 35 | ||
49 | if (length === 0) { | 36 | if (length === 0) { |
50 | errTip($passwordInput, '请输入密码'); | 37 | errTip($passwordInput, '请输入密码'); |
51 | - ep.emit('pwd', false); | ||
52 | - return; | 38 | + return false; |
53 | } | 39 | } |
54 | 40 | ||
55 | if (length < 6 || length > 20) { | 41 | if (length < 6 || length > 20) { |
56 | errTip($passwordInput, '密码只支持 6-20 位字符,建议字母+数字的组合'); | 42 | errTip($passwordInput, '密码只支持 6-20 位字符,建议字母+数字的组合'); |
57 | - ep.emit('pwd', false); | ||
58 | - return; | 43 | + return false; |
59 | } | 44 | } |
60 | 45 | ||
61 | if (!pwdRegx.test($passwordInput.val())) { | 46 | if (!pwdRegx.test($passwordInput.val())) { |
62 | errTip($passwordInput, '密码只支持 6-20 位字符,建议字母+数字的组合'); | 47 | errTip($passwordInput, '密码只支持 6-20 位字符,建议字母+数字的组合'); |
63 | - ep.emit('pwd', false); | ||
64 | - return; | 48 | + return false; |
65 | } | 49 | } |
66 | 50 | ||
67 | - ep.emit('pwd', true); | 51 | + hideTip($passwordInput); |
52 | + return true; | ||
53 | +} | ||
54 | + | ||
55 | +$passwordInput.on('blur', function() { | ||
56 | + validatePassword(); | ||
68 | }).on('focus', function() { | 57 | }).on('focus', function() { |
69 | $passwordInput.addClass('focus'); | 58 | $passwordInput.addClass('focus'); |
59 | + hideTip($passwordInput); | ||
70 | }).on('blur', function() { | 60 | }).on('blur', function() { |
71 | $passwordInput.removeClass('focus'); | 61 | $passwordInput.removeClass('focus'); |
72 | }); | 62 | }); |
73 | 63 | ||
74 | -$repasswordInput.on('keyup blur', function() { | 64 | +function validateRepassword() { |
75 | var length = $repasswordInput.val().length; | 65 | var length = $repasswordInput.val().length; |
76 | 66 | ||
77 | if (length === 0) { | 67 | if (length === 0) { |
78 | errTip($repasswordInput, '请再次输入密码'); | 68 | errTip($repasswordInput, '请再次输入密码'); |
79 | - ep.emit('repwd', false); | ||
80 | - return; | 69 | + return false; |
81 | } | 70 | } |
82 | 71 | ||
83 | if ($passwordInput.val() !== $repasswordInput.val()) { | 72 | if ($passwordInput.val() !== $repasswordInput.val()) { |
84 | errTip($repasswordInput, '两次输入的密码不一致,请重新输入'); | 73 | errTip($repasswordInput, '两次输入的密码不一致,请重新输入'); |
85 | - ep.emit('repwd', false); | ||
86 | - return; | 74 | + return false; |
87 | } | 75 | } |
88 | 76 | ||
89 | - ep.emit('repwd', true); | 77 | + hideTip($repasswordInput); |
78 | + return true; | ||
79 | +} | ||
80 | + | ||
81 | +$repasswordInput.on('blur', function() { | ||
82 | + validateRepassword(); | ||
90 | }).on('focus', function() { | 83 | }).on('focus', function() { |
91 | $repasswordInput.addClass('focus'); | 84 | $repasswordInput.addClass('focus'); |
85 | + hideTip($repasswordInput); | ||
92 | }).on('blur', function() { | 86 | }).on('blur', function() { |
93 | $repasswordInput.removeClass('focus'); | 87 | $repasswordInput.removeClass('focus'); |
94 | }); | 88 | }); |
95 | 89 | ||
96 | -// 监听 repwd 事件 | ||
97 | -ep.on('repwd', function(repwdAuth) { | ||
98 | - if (repwdAuth) { | ||
99 | - hideTip($repasswordInput); | ||
100 | - } | ||
101 | -}); | ||
102 | - | ||
103 | -// 监听 pwd 事件 | ||
104 | -ep.on('pwd', function(pwdAuth) { | ||
105 | - if (pwdAuth) { | ||
106 | - hideTip($passwordInput); | 90 | +$next.click(function() { |
91 | + if (validatePassword() && validateRepassword()) { | ||
92 | + $('#reset-pwd-form').submit(); | ||
107 | } | 93 | } |
108 | }); | 94 | }); |
@@ -16,10 +16,6 @@ var $mobile = $('#mobile'); | @@ -16,10 +16,6 @@ var $mobile = $('#mobile'); | ||
16 | var $area = $('#area'); | 16 | var $area = $('#area'); |
17 | var $next = $('#next'); | 17 | var $next = $('#next'); |
18 | 18 | ||
19 | -var EventProxy = require('yoho-eventproxy'); | ||
20 | - | ||
21 | -var ep = new EventProxy(); | ||
22 | - | ||
23 | require('yoho-jquery-placeholder'); | 19 | require('yoho-jquery-placeholder'); |
24 | 20 | ||
25 | function errTip(ele, msg) { | 21 | function errTip(ele, msg) { |
@@ -34,62 +30,46 @@ function hideTip(ele) { | @@ -34,62 +30,46 @@ function hideTip(ele) { | ||
34 | return ele.next('.tips').addClass('hide'); | 30 | return ele.next('.tips').addClass('hide'); |
35 | } | 31 | } |
36 | 32 | ||
37 | -// 确保二次密码输入正确 | ||
38 | -ep.tail('pwd', 'repwd', function(pwd, repwd) { | ||
39 | - if (pwd && repwd) { | ||
40 | - $next.removeClass('disable'); | ||
41 | - } else { | ||
42 | - $next.addClass('disable'); | ||
43 | - } | ||
44 | -}); | ||
45 | - | ||
46 | -$passwordInput.on('keyup blur', function() { | 33 | +$passwordInput.on('blur', function() { |
47 | var length = $passwordInput.val().length; | 34 | var length = $passwordInput.val().length; |
48 | 35 | ||
49 | $passwordInput.removeClass('focus'); | 36 | $passwordInput.removeClass('focus'); |
50 | 37 | ||
51 | if (length === 0) { | 38 | if (length === 0) { |
52 | errTip($passwordInput, '请输入密码'); | 39 | errTip($passwordInput, '请输入密码'); |
53 | - ep.emit('pwd', false); | ||
54 | return; | 40 | return; |
55 | } | 41 | } |
56 | 42 | ||
57 | if (length < 6 || length > 20) { | 43 | if (length < 6 || length > 20) { |
58 | errTip($passwordInput, '密码只支持 6-20 位字符,建议字母+数字的组合'); | 44 | errTip($passwordInput, '密码只支持 6-20 位字符,建议字母+数字的组合'); |
59 | - ep.emit('pwd', false); | ||
60 | return; | 45 | return; |
61 | } | 46 | } |
62 | 47 | ||
63 | if (!pwdRegx.test($passwordInput.val())) { | 48 | if (!pwdRegx.test($passwordInput.val())) { |
64 | errTip($passwordInput, '密码只支持 6-20 位字符,建议字母+数字的组合'); | 49 | errTip($passwordInput, '密码只支持 6-20 位字符,建议字母+数字的组合'); |
65 | - ep.emit('pwd', false); | ||
66 | return; | 50 | return; |
67 | } | 51 | } |
68 | 52 | ||
69 | - ep.emit('pwd', true); | ||
70 | }).on('focus', function() { | 53 | }).on('focus', function() { |
71 | hideTip($passwordInput); | 54 | hideTip($passwordInput); |
72 | $passwordInput.addClass('focus'); | 55 | $passwordInput.addClass('focus'); |
73 | }); | 56 | }); |
74 | 57 | ||
75 | -$repasswordInput.on('keyup blur', function() { | 58 | +$repasswordInput.on('blur', function() { |
76 | var length = $repasswordInput.val().length; | 59 | var length = $repasswordInput.val().length; |
77 | 60 | ||
78 | $repasswordInput.removeClass('focus'); | 61 | $repasswordInput.removeClass('focus'); |
79 | 62 | ||
80 | if (length === 0) { | 63 | if (length === 0) { |
81 | errTip($repasswordInput, '请再次输入密码'); | 64 | errTip($repasswordInput, '请再次输入密码'); |
82 | - ep.emit('repwd', false); | ||
83 | return; | 65 | return; |
84 | } | 66 | } |
85 | 67 | ||
86 | if ($passwordInput.val() !== $repasswordInput.val()) { | 68 | if ($passwordInput.val() !== $repasswordInput.val()) { |
87 | errTip($repasswordInput, '两次输入的密码不一致,请重新输入'); | 69 | errTip($repasswordInput, '两次输入的密码不一致,请重新输入'); |
88 | - ep.emit('repwd', false); | ||
89 | return; | 70 | return; |
90 | } | 71 | } |
91 | 72 | ||
92 | - ep.emit('repwd', true); | ||
93 | }).on('focus', function() { | 73 | }).on('focus', function() { |
94 | hideTip($repasswordInput); | 74 | hideTip($repasswordInput); |
95 | $repasswordInput.addClass('focus'); | 75 | $repasswordInput.addClass('focus'); |
@@ -119,25 +99,10 @@ function nextPage() { | @@ -119,25 +99,10 @@ function nextPage() { | ||
119 | $('[placeholder]').placeholder(); | 99 | $('[placeholder]').placeholder(); |
120 | 100 | ||
121 | $next.on('click', function() { | 101 | $next.on('click', function() { |
122 | - if ($next.hasClass('disable')) { | ||
123 | - return; | ||
124 | - } | ||
125 | - | ||
126 | - if ($passwordInput.val() !== $repasswordInput.val()) { | 102 | + if (($.trim($passwordInput.val()) === '') || ($passwordInput.val() !== $repasswordInput.val())) { |
127 | errTip($repasswordInput, '两次输入的密码不一致,请重新输入'); | 103 | errTip($repasswordInput, '两次输入的密码不一致,请重新输入'); |
128 | return; | 104 | return; |
129 | } | 105 | } |
130 | nextPage(); | 106 | nextPage(); |
131 | }); | 107 | }); |
132 | 108 | ||
133 | -ep.on('repwd', function(repwdAuth) { | ||
134 | - if (repwdAuth) { | ||
135 | - hideTip(); | ||
136 | - } | ||
137 | -}); | ||
138 | - | ||
139 | -ep.on('pwd', function(pwdAuth) { | ||
140 | - if (pwdAuth) { | ||
141 | - hideTip(); | ||
142 | - } | ||
143 | -}); |
-
Please register or login to post a comment