Authored by Rock Zhang

更新到201512031204静态资源

@@ -123,6 +123,20 @@ function rePosFooter() { @@ -123,6 +123,20 @@ function rePosFooter() {
123 } 123 }
124 } 124 }
125 125
  126 +/**
  127 + *
  128 + * add extra margin-bottom for footer to show yoho copyright when there is fixed bottom element on page
  129 + * @param {String} The jquery selecor of the fixed bottom element
  130 + * @return undefined
  131 + */
  132 +function reMarginFooter(fixedElement) {
  133 + var fixedElH = $(fixedElement).outerHeight();
  134 +
  135 + if (fixedElement) {
  136 + $footer.css('margin-bottom', fixedElH + 'px');
  137 + }
  138 +}
  139 +
126 //页面通用底部位置及status设置 140 //页面通用底部位置及status设置
127 (function() { 141 (function() {
128 var $op = $footer.children('.op-row'); 142 var $op = $footer.children('.op-row');
@@ -231,6 +245,8 @@ window.getShoppingKey = getShoppingKey; @@ -231,6 +245,8 @@ window.getShoppingKey = getShoppingKey;
231 245
232 window.rePosFooter = rePosFooter; 246 window.rePosFooter = rePosFooter;
233 247
  248 +window.reMarginFooter = reMarginFooter;
  249 +
234 }); 250 });
235 define("js/category/entry", ["jquery","hammer","swiper","lazyload","index"], function(require, exports, module){ 251 define("js/category/entry", ["jquery","hammer","swiper","lazyload","index"], function(require, exports, module){
236 /** 252 /**
@@ -1592,7 +1608,7 @@ $('.overlay').on('touchstart', function(e) { @@ -1592,7 +1608,7 @@ $('.overlay').on('touchstart', function(e) {
1592 }); 1608 });
1593 1609
1594 //点击一级导航,弹出二级导航 1610 //点击一级导航,弹出二级导航
1595 -$sideNav.on('touchstart', 'li', function (e) { 1611 +$sideNav.on('touchstart', 'li', function(e) {
1596 if ($(this).find('.sub-nav').size() > 0) { 1612 if ($(this).find('.sub-nav').size() > 0) {
1597 $('.sub-nav').removeClass('show'); 1613 $('.sub-nav').removeClass('show');
1598 $(this).find('.sub-nav').addClass('show'); 1614 $(this).find('.sub-nav').addClass('show');
@@ -1605,8 +1621,8 @@ $sideNav.on('touchstart', 'li', function (e) { @@ -1605,8 +1621,8 @@ $sideNav.on('touchstart', 'li', function (e) {
1605 }); 1621 });
1606 1622
1607 //返回一级导航,收起二级导航 1623 //返回一级导航,收起二级导航
1608 -$subNav.each(function () {  
1609 - $(this).find('li').eq(0).on('touchstart', function (e) { 1624 +$subNav.each(function() {
  1625 + $(this).find('li').eq(0).on('touchstart', function(e) {
1610 $('.sub-nav').removeClass('show'); 1626 $('.sub-nav').removeClass('show');
1611 e.stopPropagation(); 1627 e.stopPropagation();
1612 return false; 1628 return false;
@@ -1668,7 +1684,7 @@ if ($('.trend-topic-swiper').find('li').size() > 1) { @@ -1668,7 +1684,7 @@ if ($('.trend-topic-swiper').find('li').size() > 1) {
1668 } 1684 }
1669 1685
1670 //潮流上装/经典裤装等轮播 1686 //潮流上装/经典裤装等轮播
1671 -$('.category-swiper').each(function (i, index) { 1687 +$('.category-swiper').each(function(i, index) {
1672 swiperClass = 'category-swiper' + i; 1688 swiperClass = 'category-swiper' + i;
1673 $(this).addClass(swiperClass); 1689 $(this).addClass(swiperClass);
1674 if ($('.' + swiperClass).find('.swiper-slide').size() > 1) { 1690 if ($('.' + swiperClass).find('.swiper-slide').size() > 1) {
@@ -1684,7 +1700,7 @@ $('.category-swiper').each(function (i, index) { @@ -1684,7 +1700,7 @@ $('.category-swiper').each(function (i, index) {
1684 }); 1700 });
1685 1701
1686 //logo动画 1702 //logo动画
1687 -requestFrame = (function () { 1703 +requestFrame = (function() {
1688 var tempFunc = null, 1704 var tempFunc = null,
1689 prefixList = ['webkit', 'moz', 'ms']; 1705 prefixList = ['webkit', 'moz', 'ms'];
1690 1706
@@ -1697,11 +1713,11 @@ requestFrame = (function () { @@ -1697,11 +1713,11 @@ requestFrame = (function () {
1697 } 1713 }
1698 1714
1699 if (supportCss3) { 1715 if (supportCss3) {
1700 - return function (callback) { 1716 + return function(callback) {
1701 window[tempFunc](callback); 1717 window[tempFunc](callback);
1702 }; 1718 };
1703 } 1719 }
1704 - return function (callback) { 1720 + return function(callback) {
1705 window.setTimeout(callback, 67); 1721 window.setTimeout(callback, 67);
1706 }; 1722 };
1707 })(); 1723 })();
@@ -1728,7 +1744,7 @@ function tsAnimate() { @@ -1728,7 +1744,7 @@ function tsAnimate() {
1728 if (start % 360 === 0) { 1744 if (start % 360 === 0) {
1729 window.setTimeout(tsAnimate, 60 * 1000); 1745 window.setTimeout(tsAnimate, 60 * 1000);
1730 } else { 1746 } else {
1731 - requestFrame(function () { 1747 + requestFrame(function() {
1732 tsAnimate(); 1748 tsAnimate();
1733 }); 1749 });
1734 } 1750 }
@@ -1744,9 +1760,7 @@ $('.home-header .iconfont').on('touchstart', function() { @@ -1744,9 +1760,7 @@ $('.home-header .iconfont').on('touchstart', function() {
1744 }); 1760 });
1745 1761
1746 // 底部留出tab 的高度 1762 // 底部留出tab 的高度
1747 -$('#yoho-footer').css({  
1748 - 'margin-bottom': '2.5rem'  
1749 -}); 1763 +window.reMarginFooter('.footer-tab');
1750 1764
1751 //set cookie 1765 //set cookie
1752 exports.set = function(c) { 1766 exports.set = function(c) {
@@ -1755,6 +1769,7 @@ exports.set = function(c) { @@ -1755,6 +1769,7 @@ exports.set = function(c) {
1755 domain: '.m.yohobuy.com' 1769 domain: '.m.yohobuy.com'
1756 }); 1770 });
1757 }; 1771 };
  1772 +
1758 }); 1773 });
1759 define("js/home/maybe-like", ["jquery","hammer","lazyload"], function(require, exports, module){ 1774 define("js/home/maybe-like", ["jquery","hammer","lazyload"], function(require, exports, module){
1760 /** 1775 /**
@@ -3762,7 +3777,7 @@ var opt = {}; @@ -3762,7 +3777,7 @@ var opt = {};
3762 3777
3763 var paramStr = window.location.search.split('?')[1]; 3778 var paramStr = window.location.search.split('?')[1];
3764 3779
3765 -var keyVal = paramStr.split('&'); 3780 +var keyVal = paramStr ? paramStr.split('&') : [];
3766 3781
3767 var i, key, val; 3782 var i, key, val;
3768 3783
@@ -3773,52 +3788,25 @@ for (i = keyVal.length; i > 0; i--) { @@ -3773,52 +3788,25 @@ for (i = keyVal.length; i > 0; i--) {
3773 key = key[0]; 3788 key = key[0];
3774 3789
3775 //初始化默认参数 3790 //初始化默认参数
3776 - switch (key) {  
3777 - case 'gender':  
3778 - opt.gender = val;  
3779 - break;  
3780 - case 'brand':  
3781 - opt.brand = val;  
3782 - break;  
3783 - case 'sort':  
3784 - opt.sort = val;  
3785 - break;  
3786 - case 'msort':  
3787 - opt.msort = val;  
3788 - break;  
3789 - case 'misort':  
3790 - opt.misort = val;  
3791 - break;  
3792 - case 'color':  
3793 - opt.color = val;  
3794 - break;  
3795 - case 'size':  
3796 - opt.size = val;  
3797 - break;  
3798 - case 'price':  
3799 - opt.price = val;  
3800 - break;  
3801 - case 'discount': 3791 + opt[key] = val;
  3792 +
  3793 + //discount = p_d,同时需要两个参数
  3794 + if (key === 'discount' || key === 'p_d') {
3802 opt.discount = val; 3795 opt.discount = val;
3803 - break;  
3804 - case 'query':  
3805 - opt.query = val;  
3806 - break;  
3807 - case 'style':  
3808 - opt.style = val;  
3809 - break;  
3810 - case 'limit':  
3811 - opt.limit = val;  
3812 - break;  
3813 - case 'channel':  
3814 - opt.channel = val;  
3815 - break;  
3816 - case 'p_d':  
3817 opt.p_d = val; 3796 opt.p_d = val;
  3797 + }
  3798 +}
  3799 +
  3800 +if (typeof opt.gender === 'undefined') {
  3801 + switch (window.cookie('_Channel')) {
  3802 + case 'boys':
  3803 + opt.gender = '1,3';
3818 break; 3804 break;
3819 - case 'dayLimit':  
3820 - opt.dayLimit = val; 3805 + case 'girls':
  3806 + opt.gender = '2,3';
3821 break; 3807 break;
  3808 + default:
  3809 + opt.gender = '1,2,3';
3822 } 3810 }
3823 } 3811 }
3824 3812
@@ -4698,7 +4686,8 @@ var goodsSwiper, @@ -4698,7 +4686,8 @@ var goodsSwiper,
4698 require("js/product/detail/desc"); 4686 require("js/product/detail/desc");
4699 require("js/product/detail/comments-consults"); 4687 require("js/product/detail/comments-consults");
4700 4688
4701 - 4689 +//add extra marign-bottom for footer to show the yoho copyright
  4690 +window.reMarginFooter('.cart-bar');
4702 4691
4703 lazyLoad($('img.lazy')); 4692 lazyLoad($('img.lazy'));
4704 4693
@@ -4730,6 +4719,7 @@ $('.goodsDiscount .dropdown').on('click', function() { @@ -4730,6 +4719,7 @@ $('.goodsDiscount .dropdown').on('click', function() {
4730 } 4719 }
4731 }); 4720 });
4732 require("js/product/detail/like"); 4721 require("js/product/detail/like");
  4722 +
4733 }); 4723 });
4734 define("js/product/detail/desc", ["jquery","lazyload","swiper","index"], function(require, exports, module){ 4724 define("js/product/detail/desc", ["jquery","lazyload","swiper","index"], function(require, exports, module){
4735 /** 4725 /**
@@ -5359,7 +5349,7 @@ var $navLi = $('#fav-tab > li'), @@ -5359,7 +5349,7 @@ var $navLi = $('#fav-tab > li'),
5359 $brandLoadMore = $('.fav-brand-load-more'), 5349 $brandLoadMore = $('.fav-brand-load-more'),
5360 winH = $(window).height(), 5350 winH = $(window).height(),
5361 $favProductList = $('.fav-product-list'), 5351 $favProductList = $('.fav-product-list'),
5362 - $favBrandList = $('.fav-brand-swiper'), 5352 + $favBrandList = $('.fav-brand-swiper-wrapper'),
5363 pageId = 1, 5353 pageId = 1,
5364 brandPageId = 1, //收藏品牌的当前页数 5354 brandPageId = 1, //收藏品牌的当前页数
5365 lockId = true, 5355 lockId = true,
@@ -5703,7 +5693,7 @@ $likeBtn.bind('click', function() { @@ -5703,7 +5693,7 @@ $likeBtn.bind('click', function() {
5703 }).then(function(data) { 5693 }).then(function(data) {
5704 if (data.code === 200) { 5694 if (data.code === 200) {
5705 $that.closest('.suggest-type').removeClass('show'); 5695 $that.closest('.suggest-type').removeClass('show');
5706 - $('.suggest-good').addClass('show'); 5696 + $that.closest('.suggest-item').find('.suggest-good').addClass('show');
5707 } 5697 }
5708 }).fail(function(data) { 5698 }).fail(function(data) {
5709 5699
@@ -5730,7 +5720,7 @@ $disLikeBtn.bind('click', function() { @@ -5730,7 +5720,7 @@ $disLikeBtn.bind('click', function() {
5730 }).then(function(data) { 5720 }).then(function(data) {
5731 if (data.code === 200) { 5721 if (data.code === 200) {
5732 $that.closest('.suggest-type').removeClass('show'); 5722 $that.closest('.suggest-type').removeClass('show');
5733 - $('.suggest-bad').addClass('show'); 5723 + $that.closest('.suggest-item').find('.suggest-bad').addClass('show');
5734 } 5724 }
5735 }).fail(function(data) { 5725 }).fail(function(data) {
5736 5726
@@ -6668,7 +6658,7 @@ function couponAJAX(statu, page) { @@ -6668,7 +6658,7 @@ function couponAJAX(statu, page) {
6668 url: '/home/couponData', 6658 url: '/home/couponData',
6669 dataType: 'html', 6659 dataType: 'html',
6670 data: { 6660 data: {
6671 - statu: statu, 6661 + status: statu,
6672 page: page 6662 page: page
6673 }, 6663 },
6674 success: function(data) { 6664 success: function(data) {
@@ -6765,6 +6755,7 @@ $confim.on('touchend', '.cancel', function() { @@ -6765,6 +6755,7 @@ $confim.on('touchend', '.cancel', function() {
6765 $confim.hide(); 6755 $confim.hide();
6766 }).on('touchend', '.confim', function() { 6756 }).on('touchend', '.confim', function() {
6767 loading.showLoadingMask(); 6757 loading.showLoadingMask();
  6758 + $confim.hide();
6768 $.ajax({ 6759 $.ajax({
6769 method: 'POST', 6760 method: 'POST',
6770 url: '/home/delAddress', 6761 url: '/home/delAddress',
@@ -6777,15 +6768,15 @@ $confim.on('touchend', '.cancel', function() { @@ -6777,15 +6768,15 @@ $confim.on('touchend', '.cancel', function() {
6777 } 6768 }
6778 if (res.code !== 200) { 6769 if (res.code !== 200) {
6779 tip.show(res.message || '网络出了点问题~'); 6770 tip.show(res.message || '网络出了点问题~');
  6771 + loading.hideLoadingMask();
6780 } else { 6772 } else {
6781 window.location.reload(); 6773 window.location.reload();
6782 } 6774 }
6783 }).fail(function() { 6775 }).fail(function() {
6784 tip.show('网络出了点问题~'); 6776 tip.show('网络出了点问题~');
  6777 + loading.hideLoadingMask();
6785 }).always(function() { 6778 }).always(function() {
6786 deleteId = null; 6779 deleteId = null;
6787 - $confim.hide();  
6788 - loading.hideLoadingMask();  
6789 }); 6780 });
6790 }); 6781 });
6791 6782
@@ -6819,7 +6810,6 @@ $submit.on('touchend', function() { @@ -6819,7 +6810,6 @@ $submit.on('touchend', function() {
6819 $(this).removeClass('highlight'); 6810 $(this).removeClass('highlight');
6820 }); 6811 });
6821 6812
6822 -  
6823 }); 6813 });
6824 define("js/me/browse-record", ["jquery","lazyload","handlebars","source-map","hammer"], function(require, exports, module){ 6814 define("js/me/browse-record", ["jquery","lazyload","handlebars","source-map","hammer"], function(require, exports, module){
6825 /** 6815 /**
@@ -6957,11 +6947,12 @@ var $addressForm = $('.edit-address'), @@ -6957,11 +6947,12 @@ var $addressForm = $('.edit-address'),
6957 $submit = $('.submit'), 6947 $submit = $('.submit'),
6958 $editAddressPage = $('.my-edit-address-page'), 6948 $editAddressPage = $('.my-edit-address-page'),
6959 $addressListPage = $('.my-address-list-page'), 6949 $addressListPage = $('.my-address-list-page'),
6960 - $area = $('.area'),  
6961 $footer = $('#yoho-footer'), 6950 $footer = $('#yoho-footer'),
6962 $backBtn = $('.nav-back'), 6951 $backBtn = $('.nav-back'),
6963 $navTitle = $('.nav-title'), 6952 $navTitle = $('.nav-title'),
  6953 + $input = $('input, textarea'),
6964 navTitle = $navTitle.html(), 6954 navTitle = $navTitle.html(),
  6955 + $area = $('.area'),
6965 isSubmiting, 6956 isSubmiting,
6966 currentPage = 'edit', 6957 currentPage = 'edit',
6967 newArea = []; 6958 newArea = [];
@@ -6984,7 +6975,7 @@ $backBtn.on('touchend', function(e) { @@ -6984,7 +6975,7 @@ $backBtn.on('touchend', function(e) {
6984 6975
6985 // 恢复默认的三级选择 6976 // 恢复默认的三级选择
6986 $addressListPage.hide(); 6977 $addressListPage.hide();
6987 - $addressListPage.find('ul').hide(); 6978 + $addressListPage.find('ul').hide().find('li').removeClass('highlight');
6988 $addressListPage.children('ul').show().children('li').show(); 6979 $addressListPage.children('ul').show().children('li').show();
6989 newArea = []; 6980 newArea = [];
6990 } else { 6981 } else {
@@ -7045,6 +7036,7 @@ $addressForm.on('submit', function() { @@ -7045,6 +7036,7 @@ $addressForm.on('submit', function() {
7045 }); 7036 });
7046 7037
7047 $submit.on('touchend', function() { 7038 $submit.on('touchend', function() {
  7039 + $input.blur();
7048 $addressForm.submit(); 7040 $addressForm.submit();
7049 return false; 7041 return false;
7050 }).on('touchstart', function() { 7042 }).on('touchstart', function() {
@@ -7053,35 +7045,47 @@ $submit.on('touchend', function() { @@ -7053,35 +7045,47 @@ $submit.on('touchend', function() {
7053 $(this).removeClass('highlight'); 7045 $(this).removeClass('highlight');
7054 }); 7046 });
7055 7047
7056 -// 省市区  
7057 -$area.on('touchend', function() { 7048 +$input.on('focus', function() {
  7049 + $footer.hide();
  7050 +}).on('blur', function() {
  7051 + $footer.show();
  7052 +});
  7053 +
  7054 +// 省市区列表异步加载
  7055 +$.get('/home/locationList').then(function(html) {
  7056 + $addressListPage.html(html);
  7057 +
  7058 + // 省市区
  7059 + $area.on('touchend', function() {
7058 $editAddressPage.hide(); 7060 $editAddressPage.hide();
7059 $addressListPage.show(1, function() { 7061 $addressListPage.show(1, function() {
7060 $footer.hide(); 7062 $footer.hide();
7061 }); 7063 });
7062 currentPage = 'list'; 7064 currentPage = 'list';
7063 $navTitle.html('地区选择'); 7065 $navTitle.html('地区选择');
7064 -}); 7066 + });
7065 7067
7066 -// touchend 在下滑的时候会触发  
7067 -// 省市区联动  
7068 -$addressListPage.find('.address').each(function(i, elem) { 7068 + // touchend 在下滑的时候会触发
  7069 + // 省市区联动
  7070 + $addressListPage.find('.address').each(function(i, elem) {
7069 var addressHammer = new Hammer(elem); 7071 var addressHammer = new Hammer(elem);
7070 7072
7071 addressHammer.on('tap', function(e) { 7073 addressHammer.on('tap', function(e) {
7072 var $this = $(e.target); 7074 var $this = $(e.target);
7073 7075
  7076 + if (e.target.tagName !== 'li') {
  7077 + $this = $this.parent('li');
  7078 + }
7074 newArea.push($this.children('.caption').text()); 7079 newArea.push($this.children('.caption').text());
7075 $this.siblings().hide(); 7080 $this.siblings().hide();
7076 $this.children('ul').show().children('li').show(); 7081 $this.children('ul').show().children('li').show();
7077 7082
7078 - $(this).removeClass('highlight');  
7079 e.srcEvent.preventDefault(); 7083 e.srcEvent.preventDefault();
7080 e.srcEvent.stopPropagation(); 7084 e.srcEvent.stopPropagation();
7081 }); 7085 });
7082 -}); 7086 + });
7083 7087
7084 -$addressListPage.find('.address-last').each(function(i, elem) { 7088 + $addressListPage.find('.address-last').each(function(i, elem) {
7085 var addressLastHammer = new Hammer(elem); 7089 var addressLastHammer = new Hammer(elem);
7086 7090
7087 addressLastHammer.on('tap', function(e) { 7091 addressLastHammer.on('tap', function(e) {
@@ -7099,25 +7103,22 @@ $addressListPage.find('.address-last').each(function(i, elem) { @@ -7099,25 +7103,22 @@ $addressListPage.find('.address-last').each(function(i, elem) {
7099 7103
7100 // 恢复默认的三级选择 7104 // 恢复默认的三级选择
7101 $addressListPage.hide(); 7105 $addressListPage.hide();
7102 - $addressListPage.find('ul').hide(); 7106 + $addressListPage.find('ul').hide().find('li').removeClass('highlight');
7103 $addressListPage.children('ul').show().children('li').show(); 7107 $addressListPage.children('ul').show().children('li').show();
7104 newArea = []; 7108 newArea = [];
7105 7109
7106 e.srcEvent.preventDefault(); 7110 e.srcEvent.preventDefault();
7107 e.srcEvent.stopPropagation(); 7111 e.srcEvent.stopPropagation();
7108 }); 7112 });
7109 -}); 7113 + });
7110 7114
7111 -$addressListPage.on('touchstart', 'li', function() { 7115 + $addressListPage.on('touchstart', 'li', function() {
7112 $(this).addClass('highlight'); 7116 $(this).addClass('highlight');
7113 -}).on('touchend touchcancel', 'li', function() { 7117 + }).on('touchend touchcancel', 'li', function() {
7114 $(this).removeClass('highlight'); 7118 $(this).removeClass('highlight');
7115 -});  
7116 -  
7117 -$('input, textarea').on('focus', function() {  
7118 - $footer.hide();  
7119 -}).on('blur', function() {  
7120 - $footer.show(); 7119 + });
  7120 +}).fail(function() {
  7121 + tip.show('获取省市区列表失败');
7121 }); 7122 });
7122 7123
7123 }); 7124 });
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.