Authored by OF1706

search history

@@ -9,6 +9,8 @@ const mRoot = '../models'; @@ -9,6 +9,8 @@ const mRoot = '../models';
9 const search = require(`${mRoot}/search`); 9 const search = require(`${mRoot}/search`);
10 const _ = require('lodash'); 10 const _ = require('lodash');
11 11
  12 +const config = global.yoho.config;
  13 +
12 /** 14 /**
13 * search 首页 15 * search 首页
14 * @param {[type]} req [description] 16 * @param {[type]} req [description]
@@ -112,23 +114,39 @@ const serachFilterBrands = (req, res, next) => { @@ -112,23 +114,39 @@ const serachFilterBrands = (req, res, next) => {
112 * @param {[type]} res [description] 114 * @param {[type]} res [description]
113 * @return {[type]} [description] 115 * @return {[type]} [description]
114 */ 116 */
115 -const searchHistory = (req, res, next) => {  
116 - search.getSearchHistory(req.query).then(result => {  
117 117
118 - if (req.query.json === '1') {  
119 - return res.send(result);  
120 - } 118 +const searchHistory = (req, res) => {
121 119
122 - let dest = {  
123 - code: 200,  
124 - message: 'history',  
125 - data: result || ''  
126 - }; 120 + let history = req.cookies['_History'];
  121 + let q = req.query.query || '';
127 122
128 - res.type('text/javascript');  
129 - res.send(req.query.callback + '(' + JSON.stringify(dest) + ')');  
130 123
131 - }).catch(next); 124 + console.log("////////////----------------------");
  125 + console.log(history);
  126 + console.log("///////////----------------------");
  127 +
  128 + history = history ? history.split(',') : [];
  129 + history = _.reject(history, old => old === q ? true : false);
  130 + history.unshift(q);
  131 +
  132 + res.cookie('_History', _.take(history, 9).join(','), {
  133 + domain: config.cookieDomain,
  134 + maxAge: 60 * 60 * 24 * 1000 * 30 // 一月
  135 + });
  136 +
  137 +
  138 + let data = [];
  139 + _.forEach(history,function(item){
  140 + let list = {};
  141 + list['keyword'] = item;
  142 + data.push(list);
  143 + });
  144 + let ResData = {};
  145 + ResData['data'] = data;
  146 +
  147 + res.type('text/plain');
  148 + res.send(JSON.stringify(ResData));
  149 +
132 }; 150 };
133 151
134 152
@@ -158,6 +176,8 @@ const searchRecommend = (req, res, next) => { @@ -158,6 +176,8 @@ const searchRecommend = (req, res, next) => {
158 }).catch(next); 176 }).catch(next);
159 }; 177 };
160 178
  179 +
  180 +
161 module.exports = { 181 module.exports = {
162 index, 182 index,
163 suggest, 183 suggest,
@@ -424,14 +424,14 @@ const getBrands4Filter = (params) => { @@ -424,14 +424,14 @@ const getBrands4Filter = (params) => {
424 * 搜索 历史记录提示 424 * 搜索 历史记录提示
425 * @return 425 * @return
426 */ 426 */
427 -const getSearchHistory = (params) => {  
428 - let finalParams = {  
429 - method: 'app.search.getTerms',  
430 - keyword: params.keyword || ''  
431 - };  
432 -  
433 - return api.get('', finalParams, config.apiCache);  
434 -}; 427 +// const getSearchHistory = (params) => {
  428 +// let finalParams = {
  429 +// method: 'app.search.getTerms',
  430 +// keyword: params.keyword || ''
  431 +// };
  432 +//
  433 +// return api.get('', finalParams, config.apiCache);
  434 +// };
435 435
436 /** 436 /**
437 * 搜索 热门搜索和默认搜索 437 * 搜索 热门搜索和默认搜索
@@ -475,6 +475,6 @@ module.exports = { @@ -475,6 +475,6 @@ module.exports = {
475 getBrands4Filter, 475 getBrands4Filter,
476 getProductListOrig, 476 getProductListOrig,
477 getSearchCacheKey, 477 getSearchCacheKey,
478 - getSearchHistory, 478 + // getSearchHistory,
479 getSearchRecommend 479 getSearchRecommend
480 }; 480 };
@@ -93,35 +93,7 @@ @@ -93,35 +93,7 @@
93 {{#unless @root.pc.common.disSearchAssociation}} 93 {{#unless @root.pc.common.disSearchAssociation}}
94 <ul class="search-suggest"></ul> 94 <ul class="search-suggest"></ul>
95 {{/unless}} 95 {{/unless}}
96 - {{#unless @root.pc.common.disSearchAssociation}}  
97 - <ul class="search-suggest search-suggest-history"></ul>  
98 - {{/unless}}  
99 -  
100 - <ul class="search-suggest search-suggest-history">  
101 - <p class="search-suggest-title">最近搜过</p>  
102 - <li>  
103 - <a style="display: block;" href="\{{href}}" class="clearfix clear search-item" title="\{{keyword}}"  
104 - act="\{{href}}">  
105 - <span class="searchvalue">\{{keyword}}77777444444444444444444444444444444444444444444444</span>  
106 - <span class="searchDel">删除</span>  
107 - </a>  
108 - </li>  
109 - <li>  
110 - <a style="display: block;" href="\{{href}}" class="clearfix clear search-item" title="\{{keyword}}"  
111 - act="\{{href}}">  
112 - <span class="searchvalue">\{{keyword}}77777</span>  
113 - <span class="searchDel">删除</span>  
114 - </a>  
115 - </li>  
116 - <li>  
117 - <a style="display: block;" href="\{{href}}" class="clearfix clear search-item" title="\{{keyword}}"  
118 - act="\{{href}}">  
119 - <span class="searchvalue">\{{keyword}}77777</span>  
120 - <span class="searchDel">删除</span>  
121 - </a>  
122 - </li>  
123 - </ul>  
124 - 96 + <ul class="search-suggest search-suggest-history"></ul>
125 <div class="search-2016"> 97 <div class="search-2016">
126 <form action="//search.yohobuy.com" method="get" id="search-form"> 98 <form action="//search.yohobuy.com" method="get" id="search-form">
127 <input type="hidden" id="defaultsearch" value="{{defaultSearch}}"> 99 <input type="hidden" id="defaultsearch" value="{{defaultSearch}}">
@@ -350,17 +322,16 @@ @@ -350,17 +322,16 @@
350 \{{/data}} 322 \{{/data}}
351 </script> 323 </script>
352 <script type="text/html" id="search-suggest-history"> 324 <script type="text/html" id="search-suggest-history">
  325 + <p class="search-suggest-title">最近搜过<a class="searchDel" href="#">删除</a></p>
353 \{{#data}} 326 \{{#data}}
354 <li> 327 <li>
355 <a style="display: block;" href="\{{href}}" class="clearfix clear search-item" title="\{{keyword}}" 328 <a style="display: block;" href="\{{href}}" class="clearfix clear search-item" title="\{{keyword}}"
356 act="\{{href}}"> 329 act="\{{href}}">
357 - <span class="searchvalue">\{{keyword}}77777</span>  
358 - <span class="searchDel">删除</span> 330 + <span class="searchvalue">\{{keyword}}</span>
359 </a> 331 </a>
360 </li> 332 </li>
361 \{{/data}} 333 \{{/data}}
362 </script> 334 </script>
363 -  
364 </div> 335 </div>
365 336
366 <input id="api-domain" type="hidden" value="{{apiDomain}}"> 337 <input id="api-domain" type="hidden" value="{{apiDomain}}">
  1 +<div class="individual-slide">
  2 + <ul class="goods clearfix img-list">
  3 + {{#each item}}
  4 + <li class="good img-item" data-id="id" data-skn="skn">
  5 + <a href="{{href}}" target="_blank">
  6 + <img class="lazy" data-original="{{img}}"/>
  7 + </a>
  8 + <a class="name" href="{{href}}" target="_blank">{{title}}</a>
  9 + <p class="price">
  10 + <span class="sale-price {{#if marketPrice}}sale-price-new{{/if}}">{{price}}</span>
  11 + {{#if marketPrice}}
  12 + <span class="market-price">{{marketPrice}}</span>
  13 + {{/if}}
  14 + </p>
  15 + </li>
  16 + {{/each}}
  17 + </ul>
  18 + <div class="img-brand-switch">
  19 + {{#hasPrev}}
  20 + <a class="prev iconfont" href="javascript:;"></a>
  21 + {{/hasPrev}}
  22 + {{#hasNext}}
  23 + <a class="next iconfont" href="javascript:;"></a>
  24 + {{/hasNext}}
  25 + </div>
  26 +</div>
No preview for this file type
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > 2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3 <svg xmlns="http://www.w3.org/2000/svg"> 3 <svg xmlns="http://www.w3.org/2000/svg">
4 <metadata> 4 <metadata>
5 -Created by FontForge 20120731 at Thu Jan 19 16:45:25 2017 5 +Created by FontForge 20120731 at Wed Mar 1 20:04:54 2017
6 By admin 6 By admin
7 </metadata> 7 </metadata>
8 <defs> 8 <defs>
@@ -185,6 +185,8 @@ d="M958 758q0 30 -21 51.5t-51 21.5h-749q-30 0 -51 -21.5t-21 -51.5v-748q0 -30 21 @@ -185,6 +185,8 @@ d="M958 758q0 30 -21 51.5t-51 21.5h-749q-30 0 -51 -21.5t-21 -51.5v-748q0 -30 21
185 z" /> 185 z" />
186 <glyph glyph-name="wujiaoxing" unicode="&#xe623;" 186 <glyph glyph-name="wujiaoxing" unicode="&#xe623;"
187 d="M512 63l-316 -166l60 352l-256 250l354 51l158 321l158 -321l354 -51l-256 -250l60 -352z" /> 187 d="M512 63l-316 -166l60 352l-256 250l354 51l158 321l158 -321l354 -51l-256 -250l60 -352z" />
  188 + <glyph glyph-name="shanchu1" unicode="&#xe646;"
  189 +d="M1004 851l-17 17l-475 -476l-475 476l-17 -17l475 -475l-458 -459l17 -17l458 459l458 -459l17 17l-458 459z" />
188 <glyph glyph-name="7xiaoche" unicode="&#xe636;" horiz-adv-x="1163" 190 <glyph glyph-name="7xiaoche" unicode="&#xe636;" horiz-adv-x="1163"
189 d="M295 196q67 0 114 -47t47 -113.5t-47 -114t-114 -47.5t-114 47.5t-47 114t47 113.5t114 47zM917.5 196q66.5 0 113.5 -47t47 -113.5t-47 -114t-113.5 -47.5t-114 47.5t-47.5 114t47.5 113.5t114 47zM400 894v-99h-210v0v0l-187 -294v-372h95q27 56 80 90.5t117 34.5 191 d="M295 196q67 0 114 -47t47 -113.5t-47 -114t-114 -47.5t-114 47.5t-47 114t47 113.5t114 47zM917.5 196q66.5 0 113.5 -47t47 -113.5t-47 -114t-113.5 -47.5t-114 47.5t-47.5 114t47.5 113.5t114 47zM400 894v-99h-210v0v0l-187 -294v-372h95q27 56 80 90.5t117 34.5
190 t117 -34.5t80 -90.5h228q27 56 80 90.5t117.5 34.5t117.5 -34.5t79 -90.5h46v765h-760v0zM400 452h-283l159 250l124 1v-251v0v0zM893 701l-131 -276l-63 31l101 206h-105v68h198v-29v0v0z" /> 192 t117 -34.5t80 -90.5h228q27 56 80 90.5t117.5 34.5t117.5 -34.5t79 -90.5h46v765h-760v0zM400 452h-283l159 250l124 1v-251v0v0zM893 701l-131 -276l-63 31l101 206h-105v68h198v-29v0v0z" />
@@ -274,7 +276,8 @@ d="M958 589q0 15 -10.5 25.5t-25.5 10.5t-26 -10l-384 -384l-384 384q-11 10 -26 10t @@ -274,7 +276,8 @@ d="M958 589q0 15 -10.5 25.5t-25.5 10.5t-26 -10l-384 -384l-384 384q-11 10 -26 10t
274 d="M512 -62q-91 0 -173.5 35.5t-142 95t-95 142t-35.5 173.5t35.5 173.5t95 142t142 95t173.5 35.5t173.5 -35.5t142 -95t95 -142t35.5 -173.5t-35.5 -173.5t-95 -142t-142 -95t-173.5 -35.5zM512 766q-104 0 -192 -51t-139 -139t-51 -192t51 -192t139 -139t192 -51t192 51 276 d="M512 -62q-91 0 -173.5 35.5t-142 95t-95 142t-35.5 173.5t35.5 173.5t95 142t142 95t173.5 35.5t173.5 -35.5t142 -95t95 -142t35.5 -173.5t-35.5 -173.5t-95 -142t-142 -95t-173.5 -35.5zM512 766q-104 0 -192 -51t-139 -139t-51 -192t51 -192t139 -139t192 -51t192 51
275 t139 139t51 192t-51 192t-139 139t-192 51zM464 592q0 -20 14 -34t34 -14t34 14t14 34t-14 34t-34 14t-34 -14t-14 -34zM512 128q-13 0 -22.5 9.5t-9.5 22.5v288q0 13 9.5 22.5t22.5 9.5t22.5 -9.5t9.5 -22.5v-288q0 -13 -9.5 -22.5t-22.5 -9.5z" /> 277 t139 139t51 192t-51 192t-139 139t-192 51zM464 592q0 -20 14 -34t34 -14t34 14t14 34t-14 34t-34 14t-34 -14t-14 -34zM512 128q-13 0 -22.5 9.5t-9.5 22.5v288q0 13 9.5 22.5t22.5 9.5t22.5 -9.5t9.5 -22.5v-288q0 -13 -9.5 -22.5t-22.5 -9.5z" />
276 <glyph glyph-name="yuanxingweixuanzhong" unicode="&#xe6c3;" 278 <glyph glyph-name="yuanxingweixuanzhong" unicode="&#xe6c3;"
277 -d="M512 -64q-185 0 -316.5 131.5t-131.5 316.5t131.5 316.5t316.5 131.5t316.5 -131.5t131.5 -316.5t-131.5 -316.5t-316.5 -131.5zM512 768q-159 0 -271.5 -112.5t-112.5 -271.5t112.5 -271.5t271.5 -112.5t271.5 112.5t112.5 271.5t-112.5 271.5t-271.5 112.5z" /> 279 +d="M512 -126q-104 0 -198 40.5t-162.5 109t-109 162.5t-40.5 198t40.5 198t109 162.5t162.5 109t198 40.5t198 -40.5t162.5 -109t109 -162.5t40.5 -198t-40.5 -198t-109 -162.5t-162.5 -109t-198 -40.5zM512 821q-89 0 -170 -34.5t-139.5 -93t-93 -139.5t-34.5 -170
  280 +t34.5 -170t93 -139.5t139.5 -93t170 -34.5t170 34.5t139.5 93t93 139.5t34.5 170t-34.5 170t-93 139.5t-139.5 93t-170 34.5z" />
278 <glyph glyph-name="Fill" unicode="&#xe6c9;" 281 <glyph glyph-name="Fill" unicode="&#xe6c9;"
279 d="M512 52q-34 0 -58.5 24.5t-24.5 59t24.5 58.5t58.5 24t58.5 -24t24.5 -58.5t-24.5 -59t-58.5 -24.5zM457 660q0 23 16 39.5t39 16.5t39 -16.5t16 -39.5v-304q0 -22 -16 -38.5t-39 -16.5t-39 16.5t-16 38.5v304zM512 896h-6q-104 0 -199 -40.5t-163.5 -109t-109 -163.5 282 d="M512 52q-34 0 -58.5 24.5t-24.5 59t24.5 58.5t58.5 24t58.5 -24t24.5 -58.5t-24.5 -59t-58.5 -24.5zM457 660q0 23 16 39.5t39 16.5t39 -16.5t16 -39.5v-304q0 -22 -16 -38.5t-39 -16.5t-39 16.5t-16 38.5v304zM512 896h-6q-104 0 -199 -40.5t-163.5 -109t-109 -163.5
280 t-40.5 -199t40.5 -199t109 -163.5t163.5 -109t199 -40.5h6h6q104 0 199 40.5t163.5 109t109 163.5t40.5 199t-40.5 199t-109 163.5t-163.5 109t-199 40.5h-6z" /> 283 t-40.5 -199t40.5 -199t109 -163.5t163.5 -109t199 -40.5h6h6q104 0 199 40.5t163.5 109t109 163.5t40.5 199t-40.5 199t-109 163.5t-163.5 109t-199 40.5h-6z" />
@@ -327,5 +330,23 @@ t90.5 135t135 90.5t163 33.5zM237 64l595 595q102 -123 102 -275q0 -114 -55.5 -211t @@ -327,5 +330,23 @@ t90.5 135t135 90.5t163 33.5zM237 64l595 595q102 -123 102 -275q0 -114 -55.5 -211t
327 <glyph glyph-name="shiliangzhinengduixiang1" unicode="&#xe6e2;" 330 <glyph glyph-name="shiliangzhinengduixiang1" unicode="&#xe6e2;"
328 d="M515 -128q60 0 105.5 40t52.5 98h-322q11 -58 57 -98t107 -40zM852 225q-15 31 -15 123v113q0 111 -56 200t-149 127q-7 47 -42 77.5t-81 30.5q-51 0 -87 -36q-26 -27 -35 -72q-93 -42 -149 -131t-56 -196v-113q0 -97 -16 -128q-30 -10 -46 -20q-20 -31 -20 -57 331 d="M515 -128q60 0 105.5 40t52.5 98h-322q11 -58 57 -98t107 -40zM852 225q-15 31 -15 123v113q0 111 -56 200t-149 127q-7 47 -42 77.5t-81 30.5q-51 0 -87 -36q-26 -27 -35 -72q-93 -42 -149 -131t-56 -196v-113q0 -97 -16 -128q-30 -10 -46 -20q-20 -31 -20 -57
329 q0 -31 24 -53.5t58 -22.5h660q34 0 58 22.5t24 53.5q-4 31 -24.5 54.5t-47.5 27.5z" /> 332 q0 -31 24 -53.5t58 -22.5h660q34 0 58 22.5t24 53.5q-4 31 -24.5 54.5t-47.5 27.5z" />
  333 + <glyph glyph-name="weibiaoti-" unicode="&#xe6ed;"
  334 +d="M512 896q-212 0 -362 -150t-150 -362t150 -362t362 -150t362 150t150 362t-150 362t-362 150zM512 -39q-114 0 -211.5 57t-154.5 154.5t-57 211.5t57 211.5t154.5 154.5t211.5 57t211.5 -57t154.5 -154.5t57 -211.5t-57 -211.5t-154.5 -154.5t-211.5 -57zM512 316
  335 +q18 0 31 13t13 31v246q0 18 -13 31t-31 13t-31 -13t-13 -31v-246q0 -18 13 -31t31 -13zM512 183zM444 182.5q0 -28.5 20 -48.5t48 -20t48 20t20 48.5t-20 48.5t-48 20t-48 -20t-20 -48.5z" />
  336 + <glyph glyph-name="weibiaoti-1" unicode="&#xe6ee;"
  337 +d="M922 883l-410 -409l-410 409l-89 -89l409 -410l-409 -410l89 -89l410 409l410 -409l89 89l-409 410l409 410z" />
  338 + <glyph glyph-name="weibiaoti-2" unicode="&#xe6ef;"
  339 +d="M230 759l367 -366l-367 -359l120 -119l367 358l119 120l-119 119l-367 367z" />
  340 + <glyph glyph-name="weibiaoti-3" unicode="&#xe6f0;"
  341 +d="M512 446l-196 -202l-39 39l196 202l39 39l39 -39l196 -202l-39 -39z" />
  342 + <glyph glyph-name="weibiaoti-4" unicode="&#xe6f1;"
  343 +d="M512 306l-196 201l-39 -45l235 -235l235 235l-39 45z" />
  344 + <glyph glyph-name="weibiaoti-5" unicode="&#xe6f2;"
  345 +d="M512 384zM32 384q0 -130 64.5 -240.5t175 -175t240.5 -64.5t240.5 64.5t175 175t64.5 240.5t-64.5 240.5t-175 175t-240.5 64.5t-240.5 -64.5t-175 -175t-64.5 -240.5z" />
  346 + <glyph glyph-name="weibiaoti-6" unicode="&#xe6f8;"
  347 +d="M498 862l-409 -362q-21 -20 -21 -41v-471q0 -30 21 -52.5t48 -22.5h232v314h280v-314h238q31 0 50 22t19 53v471q0 12 -5.5 24t-15.5 17l-409 362q-5 5 -14 5t-14 -5z" />
  348 + <glyph glyph-name="weibiaoti-7" unicode="&#xe6f9;"
  349 +d="M1017 -106l-278 278q55 58 85.5 133t30.5 158q0 115 -57 212.5t-154.5 154.5t-212 57t-212 -57t-154 -154.5t-56.5 -212.5t56.5 -212.5t154 -154t212.5 -56.5q83 0 158 30.5t133 85.5l279 -279zM432 62q-109 0 -201 54t-146 146t-54 201t54 201.5t146 146t201 53.5
  350 +t201.5 -53.5t146 -146t53.5 -201.5t-53.5 -201t-146 -146t-201.5 -54z" />
330 </font> 351 </font>
331 </defs></svg> 352 </defs></svg>
No preview for this file type
No preview for this file type
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 * @date: 2016/5/9 4 * @date: 2016/5/9
5 */ 5 */
6 var $ = require('yoho-jquery'), 6 var $ = require('yoho-jquery'),
7 - handlebars = require('yoho-handlebars'); 7 + handlebars = require('yoho-handlebars')
8 8
9 var $tool = $('.tool-wrapper'), 9 var $tool = $('.tool-wrapper'),
10 $yohoGroup = $tool.find('.yoho-group'), 10 $yohoGroup = $tool.find('.yoho-group'),
@@ -17,9 +17,9 @@ var $head = $('.head-wrapper'), @@ -17,9 +17,9 @@ var $head = $('.head-wrapper'),
17 $searchSug = $head.find('.search-suggest'), 17 $searchSug = $head.find('.search-suggest'),
18 $searchHistory = $head.find('.search-suggest-history'), 18 $searchHistory = $head.find('.search-suggest-history'),
19 $searchRecommend = $head.find('.search-hot'), 19 $searchRecommend = $head.find('.search-hot'),
20 - $searchHistoryHbs = $head.find('#search-suggest-history'),  
21 - $searchRecommendHbs = $head.find('#search-suggest-recommend');  
22 -$goCart = $head.find('.go-cart'), 20 + $searchHistoryHbs = $('#search-suggest-history'),
  21 + $searchRecommendHbs = $head.find('#search-suggest-recommend'),
  22 + $goCart = $head.find('.go-cart'),
23 $myYohoBox = $('#myYohoBox'), 23 $myYohoBox = $('#myYohoBox'),
24 $goodsNum = $goCart.find('.goods-num-tip'), 24 $goodsNum = $goCart.find('.goods-num-tip'),
25 $miniCart = $head.find('.mini-cart-wrapper'); 25 $miniCart = $head.find('.mini-cart-wrapper');
@@ -142,6 +142,7 @@ function setTopBanner(data) { @@ -142,6 +142,7 @@ function setTopBanner(data) {
142 // cookie集合 142 // cookie集合
143 function exeCookieMap() { 143 function exeCookieMap() {
144 var cookies = document.cookie; 144 var cookies = document.cookie;
  145 + // console.log(cookies);
145 var cookiearr = cookies.split(';'); 146 var cookiearr = cookies.split(';');
146 var i; 147 var i;
147 var temparr; 148 var temparr;
@@ -861,23 +862,31 @@ function actionAddKeyWords() { @@ -861,23 +862,31 @@ function actionAddKeyWords() {
861 * 历史记录 搜索提示 api 862 * 历史记录 搜索提示 api
862 * @return {[type]} [description] 863 * @return {[type]} [description]
863 */ 864 */
864 -function searchSuggestHistory(key) {  
865 - var param = {  
866 - return_type: 'jsonp',  
867 - keyword: key  
868 - };  
869 865
870 - $.getJSON('//search.yohobuy.com/product/search/history?callback=?', param, function(jsonData) { 866 +function searchSuggestHistory() {
  867 +
  868 + // if ($searchKey.val() === '') {
  869 + // $searchKey.val($('#defaultsearch').val());
  870 + // }
  871 +
  872 + // 保存搜索的内容
  873 + // writeSearch.setHistoryValFun($searchKey.val());
  874 + // exeCookieMap();
  875 +
  876 + let $queryKey = $("#query-key");
  877 + $.getJSON('//search.yohobuy.com/product/search/history?query='+$queryKey.val(), function(jsonData) {
871 var searchSuggestHistoryHtml; 878 var searchSuggestHistoryHtml;
872 879
873 - if (jsonData.code === 200) {  
874 - if (jsonData.data && jsonData.data.length) { 880 + // if (jsonData.code === 200) {
  881 + // if (jsonData.data && jsonData.data.length) {
  882 +
875 searchSuggestHistoryHtml = handlebars.compile($searchHistoryHbs.html() || ''); 883 searchSuggestHistoryHtml = handlebars.compile($searchHistoryHbs.html() || '');
  884 + console.log(jsonData);
876 $searchHistory.html(searchSuggestHistoryHtml(jsonData)).show(); 885 $searchHistory.html(searchSuggestHistoryHtml(jsonData)).show();
877 - } else {  
878 - $searchHistory.hide();  
879 - }  
880 - } 886 + // } else {
  887 + // $searchHistory.hide();
  888 + // }
  889 + // }
881 }); 890 });
882 } 891 }
883 892
@@ -889,8 +898,6 @@ $searchKey.keydown(function() { @@ -889,8 +898,6 @@ $searchKey.keydown(function() {
889 898
890 }).focus(function() { 899 }).focus(function() {
891 900
892 - console.log(typeof ($.trim($(this).val())));  
893 -  
894 var val = $.trim($(this).val()); 901 var val = $.trim($(this).val());
895 searchSuggestHistory(); 902 searchSuggestHistory();
896 if (val === '') { 903 if (val === '') {
@@ -35,8 +35,6 @@ require('./detail/latest-walk'); @@ -35,8 +35,6 @@ require('./detail/latest-walk');
35 35
36 product.init(4); 36 product.init(4);
37 37
38 -  
39 -  
40 lazyLoad($('img.lazy'), { 38 lazyLoad($('img.lazy'), {
41 failure_limit: 20 39 failure_limit: 20
42 }); 40 });
@@ -482,11 +482,23 @@ @@ -482,11 +482,23 @@
482 } 482 }
483 483
484 .search-suggest-title { 484 .search-suggest-title {
  485 + width: 320px;
  486 + box-sizing: border-box;
485 color: #b0b0b0; 487 color: #b0b0b0;
486 font-size: 12px; 488 font-size: 12px;
487 line-height: 12px; 489 line-height: 12px;
488 padding: 10px 0 12px 10px; 490 padding: 10px 0 12px 10px;
489 - 491 + .searchDel {
  492 + padding: 0 10px 0 0;
  493 + color: #000;
  494 + cursor: pointer;
  495 + float: right;
  496 + line-height: 1;
  497 + height: 12px;
  498 + &:hover {
  499 + color: #d0021b;
  500 + }
  501 + }
490 } 502 }
491 503
492 .search-suggest-history { 504 .search-suggest-history {
@@ -501,12 +513,6 @@ @@ -501,12 +513,6 @@
501 overflow: hidden; 513 overflow: hidden;
502 white-space: nowrap; 514 white-space: nowrap;
503 } 515 }
504 - .searchDel {  
505 - padding: 0;  
506 - color: #000;  
507 - cursor: pointer;  
508 - float: right;  
509 - }  
510 } 516 }
511 517
512 .search-hot { 518 .search-hot {
@@ -264,6 +264,7 @@ exports.processProductList = (list, options) => { @@ -264,6 +264,7 @@ exports.processProductList = (list, options) => {
264 } 264 }
265 pruductList.push(product); 265 pruductList.push(product);
266 }); 266 });
  267 +
267 return handleGoodsListData(pruductList); 268 return handleGoodsListData(pruductList);
268 }; 269 };
269 270