Authored by uedxwg

update

@@ -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]);
@@ -19,6 +19,8 @@ var tip = require('../../plugin/tip'); @@ -19,6 +19,8 @@ var tip = require('../../plugin/tip');
19 19
20 var brandId = $('#brand-info').data('id'); 20 var brandId = $('#brand-info').data('id');
21 21
  22 +var jumpToApp = $('#jump-to-app').val();
  23 +
22 var mIntro, aIntro; 24 var mIntro, aIntro;
23 25
24 var moreHammer, likeHammer; 26 var moreHammer, likeHammer;
@@ -71,6 +73,12 @@ likeHammer.on('tap', function(e) { @@ -71,6 +73,12 @@ likeHammer.on('tap', function(e) {
71 var opt = 'ok', 73 var opt = 'ok',
72 $this = $(e.target); 74 $this = $(e.target);
73 75
  76 +
  77 + //jumpToApp = 1表示APP未登录的情况,此时不发送ajax请求而由a链接直接跳转APP
  78 + if (jumpToApp === '1') {
  79 + return;
  80 + }
  81 +
74 e.preventDefault(); 82 e.preventDefault();
75 83
76 if ($this.hasClass('like')) { 84 if ($this.hasClass('like')) {
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;
  14 +<<<<<<< HEAD
10 top: 14px; 15 top: 14px;
11 left: 24px; 16 left: 24px;
  17 +=======
  18 + top: 9px;
  19 + left: 10px;
  20 +>>>>>>> 07ccf4f30b0880e107d15539abc34f479ceb0f95
12 } 21 }
13 22
14 input { 23 input {
15 height: 30px; 24 height: 30px;
16 - width: 95%; 25 + width: 85%;
17 border-radius: 15px; 26 border-radius: 15px;
18 text-indent: 26px; 27 text-indent: 26px;
19 background: #fff; 28 background: #fff;
@@ -22,14 +31,19 @@ @@ -22,14 +31,19 @@
22 31
23 .clear-input { 32 .clear-input {
24 position: absolute; 33 position: absolute;
25 - top: 12px; 34 + top: 5px;
26 right: 50px; 35 right: 50px;
27 } 36 }
28 37
29 .search { 38 .search {
  39 +<<<<<<< HEAD
30 position: absolute; 40 position: absolute;
31 top: 7px; 41 top: 7px;
32 right:0; 42 right:0;
  43 +=======
  44 + float: right;
  45 + margin-top: 6px;
  46 +>>>>>>> 07ccf4f30b0880e107d15539abc34f479ceb0f95
33 border: none; 47 border: none;
34 background: transparent; 48 background: transparent;
35 font-size: 16px; 49 font-size: 16px;
@@ -52,6 +52,8 @@ @@ -52,6 +52,8 @@
52 </div> 52 </div>
53 {{/if}} 53 {{/if}}
54 54
  55 + <input id="jump-to-app" type="hidden" value={{jumpToApp}}>
  56 +
55 {{!-- wx-share --}} 57 {{!-- wx-share --}}
56 <input id="shareLink" type="hidden" value={{shareLink}}> 58 <input id="shareLink" type="hidden" value={{shareLink}}>
57 <input id="shareImg" type="hidden" value={{shareImg}}> 59 <input id="shareImg" type="hidden" value={{shareImg}}>
@@ -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 }