Authored by 姜枫

调整url

@@ -41,7 +41,7 @@ const list = { @@ -41,7 +41,7 @@ const list = {
41 queryParams: q 41 queryParams: q
42 }; 42 };
43 res.display('list', _.assign(retData, { 43 res.display('list', _.assign(retData, {
44 - products: data.productList, 44 + products: DataHelper.handleProductList(data.productList),
45 order: q.order 45 order: q.order
46 })); 46 }));
47 } else { 47 } else {
@@ -90,7 +90,7 @@ const list = { @@ -90,7 +90,7 @@ const list = {
90 queryParams: q 90 queryParams: q
91 }; 91 };
92 res.display('newList', _.assign(retData, { 92 res.display('newList', _.assign(retData, {
93 - products: data.productList, 93 + products: DataHelper.handleProductList(data.productList),
94 order: q.order 94 order: q.order
95 })); 95 }));
96 } else { 96 } else {
1 'use strict'; 1 'use strict';
2 2
3 const _ = require('lodash'); 3 const _ = require('lodash');
  4 +const config = global.yoho.config;
4 5
5 const helpers = { 6 const helpers = {
6 brandLetters(numberIndex) { 7 brandLetters(numberIndex) {
@@ -143,7 +144,6 @@ const helpers = { @@ -143,7 +144,6 @@ const helpers = {
143 } 144 }
144 145
145 146
146 -  
147 if (!_.isArray(sizeInfo)) { 147 if (!_.isArray(sizeInfo)) {
148 sizeInfo.checked = true; 148 sizeInfo.checked = true;
149 sizeInfo = [sizeInfo]; 149 sizeInfo = [sizeInfo];
@@ -197,6 +197,15 @@ const helpers = { @@ -197,6 +197,15 @@ const helpers = {
197 showSize: !!q.sort, 197 showSize: !!q.sort,
198 nav: this.getSortNav(q.sort, sorts) 198 nav: this.getSortNav(q.sort, sorts)
199 }; 199 };
  200 + },
  201 +
  202 + handleProductList(list) {
  203 + if (_.isArray(list)) {
  204 + list.forEach(g => {
  205 + g.url = `${config.siteUrl}/product/item/${g.productId}_${g.productSkn}.html`;
  206 + });
  207 + }
  208 + return list;
200 } 209 }
201 }; 210 };
202 211
1 <div class="goods-area"> 1 <div class="goods-area">
2 {{#each products}} 2 {{#each products}}
3 - <div class="goods" data-id="{{productId}}"> 3 + <div class="goods" data-id="{{productId}}" data-url="{{url}}">
4 <div class="goods-img"> 4 <div class="goods-img">
5 - <img class="lazy" data-original="{{image defaultImages 265 344}}" width="265" height="344" alt=""> 5 + <img class="lazy" data-original="{{image defaultImages 263 344}}" width="263" height="344" alt="">
6 </div> 6 </div>
7 <div class="goods-brand"> 7 <div class="goods-brand">
8 {{brandName}} 8 {{brandName}}
@@ -19,7 +19,7 @@ module.exports = { @@ -19,7 +19,7 @@ module.exports = {
19 }, 19 },
20 cookieDomain: 'yohoblk.com', 20 cookieDomain: 'yohoblk.com',
21 domains: { 21 domains: {
22 - api: 'http://testapi.yoho.cn:28078/', // devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078 22 + api: 'http://api.yoho.cn/', // devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078
23 service: 'http://testservice.yoho.cn:28077/', // testservice.yoho.cn:28077 devservice.yoho.cn:58077 23 service: 'http://testservice.yoho.cn:28077/', // testservice.yoho.cn:28077 devservice.yoho.cn:58077
24 search: 'http://192.168.102.216:8080/yohosearch/' 24 search: 'http://192.168.102.216:8080/yohosearch/'
25 }, 25 },
@@ -137,6 +137,18 @@ var YohoListPage = { @@ -137,6 +137,18 @@ var YohoListPage = {
137 YohoListPage.filterBrand($(this).data('value').toLowerCase()); 137 YohoListPage.filterBrand($(this).data('value').toLowerCase());
138 }); 138 });
139 139
  140 + $('.goods-area > .goods').click(function() {
  141 + var url = $(this).data('url');
  142 +
  143 + location.href = url;
  144 + });
  145 +
  146 + $('.goods-wrapper > .goods').click(function() {
  147 + var url = $(this).data('url');
  148 +
  149 + location.href = url;
  150 + });
  151 +
140 $('.goods-area > .goods').mouseenter(function(e) { 152 $('.goods-area > .goods').mouseenter(function(e) {
141 YohoListPage.showGoodsWrapper(e); 153 YohoListPage.showGoodsWrapper(e);
142 }); 154 });
@@ -264,6 +276,7 @@ var YohoListPage = { @@ -264,6 +276,7 @@ var YohoListPage = {
264 showGoodsWrapper: function(e) { 276 showGoodsWrapper: function(e) {
265 var position = $(e.currentTarget).position(); 277 var position = $(e.currentTarget).position();
266 var productId = $(e.currentTarget).data('id'); 278 var productId = $(e.currentTarget).data('id');
  279 + var url = $(e.currentTarget).data('url');
267 var imgsSize = $(e.currentTarget).find('.goods-list i').length; 280 var imgsSize = $(e.currentTarget).find('.goods-list i').length;
268 var imgsCol; 281 var imgsCol;
269 var pos = {}; 282 var pos = {};
@@ -286,6 +299,7 @@ var YohoListPage = { @@ -286,6 +299,7 @@ var YohoListPage = {
286 299
287 $(this.goodsWrapper).css(pos); 300 $(this.goodsWrapper).css(pos);
288 $('.goods', this.goodsWrapper).html($(e.currentTarget).html()); 301 $('.goods', this.goodsWrapper).html($(e.currentTarget).html());
  302 + $('.goods', this.goodsWrapper).data('url', url);
289 $('.goods-img-list', this.goodsWrapper).empty(); 303 $('.goods-img-list', this.goodsWrapper).empty();
290 $(e.currentTarget).find('.goods-list i').each(function(index) { 304 $(e.currentTarget).find('.goods-list i').each(function(index) {
291 if (index % 4 === 0) { 305 if (index % 4 === 0) {
@@ -251,6 +251,7 @@ @@ -251,6 +251,7 @@
251 text-align: center; 251 text-align: center;
252 border: 2px solid #fff; 252 border: 2px solid #fff;
253 cursor: pointer; 253 cursor: pointer;
  254 + width: 287px;
254 255
255 .goods-brand { 256 .goods-brand {
256 font-weight: 700; 257 font-weight: 700;
@@ -263,6 +264,10 @@ @@ -263,6 +264,10 @@
263 width: 265px; 264 width: 265px;
264 height: 344px; 265 height: 344px;
265 266
  267 + img {
  268 + margin: 0;
  269 + }
  270 +
266 .label { 271 .label {
267 background-color: #408ccc; 272 background-color: #408ccc;
268 height: 24px; 273 height: 24px;