Authored by hf

Merge remote-tracking branch 'origin/develop' into test

framework @ 119c247f
1 -Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2 1 +Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05
@@ -14,11 +14,11 @@ class Helpers @@ -14,11 +14,11 @@ class Helpers
14 * 备注:所有的URL构建都尽量使用该方法,便于以后维护. 14 * 备注:所有的URL构建都尽量使用该方法,便于以后维护.
15 * 15 *
16 * @param string $uri 如 "/passport/reg/index" 16 * @param string $uri 如 "/passport/reg/index"
17 - * @param array $param 参数项 array(key1 => value1, key2 => value2,) 17 + * @param array $param 参数项 array(key1 => value1, key2 => value2,),默认为array()
18 * @param string $module 模块名 如"index"表示默认, "guang"表示逛,"list"表示商品列表,"search"表示搜索 18 * @param string $module 模块名 如"index"表示默认, "guang"表示逛,"list"表示商品列表,"search"表示搜索
19 * @return string 19 * @return string
20 */ 20 */
21 - public static function url($uri, $param, $module = 'index') 21 + public static function url($uri, $param = array(), $module = 'index')
22 { 22 {
23 $url = ''; 23 $url = '';
24 24
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 */ 5 */
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 - Hammer = require('hammer'), 8 + Hammer = require('yoho.hammer'),
9 Swiper = require('yoho.iswiper'), 9 Swiper = require('yoho.iswiper'),
10 lazyLoad = require('yoho.lazyload'); 10 lazyLoad = require('yoho.lazyload');
11 11
@@ -52,11 +52,60 @@ if ($brandList.length > 0) { @@ -52,11 +52,60 @@ if ($brandList.length > 0) {
52 }); 52 });
53 } 53 }
54 54
55 -myHammer = new Hammer($('#right-bar .con').find('b').unbind()[0]);  
56 -myHammer.on('tap', function(e) {  
57 - var index = $(this).index(); 55 +if ($('#right-bar .con').find('b').unbind()[0]) {
  56 + myHammer = new Hammer($('#right-bar .con').find('b').unbind()[0]);
  57 + myHammer.on('tap', function(e) {
  58 + var index = $(this).index();
58 59
59 - if ($('.bar-' + index).size() > 0) {  
60 - document.body.scrollTop = parseInt($('.bar-' + index)[0].offsetTop) - parseInt(brandSwipe - 1);  
61 - } 60 + if ($('.bar-' + index).size() > 0) {
  61 + document.body.scrollTop = parseInt($('.bar-' + index)[0].offsetTop) - parseInt(brandSwipe - 1);
  62 + }
  63 + });
  64 +}
  65 +
  66 +function searchResult(type) {
  67 + var keyword = $('#keyword').val(),
  68 + gender = $('#gender').val();
  69 +
  70 + $.get('/brands/search', {
  71 + keyword: keyword,
  72 + gender: gender,
  73 + type: type
  74 + }, function(html) {
  75 + $('.search-result').html(html);
  76 +
  77 + });
  78 +}
  79 +
  80 +$('#keyword').on('keyup', function() {
  81 + searchResult(0);
  82 +}).on('keydown', function() {
  83 + $(this).closest('.search-box').css('width', '11.25rem');
  84 + $('.search-action').show();
  85 +}).on('blur', function() {
  86 + $(this).closest('.search-box').css('width', '12.5rem');
  87 + $('.search-action').hide();
  88 +});
  89 +
  90 +$('#search-btn').on('tap', function() {
  91 + searchResult(1);
  92 +});
  93 +
  94 +$('.clear-text').on('tap', function() {
  95 + $('#keyword').val('').trigger('input');
  96 +});
  97 +
  98 +$('form.search-box').on('submit', function() {
  99 + return false;
  100 +});
  101 +
  102 +$('.clear-history').on('tap', function() {
  103 +
  104 + // setcookie('h_brands', '', {
  105 + // expire: -1,
  106 + // path: '/',
  107 + // domain: '.m.yohobuy.com'
  108 + // });
  109 + $('#history-keyword').remove();
  110 + $(this).hide();
62 }); 111 });
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 */ 5 */
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 - Hammer = require('hammer'); 8 + Hammer = require('yoho.hammer');
9 9
10 var $nav = $('.category-nav'), 10 var $nav = $('.category-nav'),
11 $categoryContainer = $('.category-container'), 11 $categoryContainer = $('.category-container'),
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 */ 5 */
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 - Hammer = require('hammer'), 8 + Hammer = require('yoho.hammer'),
9 Swiper = require('yoho.iswiper'); 9 Swiper = require('yoho.iswiper');
10 10
11 var info = require('./info'), 11 var info = require('./info'),
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 */ 5 */
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 - Hammer = require('hammer'), 8 + Hammer = require('yoho.hammer'),
9 ellipsis = require('mlellipsis'), 9 ellipsis = require('mlellipsis'),
10 lazyLoad = require('yoho.lazyload'); 10 lazyLoad = require('yoho.lazyload');
11 11
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 */ 5 */
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 - Hammer = require('hammer'), 8 + Hammer = require('yoho.hammer'),
9 ellipsis = require('mlellipsis'), 9 ellipsis = require('mlellipsis'),
10 lazyLoad = require('yoho.lazyload'); 10 lazyLoad = require('yoho.lazyload');
11 11
@@ -85,7 +85,9 @@ likeHammer.on('tap', function(e) { @@ -85,7 +85,9 @@ likeHammer.on('tap', function(e) {
85 success: function(data) { 85 success: function(data) {
86 if (data.code === 200) { 86 if (data.code === 200) {
87 $this.toggleClass('like'); 87 $this.toggleClass('like');
88 - } else if (data.code === 400) { 88 + } else if (data.code === 400 || data.code === 412) {
  89 +
  90 + //code:412 用户ID不正确,即未登录
89 tip.show('未登录'); 91 tip.show('未登录');
90 } else { 92 } else {
91 tip.show(data.message); 93 tip.show(data.message);
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 */ 5 */
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 - Hammer = require('hammer'), 8 + Hammer = require('yoho.hammer'),
9 lazyLoad = require('yoho.lazyload'), 9 lazyLoad = require('yoho.lazyload'),
10 Swiper = require('yoho.iswiper'); 10 Swiper = require('yoho.iswiper');
11 11
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 * @date: 2015/10/12 4 * @date: 2015/10/12
5 */ 5 */
6 var $ = require('jquery'), 6 var $ = require('jquery'),
7 - Hammer = require('hammer'), 7 + Hammer = require('yoho.hammer'),
8 Swiper = require('yoho.iswiper'), 8 Swiper = require('yoho.iswiper'),
9 lazyLoad = require('yoho.lazyload'), 9 lazyLoad = require('yoho.lazyload'),
10 $mobileWrap = $('.mobile-wrap'), 10 $mobileWrap = $('.mobile-wrap'),
@@ -45,6 +45,7 @@ navHammer.on('tap', function(event) { @@ -45,6 +45,7 @@ navHammer.on('tap', function(event) {
45 }); 45 });
46 46
47 event.srcEvent.stopPropagation(); 47 event.srcEvent.stopPropagation();
  48 + return false;
48 }); 49 });
49 50
50 mobileWrapHammer = new Hammer($('.mobile-wrap')[0]); 51 mobileWrapHammer = new Hammer($('.mobile-wrap')[0]);
@@ -62,11 +63,12 @@ mobileWrapHammer.on('tap', function(e) { @@ -62,11 +63,12 @@ mobileWrapHammer.on('tap', function(e) {
62 $('.overlay').hide(); 63 $('.overlay').hide();
63 }, 300); 64 }, 300);
64 e.srcEvent.stopPropagation(); 65 e.srcEvent.stopPropagation();
  66 + return false;
65 } 67 }
66 }); 68 });
67 69
68 //点击一级导航,弹出二级导航 70 //点击一级导航,弹出二级导航
69 -$sideNav.on('touchstart', 'li', function () { 71 +$sideNav.on('touchend', 'li', function () {
70 if ($(this).find('.sub-nav').size() > 0) { 72 if ($(this).find('.sub-nav').size() > 0) {
71 $('.sub-nav').removeClass('show'); 73 $('.sub-nav').removeClass('show');
72 $(this).find('.sub-nav').addClass('show'); 74 $(this).find('.sub-nav').addClass('show');
@@ -75,10 +77,12 @@ $sideNav.on('touchstart', 'li', function () { @@ -75,10 +77,12 @@ $sideNav.on('touchstart', 'li', function () {
75 77
76 //返回一级导航,收起二级导航 78 //返回一级导航,收起二级导航
77 $('.sub-nav').each(function () { 79 $('.sub-nav').each(function () {
78 - $(this).find('li').eq(0).on('touchstart', function (e) { 80 + $(this).find('li').eq(0).on('touchend', function (e) {
79 $('.sub-nav').removeClass('show'); 81 $('.sub-nav').removeClass('show');
80 - e.stopPropagation(); 82 + return false;
81 }); 83 });
  84 +}).on('touchend', function() {
  85 + $('.sub-nav').find('li').removeClass('current');
82 }); 86 });
83 87
84 //头部banner轮播 88 //头部banner轮播
@@ -5,10 +5,12 @@ @@ -5,10 +5,12 @@
5 */ 5 */
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
  8 + Hammer = require('yoho.hammer'),
8 tip = require('../plugin/tip'), 9 tip = require('../plugin/tip'),
9 lazyLoad = require('yoho.lazyload'); 10 lazyLoad = require('yoho.lazyload');
10 11
11 -var winH = $(window).height(), 12 +var navHammer,
  13 + winH = $(window).height(),
12 loadMoreH = $('#load-more').height(), 14 loadMoreH = $('#load-more').height(),
13 $goodList = $('#goods-list'), 15 $goodList = $('#goods-list'),
14 loading = false, 16 loading = false,
@@ -35,91 +37,101 @@ if (kidsType) { @@ -35,91 +37,101 @@ if (kidsType) {
35 37
36 $curNav = $navList.children('.focus'); 38 $curNav = $navList.children('.focus');
37 39
38 -$('#maybe-like-nav').delegate('li', 'tap', function() {  
39 - var $this = $(this),  
40 - $goods = $('.goods-list'),  
41 - $content; 40 +if (lifestyleType) {
  41 + navHammer = new Hammer($navList[0]);
  42 + navHammer.on('tap', function(e) {
  43 + var $this = $(e.target).closest('li'),
  44 + $goods = $('.goods-list'),
  45 + $content;
42 46
  47 + if ($this.hasClass('focus')) {
  48 + return;
  49 + }
43 50
44 - if ($this.hasClass('focus')) {  
45 - return;  
46 - } 51 + index = $this.index();
47 52
48 - index = $this.index(); 53 + $this.addClass('focus');
  54 + $curNav.removeClass('focus');
49 55
50 - $this.addClass('focus');  
51 - $curNav.removeClass('focus'); 56 + $goods.not('.hide').addClass('hide');
  57 + $content = $goods.eq(index);
  58 + $content.removeClass('hide');
52 59
53 - $goods.not('.hide').addClass('hide');  
54 - $content = $goods.eq(index);  
55 - $content.removeClass('hide'); 60 + $curNav = $this;
56 61
57 - $curNav = $this; 62 + $(document).trigger('scroll'); //Trigger lazyLoad
  63 + });
  64 +}
58 65
59 - $(document).trigger('scroll'); //Trigger lazyLoad  
60 -});  
61 66
62 -//srcoll to load more  
63 -$(window).scroll(function () {  
64 - if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH - 50) {  
65 - if (loading) {  
66 - return;  
67 - }  
68 - loading = true;  
69 -  
70 - //num = $goodList.find('.good-info').length;  
71 - $.ajax({  
72 - type: 'GET',  
73 - url: url,  
74 - data: {  
75 - page: page + 1  
76 - },  
77 - success: function(data) {  
78 - if (data === ' ') {  
79 - loading = true;  
80 - if (gender) {  
81 - if (gender === '1,3') {  
82 - url = '/boys/bottomBanner';  
83 - } else {  
84 - url = '/girls/bottomBanner';  
85 - }  
86 - $.ajax({  
87 - type: 'GET',  
88 - url: url,  
89 - success: function(data) {  
90 - if (data && data[0] && data[0].banner[0]) {  
91 - $('#load-more-img').show();  
92 - $('#load-more-img a').attr('url', data[0].banner[0].url);  
93 - $('#load-more-img a > img').attr('src', data[0].banner[0].img);  
94 - }  
95 - },  
96 - error: function() { 67 +function search() {
  68 + if (loading) {
  69 + return;
  70 + }
  71 + loading = true;
  72 +
  73 + //num = $goodList.find('.good-info').length;
  74 + $.ajax({
  75 + type: 'GET',
  76 + url: url,
  77 + data: {
  78 + page: page + 1
  79 + },
  80 + success: function(data) {
  81 + if (data === ' ') {
  82 + loading = true;
  83 + if (gender) {
  84 + if (gender === '1,3') {
  85 + url = '/boys/bottomBanner';
  86 + } else {
  87 + url = '/girls/bottomBanner';
  88 + }
  89 + $.ajax({
  90 + type: 'GET',
  91 + url: url,
  92 + success: function(data) {
  93 + if (data) {
  94 + $('#load-more-img').show();
  95 + $('#load-more-img a').attr('href', data.url);
  96 + $('#load-more-img a > img').attr('src', data.img);
97 } 97 }
98 - }); 98 + },
  99 + error: function() {
  100 + }
  101 + });
99 102
100 - }  
101 - return;  
102 } 103 }
  104 + return;
  105 + }
103 106
104 - num = $goodList.find('.good-info').length;  
105 -  
106 - $goodList.append(data); 107 + num = $goodList.find('.good-info').length;
107 108
108 - // 2015/10/31 fei.hong: 修复第一页分页不显示图片的问题  
109 - if (num === 0) {  
110 - lazyLoad($goodList.find('.good-info').find('img.lazy'));  
111 - } else {  
112 - lazyLoad($goodList.find('.good-info:gt(' + (num - 1) + ')').find('img.lazy'));  
113 - } 109 + $goodList.append(data);
114 110
115 - loading = false;  
116 - page++;  
117 - },  
118 - error: function() {  
119 - tip.show('网络断开连接了~');  
120 - loading = false; 111 + // 2015/10/31 fei.hong: 修复第一页分页不显示图片的问题
  112 + if (num === 0) {
  113 + lazyLoad($goodList.find('.good-info').find('img.lazy'));
  114 + } else {
  115 + lazyLoad($goodList.find('.good-info:gt(' + (num - 1) + ')').find('img.lazy'));
121 } 116 }
122 - });  
123 - }  
124 117
  118 + loading = false;
  119 + page++;
  120 + },
  121 + error: function() {
  122 + tip.show('网络断开连接了~');
  123 + loading = false;
  124 + }
  125 + });
  126 +}
  127 +
  128 +$('.maybe-like p').on('touchstart', function (e) {
  129 + search();
  130 +});
  131 +
  132 +//srcoll to load more
  133 +$(window).scroll(function () {
  134 + if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH - 50) {
  135 + search();
  136 + }
125 }); 137 });
@@ -39,16 +39,6 @@ $searchBox.find('.clear-text').click(function () { @@ -39,16 +39,6 @@ $searchBox.find('.clear-text').click(function () {
39 $searchBox.find('input').val('').trigger('focus'); 39 $searchBox.find('input').val('').trigger('focus');
40 }); 40 });
41 41
42 -// clearTextHammer = new Hammer($searchBox.find('.clear-text')[0]);  
43 -// clearTextHammer.on('tap', function(e) {  
44 -// $searchBox.find('input').val('').trigger('focus');  
45 -// });  
46 -  
47 $searchBox.find('.search-icon').click(function () { 42 $searchBox.find('.search-icon').click(function () {
48 $indexSearch.submit(); 43 $indexSearch.submit();
49 -});  
50 -  
51 -// searchIconHammer = new Hammer($searchBox.find('.search-icon')[0]);  
52 -// searchIconHammer.on('tap', function(e) {  
53 -// $indexSearch.submit();  
54 -// });  
  44 +});
@@ -5,4 +5,5 @@ @@ -5,4 +5,5 @@
5 */ 5 */
6 6
7 require('./search'); 7 require('./search');
8 -require('./footer');  
  8 +require('./footer');
  9 +require('./channel');
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 */ 5 */
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 - Hammer = require('hammer'); 8 + Hammer = require('yoho.hammer');
9 9
10 var floatLayerCloseHammer, floatLayerBtnHammer; 10 var floatLayerCloseHammer, floatLayerBtnHammer;
11 11
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 */ 5 */
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 - Hammer = require('hammer'); 8 + Hammer = require('yoho.hammer');
9 9
10 var $input = $('#search-input input'); 10 var $input = $('#search-input input');
11 11
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 */ 6 */
7 7
8 var $ = require('jquery'), 8 var $ = require('jquery'),
9 - Hammer = require('hammer'); 9 + Hammer = require('yoho.hammer');
10 10
11 var $filter; 11 var $filter;
12 12
@@ -17,13 +17,6 @@ var missStatus; //是否忽略选中状态 @@ -17,13 +17,6 @@ var missStatus; //是否忽略选中状态
17 //隐藏筛选界面 17 //隐藏筛选界面
18 function hideFilter() { 18 function hideFilter() {
19 $filter.addClass('hide'); 19 $filter.addClass('hide');
20 -  
21 - if (missStatus) {  
22 -  
23 - //重置一级筛选项选中状态  
24 - $filter.find('.classify-item.active').removeClass('active');  
25 - $filter.find('.classify-item:first-child').addClass('active');  
26 - }  
27 } 20 }
28 21
29 //显示筛选界面 22 //显示筛选界面
@@ -31,6 +24,7 @@ function showFilter() { @@ -31,6 +24,7 @@ function showFilter() {
31 $filter.removeClass('hide'); 24 $filter.removeClass('hide');
32 } 25 }
33 26
  27 +//主筛选项Tap事件句柄
34 function classifyTapEvt($this) { 28 function classifyTapEvt($this) {
35 if ($this.hasClass('active')) { 29 if ($this.hasClass('active')) {
36 return; 30 return;
@@ -41,9 +35,8 @@ function classifyTapEvt($this) { @@ -41,9 +35,8 @@ function classifyTapEvt($this) {
41 $this.addClass('active'); 35 $this.addClass('active');
42 } 36 }
43 37
44 -function subClassifyTapEvt($this) {  
45 - var id = $this.data('id');  
46 - 38 +//子筛选项选中处理
  39 +function setSubClassify($this) {
47 var $sub = $this.closest('.sub-classify'); 40 var $sub = $this.closest('.sub-classify');
48 41
49 var $shower = $sub.siblings('.shower'); 42 var $shower = $sub.siblings('.shower');
@@ -72,6 +65,17 @@ function subClassifyTapEvt($this) { @@ -72,6 +65,17 @@ function subClassifyTapEvt($this) {
72 $shower.removeClass('default'); 65 $shower.removeClass('default');
73 } 66 }
74 67
  68 + return $sub;
  69 +}
  70 +
  71 +//子筛选项Tap句柄
  72 +function subClassifyTapEvt($this) {
  73 + var id = $this.data('id');
  74 +
  75 + var $sub;
  76 +
  77 + $sub = setSubClassify($this);
  78 +
75 if (fCbFn) { 79 if (fCbFn) {
76 fCbFn({ 80 fCbFn({
77 type: $sub.data('type'), 81 type: $sub.data('type'),
@@ -80,12 +84,6 @@ function subClassifyTapEvt($this) { @@ -80,12 +84,6 @@ function subClassifyTapEvt($this) {
80 } 84 }
81 85
82 hideFilter(); 86 hideFilter();
83 -  
84 - //重置选中状态  
85 - if (missStatus) {  
86 - $this.removeClass('chosed');  
87 - $sub.children(':first-child').addClass('chosed');  
88 - }  
89 } 87 }
90 88
91 //初始化筛选 89 //初始化筛选
@@ -133,8 +131,25 @@ function initFilter(opt) { @@ -133,8 +131,25 @@ function initFilter(opt) {
133 }); 131 });
134 } 132 }
135 133
  134 +//重置筛选面板
  135 +function resetFilter() {
  136 + if (typeof $filter === 'undefined') {
  137 + return;
  138 + }
  139 +
  140 + //重置子筛选项
  141 + $('.sub-classify').each(function() {
  142 + setSubClassify($(this).children(':first-child'));
  143 + });
  144 +
  145 + //重置主筛选项
  146 + classifyTapEvt($('.classify > :first-child'));
  147 +}
  148 +
136 exports.initFilter = initFilter; 149 exports.initFilter = initFilter;
137 150
138 exports.showFilter = showFilter; 151 exports.showFilter = showFilter;
139 152
140 -exports.hideFilter = hideFilter;  
  153 +exports.hideFilter = hideFilter;
  154 +
  155 +exports.resetFilter = resetFilter;
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 */ 5 */
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 - Hammer = require('hammer'), 8 + Hammer = require('yoho.hammer'),
9 lazyLoad = require('yoho.lazyload'); 9 lazyLoad = require('yoho.lazyload');
10 10
11 //品牌页参数 11 //品牌页参数
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 Swiper = require('yoho.iswiper'), 8 Swiper = require('yoho.iswiper'),
9 - Hammer = require('hammer'), 9 + Hammer = require('yoho.hammer'),
10 lazyLoad = require('yoho.lazyload'); 10 lazyLoad = require('yoho.lazyload');
11 11
12 var swiper; 12 var swiper;
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 Swiper = require('yoho.iswiper'), 8 Swiper = require('yoho.iswiper'),
9 - Hammer = require('hammer'), 9 + Hammer = require('yoho.hammer'),
10 lazyLoad = require('yoho.lazyload'); 10 lazyLoad = require('yoho.lazyload');
11 11
12 var swiper, 12 var swiper,
@@ -41,6 +41,8 @@ var defaultOpt = { @@ -41,6 +41,8 @@ var defaultOpt = {
41 dayLimit: 1 41 dayLimit: 1
42 }; 42 };
43 43
  44 +var storeOpt = $.extend({}, defaultOpt); //存储默认筛选条件以便重置
  45 +
44 var now = new Date(), 46 var now = new Date(),
45 month = now.getMonth() + 1, 47 month = now.getMonth() + 1,
46 date = now.getDate(); 48 date = now.getDate();
@@ -267,8 +269,7 @@ $.ajax({ @@ -267,8 +269,7 @@ $.ajax({
267 //切换active状态到$pre上 269 //切换active状态到$pre上
268 $pre.addClass('active'); 270 $pre.addClass('active');
269 $pre.siblings('.filter').removeClass('active'); 271 $pre.siblings('.filter').removeClass('active');
270 - },  
271 - missStatus: true 272 + }
272 }); 273 });
273 } 274 }
274 }); 275 });
@@ -343,6 +344,10 @@ navHammer.on('tap', function(e) { @@ -343,6 +344,10 @@ navHammer.on('tap', function(e) {
343 $dgc.removeClass('hide'); 344 $dgc.removeClass('hide');
344 break; 345 break;
345 } 346 }
  347 +
  348 + //重置筛选项
  349 + filter.resetFilter();
  350 + defaultOpt = $.extend({}, storeOpt);
346 } 351 }
347 352
348 $active.removeClass('active'); 353 $active.removeClass('active');
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 "import-style": "1.0.0", 23 "import-style": "1.0.0",
24 "yoho.lazyload": "1.1.0", 24 "yoho.lazyload": "1.1.0",
25 "yoho.handlebars": "3.0.3", 25 "yoho.handlebars": "3.0.3",
26 - "hammer": "2.0.4" 26 + "yoho.hammer": "2.0.4"
27 }, 27 },
28 "devDependencies": { 28 "devDependencies": {
29 "expect.js": "0.3.1" 29 "expect.js": "0.3.1"
1 .good-info { 1 .good-info {
2 float: left; 2 float: left;
3 - width: 46.4%; 3 + width: 276rem / $pxConvertRem;
4 height: 486rem / $pxConvertRem; 4 height: 486rem / $pxConvertRem;
5 - margin: 28rem / $pxConvertRem 0 0 2.4%;  
6 - 5 + margin: 0 (15rem / $pxConvertRem) (28rem / $pxConvertRem);
7 6
8 .tag-container { 7 .tag-container {
9 height: 28rem / $pxConvertRem; 8 height: 28rem / $pxConvertRem;
10 width: 100%; 9 width: 100%;
  10 + overflow: hidden;
11 11
12 .good-tag { 12 .good-tag {
13 display: block; 13 display: block;
@@ -15,23 +15,27 @@ @@ -15,23 +15,27 @@
15 height: 28rem / $pxConvertRem; 15 height: 28rem / $pxConvertRem;
16 font-size: 18rem / $pxConvertRem; 16 font-size: 18rem / $pxConvertRem;
17 text-align: center; 17 text-align: center;
18 - line-height: 32rem / $pxConvertRem; 18 + line-height: 28rem / $pxConvertRem;
  19 + box-sizing: border-box;
19 margin-right: 4rem / $pxConvertRem; 20 margin-right: 4rem / $pxConvertRem;
20 21
21 &:last-child { 22 &:last-child {
22 margin-right: 0; 23 margin-right: 0;
23 } 24 }
24 } 25 }
  26 +
25 .new-tag { 27 .new-tag {
26 width: 60rem / $pxConvertRem; 28 width: 60rem / $pxConvertRem;
27 background-color: #78dc7e; 29 background-color: #78dc7e;
28 color: #fff; 30 color: #fff;
29 } 31 }
  32 +
30 .renew-tag { 33 .renew-tag {
31 width: 90rem / $pxConvertRem; 34 width: 90rem / $pxConvertRem;
32 background-color: #78dc7e; 35 background-color: #78dc7e;
33 color: #fff; 36 color: #fff;
34 } 37 }
  38 +
35 .sale-tag { 39 .sale-tag {
36 width: 60rem / $pxConvertRem; 40 width: 60rem / $pxConvertRem;
37 background-color: #ff575c; 41 background-color: #ff575c;
@@ -43,17 +47,31 @@ @@ -43,17 +47,31 @@
43 color: #fff; 47 color: #fff;
44 } 48 }
45 .limit-tag { 49 .limit-tag {
46 - box-sizing: border-box;  
47 width: 90rem / $pxConvertRem; 50 width: 90rem / $pxConvertRem;
48 border: 1px solid #000; 51 border: 1px solid #000;
49 color: #000; 52 color: #000;
50 - line-height: 24rem / $pxConvertRem;  
51 } 53 }
52 } 54 }
53 } 55 }
54 56
55 .good-detail-img { 57 .good-detail-img {
56 position: relative; 58 position: relative;
  59 + .good-islike {
  60 + position: absolute;
  61 + width: 60rem / $pxConvertRem;
  62 + height: 60rem / $pxConvertRem;
  63 + top: 0rem / $pxConvertRem;
  64 + right: 0rem / $pxConvertRem;
  65 + line-height: 60rem / $pxConvertRem;
  66 + font-size: 30rem / $pxConvertRem;
  67 + text-align: center;
  68 + color: #b0b0b0;
  69 + text-decoration: none;
  70 + }
  71 +
  72 + .good-like {
  73 + color: #d72928;
  74 + }
57 img { 75 img {
58 display: block; 76 display: block;
59 width: 100%; 77 width: 100%;
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 z-index: 2; 11 z-index: 2;
12 .search-box { 12 .search-box {
13 position: relative; 13 position: relative;
  14 + width: 500rem / $pxConvertRem;//450
14 height: 60rem / $pxConvertRem; 15 height: 60rem / $pxConvertRem;
15 background-color: #FFF; 16 background-color: #FFF;
16 border-radius: 30rem / $pxConvertRem; 17 border-radius: 30rem / $pxConvertRem;
@@ -37,7 +38,25 @@ @@ -37,7 +38,25 @@
37 line-height: 60rem / $pxConvertRem; 38 line-height: 60rem / $pxConvertRem;
38 color: #bdbdbd; 39 color: #bdbdbd;
39 } 40 }
40 - 41 + .search-input {
  42 + border: none;
  43 + width: 95%;
  44 + height: 60rem / $pxConvertRem;
  45 + line-height: 1;
  46 + padding: 0 10rem / $pxConvertRem;
  47 + }
  48 + .search-action {
  49 + display: none;
  50 + position: absolute;
  51 + top: 0;
  52 + right: -74rem / $pxConvertRem;
  53 + font-size: 32rem / $pxConvertRem;
  54 + line-height: 60rem / $pxConvertRem;
  55 + color: #666;
  56 + }
  57 + .clear-text {
  58 + margin-right: 20rem / $pxConvertRem;
  59 + }
41 } 60 }
42 61
43 } 62 }
@@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
17 height: 192rem / $pxConvertRem; 17 height: 192rem / $pxConvertRem;
18 border-bottom: 1px solid #e0e0e0; 18 border-bottom: 1px solid #e0e0e0;
19 border-right: 1px solid #e0e0e0; 19 border-right: 1px solid #e0e0e0;
20 - border-top: 1px solid #e0e0e0;  
21 } 20 }
22 21
23 .classify-logo { 22 .classify-logo {
@@ -70,14 +70,15 @@ @@ -70,14 +70,15 @@
70 .brands-swiper { 70 .brands-swiper {
71 background: #fff; 71 background: #fff;
72 width: 100%; 72 width: 100%;
73 - height: 140rem / $pxConvertRem; 73 + height: 160rem / $pxConvertRem;
  74 + padding-top: 20rem / $pxConvertRem;
74 // margin-bottom: 28rem / $pxConvertRem; 75 // margin-bottom: 28rem / $pxConvertRem;
75 border-top: 1px solid #e0e0e0; 76 border-top: 1px solid #e0e0e0;
76 overflow: hidden; 77 overflow: hidden;
77 78
78 .brands-list { 79 .brands-list {
79 position: relative; 80 position: relative;
80 - height: 140rem / $pxConvertRem; 81 + height: 160rem / $pxConvertRem;
81 82
82 li { 83 li {
83 float: left; 84 float: left;
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 li { 16 li {
17 float: left; 17 float: left;
18 width: 158rem / $pxConvertRem; 18 width: 158rem / $pxConvertRem;
19 - height: 154rem / $pxConvertRem; 19 + height: 174rem / $pxConvertRem;
20 border-top: 1px solid #e0e0e0; 20 border-top: 1px solid #e0e0e0;
21 border-left: 1px solid #e0e0e0; 21 border-left: 1px solid #e0e0e0;
22 overflow: hidden; 22 overflow: hidden;
@@ -31,6 +31,8 @@ @@ -31,6 +31,8 @@
31 31
32 img { 32 img {
33 vertical-align: middle; 33 vertical-align: middle;
  34 + width: 100%;
  35 + height: 100%;
34 max-width: 100%; 36 max-width: 100%;
35 max-height: 100%; 37 max-height: 100%;
36 } 38 }
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 background: #fff; 2 background: #fff;
3 padding-left: 15rem / $pxConvertRem; 3 padding-left: 15rem / $pxConvertRem;
4 border-top: 1px solid #ccc; 4 border-top: 1px solid #ccc;
5 - border-bottom: 1px solid #ccc; 5 + // border-bottom: 1px solid #ccc;
6 margin-top: 30rem / $pxConvertRem; 6 margin-top: 30rem / $pxConvertRem;
7 .title { 7 .title {
8 height: 104rem / $pxConvertRem; 8 height: 104rem / $pxConvertRem;
@@ -59,6 +59,7 @@ @@ -59,6 +59,7 @@
59 .load-more-img { 59 .load-more-img {
60 padding-left: 0; 60 padding-left: 0;
61 height: 200rem / $pxConvertRem; 61 height: 200rem / $pxConvertRem;
  62 + border-top: 1px solid #ccc;
62 overflow: hidden; 63 overflow: hidden;
63 img { 64 img {
64 display: block; 65 display: block;
@@ -110,12 +110,12 @@ @@ -110,12 +110,12 @@
110 } 110 }
111 111
112 .sub-nav { 112 .sub-nav {
113 - // display: none; 113 + display: none;
114 position: fixed; 114 position: fixed;
  115 + bottom: 0;
115 top: 0; 116 top: 0;
116 - right: 100rem / $pxConvertRem;  
117 left: 0; 117 left: 0;
118 - bottom: 0; 118 + // right: 100rem / $pxConvertRem;
119 width: 100%; 119 width: 100%;
120 background: #fff !important; 120 background: #fff !important;
121 // z-index: 2; 121 // z-index: 2;
@@ -185,7 +185,7 @@ @@ -185,7 +185,7 @@
185 } 185 }
186 186
187 .sub-nav.show { 187 .sub-nav.show {
  188 + display: block;
188 @include transform(translateX(0)); 189 @include transform(translateX(0));
189 -  
190 @include transition(transform 0.3s); 190 @include transition(transform 0.3s);
191 } 191 }
@@ -91,20 +91,20 @@ @@ -91,20 +91,20 @@
91 padding-top: 50%; 91 padding-top: 50%;
92 width: 100%; 92 width: 100%;
93 position: absolute; 93 position: absolute;
94 - top: -230rem / $pxConvertRem; 94 + top: -180rem / $pxConvertRem;
95 95
96 .list-item { 96 .list-item {
97 display: block; 97 display: block;
98 position: relative; 98 position: relative;
99 - margin: 0 auto 50rem / $pxConvertRem;  
100 - width: 444rem / $pxConvertRem;  
101 - height: 110rem / $pxConvertRem; 99 + margin: 0 auto 40rem / $pxConvertRem;
  100 + width: 216px;
  101 + height: 52px;
102 text-align: center; 102 text-align: center;
103 - font-size: 30rem / $pxConvertRem;  
104 - line-height: 110rem / $pxConvertRem; 103 + font-size: 16px;
  104 + line-height: 52px;
105 color: #fff; 105 color: #fff;
106 background: #000; 106 background: #000;
107 - border: 5rem / $pxConvertRem solid #fff; 107 + border: 4px solid #fff;
108 font-weight: bold; 108 font-weight: bold;
109 } 109 }
110 .lighter { 110 .lighter {
  1 +{{> layout/header}}
  2 +<div class="brand-page yoho-page">
  3 + <div class="newbrand-search">
  4 + <form class="search-box clearfix">
  5 + <input type="text" class="search-input" id="keyword" placeholder="查找品牌">
  6 + <input type="hidden" id="gender" name="gender" value="1,3">
  7 + <i class="search-icon iconfont">&#xe60f;</i>
  8 + <div class="search-action">
  9 + <span class="iconfont clear-text">&#xe623;</span>
  10 + <span class="search-btn">搜索</span>
  11 + </div>
  12 + </form>
  13 + </div>
  14 +
  15 + <div class="search-result">
  16 + </div>
  17 +</div>
  18 +{{> layout/footer}}
  19 +{{> layout/download_app}}
1 <div class="maybe-like"> 1 <div class="maybe-like">
2 - <p class="title">  
3 - <i class="icon"></i>  
4 - <span>你可能喜欢</span>  
5 - </p> 2 + <ul id="maybe-like-nav" class="maybe-like-nav clearfix">
  3 + <li class="maybe-like-nav-item focus">新品到着</li>
  4 + <li class="maybe-like-nav-item">人气单品</li>
  5 + </ul>
6 6
7 - <ul id="maybe-like-nav" class="maybe-like-nav clearfix">  
8 - <li class="maybe-like-nav-item focus">新品到着</li>  
9 - <li class="maybe-like-nav-item">人气单品</li>  
10 - </ul>  
11 -  
12 - <div id="goods-list">  
13 - {{# goodsContainer}}  
14 - <div class="goods-list {{^show}}hide{{/show}}">  
15 - {{# goods}}  
16 - {{> good}}  
17 - {{/ goods}}  
18 - </div>  
19 - {{/ goodsContainer}}  
20 - </div> 7 + <div id="goods-list">
  8 + {{# goodsContainer}}
  9 + <div class="goods-list {{^show}}hide{{/show}}">
  10 + {{# goods}}
  11 + {{> good}}
  12 + {{/ goods}}
  13 + </div>
  14 + {{/ goodsContainer}}
  15 + </div>
21 16
22 <div id="load-more-info" class="load-more-info"> 17 <div id="load-more-info" class="load-more-info">
23 <div class="loading status hide"> 18 <div class="loading status hide">
1 {{> layout/page_footer}} 1 {{> layout/page_footer}}
2 {{> layout/download_app}} 2 {{> layout/download_app}}
  3 +{{#if hasWxShare}}
  4 + <script type="text/javascript" charset="utf-8" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
  5 +{{/if}}
3 {{#if rlsEnv}} 6 {{#if rlsEnv}}
4 <script src="http://cdn.yoho.cn/myohobuy/{{version}}/lib.js"></script> 7 <script src="http://cdn.yoho.cn/myohobuy/{{version}}/lib.js"></script>
5 <script src="http://cdn.yoho.cn/myohobuy/{{version}}/index.js"></script> 8 <script src="http://cdn.yoho.cn/myohobuy/{{version}}/index.js"></script>
@@ -24,7 +24,6 @@ @@ -24,7 +24,6 @@
24 </script> 24 </script>
25 {{/if}} 25 {{/if}}
26 {{#if guangDetail}} 26 {{#if guangDetail}}
27 -<script type="text/javascript" charset="utf-8" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>  
28 <script> 27 <script>
29 seajs.use('js/guang/detail'); 28 seajs.use('js/guang/detail');
30 </script> 29 </script>
@@ -46,9 +46,9 @@ class HomeModel @@ -46,9 +46,9 @@ class HomeModel
46 const COOKIE_NAME_LIFESTYLE = 'lifestyle'; 46 const COOKIE_NAME_LIFESTYLE = 'lifestyle';
47 47
48 /* COOKIE标识访问的是男生频道底部Banner */ 48 /* COOKIE标识访问的是男生频道底部Banner */
49 - const COOKIE_NAME_BOYS_BOTTOM_BANNER = '8c48745a39373d621bf5fd80edf59b5e'; 49 + const CODE_NAME_BOYS_BOTTOM_BANNER = '8c48745a39373d621bf5fd80edf59b5e';
50 /* COOKIE标识访问的是女生频道频道底部Banner */ 50 /* COOKIE标识访问的是女生频道频道底部Banner */
51 - const COOKIE_NAME_GIRLS_BOTTOM_BANNER = 'c63939b2ad458e9cb51147940c1da2e5'; 51 + const CODE_NAME_GIRLS_BOTTOM_BANNER = 'c63939b2ad458e9cb51147940c1da2e5';
52 52
53 /** 53 /**
54 * 选择频道 54 * 选择频道
@@ -125,10 +125,10 @@ class HomeModel @@ -125,10 +125,10 @@ class HomeModel
125 { 125 {
126 $result = false; 126 $result = false;
127 if($channel == 2) { 127 if($channel == 2) {
128 - $resource = self::COOKIE_NAME_GIRLS_BOTTOM_BANNER; 128 + $resource = self::CODE_NAME_GIRLS_BOTTOM_BANNER;
129 $cache = CacheConfig::KEY_ACTION_GRILS_BOTTOM_BANNER; 129 $cache = CacheConfig::KEY_ACTION_GRILS_BOTTOM_BANNER;
130 } else { 130 } else {
131 - $resource = self::COOKIE_NAME_BOYS_BOTTOM_BANNER; 131 + $resource = self::CODE_NAME_BOYS_BOTTOM_BANNER;
132 $cache = CacheConfig::KEY_ACTION_BOYS_BOTTOM_BANNER; 132 $cache = CacheConfig::KEY_ACTION_BOYS_BOTTOM_BANNER;
133 } 133 }
134 134
@@ -143,13 +143,14 @@ class HomeModel @@ -143,13 +143,14 @@ class HomeModel
143 // 调用接口获取数据 143 // 调用接口获取数据
144 $banner = IndexData::getBannerStart($resource); 144 $banner = IndexData::getBannerStart($resource);
145 if (isset($banner['code']) && $banner['code'] == 200) { 145 if (isset($banner['code']) && $banner['code'] == 200) {
146 - // 构建数据  
147 - $data = array(); 146 + $result = array();
  147 + // 处理数据
148 foreach ($banner['data'] as $val) { 148 foreach ($banner['data'] as $val) {
149 - $data['list'][] = $val; 149 + foreach ($val['data'] as $single) {
  150 + $result['url'] = ($channel === 2) ? Helpers::url('/boys') : Helpers::url('/girls');
  151 + $result['img'] = Helpers::getImageUrl($single['src'], 640, 200);
  152 + }
150 } 153 }
151 -  
152 - $result = FloorProcess::getContent($data, $channel);  
153 } 154 }
154 155
155 if (USE_CACHE) { 156 if (USE_CACHE) {
@@ -43,4 +43,39 @@ class BrandController extends AbstractAction @@ -43,4 +43,39 @@ class BrandController extends AbstractAction
43 $this->_view->display('index', Category\BrandModel::getBrandByChannel($channel)); 43 $this->_view->display('index', Category\BrandModel::getBrandByChannel($channel));
44 } 44 }
45 45
  46 + /**
  47 + * 品牌一览搜索页
  48 + *
  49 + * @param string gender 老版本中使用的参数, 做兼容判断
  50 + * @param int channel 1表示男生频道, 2表示女生频道, 3表示潮童频道, 4表示创意生活频道
  51 + */
  52 + public function searchAction()
  53 + {
  54 + $this->setTitle('品牌一览');
  55 + $this->setNavHeader('品牌一览');
  56 +
  57 + /* 判断参数是否有效 */
  58 + $channel = null;
  59 + $gender = $this->get('gender');
  60 + if (!empty($gender)) {
  61 + switch ($gender) {
  62 + case '1,3': // 男
  63 + $channel = 1;
  64 + break;
  65 + case '2,3': // 女
  66 + $channel = 2;
  67 + break;
  68 + }
  69 + }
  70 + if (!isset($channel)) {
  71 + $channel = $this->get('channel', 1);
  72 + if (!is_numeric($channel) || intval($channel) > 4) {
  73 + $channel = 1;
  74 + }
  75 + }
  76 +
  77 + // 渲染模板
  78 + $this->_view->display('search', Category\BrandModel::getBrandByChannel($channel));
  79 + }
  80 +
46 } 81 }
@@ -68,6 +68,13 @@ routes.brands.route.module = Category @@ -68,6 +68,13 @@ routes.brands.route.module = Category
68 routes.brands.route.controller = Brand 68 routes.brands.route.controller = Brand
69 routes.brands.route.action = Index 69 routes.brands.route.action = Index
70 70
  71 +; 品牌一览搜索页
  72 +routes.brands.type = "rewrite"
  73 +routes.brands.match = "/brands/search"
  74 +routes.brands.route.module = Category
  75 +routes.brands.route.controller = Brand
  76 +routes.brands.route.action = Search
  77 +
71 ; 新品到着(NEW) 78 ; 新品到着(NEW)
72 routes.productnew.type = "rewrite" 79 routes.productnew.type = "rewrite"
73 routes.productnew.match = "/product/new$" 80 routes.productnew.match = "/product/new$"