Authored by yyq

style

@@ -13,6 +13,17 @@ const seoHandler = require('./seo-handler'); @@ -13,6 +13,17 @@ const seoHandler = require('./seo-handler');
13 const utils = '../../../utils'; 13 const utils = '../../../utils';
14 const productProcess = require(`${utils}/product-process-simple`); 14 const productProcess = require(`${utils}/product-process-simple`);
15 15
  16 +const _handleImageUrl = (url) => {
  17 + if (url) {
  18 + let imgArr = _.split(url, '?', 1);
  19 +
  20 + imgArr.push('imageView2/1/w/{width}/h/{height}/q/90');
  21 + url = imgArr.join('?');
  22 + }
  23 +
  24 + return url;
  25 +}
  26 +
16 const _setHotKeywordData = (result, params, channel) => { 27 const _setHotKeywordData = (result, params, channel) => {
17 let changeQuery = Object.assign({}, params); 28 let changeQuery = Object.assign({}, params);
18 let finalResult = { 29 let finalResult = {
@@ -137,17 +148,19 @@ module.exports = class extends global.yoho.BaseModel { @@ -137,17 +148,19 @@ module.exports = class extends global.yoho.BaseModel {
137 params.query = keyword.name; 148 params.query = keyword.name;
138 149
139 return this.getSearchProduct(params, channel).then(result => { 150 return this.getSearchProduct(params, channel).then(result => {
  151 + const keyNum = 10;
140 let hotKeys = (keyword.data || []).map(val => { 152 let hotKeys = (keyword.data || []).map(val => {
141 val.href = helpers.urlFormat(`/hot/${val.id}.html`); 153 val.href = helpers.urlFormat(`/hot/${val.id}.html`);
142 return val; 154 return val;
143 }); 155 });
144 let seoTDK = seoHandler.getHotKeywordsSeo(keyword.name, _.get(result, 'product.totalCount', '多')); 156 let seoTDK = seoHandler.getHotKeywordsSeo(keyword.name, _.get(result, 'product.totalCount', '多'));
145 157
146 - keyword.list = _.take(hotKeys, 6); 158 + keyword.goods_img = _handleImageUrl(keyword.goods_img);
  159 + keyword.list = _.take(hotKeys, keyNum);
147 keyword.describe = keyword.describe || seoTDK.description; 160 keyword.describe = keyword.describe || seoTDK.description;
148 161
149 Object.assign(result, { 162 Object.assign(result, {
150 - hotKeys: _.drop(hotKeys, 6), 163 + hotKeys: _.drop(hotKeys, keyNum),
151 keyword: keyword 164 keyword: keyword
152 }, seoTDK); 165 }, seoTDK);
153 166
@@ -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}}" alt="{{name}}"> 25 + <img class="thumb" src="{{image2 goods_img w=300 h=300}}" alt="{{name}}">
26 {{/ keyword}} 26 {{/ keyword}}
27 </div> 27 </div>
28 28
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 position: relative; 12 position: relative;
13 13
14 .sort-intro { 14 .sort-intro {
15 - width: 488px; 15 + width: 650px;
16 height: 300px; 16 height: 300px;
17 line-height: 300px; 17 line-height: 300px;
18 border: 1px solid #eaeceb; 18 border: 1px solid #eaeceb;
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 21
22 .inline { 22 .inline {
23 width: 100%; 23 width: 100%;
24 - padding: 0 50px; 24 + padding: 0 30px;
25 line-height: 1; 25 line-height: 1;
26 text-align: center; 26 text-align: center;
27 display: inline-block; 27 display: inline-block;
@@ -53,7 +53,7 @@ @@ -53,7 +53,7 @@
53 margin-top: 30px; 53 margin-top: 30px;
54 54
55 > li { 55 > li {
56 - width: 33.33%; 56 + width: 20%;
57 text-align: center; 57 text-align: center;
58 float: left; 58 float: left;
59 font-size: 12px; 59 font-size: 12px;
@@ -67,7 +67,7 @@ @@ -67,7 +67,7 @@
67 } 67 }
68 68
69 .thumb { 69 .thumb {
70 - width: 480px; 70 + width: 300px;
71 height: 300px; 71 height: 300px;
72 position: absolute; 72 position: absolute;
73 top: 0; 73 top: 0;