Authored by hf

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

@@ -70,43 +70,46 @@ function searchResult() { @@ -70,43 +70,46 @@ function searchResult() {
70 i = 0, 70 i = 0,
71 html = ''; 71 html = '';
72 72
73 - // 遍历首字母搜索  
74 - $.each(brandsData, function(k, v) {  
75 - if ($.isArray(v)) { 73 + if (keyword !== '') {
  74 +
  75 + // 遍历首字母搜索
  76 + $.each(brandsData, function(k, v) {
  77 + if ($.isArray(v)) {
  78 +
  79 + // 遍历品牌,进行匹配
  80 + $.each(v, function(i, brand) {
  81 + if (brand.name.toLowerCase().indexOf(keyword) > -1) {
  82 + result[k] = result[k] || [];
  83 + result[k].push(brand);
  84 + }
  85 + });
  86 + }
  87 + });
76 88
77 - // 遍历品牌,进行匹配 89 + // 根据搜索结果生成 HTML
  90 + $.each(result, function(k, v) {
  91 + var brandHtml = ['<div class="brand-list bar-', i, '">'];
  92 +
  93 + i++;
  94 + brandHtml.push('<div class="title-bar"><h2>');
  95 + brandHtml.push(k);
  96 + brandHtml.push('</h2></div>');
78 $.each(v, function(i, brand) { 97 $.each(v, function(i, brand) {
79 - if (brand.name.toLowerCase().indexOf(keyword) > -1) {  
80 - result[k] = result[k] || [];  
81 - result[k].push(brand); 98 +
  99 + brandHtml.push('<p><a href="' + brand.url + '">' + brand.name);
  100 + if (brand.isNew) {
  101 + brandHtml.push('<i class="icon-hot">HOT</i>');
82 } 102 }
  103 + if (brand.isHot) {
  104 + brandHtml.push('<i class="icon-new">NEW</i>');
  105 + }
  106 + brandHtml.push('</a></p>');
83 }); 107 });
84 - }  
85 - }); 108 + brandHtml.push('</div>');
  109 + html += brandHtml.join('');
86 110
87 - // 根据搜索结果生成 HTML  
88 - $.each(result, function(k, v) {  
89 - var brandHtml = ['<div class="brand-list bar-', i, '">'];  
90 -  
91 - i++;  
92 - brandHtml.push('<div class="title-bar"><h2>');  
93 - brandHtml.push(k);  
94 - brandHtml.push('</h2></div>');  
95 - $.each(v, function(i, brand) {  
96 -  
97 - brandHtml.push('<p><a href="' + brand.url + '">' + brand.name);  
98 - if (brand.isNew) {  
99 - brandHtml.push('<i class="icon-hot">HOT</i>');  
100 - }  
101 - if (brand.isHot) {  
102 - brandHtml.push('<i class="icon-new">NEW</i>');  
103 - }  
104 - brandHtml.push('</a></p>');  
105 }); 111 });
106 - brandHtml.push('</div>');  
107 - html += brandHtml.join('');  
108 -  
109 - }); 112 + }
110 113
111 // 插入 dom,绑定事件 114 // 插入 dom,绑定事件
112 $('.search-result').html(html); 115 $('.search-result').html(html);
@@ -118,7 +121,6 @@ if ($('.brand-search-page').length) { @@ -118,7 +121,6 @@ if ($('.brand-search-page').length) {
118 121
119 $keyword.on('input', function() { 122 $keyword.on('input', function() {
120 if ($keyword.val().length) { 123 if ($keyword.val().length) {
121 - searchResult();  
122 $icon.css('color', '#000'); 124 $icon.css('color', '#000');
123 $(this).closest('.search-box').css('width', '11.25rem'); 125 $(this).closest('.search-box').css('width', '11.25rem');
124 $('.search-action').show(); 126 $('.search-action').show();
@@ -127,6 +129,7 @@ if ($('.brand-search-page').length) { @@ -127,6 +129,7 @@ if ($('.brand-search-page').length) {
127 $(this).closest('.search-box').css('width', '12.5rem'); 129 $(this).closest('.search-box').css('width', '12.5rem');
128 $('.search-action').hide(); 130 $('.search-action').hide();
129 } 131 }
  132 + searchResult();
130 }).focus(); 133 }).focus();
131 134
132 clearTextHammer = new Hammer($('.clear-text')[0]); 135 clearTextHammer = new Hammer($('.clear-text')[0]);
1 .good-list-page { 1 .good-list-page {
2 .search-input { 2 .search-input {
3 position: relative; 3 position: relative;
4 - padding: 7px 46px 7px 15px; 4 + padding: 7px 15px;
5 background: #f8f8f8; 5 background: #f8f8f8;
6 6
  7 + > form {
  8 + position: relative;
  9 + }
  10 +
7 .search-icon { 11 .search-icon {
8 position: absolute; 12 position: absolute;
9 font-size: 12px; 13 font-size: 12px;
10 - top: 16px;  
11 - left: 24px; 14 + top: 9px;
  15 + left: 10px;
12 } 16 }
13 17
14 input { 18 input {
15 height: 30px; 19 height: 30px;
16 - width: 95%; 20 + width: 85%;
17 border-radius: 15px; 21 border-radius: 15px;
18 text-indent: 26px; 22 text-indent: 26px;
19 background: #fff; 23 background: #fff;
@@ -22,14 +26,13 @@ @@ -22,14 +26,13 @@
22 26
23 .clear-input { 27 .clear-input {
24 position: absolute; 28 position: absolute;
25 - top: 12px; 29 + top: 5px;
26 right: 50px; 30 right: 50px;
27 } 31 }
28 32
29 .search { 33 .search {
30 - position: absolute;  
31 - top: 12px;  
32 - right: .4rem; 34 + float: right;
  35 + margin-top: 6px;
33 border: none; 36 border: none;
34 background: transparent; 37 background: transparent;
35 font-size: 16px; 38 font-size: 16px;
@@ -53,8 +53,7 @@ class BoysController extends AbstractAction @@ -53,8 +53,7 @@ class BoysController extends AbstractAction
53 break; 53 break;
54 } 54 }
55 55
56 - $channel = Helpers::getChannelByCookie();  
57 - $bottomBanner = Index\HomeModel::getBottomBanner($channel); 56 + $bottomBanner = Index\HomeModel::getBottomBanner(1);
58 if (empty($bottomBanner)) { 57 if (empty($bottomBanner)) {
59 break; 58 break;
60 } 59 }
@@ -48,8 +48,7 @@ class GirlsController extends AbstractAction @@ -48,8 +48,7 @@ class GirlsController extends AbstractAction
48 break; 48 break;
49 } 49 }
50 50
51 - $channel = Helpers::getChannelByCookie();  
52 - $bottomBanner = Index\HomeModel::getBottomBanner($channel); 51 + $bottomBanner = Index\HomeModel::getBottomBanner(2);
53 if (empty($bottomBanner)) { 52 if (empty($bottomBanner)) {
54 break; 53 break;
55 } 54 }