code review by hf: merge liangzhifeng and zhangzhen codes do fixes some bugs
Showing
41 changed files
with
295 additions
and
338 deletions
@@ -303,6 +303,7 @@ class AbstractAction extends Controller_Abstract | @@ -303,6 +303,7 @@ class AbstractAction extends Controller_Abstract | ||
303 | 303 | ||
304 | if (!$this->_uid) { | 304 | if (!$this->_uid) { |
305 | $cookie = $this->getCookie('_UID'); | 305 | $cookie = $this->getCookie('_UID'); |
306 | + // 兼容老的 | ||
306 | if (!empty($cookie)) { | 307 | if (!empty($cookie)) { |
307 | $cookieList = explode('::', $cookie); | 308 | $cookieList = explode('::', $cookie); |
308 | if (isset($cookieList[1]) && is_numeric($cookieList[1])) { | 309 | if (isset($cookieList[1]) && is_numeric($cookieList[1])) { |
@@ -321,6 +322,13 @@ class AbstractAction extends Controller_Abstract | @@ -321,6 +322,13 @@ class AbstractAction extends Controller_Abstract | ||
321 | $this->_usession = $cookieList[3]; | 322 | $this->_usession = $cookieList[3]; |
322 | $this->_vip = $cookieList[2]; | 323 | $this->_vip = $cookieList[2]; |
323 | } | 324 | } |
325 | + } | ||
326 | + // 新的, 如果老站没有同步成功,再尝试从SESSION获取 | ||
327 | + elseif ($useSession) { | ||
328 | + $uid = $this->getSession('_LOGIN_UID'); | ||
329 | + if (!empty($uid)) { | ||
330 | + $this->_uid = $uid; | ||
331 | + } | ||
324 | } | 332 | } |
325 | } | 333 | } |
326 | return $this->_uid; | 334 | return $this->_uid; |
@@ -576,7 +576,7 @@ class Helpers | @@ -576,7 +576,7 @@ class Helpers | ||
576 | $oneGoods['id'] = $value['product_sku']; | 576 | $oneGoods['id'] = $value['product_sku']; |
577 | $oneGoods['skn'] = $value['product_skn']; | 577 | $oneGoods['skn'] = $value['product_skn']; |
578 | $oneGoods['name'] = $value['product_name']; | 578 | $oneGoods['name'] = $value['product_name']; |
579 | - $oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 90, 100) : ''; | 579 | + $oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 120, 160) : ''; |
580 | $oneGoods['color'] = $value['color_name']; | 580 | $oneGoods['color'] = $value['color_name']; |
581 | $oneGoods['size'] = $value['size_name']; | 581 | $oneGoods['size'] = $value['size_name']; |
582 | $oneGoods['checked'] = $value['selected'] === 'Y'; | 582 | $oneGoods['checked'] = $value['selected'] === 'Y'; |
@@ -633,11 +633,13 @@ class Helpers | @@ -633,11 +633,13 @@ class Helpers | ||
633 | 633 | ||
634 | $gift = array(); | 634 | $gift = array(); |
635 | $oneGoods = array(); | 635 | $oneGoods = array(); |
636 | + $number = 0; | ||
636 | foreach ($advanceGoods as $value) { | 637 | foreach ($advanceGoods as $value) { |
637 | $gift = array(); | 638 | $gift = array(); |
638 | $gift['promotionId'] = $value['promotion_id']; | 639 | $gift['promotionId'] = $value['promotion_id']; |
639 | $gift['promotionTitle'] = $value['promotion_title']; | 640 | $gift['promotionTitle'] = $value['promotion_title']; |
640 | 641 | ||
642 | + $number = 0; | ||
641 | foreach ($value['goods_list'] as $single) { | 643 | foreach ($value['goods_list'] as $single) { |
642 | $oneGoods = array(); | 644 | $oneGoods = array(); |
643 | $oneGoods['id'] = $single['product_skn']; | 645 | $oneGoods['id'] = $single['product_skn']; |
@@ -648,12 +650,14 @@ class Helpers | @@ -648,12 +650,14 @@ class Helpers | ||
648 | $oneGoods['count'] = $single['storage_number']; | 650 | $oneGoods['count'] = $single['storage_number']; |
649 | 651 | ||
650 | $gift['goods'][] = $oneGoods; | 652 | $gift['goods'][] = $oneGoods; |
653 | + $number ++; | ||
651 | } | 654 | } |
652 | 655 | ||
653 | $arr[] = $gift; | 656 | $arr[] = $gift; |
654 | 657 | ||
655 | // 计算加价购商品数目 | 658 | // 计算加价购商品数目 |
656 | - $count += count($value['goods_list']); | 659 | + //$count += count($value['goods_list']); |
660 | + $count += $number; | ||
657 | } | 661 | } |
658 | 662 | ||
659 | return $arr; | 663 | return $arr; |
@@ -746,7 +750,7 @@ class Helpers | @@ -746,7 +750,7 @@ class Helpers | ||
746 | public static function syncUserSession($uid, $refer = '', $callback = 'call') | 750 | public static function syncUserSession($uid, $refer = '', $callback = 'call') |
747 | { | 751 | { |
748 | return 'http://mapi.yohobuy.com/Passport/session/index?callback=' . $callback | 752 | return 'http://mapi.yohobuy.com/Passport/session/index?callback=' . $callback |
749 | - . '&sign=' .md5(md5($uid . 'Js8Yn0!EwPM45-ws')) . '&uid=' . $uid . '&go=' . $refer; | 753 | + . '&sign=' . md5(md5($uid . 'Js8Yn0!EwPM45-ws')) . '&uid=' . $uid . '&go=' . $refer; |
750 | } | 754 | } |
751 | 755 | ||
752 | /** | 756 | /** |
@@ -10,11 +10,13 @@ var $ = require('jquery'), | @@ -10,11 +10,13 @@ var $ = require('jquery'), | ||
10 | 10 | ||
11 | var chosePanel = require('./chose-panel'), | 11 | var chosePanel = require('./chose-panel'), |
12 | dialog = require('../me/dialog'), | 12 | dialog = require('../me/dialog'), |
13 | + loading = require('../plugin/loading'), | ||
13 | tip = require('../plugin/tip'); | 14 | tip = require('../plugin/tip'); |
14 | 15 | ||
15 | var $cartContent = $('.cart-content'), | 16 | var $cartContent = $('.cart-content'), |
16 | cartType = $('#cartType').val(), | 17 | cartType = $('#cartType').val(), |
17 | $cartNav = $('.cart-nav'), | 18 | $cartNav = $('.cart-nav'), |
19 | + $cartPage = $('.shopping-cart-page'), | ||
18 | hasShowCartPresellTip = false; | 20 | hasShowCartPresellTip = false; |
19 | 21 | ||
20 | var navHammer, | 22 | var navHammer, |
@@ -22,8 +24,31 @@ var navHammer, | @@ -22,8 +24,31 @@ var navHammer, | ||
22 | freebieHammer, | 24 | freebieHammer, |
23 | switchChose = false; | 25 | switchChose = false; |
24 | 26 | ||
25 | -require('../product/recommend-for-you'); | ||
26 | -require('./good'); | 27 | +var isRefreshByDelete = window.cookie('_yoho-cart-refreshByDelete') === 'true' ? true : false; |
28 | + | ||
29 | + | ||
30 | +loading.showLoadingMask(); | ||
31 | + | ||
32 | +function needLoadRecommandForYou() { | ||
33 | + return window.isCookiesEnabled() ? | ||
34 | + $('.cart-goods').length <= 0 && !isRefreshByDelete : | ||
35 | + $('.cart-goods').length <= 0; | ||
36 | +} | ||
37 | + | ||
38 | + | ||
39 | +if (needLoadRecommandForYou()) { | ||
40 | + require('../product/recommend-for-you'); | ||
41 | +} else { | ||
42 | + if (isRefreshByDelete) { | ||
43 | + $('body').css('background-color', '#f0f0f0'); | ||
44 | + } | ||
45 | + require('./good'); | ||
46 | +} | ||
47 | + | ||
48 | +$cartPage.css('display', 'block'); | ||
49 | +loading.hideLoadingMask(); | ||
50 | + | ||
51 | +window.setCookie('_yoho-cart-refreshByDelete', false); | ||
27 | 52 | ||
28 | ellipsis.init(); | 53 | ellipsis.init(); |
29 | 54 |
@@ -67,11 +67,12 @@ function show(html, cb) { | @@ -67,11 +67,12 @@ function show(html, cb) { | ||
67 | document.documentElement.scrollLeft || document.body.scrollLeft, | 67 | document.documentElement.scrollLeft || document.body.scrollLeft, |
68 | document.documentElement.scrollTop || document.body.scrollTop | 68 | document.documentElement.scrollTop || document.body.scrollTop |
69 | ], | 69 | ], |
70 | - $html = $('html'); // it would make more sense to apply this to body, but IE7 won't have that | 70 | + $html = $('html, body'); // it would make more sense to apply this to body, but IE7 won't have that |
71 | 71 | ||
72 | $html.data('scroll-position', scrollPosition); | 72 | $html.data('scroll-position', scrollPosition); |
73 | $html.data('previous-overflow', $html.css('overflow')); | 73 | $html.data('previous-overflow', $html.css('overflow')); |
74 | $html.css('overflow', 'hidden'); | 74 | $html.css('overflow', 'hidden'); |
75 | + $html.css('height', '100%'); | ||
75 | window.scrollTo(scrollPosition[0], scrollPosition[1]); | 76 | window.scrollTo(scrollPosition[0], scrollPosition[1]); |
76 | 77 | ||
77 | if (html) { | 78 | if (html) { |
@@ -89,11 +90,12 @@ function show(html, cb) { | @@ -89,11 +90,12 @@ function show(html, cb) { | ||
89 | 90 | ||
90 | //隐藏当前Panel | 91 | //隐藏当前Panel |
91 | function hide() { | 92 | function hide() { |
92 | - var $html = $('html'), | 93 | + var $html = $('html, body'), |
93 | scrollPosition = $html.data('scroll-position'); | 94 | scrollPosition = $html.data('scroll-position'); |
94 | 95 | ||
95 | // un-lock scroll position | 96 | // un-lock scroll position |
96 | $html.css('overflow', $html.data('previous-overflow')); | 97 | $html.css('overflow', $html.data('previous-overflow')); |
98 | + $html.css('height', 'auto'); | ||
97 | window.scrollTo(scrollPosition[0], scrollPosition[1]); | 99 | window.scrollTo(scrollPosition[0], scrollPosition[1]); |
98 | $('.chose-panel').hide(); | 100 | $('.chose-panel').hide(); |
99 | } | 101 | } |
@@ -104,7 +106,7 @@ function updateConformButtonClassAndText() { | @@ -104,7 +106,7 @@ function updateConformButtonClassAndText() { | ||
104 | if (2 === $chosed.closest('.zero-stock').length) { | 106 | if (2 === $chosed.closest('.zero-stock').length) { |
105 | $('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄'); | 107 | $('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄'); |
106 | } else { | 108 | } else { |
107 | - $('#chose-btn-sure').css('background-color', '#eb0313').html('确定'); | 109 | + $('#chose-btn-sure').css('background-color', '#eb0313').html('加入购物车'); |
108 | } | 110 | } |
109 | } | 111 | } |
110 | 112 |
@@ -14,6 +14,8 @@ var $ = require('jquery'), | @@ -14,6 +14,8 @@ var $ = require('jquery'), | ||
14 | var $page = $('.gift-advance-page'), | 14 | var $page = $('.gift-advance-page'), |
15 | queryString = $.queryString(); | 15 | queryString = $.queryString(); |
16 | 16 | ||
17 | +require('../common'); | ||
18 | + | ||
17 | lazyLoad($('.lazy')); | 19 | lazyLoad($('.lazy')); |
18 | 20 | ||
19 | function getProductInfo(skn, promotionId) { | 21 | function getProductInfo(skn, promotionId) { |
@@ -19,7 +19,7 @@ var $selectAllBtn = $('.balance .checkbox'), | @@ -19,7 +19,7 @@ var $selectAllBtn = $('.balance .checkbox'), | ||
19 | ellipsis.init(); | 19 | ellipsis.init(); |
20 | 20 | ||
21 | lazyLoad({ | 21 | lazyLoad({ |
22 | - try_again_css: 'good-failure' | 22 | + try_again_css: 'order-failure' |
23 | }); | 23 | }); |
24 | 24 | ||
25 | setTimeout(function() { | 25 | setTimeout(function() { |
@@ -75,7 +75,9 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -75,7 +75,9 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
75 | }, function() { | 75 | }, function() { |
76 | tip.show('网络异常'); | 76 | tip.show('网络异常'); |
77 | }); | 77 | }); |
78 | -}).on('touchstart', '.icon-del', function(e) { | 78 | +}); |
79 | + | ||
80 | +$('.icon-del').on('touchstart', function(e) { | ||
79 | var $this = $(this); | 81 | var $this = $(this); |
80 | 82 | ||
81 | e.stopPropagation(); | 83 | e.stopPropagation(); |
@@ -106,12 +108,14 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -106,12 +108,14 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
106 | }); | 108 | }); |
107 | orderInfo('couponCode', null); | 109 | orderInfo('couponCode', null); |
108 | orderInfo('couponName', null); | 110 | orderInfo('couponName', null); |
111 | + window.setCookie('_yoho-cart-refreshByDelete', true); | ||
109 | window.location.href = '/cart/index/index?cartType=' + $('#cartType').val(); | 112 | window.location.href = '/cart/index/index?cartType=' + $('#cartType').val(); |
110 | } else { | 113 | } else { |
111 | tip.show(data.message); | 114 | tip.show(data.message); |
112 | } | 115 | } |
113 | }, function() { | 116 | }, function() { |
114 | tip.show('网络异常'); | 117 | tip.show('网络异常'); |
118 | + window.location.reload(); | ||
115 | }); | 119 | }); |
116 | }); | 120 | }); |
117 | }); | 121 | }); |
@@ -26,6 +26,8 @@ var dispatchModeHammer, | @@ -26,6 +26,8 @@ var dispatchModeHammer, | ||
26 | orderInfo = order.orderInfo, | 26 | orderInfo = order.orderInfo, |
27 | isSubmiting; | 27 | isSubmiting; |
28 | 28 | ||
29 | +require('../common'); | ||
30 | + | ||
29 | lazyLoad(); | 31 | lazyLoad(); |
30 | 32 | ||
31 | if (window.getUid() !== orderInfo('uid')) { | 33 | if (window.getUid() !== orderInfo('uid')) { |
@@ -6,6 +6,8 @@ | @@ -6,6 +6,8 @@ | ||
6 | var $ = require('jquery'); | 6 | var $ = require('jquery'); |
7 | var info = window.cookie('order-info'); | 7 | var info = window.cookie('order-info'); |
8 | 8 | ||
9 | +require('../common'); | ||
10 | + | ||
9 | function init() { | 11 | function init() { |
10 | info = { | 12 | info = { |
11 | uid: window.getUid(), | 13 | uid: window.getUid(), |
@@ -10,17 +10,31 @@ var $ = require('jquery'), | @@ -10,17 +10,31 @@ var $ = require('jquery'), | ||
10 | var $confim = $('.confim-mask'), | 10 | var $confim = $('.confim-mask'), |
11 | deleteId; | 11 | deleteId; |
12 | 12 | ||
13 | +require('../common'); | ||
14 | + | ||
13 | $('.address-item').on('touchend', function() { | 15 | $('.address-item').on('touchend', function() { |
14 | - orderInfo('addressId', $(this).data('address-id')); | 16 | + var $this = $(this); |
17 | + var addressId = $this.data('address-id'); | ||
18 | + var address = { | ||
19 | + address_id: $this.data('address-id'), | ||
20 | + consignee: $this.find('.name').text(), | ||
21 | + mobile: $this.find('.tel').text(), | ||
22 | + address_info: $this.find('.address-info').text(), | ||
23 | + is_support: $this.data('is-support') | ||
24 | + }; | ||
25 | + | ||
26 | + orderInfo('addressId', addressId); | ||
27 | + orderInfo('address', address); | ||
15 | }).on('touchend', '.edit', function() { | 28 | }).on('touchend', '.edit', function() { |
16 | window.location.href = $(this).data('href'); | 29 | window.location.href = $(this).data('href'); |
17 | return false; | 30 | return false; |
18 | -}).on('touchend', '.del', function() { | ||
19 | - deleteId = $(this).data('address-id'); | 31 | +}).on('touchstart', '.del', function() { |
32 | + deleteId = $(this).data('id'); | ||
20 | }); | 33 | }); |
21 | 34 | ||
22 | $confim.on('touchend', '.confim', function() { | 35 | $confim.on('touchend', '.confim', function() { |
23 | if (orderInfo('addressId') === deleteId) { | 36 | if (orderInfo('addressId') === deleteId) { |
24 | orderInfo('addressId', null); | 37 | orderInfo('addressId', null); |
38 | + orderInfo('address', null); | ||
25 | } | 39 | } |
26 | }); | 40 | }); |
@@ -21,6 +21,8 @@ var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()), | @@ -21,6 +21,8 @@ var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()), | ||
21 | 21 | ||
22 | var winH = $(window).height(); | 22 | var winH = $(window).height(); |
23 | 23 | ||
24 | +require('../common'); | ||
25 | + | ||
24 | // conponNotAvaliableTmpl = Handlebars.compile($('#tmpl-coupon-not-avaliable').html()), | 26 | // conponNotAvaliableTmpl = Handlebars.compile($('#tmpl-coupon-not-avaliable').html()), |
25 | 27 | ||
26 | function fixedLayOut() { | 28 | function fixedLayOut() { |
@@ -67,9 +69,27 @@ $newCoupon.on('submit', function() { | @@ -67,9 +69,27 @@ $newCoupon.on('submit', function() { | ||
67 | 69 | ||
68 | $('#coupon-list').on('touchend', '.employ-main', function() { | 70 | $('#coupon-list').on('touchend', '.employ-main', function() { |
69 | var $this = $(this); | 71 | var $this = $(this); |
72 | + var couponCode = $this.data('coupon-code'); | ||
73 | + | ||
74 | + $.ajax({ | ||
75 | + method: 'POST', | ||
76 | + url: '/cart/index/couponSearch', | ||
77 | + data: { | ||
78 | + couponCode: couponCode | ||
79 | + } | ||
80 | + }).then(function(res) { | ||
81 | + if (res.code === 200) { | ||
70 | 82 | ||
71 | - orderInfo('couponCode', $this.data('coupon-code')); | ||
72 | - orderInfo('couponName', $this.data('coupon-name')); | 83 | + //tip.show('优惠券可用'); |
84 | + orderInfo('couponCode', res.data.coupon_code); | ||
85 | + orderInfo('couponName', res.data.coupon_title); | ||
86 | + window.location.href = '/cart/index/orderEnsure'; | ||
87 | + } else { | ||
88 | + tip.show(res.message || '网络错误'); | ||
89 | + } | ||
90 | + }).fail(function() { | ||
91 | + tip.show('网络错误'); | ||
92 | + }); | ||
73 | }).on('touchstart', '.employ-main', function() { | 93 | }).on('touchstart', '.employ-main', function() { |
74 | var $this = $(this); | 94 | var $this = $(this); |
75 | 95 |
@@ -58,6 +58,17 @@ function setCookie(name, value, options) { | @@ -58,6 +58,17 @@ function setCookie(name, value, options) { | ||
58 | } | 58 | } |
59 | } | 59 | } |
60 | 60 | ||
61 | +function isCookiesEnabled() { | ||
62 | + var cookieEnabled = (navigator.cookieEnabled) ? true : false; | ||
63 | + | ||
64 | + if (typeof navigator.cookieEnabled === 'undefined' && !cookieEnabled) { | ||
65 | + document.cookie = 'testcookie'; | ||
66 | + cookieEnabled = (document.cookie.indexOf('testcookie') !== -1) ? true : false; | ||
67 | + } | ||
68 | + | ||
69 | + return (cookieEnabled); | ||
70 | +} | ||
71 | + | ||
61 | function getUser() { | 72 | function getUser() { |
62 | var c = cookie('_UID'), | 73 | var c = cookie('_UID'), |
63 | user; | 74 | user; |
@@ -179,7 +190,7 @@ function reMarginFooter(fixedElement) { | @@ -179,7 +190,7 @@ function reMarginFooter(fixedElement) { | ||
179 | a.async = 1; | 190 | a.async = 1; |
180 | a.src = j; | 191 | a.src = j; |
181 | m.parentNode.insertBefore(a, m); | 192 | m.parentNode.insertBefore(a, m); |
182 | -})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.13.6.3/yas-debug.js', '_yas'); | 193 | +})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.13.6.3/yas.js', '_yas'); |
183 | 194 | ||
184 | (function() { | 195 | (function() { |
185 | var uid = getUid(); | 196 | var uid = getUid(); |
@@ -276,6 +287,8 @@ window.cookie = cookie; | @@ -276,6 +287,8 @@ window.cookie = cookie; | ||
276 | 287 | ||
277 | window.setCookie = setCookie; | 288 | window.setCookie = setCookie; |
278 | 289 | ||
290 | +window.isCookiesEnabled = isCookiesEnabled; | ||
291 | + | ||
279 | window.getUser = getUser; | 292 | window.getUser = getUser; |
280 | 293 | ||
281 | window.getUid = getUid; | 294 | window.getUid = getUid; |
@@ -17,19 +17,13 @@ var $ = require('jquery'), | @@ -17,19 +17,13 @@ var $ = require('jquery'), | ||
17 | trendTopicSwiper, | 17 | trendTopicSwiper, |
18 | goodsSwiper; | 18 | goodsSwiper; |
19 | 19 | ||
20 | -var requestFrame, | ||
21 | - thisFunc, | ||
22 | - start = 0, | ||
23 | - i, | 20 | +var start = 0, |
24 | swiperClass, | 21 | swiperClass, |
25 | - supportCss3, | ||
26 | $logotrans = $('.home-header .logo'), | 22 | $logotrans = $('.home-header .logo'), |
27 | isen = true; | 23 | isen = true; |
28 | 24 | ||
29 | var navHammer; | 25 | var navHammer; |
30 | 26 | ||
31 | -require('./maybe-like'); | ||
32 | - | ||
33 | lazyLoad($('img.lazy')); | 27 | lazyLoad($('img.lazy')); |
34 | 28 | ||
35 | navHammer = new Hammer($('.nav-btn')[0]); | 29 | navHammer = new Hammer($('.nav-btn')[0]); |
@@ -39,13 +33,6 @@ navHammer.on('tap', function(event) { | @@ -39,13 +33,6 @@ navHammer.on('tap', function(event) { | ||
39 | $overlay.show().css('opacity', 0.3); | 33 | $overlay.show().css('opacity', 0.3); |
40 | $sideNav.addClass('on'); | 34 | $sideNav.addClass('on'); |
41 | 35 | ||
42 | - //设置boy高宽,页面不能上下滑动 | ||
43 | - $('body').css({ | ||
44 | - height: $(window).height(), | ||
45 | - width: $(window).width(), | ||
46 | - overflow: 'hidden' | ||
47 | - }); | ||
48 | - | ||
49 | event.srcEvent.stopPropagation(); | 36 | event.srcEvent.stopPropagation(); |
50 | return false; | 37 | return false; |
51 | }); | 38 | }); |
@@ -56,10 +43,6 @@ function hideSideBar() { | @@ -56,10 +43,6 @@ function hideSideBar() { | ||
56 | $('.overlay').hide(); | 43 | $('.overlay').hide(); |
57 | $('.sub-nav').removeClass('show'); | 44 | $('.sub-nav').removeClass('show'); |
58 | $sideNav.removeClass('on'); | 45 | $sideNav.removeClass('on'); |
59 | - $('body').css({ | ||
60 | - height: 'auto', | ||
61 | - overflow: 'auto' | ||
62 | - }); | ||
63 | } | 46 | } |
64 | } | 47 | } |
65 | 48 | ||
@@ -68,6 +51,11 @@ $('.overlay').on('touchstart', function(e) { | @@ -68,6 +51,11 @@ $('.overlay').on('touchstart', function(e) { | ||
68 | return false; | 51 | return false; |
69 | }); | 52 | }); |
70 | 53 | ||
54 | +//禁止在侧边栏可以上下滚动 | ||
55 | +$('.side-nav').on('touchmove', function() { | ||
56 | + return false; | ||
57 | +}); | ||
58 | + | ||
71 | //点击一级导航,弹出二级导航 | 59 | //点击一级导航,弹出二级导航 |
72 | $sideNav.on('touchstart', 'li', function(e) { | 60 | $sideNav.on('touchstart', 'li', function(e) { |
73 | if ($(this).find('.sub-nav').size() > 0) { | 61 | if ($(this).find('.sub-nav').size() > 0) { |
@@ -161,28 +149,6 @@ $('.category-swiper').each(function(i, index) { | @@ -161,28 +149,6 @@ $('.category-swiper').each(function(i, index) { | ||
161 | }); | 149 | }); |
162 | 150 | ||
163 | //logo动画 | 151 | //logo动画 |
164 | -requestFrame = (function() { | ||
165 | - var tempFunc = null, | ||
166 | - prefixList = ['webkit', 'moz', 'ms']; | ||
167 | - | ||
168 | - for (i = 0; i < prefixList.length; i++) { | ||
169 | - thisFunc = prefixList[i] + 'RequestAnimationFrame'; | ||
170 | - if (window[thisFunc]) { | ||
171 | - supportCss3 = true; | ||
172 | - tempFunc = thisFunc; | ||
173 | - } | ||
174 | - } | ||
175 | - | ||
176 | - if (supportCss3) { | ||
177 | - return function(callback) { | ||
178 | - window[tempFunc](callback); | ||
179 | - }; | ||
180 | - } | ||
181 | - return function(callback) { | ||
182 | - window.setTimeout(callback, 67); | ||
183 | - }; | ||
184 | -})(); | ||
185 | - | ||
186 | function tsAnimate() { | 152 | function tsAnimate() { |
187 | start = start + 10; | 153 | start = start + 10; |
188 | $logotrans.css({ | 154 | $logotrans.css({ |
@@ -205,9 +171,7 @@ function tsAnimate() { | @@ -205,9 +171,7 @@ function tsAnimate() { | ||
205 | if (start % 360 === 0) { | 171 | if (start % 360 === 0) { |
206 | window.setTimeout(tsAnimate, 60 * 1000); | 172 | window.setTimeout(tsAnimate, 60 * 1000); |
207 | } else { | 173 | } else { |
208 | - requestFrame(function() { | ||
209 | - tsAnimate(); | ||
210 | - }); | 174 | + window.requestAnimationFrame(tsAnimate); |
211 | } | 175 | } |
212 | } | 176 | } |
213 | } | 177 | } |
@@ -230,3 +194,5 @@ exports.set = function(c) { | @@ -230,3 +194,5 @@ exports.set = function(c) { | ||
230 | domain: '.m.yohobuy.com' | 194 | domain: '.m.yohobuy.com' |
231 | }); | 195 | }); |
232 | }; | 196 | }; |
197 | + | ||
198 | +require('./maybe-like'); |
@@ -119,7 +119,11 @@ $submit.on('touchend', function() { | @@ -119,7 +119,11 @@ $submit.on('touchend', function() { | ||
119 | }); | 119 | }); |
120 | 120 | ||
121 | // 省市区列表异步加载 | 121 | // 省市区列表异步加载 |
122 | -$.get('/home/locationList').then(function(html) { | 122 | +$.ajax({ |
123 | + method: 'GET', | ||
124 | + url: '/home/locationList', | ||
125 | + timeout: 60000 | ||
126 | +}).then(function(html) { | ||
123 | $addressListPage.html(html); | 127 | $addressListPage.html(html); |
124 | 128 | ||
125 | // 省市区 | 129 | // 省市区 |
@@ -141,7 +145,7 @@ $.get('/home/locationList').then(function(html) { | @@ -141,7 +145,7 @@ $.get('/home/locationList').then(function(html) { | ||
141 | if (e.target.tagName.toLowerCase() !== 'li') { | 145 | if (e.target.tagName.toLowerCase() !== 'li') { |
142 | $this = $this.parent('li'); | 146 | $this = $this.parent('li'); |
143 | } | 147 | } |
144 | - newArea.push($this.children('.caption').text()); | 148 | + newArea.push($this.children('.caption').text().trim()); |
145 | $this.siblings().hide(); | 149 | $this.siblings().hide(); |
146 | $this.children('ul').show().children('li').show(); | 150 | $this.children('ul').show().children('li').show(); |
147 | 151 | ||
@@ -157,7 +161,7 @@ $.get('/home/locationList').then(function(html) { | @@ -157,7 +161,7 @@ $.get('/home/locationList').then(function(html) { | ||
157 | var $this = $(e.target); | 161 | var $this = $(e.target); |
158 | 162 | ||
159 | // 填结果到 html | 163 | // 填结果到 html |
160 | - newArea.push($this.children('.caption').text()); | 164 | + newArea.push($this.text().trim()); |
161 | $('[name="area"]').val(newArea.join(' ')); | 165 | $('[name="area"]').val(newArea.join(' ')); |
162 | $('[name="area_code"]').val($this.data('id')); | 166 | $('[name="area_code"]').val($this.data('id')); |
163 | 167 |
@@ -16,6 +16,8 @@ var $action = $('.action'), | @@ -16,6 +16,8 @@ var $action = $('.action'), | ||
16 | $addressItem = $('.address-item'), | 16 | $addressItem = $('.address-item'), |
17 | deleteId; | 17 | deleteId; |
18 | 18 | ||
19 | +require('../common'); | ||
20 | + | ||
19 | $pageWrap.first().css('min-height', function() { | 21 | $pageWrap.first().css('min-height', function() { |
20 | return $(window).height() - $('#yoho-header').height() - $footer.height(); | 22 | return $(window).height() - $('#yoho-header').height() - $footer.height(); |
21 | }); | 23 | }); |
@@ -12,30 +12,35 @@ var $dialogWrapper, | @@ -12,30 +12,35 @@ var $dialogWrapper, | ||
12 | dialogTpl, | 12 | dialogTpl, |
13 | dialogTemplate; | 13 | dialogTemplate; |
14 | 14 | ||
15 | - | ||
16 | -dialogTpl = '<div id="dialog-wrapper" class="dialog-wrapper">' + | ||
17 | - '<div class="dialog-box">' + | ||
18 | - '{{# hasHeader}}' + | ||
19 | - '{{/ hasHeader}}' + | ||
20 | - '<div class="dialog-content">{{dialogText}}</div>' + | ||
21 | - '{{# hasFooter}}' + | ||
22 | - '<div class="dialog-footer">' + | ||
23 | - '{{# leftBtnText}}' + | ||
24 | - '<span class="dialog-left-btn">{{.}}</span>' + | ||
25 | - '{{/ leftBtnText}}' + | ||
26 | - '{{# rightBtnText}}' + | ||
27 | - '<span class="dialog-right-btn">{{.}}</span>' + | ||
28 | - '{{/ rightBtnText}}' + | ||
29 | - '</div>' + | ||
30 | - '{{/ hasFooter}}' + | ||
31 | - '</div>' + | 15 | +function getInstance() { |
16 | + if (dialogTpl === undefined) { | ||
17 | + dialogTpl = '<div id="dialog-wrapper" class="dialog-wrapper">' + | ||
18 | + '<div class="dialog-box">' + | ||
19 | + '{{# hasHeader}}' + | ||
20 | + '{{/ hasHeader}}' + | ||
21 | + '<div class="dialog-content">{{dialogText}}</div>' + | ||
22 | + '{{# hasFooter}}' + | ||
23 | + '<div class="dialog-footer">' + | ||
24 | + '{{# leftBtnText}}' + | ||
25 | + '<span class="dialog-left-btn">{{.}}</span>' + | ||
26 | + '{{/ leftBtnText}}' + | ||
27 | + '{{# rightBtnText}}' + | ||
28 | + '<span class="dialog-right-btn">{{.}}</span>' + | ||
29 | + '{{/ rightBtnText}}' + | ||
30 | + '</div>' + | ||
31 | + '{{/ hasFooter}}' + | ||
32 | + '</div>' + | ||
32 | '</div>'; | 33 | '</div>'; |
33 | 34 | ||
34 | -dialogTemplate = Handlebars.compile(dialogTpl); | 35 | + dialogTemplate = Handlebars.compile(dialogTpl); |
36 | + } | ||
37 | + return dialogTemplate; | ||
38 | +} | ||
35 | 39 | ||
36 | exports.showDialog = function(data, callback, callbackForLeft) { | 40 | exports.showDialog = function(data, callback, callbackForLeft) { |
37 | 41 | ||
38 | - var dialogStr = dialogTemplate(data), | 42 | + var dialogTemplate = getInstance(), |
43 | + dialogStr = dialogTemplate(data), | ||
39 | $dialogBox, | 44 | $dialogBox, |
40 | defaultHideDuraton, | 45 | defaultHideDuraton, |
41 | dialogWrapperHammer; | 46 | dialogWrapperHammer; |
@@ -73,6 +78,11 @@ exports.showDialog = function(data, callback, callbackForLeft) { | @@ -73,6 +78,11 @@ exports.showDialog = function(data, callback, callbackForLeft) { | ||
73 | }, defaultHideDuraton); | 78 | }, defaultHideDuraton); |
74 | } | 79 | } |
75 | 80 | ||
81 | + //禁止在dialog上可以上下滚动 | ||
82 | + $dialogWrapper.on('touchmove', function() { | ||
83 | + return false; | ||
84 | + }); | ||
85 | + | ||
76 | dialogWrapperHammer.on('tap', function(event) { | 86 | dialogWrapperHammer.on('tap', function(event) { |
77 | 87 | ||
78 | if ($(event.target).hasClass('dialog-left-btn')) { | 88 | if ($(event.target).hasClass('dialog-left-btn')) { |
@@ -83,5 +93,9 @@ exports.showDialog = function(data, callback, callbackForLeft) { | @@ -83,5 +93,9 @@ exports.showDialog = function(data, callback, callbackForLeft) { | ||
83 | } else if ($(event.target).hasClass('dialog-right-btn')) { | 93 | } else if ($(event.target).hasClass('dialog-right-btn')) { |
84 | callback(); | 94 | callback(); |
85 | } | 95 | } |
96 | + | ||
97 | + // 防止出现点透问题 | ||
98 | + event.preventDefault(); | ||
99 | + event.srcEvent.stopPropagation(); | ||
86 | }); | 100 | }); |
87 | }; | 101 | }; |
@@ -71,7 +71,7 @@ function callpay(orderCode) { | @@ -71,7 +71,7 @@ function callpay(orderCode) { | ||
71 | } else { | 71 | } else { |
72 | $.ajax({ | 72 | $.ajax({ |
73 | type: 'GET', | 73 | type: 'GET', |
74 | - url: '/shopping/pay/wechatwapapi?order_code=' + orderCode, | 74 | + url: '/home/wechatpay?order_code=' + orderCode, |
75 | dataType: 'json', | 75 | dataType: 'json', |
76 | success: function(res) { | 76 | success: function(res) { |
77 | if (res.code === 200) { | 77 | if (res.code === 200) { |
@@ -243,11 +243,11 @@ function search(opt) { | @@ -243,11 +243,11 @@ function search(opt) { | ||
243 | break; | 243 | break; |
244 | case 'price': | 244 | case 'price': |
245 | window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid, | 245 | window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid, |
246 | - '', '.new-goods .good-info .good-detail-img .good-thumb'); | 246 | + '', '.price-goods .good-info .good-detail-img .good-thumb'); |
247 | break; | 247 | break; |
248 | case 'discount': | 248 | case 'discount': |
249 | window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid, | 249 | window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid, |
250 | - '', '.new-goods .good-info .good-detail-img .good-thumb'); | 250 | + '', '.discount-goods .good-info .good-detail-img .good-thumb'); |
251 | break; | 251 | break; |
252 | } | 252 | } |
253 | } | 253 | } |
@@ -41,6 +41,7 @@ | @@ -41,6 +41,7 @@ | ||
41 | .thumb { | 41 | .thumb { |
42 | float: left; | 42 | float: left; |
43 | width: 100rem / $pxConvertRem; | 43 | width: 100rem / $pxConvertRem; |
44 | + margin-right: 20rem / $pxConvertRem; | ||
44 | } | 45 | } |
45 | 46 | ||
46 | .text-info { | 47 | .text-info { |
@@ -48,7 +49,7 @@ | @@ -48,7 +49,7 @@ | ||
48 | .name { | 49 | .name { |
49 | font-size: 28rem / $pxConvertRem; | 50 | font-size: 28rem / $pxConvertRem; |
50 | height: 74rem / $pxConvertRem; | 51 | height: 74rem / $pxConvertRem; |
51 | - overflow: hidden; | 52 | + overflow: hidden; |
52 | display: -webkit-box; | 53 | display: -webkit-box; |
53 | -webkit-line-clamp: 2; | 54 | -webkit-line-clamp: 2; |
54 | -webkit-box-orient: vertical; | 55 | -webkit-box-orient: vertical; |
@@ -28,12 +28,16 @@ | @@ -28,12 +28,16 @@ | ||
28 | } | 28 | } |
29 | 29 | ||
30 | .few-tag { | 30 | .few-tag { |
31 | - width: 148rem / $pxConvertRem; | 31 | + width: 150rem / $pxConvertRem; |
32 | position: absolute; | 32 | position: absolute; |
33 | - left: 92rem / $pxConvertRem; | ||
34 | text-align: center; | 33 | text-align: center; |
35 | - top: 75%; | 34 | + top: 72%; |
36 | color: #fff; | 35 | color: #fff; |
36 | + | ||
37 | + span { | ||
38 | + display: inline-block; | ||
39 | + @include transform(scale(0.833)); | ||
40 | + } | ||
37 | } | 41 | } |
38 | 42 | ||
39 | .gift-tag { | 43 | .gift-tag { |
@@ -71,8 +75,7 @@ | @@ -71,8 +75,7 @@ | ||
71 | 75 | ||
72 | .thumb { | 76 | .thumb { |
73 | float: left; | 77 | float: left; |
74 | - width: 180rem / $pxConvertRem; | ||
75 | - height: 200rem / $pxConvertRem; | 78 | + width: 150rem / $pxConvertRem; |
76 | background-size: 100%; | 79 | background-size: 100%; |
77 | background-repeat: no-repeat; | 80 | background-repeat: no-repeat; |
78 | } | 81 | } |
@@ -80,7 +83,7 @@ | @@ -80,7 +83,7 @@ | ||
80 | .deps { | 83 | .deps { |
81 | position: relative; | 84 | position: relative; |
82 | width: 380rem / $pxConvertRem; | 85 | width: 380rem / $pxConvertRem; |
83 | - margin-left: 4.7rem; | 86 | + margin-left: 180rem / $pxConvertRem; |
84 | border-bottom: 1px solid #e0e0e0; | 87 | border-bottom: 1px solid #e0e0e0; |
85 | padding: 0.5rem 0; | 88 | padding: 0.5rem 0; |
86 | } | 89 | } |
@@ -120,10 +123,10 @@ | @@ -120,10 +123,10 @@ | ||
120 | } | 123 | } |
121 | 124 | ||
122 | .count { | 125 | .count { |
123 | - font-size: 28rem / $pxConvertRem; | 126 | + font-size: 20rem / $pxConvertRem; |
124 | color: #999; | 127 | color: #999; |
125 | display: inline-block; | 128 | display: inline-block; |
126 | - width: 19%; | 129 | + width: 22%; |
127 | position: absolute; | 130 | position: absolute; |
128 | text-align: center; | 131 | text-align: center; |
129 | } | 132 | } |
@@ -152,10 +155,10 @@ | @@ -152,10 +155,10 @@ | ||
152 | display: inline-block; | 155 | display: inline-block; |
153 | color: #fff; | 156 | color: #fff; |
154 | background: #d1021c; | 157 | background: #d1021c; |
155 | - border: 1px solid #9d0000; | ||
156 | - @include border-radius(0.5rem); | ||
157 | - padding: 4rem / $pxConvertRem 0.5rem; | ||
158 | - margin-left: 0.2rem; | 158 | + @include border-radius(16rem / $pxConvertRem); |
159 | + padding: 0rem / $pxConvertRem 12rem / $pxConvertRem; | ||
160 | + margin-left: 8rem / $pxConvertRem; | ||
161 | + font-size: 20rem / $pxConvertRem; | ||
159 | } | 162 | } |
160 | 163 | ||
161 | .la-tag { | 164 | .la-tag { |
@@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
8 | margin-bottom: 120rem / $pxConvertRem; | 8 | margin-bottom: 120rem / $pxConvertRem; |
9 | overflow-x: hidden; | 9 | overflow-x: hidden; |
10 | background: #f0f0f0; | 10 | background: #f0f0f0; |
11 | + display: none; | ||
11 | 12 | ||
12 | .yoho-tip { | 13 | .yoho-tip { |
13 | z-index: 4; | 14 | z-index: 4; |
@@ -77,7 +78,7 @@ | @@ -77,7 +78,7 @@ | ||
77 | padding: 10px; | 78 | padding: 10px; |
78 | background: #000; | 79 | background: #000; |
79 | color: #fff; | 80 | color: #fff; |
80 | - font-size: 20px; | 81 | + font-size: 12px; |
81 | @include border-radius(5px); | 82 | @include border-radius(5px); |
82 | text-align: center; | 83 | text-align: center; |
83 | width: 7rem; | 84 | width: 7rem; |
@@ -189,7 +189,7 @@ | @@ -189,7 +189,7 @@ | ||
189 | margin: pxToRem(20px) 0; | 189 | margin: pxToRem(20px) 0; |
190 | padding: 0 pxToRem(12px); | 190 | padding: 0 pxToRem(12px); |
191 | width: 100%; | 191 | width: 100%; |
192 | - height: pxToRem(60px); | 192 | + height: pxToRem(72px); |
193 | color: #444; | 193 | color: #444; |
194 | background: #efefef; | 194 | background: #efefef; |
195 | font-size: pxToRem(24px); | 195 | font-size: pxToRem(24px); |
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | left: 0; | 7 | left: 0; |
8 | right: 100rem / $pxConvertRem; | 8 | right: 100rem / $pxConvertRem; |
9 | width: 540rem / $pxConvertRem; | 9 | width: 540rem / $pxConvertRem; |
10 | - z-index: 1; | 10 | + z-index: 4; |
11 | overflow: hidden; | 11 | overflow: hidden; |
12 | @include transition(all .3s); | 12 | @include transition(all .3s); |
13 | 13 | ||
@@ -188,4 +188,4 @@ | @@ -188,4 +188,4 @@ | ||
188 | display: block; | 188 | display: block; |
189 | @include transform(translateX(0)); | 189 | @include transform(translateX(0)); |
190 | @include transition(transform 0.3s); | 190 | @include transition(transform 0.3s); |
191 | -} | ||
191 | +} |
static/sass/index.scss
deleted
100644 → 0
1 | -@charset "utf-8"; | ||
2 | - | ||
3 | -@import "compass", "compass/reset"; | ||
4 | -$pxConvertRem: 40; | ||
5 | - | ||
6 | -* { | ||
7 | - -webkit-tap-highlight-color: rgba(0,0,0,0); | ||
8 | - -moz-tap-highlight-color: rgba(0,0,0,0); | ||
9 | - tap-highlight-color: rgba(0,0,0,0); | ||
10 | -} | ||
11 | - | ||
12 | -html, body { | ||
13 | - font-family: helvetica,Arial,"黑体"; | ||
14 | - width: 100%; | ||
15 | - font-size: 12px; | ||
16 | - line-height: 1.4; | ||
17 | -} | ||
18 | - | ||
19 | -.clearfix:before, | ||
20 | -.clearfix:after { | ||
21 | - content: ""; | ||
22 | - display: table; | ||
23 | -} | ||
24 | - | ||
25 | -.clearfix:after { | ||
26 | - clear: both; | ||
27 | -} | ||
28 | - | ||
29 | -.clearfix { | ||
30 | - *zoom: 1; | ||
31 | -} | ||
32 | - | ||
33 | -button, input, select, textarea { | ||
34 | - font-family: inherit; | ||
35 | - font-size: 100%; | ||
36 | - margin: 0; | ||
37 | -} | ||
38 | - | ||
39 | -img { | ||
40 | - max-width: 100%; | ||
41 | - display: block; | ||
42 | - border: 0; | ||
43 | - margin: 0 auto; | ||
44 | -} | ||
45 | - | ||
46 | -a { | ||
47 | - text-decoration: none; | ||
48 | - outline: none; | ||
49 | - color: #000; | ||
50 | - | ||
51 | - &:link, | ||
52 | - &:visited, | ||
53 | - &:hover, | ||
54 | - &:actived { | ||
55 | - color: #000; | ||
56 | - } | ||
57 | -} | ||
58 | - | ||
59 | -*:focus { | ||
60 | - outline: none; | ||
61 | -} | ||
62 | - | ||
63 | -.hide { | ||
64 | - display: none; | ||
65 | -} | ||
66 | - | ||
67 | -.overflow-hidden { | ||
68 | - overflow: hidden; | ||
69 | -} | ||
70 | - | ||
71 | -@font-face { | ||
72 | - font-family: "iconfont"; | ||
73 | - src: font-url('iconfont.eot'); /* IE9*/ | ||
74 | - src: font-url('iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ | ||
75 | - font-url('iconfont.woff') format('woff'), /* chrome、firefox */ | ||
76 | - font-url('iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ | ||
77 | - font-url('iconfont.svg#iconfont') format('svg'); /* iOS 4.1- */ | ||
78 | -} | ||
79 | - | ||
80 | -.iconfont { | ||
81 | - font-family: "iconfont" !important; | ||
82 | - font-size: 16px; | ||
83 | - font-style: normal; | ||
84 | - text-decoration: none; | ||
85 | - -webkit-font-smoothing: antialiased; | ||
86 | - -webkit-text-stroke-width: 0.2px; | ||
87 | - -moz-osx-font-smoothing: grayscale; | ||
88 | -} | ||
89 | - | ||
90 | -.yoho-tip { | ||
91 | - position: fixed; | ||
92 | - display: none; | ||
93 | - text-align: center; | ||
94 | - width: 70%; | ||
95 | - padding: 34px 0; | ||
96 | - top: 50%; | ||
97 | - left: 50%; | ||
98 | - margin-left: -35%; | ||
99 | - margin-top: -45px; | ||
100 | - background-color: rgba(0,0,0,.7); | ||
101 | - color: #fff; | ||
102 | - font-size: 18px; | ||
103 | - border: none; | ||
104 | - z-index:4; | ||
105 | - @include border-radius(10px); | ||
106 | -} | ||
107 | - | ||
108 | -.tap-hightlight { | ||
109 | - &.highlight { | ||
110 | - background: #eee!important; | ||
111 | - } | ||
112 | -} | ||
113 | - | ||
114 | -.load-more-info { | ||
115 | - width: 100%; | ||
116 | - height: 70rem / $pxConvertRem; | ||
117 | - line-height: 70rem / $pxConvertRem; | ||
118 | - text-align: center; | ||
119 | - font-size: 14px; | ||
120 | - overflow: hidden; | ||
121 | - | ||
122 | - .status { | ||
123 | - &.hide { | ||
124 | - display: none; | ||
125 | - } | ||
126 | - } | ||
127 | -} | ||
128 | - | ||
129 | -/*px转化rem*/ | ||
130 | -@function pxToRem($px) { | ||
131 | - $pxConvertRem: 40px; | ||
132 | - | ||
133 | - @if $px == 0 { | ||
134 | - @return 0; | ||
135 | - } @else { | ||
136 | - @return $px / $pxConvertRem * 1rem; | ||
137 | - } | ||
138 | -} | ||
139 | - | ||
140 | -@mixin rem-sprite ($map,$sprite) { | ||
141 | - $offsetY: nth(sprite-position($map,$sprite),2); | ||
142 | - background-image: sprite-url($map); | ||
143 | - background-repeat: no-repeat; | ||
144 | - background-position: 0 pxToRem($offsetY); | ||
145 | - background-size: pxToRem(sprite-width($map)) pxToRem(sprite-height($map)); | ||
146 | -} | ||
147 | - | ||
148 | -@import "layout/header"; | ||
149 | -@import "layout/footer"; | ||
150 | -@import "layout/footer_tab"; | ||
151 | -@import "good"; | ||
152 | -@import "lazy-failure"; | ||
153 | -@import "filter"; | ||
154 | -@import "loading"; | ||
155 | -@import "passport/index"; | ||
156 | -@import "guang/index"; | ||
157 | -@import "home/index"; | ||
158 | -@import "category/index"; | ||
159 | -@import "product/index"; | ||
160 | -@import "index/index"; | ||
161 | -@import "cart/index"; | ||
162 | -@import "me/index"; //个人中心 |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | .swiper-container { | 15 | .swiper-container { |
16 | padding: pxToRem(30px) 0 pxToRem(20px); | 16 | padding: pxToRem(30px) 0 pxToRem(20px); |
17 | width: 100%; | 17 | width: 100%; |
18 | - height: pxToRem(252px); | 18 | + // height: pxToRem(252px); |
19 | // overflow: hidden; | 19 | // overflow: hidden; |
20 | 20 | ||
21 | .swiper-slide { | 21 | .swiper-slide { |
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | <p class="infos"> | 5 | <p class="infos"> |
6 | 收货地址 | 6 | 收货地址 |
7 | <span class="per-info">{{name}} {{phoneNum}}</span> | 7 | <span class="per-info">{{name}} {{phoneNum}}</span> |
8 | - <span class="address">{{area}} {{address}}</span> | 8 | + <span class="address">{{addressInfo}}</span> |
9 | </p> | 9 | </p> |
10 | <span class="iconfont"></span> | 10 | <span class="iconfont"></span> |
11 | </a> | 11 | </a> |
@@ -46,9 +46,9 @@ | @@ -46,9 +46,9 @@ | ||
46 | <a href="/cart/index/selectCoupon"> | 46 | <a href="/cart/index/selectCoupon"> |
47 | <span class="title">优惠券</span> | 47 | <span class="title">优惠券</span> |
48 | {{# coupon}} | 48 | {{# coupon}} |
49 | - <span class="coupon-count"> | 49 | + <!--<span class="coupon-count"> |
50 | {{count}}张可用 | 50 | {{count}}张可用 |
51 | - </span> | 51 | + </span>--> |
52 | 52 | ||
53 | {{#if couponName}} | 53 | {{#if couponName}} |
54 | <span class="used coupon-use" data-name="{{couponName}}"> | 54 | <span class="used coupon-use" data-name="{{couponName}}"> |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <div class="my-address-page select-address-page yoho-page"> | 2 | <div class="my-address-page select-address-page yoho-page"> |
3 | <div class="page-wrap"> | 3 | <div class="page-wrap"> |
4 | {{# address}} | 4 | {{# address}} |
5 | - <a class="address-item" data-address-id="{{address_id}}" href="/cart/index/orderEnsure"> | 5 | + <a class="address-item" data-address-id="{{address_id}}" data-is-support="{{is_support}}" href="/cart/index/orderEnsure"> |
6 | <span class="name">{{consignee}}</span> | 6 | <span class="name">{{consignee}}</span> |
7 | <span class="tel">{{mobile}}</span> | 7 | <span class="tel">{{mobile}}</span> |
8 | <p class="address-info">{{area}} {{address}}</p> | 8 | <p class="address-info">{{area}} {{address}}</p> |
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | <script id="tmpl-coupon" type="text/tmpl"> | 13 | <script id="tmpl-coupon" type="text/tmpl"> |
14 | \{{#coupons}} | 14 | \{{#coupons}} |
15 | \{{^ notAvailable}} | 15 | \{{^ notAvailable}} |
16 | - <a class="employ-main" data-coupon-code="\{{ couponCode}}" data-coupon-name="\{{ couponDetailInfomation}}" href="/cart/index/orderEnsure"> | 16 | + <a class="employ-main" data-coupon-code="\{{ couponCode}}" data-coupon-name="\{{ couponDetailInfomation}}" href="javascript:void(0);"> |
17 | <span>\{{ couponValue}}</span> | 17 | <span>\{{ couponValue}}</span> |
18 | <p class="coupon-name">\{{ couponDetailInfomation}}</p> | 18 | <p class="coupon-name">\{{ couponDetailInfomation}}</p> |
19 | <p>有效期:\{{ couponValidity}}</p> | 19 | <p>有效期:\{{ couponValidity}}</p> |
@@ -56,13 +56,7 @@ | @@ -56,13 +56,7 @@ | ||
56 | {{/if}} | 56 | {{/if}} |
57 | 57 | ||
58 | <div class="price-compute"> | 58 | <div class="price-compute"> |
59 | - <p> | ||
60 | - <span>总价(¥{{price}})<i>-</i></span> | ||
61 | - <span>活动价(¥{{activityPrice}})</span> | ||
62 | - </p> | ||
63 | - <p> | ||
64 | - <span><i>=</i>商品总计金额 (¥{{sumPrice}})</span> | ||
65 | - </p> | 59 | + <p>{{formulaPrice}}</p> |
66 | </div> | 60 | </div> |
67 | 61 | ||
68 | <div class="balance"> | 62 | <div class="balance"> |
@@ -63,7 +63,7 @@ | @@ -63,7 +63,7 @@ | ||
63 | </div> | 63 | </div> |
64 | </div> | 64 | </div> |
65 | <div class="btn-wrap"> | 65 | <div class="btn-wrap"> |
66 | - <button id="chose-btn-sure" class="btn btn-sure">确定</button> | 66 | + <button id="chose-btn-sure" class="btn btn-sure">加入购物车</button> |
67 | </div> | 67 | </div> |
68 | </div> | 68 | </div> |
69 | </div> | 69 | </div> |
@@ -13,10 +13,10 @@ | @@ -13,10 +13,10 @@ | ||
13 | <img class="thumb lazy" data-original="{{thumb}}"> | 13 | <img class="thumb lazy" data-original="{{thumb}}"> |
14 | </a> | 14 | </a> |
15 | {{#if isAdvanceBuy}} | 15 | {{#if isAdvanceBuy}} |
16 | - <p class="few-tag plus-tag">加价购</p> | 16 | + <p class="few-tag plus-tag"><span>加价购</span></p> |
17 | {{/if}} | 17 | {{/if}} |
18 | {{#if isGift}} | 18 | {{#if isGift}} |
19 | - <p class="few-tag gift-tag">赠品</p> | 19 | + <p class="few-tag gift-tag"><span>赠品</span></p> |
20 | {{/if}} | 20 | {{/if}} |
21 | 21 | ||
22 | <div class="deps show"> | 22 | <div class="deps show"> |
1 | <!-- Google Tag Manager --> | 1 | <!-- Google Tag Manager --> |
2 | <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-W958MG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> | 2 | <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-W958MG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> |
3 | <script> | 3 | <script> |
4 | - (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | ||
5 | - new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | ||
6 | - j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | ||
7 | - '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | ||
8 | - })(window,document,'script','dataLayer','GTM-W958MG'); | ||
9 | -</script> | ||
10 | -<!-- End Google Tag Manager --> | ||
11 | -<script type="text/javascript"> | ||
12 | - var _hmt = _hmt || []; | ||
13 | - (function() { | ||
14 | - var hm = document.createElement("script"); | ||
15 | - hm.src = "//hm.baidu.com/hm.js?c6ee7218b8321cb65fb2e98f284d8311"; | ||
16 | - hm.async = 1; | ||
17 | - var s = document.getElementsByTagName("script")[0]; | ||
18 | - s.parentNode.insertBefore(hm, s); | ||
19 | - })(); | 4 | +var _hmt = _hmt || []; |
5 | +(function() { | ||
6 | + function async_load(){ | ||
7 | + (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | ||
8 | + new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | ||
9 | + j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | ||
10 | + '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | ||
11 | + })(window,document,'script','dataLayer','GTM-W958MG'); | ||
12 | + (function() { | ||
13 | + var hm = document.createElement("script"); | ||
14 | + hm.src = "//hm.baidu.com/hm.js?c6ee7218b8321cb65fb2e98f284d8311"; | ||
15 | + hm.async = 1; | ||
16 | + var s = document.getElementsByTagName("script")[0]; | ||
17 | + s.parentNode.insertBefore(hm, s); | ||
18 | + })(); | ||
19 | + (function() { | ||
20 | + var hm = document.createElement("script"); | ||
21 | + hm.src = "//hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841"; | ||
22 | + hm.async = 1; | ||
23 | + var s = document.getElementsByTagName("script")[0]; | ||
24 | + s.parentNode.insertBefore(hm, s); | ||
25 | + })(); | ||
26 | + (function() { | ||
27 | + var hm = document.createElement("script"); | ||
28 | + hm.src = "http://static.yohobuy.com/js/analytics/analysis.js"; | ||
29 | + hm.async = 1; | ||
30 | + var s = document.getElementsByTagName("script")[0]; | ||
31 | + s.parentNode.insertBefore(hm, s); | ||
32 | + })(); | ||
33 | + } | ||
34 | + window.addEventListener('load', async_load, false); | ||
35 | +})(); | ||
20 | </script> | 36 | </script> |
21 | <script> | 37 | <script> |
22 | - var _hmt = _hmt || []; | ||
23 | - (function() { | ||
24 | - var hm = document.createElement("script"); | ||
25 | - hm.src = "//hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841"; | ||
26 | - hm.async = 1; | ||
27 | - var s = document.getElementsByTagName("script")[0]; | ||
28 | - s.parentNode.insertBefore(hm, s); | ||
29 | - })(); | 38 | + window._py = window._py||[]; |
39 | + window._py.push(['a', 'MC..o8vMMWxEXDCiqYckD81lUX']); | ||
40 | + window._py.push(['domain','stats.ipinyou.com']); | ||
41 | + window._py.push(['e','']); | ||
42 | + if(typeof _goodsData!='undefined'){ | ||
43 | + window._py.push(['pi',_goodsData]); | ||
44 | + } | ||
45 | + -function(d){ | ||
46 | + var f = 'https:' == d.location.protocol;var c = d.createElement('script');c.type='text/javascript';c.async=1; | ||
47 | + c.src=(f ? 'https' : 'http') + '://'+(f?'fm.ipinyou.com':'fm.p0y.cn')+'/j/t/adv.js'; | ||
48 | + var h = d.getElementsByTagName("script")[0];h.parentNode.insertBefore(c, h); | ||
49 | + }(document); | ||
30 | </script> | 50 | </script> |
31 | -<script src="http://static.yohobuy.com/js/analytics/analysis.js" async="async"></script> | ||
32 | -<script src="http://static.yohobuy.com/m/v1/js/om_code.js" async="async"></script> | 51 | +<script src="http://static.yohobuy.com/m/v1/js/om_code.js" async="async"></script> |
@@ -18,8 +18,8 @@ | @@ -18,8 +18,8 @@ | ||
18 | {{#if devEnv}} | 18 | {{#if devEnv}} |
19 | <script src="http://localhost:8000/static/js/sea.js?nowrap"></script> | 19 | <script src="http://localhost:8000/static/js/sea.js?nowrap"></script> |
20 | <script>seajs.config({base: 'http://localhost:8000/'});</script> | 20 | <script>seajs.config({base: 'http://localhost:8000/'});</script> |
21 | -{{/if}} | ||
22 | - {{> layout/use}} | 21 | +{{/if}} |
22 | +{{> layout/use}} | ||
23 | {{> layout/analysis}} | 23 | {{> layout/analysis}} |
24 | </body> | 24 | </body> |
25 | </html> | 25 | </html> |
@@ -55,7 +55,7 @@ class HomeController extends AbstractAction | @@ -55,7 +55,7 @@ class HomeController extends AbstractAction | ||
55 | 'cartUrl' => Helpers::url('/cart/index/index', null), | 55 | 'cartUrl' => Helpers::url('/cart/index/index', null), |
56 | 'signinUrl' => Helpers::url('/signin.html', array('refer' => Helpers::url('/home'))), | 56 | 'signinUrl' => Helpers::url('/signin.html', array('refer' => Helpers::url('/home'))), |
57 | ); | 57 | ); |
58 | - $uid = $this->getUid(false); | 58 | + $uid = $this->getUid(true); |
59 | if ($uid) { | 59 | if ($uid) { |
60 | $data['isLogin'] = true; | 60 | $data['isLogin'] = true; |
61 | $udid = $this->getUdid(); | 61 | $udid = $this->getUdid(); |
@@ -89,7 +89,7 @@ class CartModel | @@ -89,7 +89,7 @@ class CartModel | ||
89 | } | 89 | } |
90 | 90 | ||
91 | // 普通购物车空,则显示预售购物车 | 91 | // 普通购物车空,则显示预售购物车 |
92 | - if ($ordinaryCount === '0' && $ordinaryCount) { | 92 | + if ($ordinaryCount === '0' && $ordinarySoldOut) { |
93 | $result['cartNav'] = false; | 93 | $result['cartNav'] = false; |
94 | $result['cartType'] = 'advance'; | 94 | $result['cartType'] = 'advance'; |
95 | } | 95 | } |
@@ -324,6 +324,12 @@ class CartModel | @@ -324,6 +324,12 @@ class CartModel | ||
324 | 324 | ||
325 | $pay = CartData::cartPay($uid, $cartType); | 325 | $pay = CartData::cartPay($uid, $cartType); |
326 | 326 | ||
327 | + // 商品为空返回 | ||
328 | + if (!$pay || empty($pay['data']['goods_list'])) { | ||
329 | + $result['cartUrl'] = Helpers::url('/cart/index/index'); | ||
330 | + return $result; | ||
331 | + } | ||
332 | + | ||
327 | if ($pay && isset($pay['code']) && $pay['code'] === 200) { | 333 | if ($pay && isset($pay['code']) && $pay['code'] === 200) { |
328 | $payReturn = $pay['data']; | 334 | $payReturn = $pay['data']; |
329 | $address = array(); | 335 | $address = array(); |
@@ -335,8 +341,8 @@ class CartModel | @@ -335,8 +341,8 @@ class CartModel | ||
335 | } | 341 | } |
336 | 342 | ||
337 | // 根据地址id查询地址信息 | 343 | // 根据地址id查询地址信息 |
338 | - if (isset($orderInfo['addressId'])) { | ||
339 | - $address = UserModel::getAddressDataById($uid, $orderInfo['addressId']); | 344 | + if (isset($orderInfo['address'])) { |
345 | + $address = $orderInfo['address']; | ||
340 | } | 346 | } |
341 | 347 | ||
342 | // 收货人有关信息 | 348 | // 收货人有关信息 |
@@ -344,8 +350,8 @@ class CartModel | @@ -344,8 +350,8 @@ class CartModel | ||
344 | $result['addressId'] = isset($address['address_id']) ? $address['address_id'] : $payReturn['delivery_address']['address_id']; | 350 | $result['addressId'] = isset($address['address_id']) ? $address['address_id'] : $payReturn['delivery_address']['address_id']; |
345 | $result['name'] = isset($address['consignee']) ? $address['consignee'] : $payReturn['delivery_address']['consignee']; | 351 | $result['name'] = isset($address['consignee']) ? $address['consignee'] : $payReturn['delivery_address']['consignee']; |
346 | $result['phoneNum'] = isset($address['mobile']) ? $address['mobile'] : $payReturn['delivery_address']['mobile']; | 352 | $result['phoneNum'] = isset($address['mobile']) ? $address['mobile'] : $payReturn['delivery_address']['mobile']; |
347 | - $result['area'] = isset($address['area']) ? $address['area'] : $payReturn['delivery_address']['area']; | ||
348 | - $result['address'] = isset($address['address']) ? $address['address'] : $payReturn['delivery_address']['address']; | 353 | +// $result['area'] = isset($address['area']) ? $address['area'] : $payReturn['delivery_address']['area']; |
354 | + $result['addressInfo'] = isset($address['address_info']) ? $address['address_info'] : $payReturn['delivery_address']['area'] . ' ' . $payReturn['delivery_address']['address']; | ||
349 | $isSupport = isset($address['is_support']) ? $address['is_support'] : $payReturn['delivery_address']['is_support']; | 355 | $isSupport = isset($address['is_support']) ? $address['is_support'] : $payReturn['delivery_address']['is_support']; |
350 | $result['isSupport'] = $isSupport === 'Y'; | 356 | $result['isSupport'] = $isSupport === 'Y'; |
351 | } | 357 | } |
@@ -477,9 +483,10 @@ class CartModel | @@ -477,9 +483,10 @@ class CartModel | ||
477 | isset($orderInfo['msg']) && $result['msg'] = $orderInfo['msg']; | 483 | isset($orderInfo['msg']) && $result['msg'] = $orderInfo['msg']; |
478 | 484 | ||
479 | // 优惠券数据 | 485 | // 优惠券数据 |
480 | - $coupons = array(); | ||
481 | - !empty($orderCompute['coupon_amount']) && $coupons['couponName'] = $orderInfo['couponName']; | ||
482 | - $coupons += self::getCouponList($uid, true); | 486 | + $coupons = array('couponName' => ''); |
487 | + if (!empty($orderCompute['coupon_amount'])) { | ||
488 | + $coupons['couponName'] = $orderInfo['couponName']; | ||
489 | + } | ||
483 | $result['coupon'] = $coupons; | 490 | $result['coupon'] = $coupons; |
484 | } | 491 | } |
485 | 492 | ||
@@ -553,11 +560,10 @@ class CartModel | @@ -553,11 +560,10 @@ class CartModel | ||
553 | do { | 560 | do { |
554 | if (isset($coupons['data']['couponList'])) { | 561 | if (isset($coupons['data']['couponList'])) { |
555 | foreach ($coupons['data']['couponList'] as $val) { | 562 | foreach ($coupons['data']['couponList'] as $val) { |
556 | - $notAvailableRes = self::searchCoupon($uid, $val['couponCode']); | 563 | + // $notAvailableRes = self::searchCoupon($uid, $val['couponCode']); |
557 | // 处理可用的优惠券 | 564 | // 处理可用的优惠券 |
558 | - if ($val['isValidity'] === 'N' || (isset($notAvailableRes['code']) && $notAvailableRes['code'] !== 200)) { | 565 | + if ($val['isValidity'] === 'N') { |
559 | $val['notAvailable'] = true; | 566 | $val['notAvailable'] = true; |
560 | - // continue; | ||
561 | } | 567 | } |
562 | $result[] = $val; | 568 | $result[] = $val; |
563 | } | 569 | } |
@@ -788,8 +794,9 @@ class CartModel | @@ -788,8 +794,9 @@ class CartModel | ||
788 | } | 794 | } |
789 | 795 | ||
790 | // 结算数据 | 796 | // 结算数据 |
791 | - $result['price'] = Helpers::transPrice($data['shopping_cart_data']['order_amount']); | ||
792 | - $result['activityPrice'] = Helpers::transPrice($data['shopping_cart_data']['discount_amount']); | 797 | + $result['formulaPrice'] = $data['shopping_cart_data']['promotion_formula']; |
798 | + /*$result['price'] = Helpers::transPrice($data['shopping_cart_data']['order_amount']); | ||
799 | + $result['activityPrice'] = Helpers::transPrice($data['shopping_cart_data']['discount_amount']);*/ | ||
793 | $result['count'] = $data['shopping_cart_data']['selected_goods_count']; | 800 | $result['count'] = $data['shopping_cart_data']['selected_goods_count']; |
794 | $result['isAllSelected'] = ($data['shopping_cart_data']['goods_count'] === $data['shopping_cart_data']['selected_goods_count']) && ($data['shopping_cart_data']['selected_goods_count'] >0); | 801 | $result['isAllSelected'] = ($data['shopping_cart_data']['goods_count'] === $data['shopping_cart_data']['selected_goods_count']) && ($data['shopping_cart_data']['selected_goods_count'] >0); |
795 | $result['sumPrice'] = Helpers::transPrice($data['shopping_cart_data']['last_order_amount']); | 802 | $result['sumPrice'] = Helpers::transPrice($data['shopping_cart_data']['last_order_amount']); |
@@ -284,22 +284,17 @@ class IndexController extends AbstractAction | @@ -284,22 +284,17 @@ class IndexController extends AbstractAction | ||
284 | $orderInfo = json_decode($cookieData, true); | 284 | $orderInfo = json_decode($cookieData, true); |
285 | $cartType = $orderInfo['cartType']; | 285 | $cartType = $orderInfo['cartType']; |
286 | } | 286 | } |
287 | - $cartKey = 'commonCart'; | ||
288 | - if ($cartType === 'advance') { | ||
289 | - $cartKey = 'preSellCart'; | ||
290 | - } | ||
291 | 287 | ||
292 | - $shoppingKey = Helpers::getShoppingKeyByCookie(); | ||
293 | $uid = $this->getUid(true); | 288 | $uid = $this->getUid(true); |
294 | - $cartGoods = CartModel::getCartData($uid, $shoppingKey); | ||
295 | - if (isset($cartGoods['isEmptyCart']) || empty($cartGoods[$cartKey])) { | ||
296 | - $this->go(Helpers::url('/cart/index/index')); | 289 | + $order = CartModel::cartPay($uid, $cartType, $orderInfo); |
290 | + if (isset($order['cartUrl'])) { | ||
291 | + $this->go($order['cartUrl']); | ||
297 | } | 292 | } |
298 | 293 | ||
299 | $data = array( | 294 | $data = array( |
300 | 'orderEnsurePage' => true, | 295 | 'orderEnsurePage' => true, |
301 | 'isOrdinaryCart' => ($cartType !== 'advance'), | 296 | 'isOrdinaryCart' => ($cartType !== 'advance'), |
302 | - 'orderEnsure' => CartModel::cartPay($uid, $cartType, $orderInfo) | 297 | + 'orderEnsure' => $order |
303 | ); | 298 | ); |
304 | 299 | ||
305 | $this->_view->display('order-ensure', $data); | 300 | $this->_view->display('order-ensure', $data); |
@@ -17,6 +17,9 @@ class LoginController extends AbstractAction | @@ -17,6 +17,9 @@ class LoginController extends AbstractAction | ||
17 | */ | 17 | */ |
18 | public function indexAction() | 18 | public function indexAction() |
19 | { | 19 | { |
20 | + // 设置登录有效时间30分钟, 防机器刷 | ||
21 | + $this->setSession('_LOGIN_EXPIRE', time() + 1800); | ||
22 | + | ||
20 | // 清除客户端 | 23 | // 清除客户端 |
21 | $this->setCookie('_UID', ''); | 24 | $this->setCookie('_UID', ''); |
22 | $this->setCookie('_TOKEN', ''); | 25 | $this->setCookie('_TOKEN', ''); |
@@ -51,6 +54,9 @@ class LoginController extends AbstractAction | @@ -51,6 +54,9 @@ class LoginController extends AbstractAction | ||
51 | */ | 54 | */ |
52 | public function internationalAction() | 55 | public function internationalAction() |
53 | { | 56 | { |
57 | + // 设置登录有效时间30分钟, 防机器刷 | ||
58 | + $this->setSession('_LOGIN_EXPIRE', time() + 1800); | ||
59 | + | ||
54 | $refer = $this->get('refer'); | 60 | $refer = $this->get('refer'); |
55 | if (!empty($refer)) { | 61 | if (!empty($refer)) { |
56 | $this->setCookie('refer', $refer); | 62 | $this->setCookie('refer', $refer); |
@@ -80,6 +86,7 @@ class LoginController extends AbstractAction | @@ -80,6 +86,7 @@ class LoginController extends AbstractAction | ||
80 | $this->setCookie('_SPK', ''); | 86 | $this->setCookie('_SPK', ''); |
81 | // 清除服务端会话 | 87 | // 清除服务端会话 |
82 | $this->setSession('_TOKEN', ''); | 88 | $this->setSession('_TOKEN', ''); |
89 | + $this->setSession('_LOGIN_UID', ''); | ||
83 | 90 | ||
84 | $refer = $this->server('HTTP_REFERER', SITE_MAIN); | 91 | $refer = $this->server('HTTP_REFERER', SITE_MAIN); |
85 | $token = $this->get('token'); | 92 | $token = $this->get('token'); |
@@ -123,6 +130,12 @@ class LoginController extends AbstractAction | @@ -123,6 +130,12 @@ class LoginController extends AbstractAction | ||
123 | break; | 130 | break; |
124 | } | 131 | } |
125 | 132 | ||
133 | + /* 设置登录有效时间30分钟, 防机器刷 */ | ||
134 | + $expire = $this->getSession('_LOGIN_EXPIRE'); | ||
135 | + if (empty($expire) || $expire < time()) { | ||
136 | + break; | ||
137 | + } | ||
138 | + | ||
126 | /* 调用登录接口进行登录 */ | 139 | /* 调用登录接口进行登录 */ |
127 | // 获取未登录时的唯一识别码 | 140 | // 获取未登录时的唯一识别码 |
128 | $shoppingKey = Helpers::getShoppingKeyByCookie(); | 141 | $shoppingKey = Helpers::getShoppingKeyByCookie(); |
@@ -143,6 +156,7 @@ class LoginController extends AbstractAction | @@ -143,6 +156,7 @@ class LoginController extends AbstractAction | ||
143 | $token = Helpers::makeToken($data['data']['uid']); | 156 | $token = Helpers::makeToken($data['data']['uid']); |
144 | $this->setCookie('_TOKEN', $token); | 157 | $this->setCookie('_TOKEN', $token); |
145 | $this->setSession('_TOKEN', $token); | 158 | $this->setSession('_TOKEN', $token); |
159 | + $this->setSession('_LOGIN_UID', $data['data']['uid']); | ||
146 | } while (false); | 160 | } while (false); |
147 | 161 | ||
148 | $this->echoJson($data); | 162 | $this->echoJson($data); |
@@ -211,8 +225,9 @@ class LoginController extends AbstractAction | @@ -211,8 +225,9 @@ class LoginController extends AbstractAction | ||
211 | 225 | ||
212 | if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { | 226 | if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { |
213 | $token = Helpers::makeToken($result['data']['uid']); | 227 | $token = Helpers::makeToken($result['data']['uid']); |
214 | - $this->setCookie('_TOKEN', $token); | ||
215 | $this->setSession('_TOKEN', $token); | 228 | $this->setSession('_TOKEN', $token); |
229 | + $this->setSession('_LOGIN_UID', $result['data']['uid']); | ||
230 | + $this->setCookie('_TOKEN', $token); | ||
216 | $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); | 231 | $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); |
217 | } else { | 232 | } else { |
218 | $this->go($refer); | 233 | $this->go($refer); |
@@ -248,8 +263,9 @@ class LoginController extends AbstractAction | @@ -248,8 +263,9 @@ class LoginController extends AbstractAction | ||
248 | 263 | ||
249 | if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { | 264 | if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { |
250 | $token = Helpers::makeToken($result['data']['uid']); | 265 | $token = Helpers::makeToken($result['data']['uid']); |
251 | - $this->setCookie('_TOKEN', $token); | ||
252 | $this->setSession('_TOKEN', $token); | 266 | $this->setSession('_TOKEN', $token); |
267 | + $this->setSession('_LOGIN_UID', $result['data']['uid']); | ||
268 | + $this->setCookie('_TOKEN', $token); | ||
253 | $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); | 269 | $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); |
254 | } else { | 270 | } else { |
255 | $this->go($refer); | 271 | $this->go($refer); |
@@ -285,8 +301,9 @@ class LoginController extends AbstractAction | @@ -285,8 +301,9 @@ class LoginController extends AbstractAction | ||
285 | 301 | ||
286 | if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { | 302 | if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { |
287 | $token = Helpers::makeToken($result['data']['uid']); | 303 | $token = Helpers::makeToken($result['data']['uid']); |
288 | - $this->setCookie('_TOKEN', $token); | ||
289 | $this->setSession('_TOKEN', $token); | 304 | $this->setSession('_TOKEN', $token); |
305 | + $this->setSession('_LOGIN_UID', $result['data']['uid']); | ||
306 | + $this->setCookie('_TOKEN', $token); | ||
290 | $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); | 307 | $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); |
291 | } else { | 308 | } else { |
292 | $this->go($refer); | 309 | $this->go($refer); |
@@ -50,7 +50,7 @@ application.template.ext = ".phtml" | @@ -50,7 +50,7 @@ application.template.ext = ".phtml" | ||
50 | application.assets.path = ROOT_PATH "/assets" | 50 | application.assets.path = ROOT_PATH "/assets" |
51 | 51 | ||
52 | ; 应用的版本号 | 52 | ; 应用的版本号 |
53 | -application.version = "1.2.6" | 53 | +application.version = "1.2.7" |
54 | 54 | ||
55 | ; 网站SEO信息 | 55 | ; 网站SEO信息 |
56 | application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停" | 56 | application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停" |
@@ -50,7 +50,7 @@ application.template.ext = ".phtml" | @@ -50,7 +50,7 @@ application.template.ext = ".phtml" | ||
50 | application.assets.path = ROOT_PATH "/assets" | 50 | application.assets.path = ROOT_PATH "/assets" |
51 | 51 | ||
52 | ; 应用的版本号 | 52 | ; 应用的版本号 |
53 | -application.version = "1.2.6" | 53 | +application.version = "1.2.7" |
54 | 54 | ||
55 | ; 网站SEO信息 | 55 | ; 网站SEO信息 |
56 | application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停" | 56 | application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停" |
@@ -50,7 +50,7 @@ application.template.ext = ".phtml" | @@ -50,7 +50,7 @@ application.template.ext = ".phtml" | ||
50 | application.assets.path = ROOT_PATH "/assets" | 50 | application.assets.path = ROOT_PATH "/assets" |
51 | 51 | ||
52 | ; 应用的版本号 | 52 | ; 应用的版本号 |
53 | -application.version = "1.2.6" | 53 | +application.version = "1.2.7" |
54 | 54 | ||
55 | ; 网站SEO信息 | 55 | ; 网站SEO信息 |
56 | application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停" | 56 | application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停" |
@@ -50,7 +50,7 @@ application.template.ext = ".phtml" | @@ -50,7 +50,7 @@ application.template.ext = ".phtml" | ||
50 | application.assets.path = ROOT_PATH "/assets" | 50 | application.assets.path = ROOT_PATH "/assets" |
51 | 51 | ||
52 | ; 应用的版本号 | 52 | ; 应用的版本号 |
53 | -application.version = "1.2.6" | 53 | +application.version = "1.2.7" |
54 | 54 | ||
55 | ; 网站SEO信息 | 55 | ; 网站SEO信息 |
56 | application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停" | 56 | application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停" |
-
Please register or login to post a comment