Authored by hf

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

@@ -11,8 +11,9 @@ var $ = require('jquery'), @@ -11,8 +11,9 @@ var $ = require('jquery'),
11 11
12 var swiper, 12 var swiper,
13 $fixTitleBar, 13 $fixTitleBar,
14 - $brandList = $('.brand-list');  
15 -var $icon = $('.search-icon'); 14 + $brandList = $('.brand-list'),
  15 + $icon = $('.search-icon'),
  16 + hotBrandsSwiper;
16 17
17 var searchH = $('.newbrand-search').outerHeight(), 18 var searchH = $('.newbrand-search').outerHeight(),
18 headerH = $('.yoho-header').outerHeight(), 19 headerH = $('.yoho-header').outerHeight(),
@@ -23,6 +24,14 @@ var brandsData, @@ -23,6 +24,14 @@ var brandsData,
23 $keyword, 24 $keyword,
24 clearTextHammer; 25 clearTextHammer;
25 26
  27 +//热门品牌滑动
  28 +hotBrandsSwiper = new Swiper('.brands-swiper', {
  29 + grabCursor: true,
  30 + slidesPerView: 'auto',
  31 + wrapperClass: 'brands-list',
  32 + slideElement: 'li'
  33 +});
  34 +
26 swiper = new Swiper('.swiper-container', { 35 swiper = new Swiper('.swiper-container', {
27 lazyLoading: true, 36 lazyLoading: true,
28 loop: true, 37 loop: true,
@@ -37,12 +46,16 @@ $('.yoho-header').css({ @@ -37,12 +46,16 @@ $('.yoho-header').css({
37 top: 0 46 top: 0
38 }); 47 });
39 48
  49 +if ($('.banner-top').length > 0) {
  50 + $('.hot-brands').css('padding-top', '0');
  51 +}
  52 +
40 $fixTitleBar = $('<div class="title-bar fixed-title-bar"><h2></h2></div>'); 53 $fixTitleBar = $('<div class="title-bar fixed-title-bar"><h2></h2></div>');
41 $fixTitleBar.css({ 54 $fixTitleBar.css({
42 position: 'fixed', 55 position: 'fixed',
43 top: brandSwipe 56 top: brandSwipe
44 }).hide(); 57 }).hide();
45 -minBrandListTop = brandSwipe + $('.hot-brand').outerHeight() + $('.banner-top').outerHeight(); 58 +minBrandListTop = brandSwipe + $('.hot-brands').outerHeight() + $('.banner-top').outerHeight();
46 $brandList.last().append($fixTitleBar); 59 $brandList.last().append($fixTitleBar);
47 60
48 function scrollHandler() { 61 function scrollHandler() {
@@ -5,12 +5,14 @@ @@ -5,12 +5,14 @@
5 */ 5 */
6 var $ = require('jquery'), 6 var $ = require('jquery'),
7 Swiper = require('yoho.iswiper'), 7 Swiper = require('yoho.iswiper'),
  8 + Hammer = require('yoho.hammer'),
8 lazyLoad = require('yoho.lazyload'); 9 lazyLoad = require('yoho.lazyload');
9 10
10 var goodsSwiper, 11 var goodsSwiper,
11 $discountFolder = $('.goodsDiscount .discount-folder'), 12 $discountFolder = $('.goodsDiscount .discount-folder'),
12 $discountArrow = $('.goodsDiscount .first-item span'); 13 $discountArrow = $('.goodsDiscount .first-item span');
13 14
  15 +var goodsDiscountHammer = new Hammer(document.getElementById('goodsDiscount'));
14 16
15 require('./desc'); 17 require('./desc');
16 require('./comments-consults'); 18 require('./comments-consults');
@@ -38,7 +40,7 @@ if (0 === $('.goodsDiscount .discount-folder').children().length) { @@ -38,7 +40,7 @@ if (0 === $('.goodsDiscount .discount-folder').children().length) {
38 } 40 }
39 41
40 //goods-discount下拉按钮点击事件 42 //goods-discount下拉按钮点击事件
41 -$('.goodsDiscount').on('touchend', function(e) { 43 +goodsDiscountHammer.on('tap', function(e) {
42 if ($discountFolder.is(':hidden')) { 44 if ($discountFolder.is(':hidden')) {
43 $discountArrow.removeClass('icon-down').addClass('icon-up').html('&#xe608;'); 45 $discountArrow.removeClass('icon-down').addClass('icon-up').html('&#xe608;');
44 $discountFolder.slideDown(); 46 $discountFolder.slideDown();
@@ -46,7 +48,7 @@ $('.goodsDiscount').on('touchend', function(e) { @@ -46,7 +48,7 @@ $('.goodsDiscount').on('touchend', function(e) {
46 $discountArrow.removeClass('icon-up').addClass('icon-down').html('&#xe609;'); 48 $discountArrow.removeClass('icon-up').addClass('icon-down').html('&#xe609;');
47 $discountFolder.slideUp(); 49 $discountFolder.slideUp();
48 } 50 }
49 -  
50 return false; 51 return false;
51 }); 52 });
  53 +
52 require('./like'); 54 require('./like');
@@ -12,8 +12,46 @@ var page = 1, @@ -12,8 +12,46 @@ var page = 1,
12 notab = 0, 12 notab = 0,
13 sort = '', 13 sort = '',
14 id = '', 14 id = '',
  15 + hotrankNav,
15 noResult = '<p class="no-result">未找到相关搜索结果</p>'; 16 noResult = '<p class="no-result">未找到相关搜索结果</p>';
16 17
  18 +// var renderRank = {
  19 +// errMsg: '<p class="no-result">未找到相关搜索结果</p>',
  20 +// navSelector: '.goods-nav',
  21 +// rankSelector: '#hotRank',
  22 +// navHTML: null,
  23 +// data: null,
  24 +// inited: 0,
  25 +// setData: function(data) {
  26 +// this.data = data;
  27 +// },
  28 +// showDataEmptyMsg: function() {
  29 +// $(this.rankSelector).append(this.errMsg);
  30 +// },
  31 +// isDataEmpty: function() {
  32 +// if (this.data.indexOf('>') === -1) {
  33 +// return true;
  34 +// } else {
  35 +// return false;
  36 +// }
  37 +// },
  38 +// appendData: function() {
  39 +// if (!this.inited) {
  40 +// this.inited = 1;
  41 +// }
  42 +// $(this.rankSelector).append(this.data);
  43 +// },
  44 +// render: function(data) {
  45 +// this.setData(data);
  46 +// if (!this.isDataEmpty()) {
  47 +// this.appendData();
  48 +// } else {
  49 +// this.showDataEmptyMsg();
  50 +// }
  51 +// }
  52 +
  53 +// };
  54 +
17 function hotrank(page, sort, tabId, notab) { 55 function hotrank(page, sort, tabId, notab) {
18 loading.showLoadingMask(); 56 loading.showLoadingMask();
19 $.ajax({ 57 $.ajax({
@@ -26,15 +64,47 @@ function hotrank(page, sort, tabId, notab) { @@ -26,15 +64,47 @@ function hotrank(page, sort, tabId, notab) {
26 notab: notab 64 notab: notab
27 }, 65 },
28 success: function(data) { 66 success: function(data) {
29 - console.log(data);  
30 - if (page === 1) {  
31 - $('.rank-main').remove();  
32 - }  
33 - if (data === ' ' && $('.rank-main ul li').length < 1) {  
34 - $('#hotRank').html(noResult); 67 +
  68 + // if (page === 1) {
  69 + // $('.no-result').remove();
  70 + // $('.rank-main').remove();
  71 + // }
  72 +
  73 + // if (notab === 1) {
  74 + // if (data === ' ' && $('.rank-main').length < 1) {
  75 + // var hotrankNav = $('.goods-nav').prop("outerHTML");
  76 +
  77 + // $('#hotRank').html(hotrankNav + noResult);
  78 + // } else {
  79 + // $('#hotRank').append(data);
  80 + // }
  81 + // } else {
  82 + // if (data === ' ') {
  83 + // $('#hotRank').html(noResult);
  84 + // } else {
  85 + // $('#hotRank').append(data);
  86 + // }
  87 + // }
  88 + if (data === ' ') {
  89 + if ($('.rank-main').length < 1 && $('.goods-nav').length < 1) {
  90 + $('#hotRank').html(noResult);
  91 + } else {
  92 + if (page === 1) {
  93 + hotrankNav = $('.goods-nav').prop('outerHTML');
  94 +
  95 + $('#hotRank').html(hotrankNav + noResult);
  96 + }
  97 + }
35 } else { 98 } else {
  99 + $('.no-result').remove();
  100 + $('.rank-main').remove();
36 $('#hotRank').append(data); 101 $('#hotRank').append(data);
37 } 102 }
  103 +
  104 + // renderRank.render(data);
  105 +
  106 +
  107 +
38 lazyLoad($('img.lazy')); 108 lazyLoad($('img.lazy'));
39 $('.rank-main ul li:gt(2)').find('.item-content i').removeClass('top'); 109 $('.rank-main ul li:gt(2)').find('.item-content i').removeClass('top');
40 winH = $(window).height(); 110 winH = $(window).height();
@@ -83,7 +153,11 @@ hotnav.on('tap', function(e) { @@ -83,7 +153,11 @@ hotnav.on('tap', function(e) {
83 id = target.getAttribute('data-id') ? target.getAttribute('data-id') : ''; 153 id = target.getAttribute('data-id') ? target.getAttribute('data-id') : '';
84 sort = target.getAttribute('data-sort') ? target.getAttribute('data-sort') : ''; 154 sort = target.getAttribute('data-sort') ? target.getAttribute('data-sort') : '';
85 page = 1; 155 page = 1;
  156 +
  157 + // notab = renderRank.inited;
86 notab = 1; 158 notab = 1;
  159 +
  160 +
87 hotrank(page, sort, id, notab); 161 hotrank(page, sort, id, notab);
88 } 162 }
89 }); 163 });
@@ -75,6 +75,10 @@ @@ -75,6 +75,10 @@
75 background-color:#f8f8f8; 75 background-color:#f8f8f8;
76 } 76 }
77 77
  78 + .hot-brands {
  79 + padding-top: 178rem / $pxConvertRem;
  80 + }
  81 +
78 .hot-brand { 82 .hot-brand {
79 margin: (30rem / $pxConvertRem) 0 0; 83 margin: (30rem / $pxConvertRem) 0 0;
80 84
@@ -64,7 +64,7 @@ @@ -64,7 +64,7 @@
64 {{/vipLevel}} 64 {{/vipLevel}}
65 65
66 {{# goodsDiscount}} 66 {{# goodsDiscount}}
67 - <div class="goodsDiscount"> 67 + <div class="goodsDiscount" id="goodsDiscount">
68 {{# list}} 68 {{# list}}
69 {{#if @first}} 69 {{#if @first}}
70 {{#if text}} 70 {{#if text}}
@@ -602,9 +602,8 @@ class HomeController extends AbstractAction @@ -602,9 +602,8 @@ class HomeController extends AbstractAction
602 //显示网站导航头部信息 602 //显示网站导航头部信息
603 $this->setNavHeader('会员等级'); 603 $this->setNavHeader('会员等级');
604 604
605 - $gender = Helpers::getGenderByCookie();  
606 $channel = Helpers::getChannelByCookie(); 605 $channel = Helpers::getChannelByCookie();
607 - $data = GradeModel::getGrade($gender, $channel, $this->_uid); 606 + $data = GradeModel::getGrade($channel, $this->_uid);
608 $data['pageFooter'] = true; 607 $data['pageFooter'] = true;
609 608
610 $this->_view->display('vip-grade', $data); 609 $this->_view->display('vip-grade', $data);
@@ -237,7 +237,7 @@ class UserModel @@ -237,7 +237,7 @@ class UserModel
237 $product = array(); 237 $product = array();
238 foreach ($val['new_product'] as $one) { 238 foreach ($val['new_product'] as $one) {
239 $product = array(); 239 $product = array();
240 - $product['link'] = isset($val['goodsId']) ? Helpers::url('/product/pro_' . $val['product_id'] . '_' . $val['goodsId'] . '/' . $val['cnAlphabet'] . '.html') : ''; 240 + $product['link'] = isset($val['goodsList'][0]) ? Helpers::url('/product/pro_' . $val['product_id'] . '_' . $val['goodsList'][0]['id'] . '/' . $val['cnAlphabet'] . '.html') : '';
241 $product['imgUrl'] = (isset($one['default_images']) && !empty($one['default_images'])) ? Images::getImageUrl($one['default_images'], 235, 314) : ''; 241 $product['imgUrl'] = (isset($one['default_images']) && !empty($one['default_images'])) ? Images::getImageUrl($one['default_images'], 235, 314) : '';
242 $product['price'] = !empty($one['market_price']) ? '¥' . $one['market_price'] : 0; 242 $product['price'] = !empty($one['market_price']) ? '¥' . $one['market_price'] : 0;
243 $product['discount'] = !empty($one['sales_price']) ? '¥' . $one['sales_price'] : 0; 243 $product['discount'] = !empty($one['sales_price']) ? '¥' . $one['sales_price'] : 0;
@@ -23,16 +23,16 @@ class NewsaleModel @@ -23,16 +23,16 @@ class NewsaleModel
23 /* 男生频道取新品到着及折扣专区数据的位置码 */ 23 /* 男生频道取新品到着及折扣专区数据的位置码 */
24 24
25 const CODE_TOP_NEW_BOYS = '3cf2c1be5217fbab6009ce83959e1e12'; 25 const CODE_TOP_NEW_BOYS = '3cf2c1be5217fbab6009ce83959e1e12';
26 - const CODE_TOP_SALE_BOYS = '153180b9a88c0b565848850c523bb637'; 26 + const CODE_TOP_SALE_BOYS = 'e9c9be32d72e2906d404a72ee24cb523';
27 /* 女生频道取新品到着及折扣专区数据的位置码 */ 27 /* 女生频道取新品到着及折扣专区数据的位置码 */
28 const CODE_TOP_NEW_GIRLS = '1cf7f9f10e2a2670e73d05c568793ad9'; 28 const CODE_TOP_NEW_GIRLS = '1cf7f9f10e2a2670e73d05c568793ad9';
29 - const CODE_TOP_SALE_GIRLS = '0b2d133419a0f7c381306fd3522365e1'; 29 + const CODE_TOP_SALE_GIRLS = '785c0e6aab746949073c4ffb9d5106ac';
30 /* 潮童频道取新品到着及折扣专区数据的位置码 */ 30 /* 潮童频道取新品到着及折扣专区数据的位置码 */
31 const CODE_TOP_NEW_KIDS = '57457adececa6c748b29c90cad0ae940'; 31 const CODE_TOP_NEW_KIDS = '57457adececa6c748b29c90cad0ae940';
32 - const CODE_TOP_SALE_KIDS = 'de23648d28ee1e8a3f087a9dbac506f8'; 32 + const CODE_TOP_SALE_KIDS = 'ad1bb67a6007819c86f737d74172fd2e';
33 /* 创意生活频道取新品到着及折扣专区数据的位置码 */ 33 /* 创意生活频道取新品到着及折扣专区数据的位置码 */
34 const CODE_TOP_NEW_LIFESTYLE = '04953a61cbf1db426a681e55d496d2fe'; 34 const CODE_TOP_NEW_LIFESTYLE = '04953a61cbf1db426a681e55d496d2fe';
35 - const CODE_TOP_SALE_LIFESTYLE = '01269e498ff5b07756e0733ec0e88c75'; 35 + const CODE_TOP_SALE_LIFESTYLE = '8132c7db3adbeb7b0d0002de9691c753';
36 36
37 /** 37 /**
38 * 获取新品到着的焦点图资源数据 38 * 获取新品到着的焦点图资源数据