Authored by zhangxiaoru

editorial

@@ -80,6 +80,7 @@ const favorite = { @@ -80,6 +80,7 @@ const favorite = {
80 p.hideBtn = true; 80 p.hideBtn = true;
81 } else if (p.storage === 0) { 81 } else if (p.storage === 0) {
82 p.stateText = '已售罄'; 82 p.stateText = '已售罄';
  83 + p.hideBtn = true;
83 } 84 }
84 p.url = `/product/pro_${p.productId}_${p.goodsId}/${p.cnAlphabet}.html`; 85 p.url = `/product/pro_${p.productId}_${p.goodsId}/${p.cnAlphabet}.html`;
85 p.imageUrl = p.image.replace('imageMogr2', 'imageMogr1'); 86 p.imageUrl = p.image.replace('imageMogr2', 'imageMogr1');
@@ -63,7 +63,8 @@ @@ -63,7 +63,8 @@
63 <div class="refund-type"> 63 <div class="refund-type">
64 <div> 64 <div>
65 {{# returnMode}} 65 {{# returnMode}}
66 - <label class="type-item {{class}}{{#if cur}} cur{{/if}}" title="{{title}}" data-id="{{id}}">{{name}}</label> 66 + {{!-- <label class="type-item {{class}}{{#if cur}} cur{{/if}}" title="{{title}}" data-id="{{id}}">{{name}}</label> --}}
  67 + <label class="type-item {{class}}{{#if cur}} cur{{/if}} zfb-icon" title="{{title}}" data-id="{{id}}"></label>
67 {{#if tip}} 68 {{#if tip}}
68 <span class="type-tip">{{tip}}</span> 69 <span class="type-tip">{{tip}}</span>
69 {{/if}} 70 {{/if}}
@@ -32,7 +32,7 @@ const _doPassportCallback = (req, res, user) => { @@ -32,7 +32,7 @@ const _doPassportCallback = (req, res, user) => {
32 32
33 refer = !BlockRedirectFilter.test(decodeURI(refer)) ? decodeURI(refer) : config.siteUrl; 33 refer = !BlockRedirectFilter.test(decodeURI(refer)) ? decodeURI(refer) : config.siteUrl;
34 34
35 - if (user.openId && user.nickname) { 35 + if (user.openId) {
36 let signinByOpenID = LoginService.signinByOpenIDAsync( 36 let signinByOpenID = LoginService.signinByOpenIDAsync(
37 _.trim(user.nickname), _.trim(user.openId), 37 _.trim(user.nickname), _.trim(user.openId),
38 _.trim(user.sourceType), _.trim(shoppingKey), 38 _.trim(user.sourceType), _.trim(shoppingKey),
@@ -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
@@ -36,19 +36,20 @@ const syncUserSession = (uid, req, res) => { @@ -36,19 +36,20 @@ const syncUserSession = (uid, req, res) => {
36 return UserService.profileAsync(uid).then((userInfo) => { 36 return UserService.profileAsync(uid).then((userInfo) => {
37 let token = sign.makeToken(uid); 37 let token = sign.makeToken(uid);
38 let user = userInfo.data; 38 let user = userInfo.data;
  39 + let name = user.nickname || user.profile_name || user.username;
39 40
40 if (!_.isEmpty(user)) { 41 if (!_.isEmpty(user)) {
41 - let uidCookie = `${user.profile_name}::${crypto.encryption('', user.uid + '')}::${user.username}::${token}`; 42 + let uidCookie = `${name}::${crypto.encryption('', user.uid + '')}::${user.username}::${token}`;
42 43
43 req.session._TOKEN = token; 44 req.session._TOKEN = token;
44 req.session._LOGIN_UID = uid; 45 req.session._LOGIN_UID = uid;
45 - req.session._USERNAME = user.username; 46 + req.session._USERNAME = name;
46 47
47 res.cookie('_UID', uidCookie, { 48 res.cookie('_UID', uidCookie, {
48 domain: config.cookieDomain 49 domain: config.cookieDomain
49 }); 50 });
50 51
51 - res.cookie('_USERNAME', user.username, { 52 + res.cookie('_USERNAME', name, {
52 domain: config.cookieDomain 53 domain: config.cookieDomain
53 }); 54 });
54 } 55 }
@@ -67,7 +67,7 @@ @@ -67,7 +67,7 @@
67 67
68 <li> 68 <li>
69 <div> 69 <div>
70 - <input id="reset-pwd-btn" class="reset-pwd-btn disable" type="submit" value="下一步" disabled> 70 + <a id="reset-pwd-btn" class="reset-pwd-btn">下一步</a>
71 </div> 71 </div>
72 </li> 72 </li>
73 73
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 29
30 <li> 30 <li>
31 <div> 31 <div>
32 - <a id="next" class="btn btn-fixed-height disable">确认</a> 32 + <a id="next" class="btn btn-fixed-height">确认</a>
33 </div> 33 </div>
34 </li> 34 </li>
35 </ul> 35 </ul>
@@ -17,7 +17,7 @@ exports.index = (req, res, next) => { @@ -17,7 +17,7 @@ exports.index = (req, res, next) => {
17 cartModel.getCartData(shoppingKey, uid).then((result) => { 17 cartModel.getCartData(shoppingKey, uid).then((result) => {
18 if (result.code === 200) { 18 if (result.code === 200) {
19 19
20 - res.header('Cache-Control', 'no-cache'); 20 + res.header('Cache-Control', 'no-store');
21 21
22 res.display('cart', _.merge({ 22 res.display('cart', _.merge({
23 module: 'shopping', 23 module: 'shopping',
@@ -173,7 +173,7 @@ $(function() { @@ -173,7 +173,7 @@ $(function() {
173 if (data.code === 200) { 173 if (data.code === 200) {
174 info.mobile = info.mobile.substring(0, 3) + '****' + info.mobile.substring(7, 11); 174 info.mobile = info.mobile.substring(0, 3) + '****' + info.mobile.substring(7, 11);
175 info.address_id = info.id; 175 info.address_id = info.id;
176 - $('#tr_' + info.id).parent().before(Bll.getHtml(info)).remove(); 176 + $('#tr_' + info.id).parents('tr').before(Bll.getHtml(info)).remove();
177 Bll.clearInput(); 177 Bll.clearInput();
178 $('.tip em').html('新增地址'); 178 $('.tip em').html('新增地址');
179 } else { 179 } else {
@@ -192,7 +192,7 @@ $(function() { @@ -192,7 +192,7 @@ $(function() {
192 if (data.code === 200) { 192 if (data.code === 200) {
193 info.mobile = info.mobile.substring(0, 3) + '****' + info.mobile.substring(7, 11); 193 info.mobile = info.mobile.substring(0, 3) + '****' + info.mobile.substring(7, 11);
194 info.address_id = info.id; 194 info.address_id = info.id;
195 - $('#tr_' + info.id).parent().before(Bll.getHtml(info)).remove(); 195 + $('#tr_' + info.id).parents('tr').before(Bll.getHtml(info)).remove();
196 Bll.clearInput(); 196 Bll.clearInput();
197 $('.tip em').html('新增地址'); 197 $('.tip em').html('新增地址');
198 } else { 198 } else {
@@ -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 -});  
@@ -239,7 +239,6 @@ @@ -239,7 +239,6 @@
239 .subtext { 239 .subtext {
240 font-size: 12px; 240 font-size: 12px;
241 cursor: pointer; 241 cursor: pointer;
242 - color: #666;  
243 } 242 }
244 243
245 .no-space { 244 .no-space {
@@ -259,21 +258,26 @@ @@ -259,21 +258,26 @@
259 } 258 }
260 259
261 .msg { 260 .msg {
262 - margin-top: 50px; 261 + margin-top: 45px;
263 text-align: center; 262 text-align: center;
264 263
265 .msg-zh { 264 .msg-zh {
266 - font-size: $bigSize;  
267 - margin-bottom: $space; 265 + font-size: 20px;
  266 + line-height: 30px;
  267 + margin-bottom: 15px;
268 } 268 }
269 269
270 .msg-en { 270 .msg-en {
271 margin-bottom: 40px; 271 margin-bottom: 40px;
  272 + font-size: 14px;
272 } 273 }
273 274
274 .btn { 275 .btn {
275 display: inline-block; 276 display: inline-block;
276 - width: 100px !important; 277 + width: 130px !important;
  278 + height: 40px !important;
  279 + line-height: 40px !important;
  280 + font-size: 14px;
277 } 281 }
278 } 282 }
279 } 283 }
@@ -160,7 +160,7 @@ @@ -160,7 +160,7 @@
160 .code-horn { 160 .code-horn {
161 width: 7px; 161 width: 7px;
162 height: 12px; 162 height: 12px;
163 - background: resolve('me/code-horn.png') no-repeat; 163 + background: resolve("me/code-horn.png") no-repeat;
164 position: absolute; 164 position: absolute;
165 left: -7px; 165 left: -7px;
166 top: 6px; 166 top: 6px;
@@ -193,12 +193,13 @@ @@ -193,12 +193,13 @@
193 color: #999; 193 color: #999;
194 } 194 }
195 195
  196 + .zfb-icon,
196 .ali-item { 197 .ali-item {
197 - background: resolve('me/alipay.png') no-repeat center center; 198 + background: resolve("me/alipay.png") no-repeat center center;
198 } 199 }
199 200
200 .union-item { 201 .union-item {
201 - background: resolve('me/unionpay.png') no-repeat center center; 202 + background: resolve("me/unionpay.png") no-repeat center center;
202 } 203 }
203 204
204 > dl { 205 > dl {
1 -<h1 class="dialog-title">订单修改</h1> 1 +<h1 class="dialog-title">修改订单</h1>
2 2
3 {{# data}} 3 {{# data}}
4 <div class="form" data-code={{orderCode}}> 4 <div class="form" data-code={{orderCode}}>