Authored by yyq

fix hot

@@ -292,7 +292,7 @@ const getHotKeywordsSeo = (keyword, num) => { @@ -292,7 +292,7 @@ const getHotKeywordsSeo = (keyword, num) => {
292 return { 292 return {
293 title: `${keyword}_${keyword}【图片,新款,价格,折扣,搭配】-YOHO!BUY有货`, 293 title: `${keyword}_${keyword}【图片,新款,价格,折扣,搭配】-YOHO!BUY有货`,
294 keywords: keyword, 294 keywords: keyword,
295 - description: `YOHO!BUY有货网是国内专业的【${keyword}】网上潮流购物商城,为您找到${num}条【${keyword}】产品的品牌、图片、款式、价格、折扣等信息。买正品【${keyword},就上YOHO!BUY有货!` // eslint-disable-line 295 + description: `YOHO!BUY 有货网是国内专业的${keyword}网上潮流购物商城,为您找到${num}${keyword}产品的品牌、图片、款式、价格、折扣等信息。买正品${keyword},就上YOHO!BUY有货!` // eslint-disable-line
296 }; 296 };
297 }; 297 };
298 298
@@ -26,6 +26,13 @@ const _setHotKeywordData = (result, params, channel) => { @@ -26,6 +26,13 @@ const _setHotKeywordData = (result, params, channel) => {
26 // 获取商品数据和顶部筛选条件 26 // 获取商品数据和顶部筛选条件
27 if (result[1].code === 200) { 27 if (result[1].code === 200) {
28 let data = result[1].data; 28 let data = result[1].data;
  29 + let goodsList = productProcess.processProductList(data.product_list,
  30 + Object.assign({showDiscount: false, from: {type: 'hot', params: params}}, params));
  31 +
  32 + goodsList.map(goods => {
  33 + goods.productTitle = `${params.query}|${goods.product_name}`;
  34 + return goods;
  35 + });
29 36
30 Object.assign(finalResult, 37 Object.assign(finalResult,
31 searchHandler.handlePathNavData({total: data.total}, params, 'search', channel), 38 searchHandler.handlePathNavData({total: data.total}, params, 'search', channel),
@@ -34,8 +41,7 @@ const _setHotKeywordData = (result, params, channel) => { @@ -34,8 +41,7 @@ const _setHotKeywordData = (result, params, channel) => {
34 opts: searchHandler.handleOptsData(changeQuery, data.total), 41 opts: searchHandler.handleOptsData(changeQuery, data.total),
35 totalCount: data.total, 42 totalCount: data.total,
36 footPager: searchHandler.handlePagerData(data.total, changeQuery), 43 footPager: searchHandler.handlePagerData(data.total, changeQuery),
37 - goods: productProcess.processProductList(data.product_list,  
38 - Object.assign({showDiscount: false, from: {type: 'hot', params: params}}, params)), 44 + goods: goodsList,
39 hasNextPage: searchHandler.handleNextPage(changeQuery, data.total) 45 hasNextPage: searchHandler.handleNextPage(changeQuery, data.total)
40 } 46 }
41 } 47 }
@@ -58,8 +64,12 @@ const _setHotKeywordData = (result, params, channel) => { @@ -58,8 +64,12 @@ const _setHotKeywordData = (result, params, channel) => {
58 64
59 finalResult.latestWalkExtra = [{ 65 finalResult.latestWalkExtra = [{
60 extraTabName: '相关推荐', 66 extraTabName: '相关推荐',
  67 + active: true,
61 extraGoodsList: productProcess.processProductList(data.product_list, 68 extraGoodsList: productProcess.processProductList(data.product_list,
62 Object.assign({showDiscount: false, from: {type: 'hot', params: params}}, params)) 69 Object.assign({showDiscount: false, from: {type: 'hot', params: params}}, params))
  70 + }, {
  71 + extraTabName: '最近预览',
  72 + latestWalk: 5
63 }]; 73 }];
64 } 74 }
65 75
@@ -96,7 +106,7 @@ module.exports = class extends global.yoho.BaseModel { @@ -96,7 +106,7 @@ module.exports = class extends global.yoho.BaseModel {
96 searchParams.need_filter = 'yes'; 106 searchParams.need_filter = 'yes';
97 107
98 return Promise.all([ 108 return Promise.all([
99 - headerModel.requestHeaderData(channel), 109 + headerModel.requestHeaderData(channel, true),
100 this.searchApi.getSeoProductList(searchParams, 'fuzzySearch'), 110 this.searchApi.getSeoProductList(searchParams, 'fuzzySearch'),
101 this.searchApi.getSeoProductList(Object.assign(searchParams, { 111 this.searchApi.getSeoProductList(Object.assign(searchParams, {
102 order: 's_n_desc', 112 order: 's_n_desc',
@@ -130,14 +140,15 @@ module.exports = class extends global.yoho.BaseModel { @@ -130,14 +140,15 @@ module.exports = class extends global.yoho.BaseModel {
130 val.href = helpers.urlFormat(`/hot/${val.id}.html`); 140 val.href = helpers.urlFormat(`/hot/${val.id}.html`);
131 return val; 141 return val;
132 }); 142 });
  143 + let seoTDK = seoHandler.getHotKeywordsSeo(keyword.name, _.get(result, 'product.totalCount', '多'));
133 144
134 keyword.list = _.take(hotKeys, 6); 145 keyword.list = _.take(hotKeys, 6);
  146 + keyword.describe = keyword.describe || seoTDK.description;
135 147
136 Object.assign(result, { 148 Object.assign(result, {
137 hotKeys: _.drop(hotKeys, 6), 149 hotKeys: _.drop(hotKeys, 6),
138 - keyword: keyword,  
139 - latestWalk: 5  
140 - }, seoHandler.getHotKeywordsSeo(keyword.name, _.get(result, 'product.totalCount', '多'))); 150 + keyword: keyword
  151 + }, seoTDK);
141 152
142 return result; 153 return result;
143 }); 154 });
1 -<div class="yoho-page seo-hot-page product-list-page"> 1 +<div class="yoho-page product-page seo-hot-page product-list-page">
2 {{> common/path-nav}} 2 {{> common/path-nav}}
3 3
4 <div class="clearfix"> 4 <div class="clearfix">
@@ -7,10 +7,10 @@ @@ -7,10 +7,10 @@
7 {{# keyword}} 7 {{# keyword}}
8 <div class="sort-intro"> 8 <div class="sort-intro">
9 <div class="inline"> 9 <div class="inline">
10 - <p class="name">  
11 - <span class="cn">{{name}}</span> 10 + <div class="name">
  11 + <h1 class="cn">{{name}}</h1>
12 {{# nameEn}}<span class="en">{{.}}</span>{{/ nameEn}} 12 {{# nameEn}}<span class="en">{{.}}</span>{{/ nameEn}}
13 - </p> 13 + </div>
14 {{# describe}}<p class="desc">{{.}}</p>{{/ describe}} 14 {{# describe}}<p class="desc">{{.}}</p>{{/ describe}}
15 15
16 {{#if list}} 16 {{#if list}}
@@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
22 {{/if}} 22 {{/if}}
23 </div> 23 </div>
24 </div> 24 </div>
25 - <img class="thumb" src="{{image2 goods_img}}"> 25 + <img class="thumb" src="{{image2 goods_img}}" alt="{{name}}">
26 {{/ keyword}} 26 {{/ keyword}}
27 </div> 27 </div>
28 28
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 <div class="right-content"> 34 <div class="right-content">
35 {{#if hotKeys}} 35 {{#if hotKeys}}
36 <div class="hot-block"> 36 <div class="hot-block">
37 - <p class="title">热门关键词</p> 37 + <h3 class="title">热门关键词</h3>
38 <p class="hot-key"> 38 <p class="hot-key">
39 {{# hotKeys}} 39 {{# hotKeys}}
40 <a href="{{href}}">{{keyword}}</a> 40 <a href="{{href}}">{{keyword}}</a>
@@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
43 </div> 43 </div>
44 {{/if}} 44 {{/if}}
45 <div class="hot-block"> 45 <div class="hot-block">
46 - <p class="title">热门品牌</p> 46 + <h3 class="title">热门品牌</h3>
47 47
48 {{# hotBrands}} 48 {{# hotBrands}}
49 <a href="{{href}}" class="brand-item" target="_blank" title="{{brand_name_cn}}"> 49 <a href="{{href}}" class="brand-item" target="_blank" title="{{brand_name_cn}}">
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 {{/if}} 8 {{/if}}
9 9
10 {{# latestWalkExtra}} 10 {{# latestWalkExtra}}
11 - <span class="tab-item extra-tab-item" data-key="{{@index}}">{{extraTabName}}</span> 11 + <span class="tab-item extra-tab-item{{#if active}} bottom-cur{{/if}}" data-key="{{@index}}">{{extraTabName}}</span>
12 {{/ latestWalkExtra}} 12 {{/ latestWalkExtra}}
13 <div class="bottom-line"></div> 13 <div class="bottom-line"></div>
14 </div> 14 </div>
@@ -44,23 +44,45 @@ @@ -44,23 +44,45 @@
44 {{/if}} 44 {{/if}}
45 45
46 {{# latestWalkExtra}} 46 {{# latestWalkExtra}}
47 - <div class="latest-walk-extra-area extra-area-{{@index}}">  
48 - <div class="goods clearfix">  
49 - {{# extraGoodsList}}  
50 - <div class="good">  
51 - <a href="{{url}}" target="_blank" title="{{product_name}}">  
52 - <img class="lazy" data-original="{{image2 thumb w=280 h=382}}" alt="{{product_name}}" />  
53 - </a>  
54 - <a class="name" href="{{url}}" target="_blank">{{product_name}}</a>  
55 - <p class="price">  
56 - {{#if market_price}}  
57 - <span class="market-price">¥{{round market_price 2}}</span>  
58 - {{/ if}}  
59 - <span class="sale-price">¥{{round sales_price 2}}</span> 47 + <div class="latest-walk-extra-area extra-area-{{@index}}{{#if active}} active{{/if}}">
  48 + {{#if extraGoodsList}}
  49 + <div class="goods clearfix">
  50 + {{# extraGoodsList}}
  51 + <div class="good">
  52 + <a href="{{url}}" target="_blank" title="{{product_name}}">
  53 + <img class="lazy" data-original="{{image2 thumb w=280 h=382}}" alt="{{product_name}}" />
  54 + </a>
  55 + <a class="name" href="{{url}}" target="_blank">{{product_name}}</a>
  56 + <p class="price">
  57 + {{#if market_price}}
  58 + <span class="market-price">¥{{round market_price 2}}</span>
  59 + {{/ if}}
  60 + <span class="sale-price">¥{{round sales_price 2}}</span>
  61 + </p>
  62 + </div>
  63 + {{/ extraGoodsList}}
  64 + </div>
  65 + {{/if}}
  66 +
  67 + {{#if latestWalk}}
  68 + <div class="latest-walk-area">
  69 + <input id="latest-walk-count" type="hidden" value="{{latestWalk}}">
  70 + <div class="latest-walk">
  71 + <div id="latest-walk-goods" class="goods clearfix"></div>
  72 + <p class="null-data">
  73 + 无最近浏览的商品
60 </p> 74 </p>
61 </div> 75 </div>
62 - {{/ extraGoodsList}}  
63 - </div> 76 +
  77 + {{> product/latest-walk-tpl}}
  78 +
  79 + <div class="lazy-load-object">
  80 + <textarea class="latest-walk-datalazyload" style="visibility: hidden;">
  81 + <script> fetchLatestWalk(); </script>
  82 + </textarea>
  83 + </div>
  84 + </div>
  85 + {{/if}}
64 </div> 86 </div>
65 {{/ latestWalkExtra}} 87 {{/ latestWalkExtra}}
66 </div> 88 </div>
@@ -127,6 +127,10 @@ @@ -127,6 +127,10 @@
127 display: none; 127 display: none;
128 } 128 }
129 129
  130 + .active {
  131 + display: block;
  132 + }
  133 +
130 .goods { 134 .goods {
131 width: 110%; 135 width: 110%;
132 height: auto; 136 height: auto;