Authored by 姜枫

调整url

... ... @@ -41,7 +41,7 @@ const list = {
queryParams: q
};
res.display('list', _.assign(retData, {
products: data.productList,
products: DataHelper.handleProductList(data.productList),
order: q.order
}));
} else {
... ... @@ -90,7 +90,7 @@ const list = {
queryParams: q
};
res.display('newList', _.assign(retData, {
products: data.productList,
products: DataHelper.handleProductList(data.productList),
order: q.order
}));
} else {
... ...
'use strict';
const _ = require('lodash');
const config = global.yoho.config;
const helpers = {
brandLetters(numberIndex) {
... ... @@ -143,7 +144,6 @@ const helpers = {
}
if (!_.isArray(sizeInfo)) {
sizeInfo.checked = true;
sizeInfo = [sizeInfo];
... ... @@ -197,6 +197,15 @@ const helpers = {
showSize: !!q.sort,
nav: this.getSortNav(q.sort, sorts)
};
},
handleProductList(list) {
if (_.isArray(list)) {
list.forEach(g => {
g.url = `${config.siteUrl}/product/item/${g.productId}_${g.productSkn}.html`;
});
}
return list;
}
};
... ...
<div class="goods-area">
{{#each products}}
<div class="goods" data-id="{{productId}}">
<div class="goods" data-id="{{productId}}" data-url="{{url}}">
<div class="goods-img">
<img class="lazy" data-original="{{image defaultImages 265 344}}" width="265" height="344" alt="">
<img class="lazy" data-original="{{image defaultImages 263 344}}" width="263" height="344" alt="">
</div>
<div class="goods-brand">
{{brandName}}
... ...
... ... @@ -19,7 +19,7 @@ module.exports = {
},
cookieDomain: 'yohoblk.com',
domains: {
api: 'http://testapi.yoho.cn:28078/', // devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078
api: 'http://api.yoho.cn/', // devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078
service: 'http://testservice.yoho.cn:28077/', // testservice.yoho.cn:28077 devservice.yoho.cn:58077
search: 'http://192.168.102.216:8080/yohosearch/'
},
... ...
... ... @@ -137,6 +137,18 @@ var YohoListPage = {
YohoListPage.filterBrand($(this).data('value').toLowerCase());
});
$('.goods-area > .goods').click(function() {
var url = $(this).data('url');
location.href = url;
});
$('.goods-wrapper > .goods').click(function() {
var url = $(this).data('url');
location.href = url;
});
$('.goods-area > .goods').mouseenter(function(e) {
YohoListPage.showGoodsWrapper(e);
});
... ... @@ -264,6 +276,7 @@ var YohoListPage = {
showGoodsWrapper: function(e) {
var position = $(e.currentTarget).position();
var productId = $(e.currentTarget).data('id');
var url = $(e.currentTarget).data('url');
var imgsSize = $(e.currentTarget).find('.goods-list i').length;
var imgsCol;
var pos = {};
... ... @@ -286,6 +299,7 @@ var YohoListPage = {
$(this.goodsWrapper).css(pos);
$('.goods', this.goodsWrapper).html($(e.currentTarget).html());
$('.goods', this.goodsWrapper).data('url', url);
$('.goods-img-list', this.goodsWrapper).empty();
$(e.currentTarget).find('.goods-list i').each(function(index) {
if (index % 4 === 0) {
... ...
... ... @@ -251,6 +251,7 @@
text-align: center;
border: 2px solid #fff;
cursor: pointer;
width: 287px;
.goods-brand {
font-weight: 700;
... ... @@ -263,6 +264,10 @@
width: 265px;
height: 344px;
img {
margin: 0;
}
.label {
background-color: #408ccc;
height: 24px;
... ...