Authored by yyq

shop url

... ... @@ -14,21 +14,33 @@ const searchApi = require(`${mRoot}/search-api`);
// 店铺页
const shop = (shopId, req, res, next, brandInfo) => {
let domain = req.query.domain,
params = req.query;
_.unset(params, 'domain');
shopId = parseInt(shopId, 10);
Object.assign(params, {shopId: shopId});
list.getShopInfo(shopId, req.user.uid).then(shopInfo => {
if (+shopInfo.shopTemplateType === 2) { // 经典模板
let pjax = req.query._pjax;
let pjax = params._pjax;
// 比较品牌域名与店铺域名是否一致,不一致跳转至店铺域名
if (!pjax && shopInfo.domain && domain !== shopInfo.domain) {
res.redirect(helpers.urlFormat('', params, shopInfo.domain));
return;
}
if (+shopInfo.shopTemplateType === 2) { // 经典模板
if (pjax) {
list.getShopGoodsData(shopId, req.yoho.channel, req.query, shopInfo).then(result => {
list.getShopGoodsData(shopId, req.yoho.channel, params, shopInfo).then(result => {
Object.assign(result, {layout: false});
res.render('list/goods-list', result);
}).catch(next);
return;
}
list.getShopData(shopId, req.yoho.channel, req.query, shopInfo).then(result => {
list.getShopData(shopId, req.yoho.channel, params, shopInfo).then(result => {
Object.assign(result, {
page: 'shop',
shopId: shopId
... ... @@ -41,7 +53,7 @@ const shop = (shopId, req, res, next, brandInfo) => {
res.render('list/shop-index', result);
}).catch(next);
} else { // 基础模板
list.getBaseShopData(req.query, Object.assign({uid: req.user.uid}, brandInfo),
list.getBaseShopData(params, Object.assign({uid: req.user.uid}, brandInfo),
req.yoho.channel, shopId).then(result => {
Object.assign(result, {page: 'list'});
... ...
... ... @@ -631,8 +631,7 @@ const getShopData = (shopId, channel, params, shopInfo) => {
_.forEach(prodList, value => {
list[value.product_skn] = {
img: helpers.getForceSourceUrl(value.default_images) +
'?imageView2/1/w/{width}/h/{height}',
img: value.default_images,
title: value.product_name,
price: ${value.sales_price}`
};
... ...
<ul>
{{#each list}}
<li>
<a class="item item-{{@index}}" href="{{url}}" target= "_blank">
<img class="lazy" data-original="{{image img 235 250}}"/>
<p class="title">
{{title}}
</p>
<p class="price">
{{price}}
</p>
{{#if index}}
<span class="hat">{{index}}</span>
{{/if}}
</a>
<li>
<a class="item item-{{@index}}" href="{{url}}" target= "_blank">
<img class="lazy" data-original="{{image img 235 315}}"/>
<div class="info">
<p class="title">{{title}}</p>
<p class="price">{{price}}</p>
</div>
{{#if index}}
<span class="hat">{{index}}</span>
{{/if}}
</a>
</li>
{{/each}}
</ul>
... ...
... ... @@ -259,15 +259,37 @@
margin-bottom: 20px;
width: 235px;
height: 315px;
font-size: 14px;
font-size: 0;
text-align: center;
line-height: 1.5;
background: #f5f5f5;
font-weight: bold;
overflow: hidden;
img {
width: 235px;
height: 250px;
width: 100%;
height: 100%;
}
.info {
width: 100%;
height: 64px;
font-size: 14px;
margin-top: -64px;
overflow: hidden;
}
.info:before {
content: '';
width: 100%;
height: 100%;
background-color: #f5f5f5;
opacity: 0.5;
display: block;
}
.info > p {
position: relative;
top: -52px;
}
.title {
... ...