Authored by zhangxiaoru

品牌跳转

... ... @@ -42,7 +42,7 @@ const _packageAd = (params) => {
const _packageList = (channel) => {
return api.get('', {
method: 'app.brand.newBrandList',
method: 'app.brand.allBrandList',
yh_channel: channel
}, {
cache: true,
... ... @@ -172,7 +172,10 @@ const getBrandListByChannel = (channel) => {
name: row.brand_name,
isHot: row.is_hot === 'Y' ? true : false,
isNew: row.is_show_new === 'Y' ? true : false,
url: helpers.urlFormat('/product/index/brand?domain=' + row.brand_domain)
url: helpers.urlFormat('/product/index/brand', {
domain: row.brand_domain,
shopType: row.type
})
});
});
resu.brandList.push(obj);
... ... @@ -190,7 +193,10 @@ const getBrandListByChannel = (channel) => {
obj.list.push({
brandName: newList[key].brand_name,
url: helpers.urlFormat('/product/index/brand?domain=' + newList[key].brand_domain),
url: helpers.urlFormat('/product/index/brand', {
domain: newList[key].brand_domain,
shopType: newList[key].type
}),
img: helpers.image(newList[key].brand_ico, 186, 115),
});
resu.newBrandWall.push(obj);
... ... @@ -208,7 +214,10 @@ const getBrandListByChannel = (channel) => {
obj.list.push({
brandName: hotList[key].brand_name,
url: helpers.urlFormat('/product/index/brand?domain=' + hotList[key].brand_domain),
url: helpers.urlFormat('/product/index/brand', {
domain: hotList[key].brand_domain,
shopType: hotList[key].type
}),
img: helpers.image(hotList[key].brand_ico, 186, 115),
});
resu.recommandBrandWall.push(obj);
... ...
... ... @@ -43,6 +43,7 @@ const shop = {
let title = '';
let uid = req.user.uid || 0;
let shopEnter;
let shopType = req.query.shopType;
if (req.query.shop_id) {
return shop.shop(req, res, next);
... ... @@ -81,13 +82,13 @@ const shop = {
searchParam.uid = uid;
}
if (req.query.from !== 'search' && brandLogo.type === '2' && brandLogo.shopId) {
if (req.query.from !== 'search' && brandLogo.type === '2' && brandLogo.shopId && shopType !== '1') {
req.query.shop_id = brandLogo.shopId;
shop.shop(req, res, next);
return false;
} else if (req.query.from === 'search') {
} else if (req.query.from === 'search' || shopType === '1') {
return Promise.all([
listModel.getBrandShops(brandId, req),
listModel.getBrandShops(brandLogo.brandDomain, req),
searchModel.getSearchData(searchParam)
]).then(shopResult => {
let brandShop = shopResult[0];
... ... @@ -113,14 +114,16 @@ const shop = {
}
if (brandShop.length > 0 || brandLogo && shopEnter) {
params = _.assign({
brandWay: _.isEmpty(brandShop) ? brandLogo : brandShop,
search: {
default: req.query.query,
default: req.query.query || req.query.domain,
url: helpers.urlFormat('', null, 'search')
}
}, params);
}
return true;
});
} else {
... ...
... ... @@ -34,12 +34,16 @@ const _processBrandShops = (list) => {
url: helpers.urlFormat('/product/index/brand/', {
shop_id: item.shop_id
}),
thumb: helpers.image(item.brand_ico, 75, 40),
name: item.brand_name
thumb: helpers.image(item.shop_logo, 75, 40),
name: item.shop_name
});
}
});
if (formatDat.length > 2) {
formatDat.moreShop = true;
}
return formatDat;
};
... ... @@ -749,7 +753,8 @@ const getBrandLogoByDomain = (domain) => {
thumb: helpers.image(formatData.brand_ico, 75, 40),
name: formatData.brand_name,
shopId: formatData.shop_id ? formatData.shop_id : 0, // 店铺id
type: formatData.type ? formatData.type : 0
type: formatData.type ? formatData.type : 0,
brandDomain: formatData.brand_domain
};
} else {
return false;
... ... @@ -763,18 +768,18 @@ const getBrandLogoByDomain = (domain) => {
* @param req
* @return array
*/
const getBrandShops = (brandId, req) => {
const getBrandShops = (domain, req) => {
return api.get('', {
method: 'app.shop.queryShopsByBrandId',
brand_id: brandId
method: 'app.search.li',
query: domain
}, {
code: 200,
cache: true
}).then(result => {
if (_.isArray(result.data)) {
if (result.data.shopList && _.isArray(result.data.shopList)) {
let seoResult = _getBrandShopSeo(req.channel, result.data[0], req.query);
return Object.assign(_processBrandShops(result.data), {seoResult: seoResult});
return Object.assign(_processBrandShops(result.data.shopList), {seoResult: seoResult});
} else {
return [];
}
... ...
... ... @@ -12,8 +12,10 @@
</div>
<ul class="search-associate"></ul>
{{/ search}}
{{# brandWay}}
{{#if brandWay}}
<div class="brand-way">
<div class="brand-enter">
{{# brandWay}}
<a href={{url}}>
<img class="brand-thumb" src={{image2 thumb q=60}}>
<span class="brand-name">{{name}}</span>
... ... @@ -22,8 +24,16 @@
<i class="iconfont">&#xe614;</i>
</span>
</a>
</div>
{{/ brandWay}}
</div>
{{#if brandWay.moreShop}}
<div class="more-shop down">
<span class="iconfont">&#xe616;</span>
</div>
{{/if}}
</div>
{{/if}}
<!-- 品牌页面 -->
{{# brandHome}}
<div id="brand-header" class="brand-header" data-id={{id}}>
... ...
... ... @@ -10,15 +10,26 @@ const isProduction = process.env.NODE_ENV === 'production';
const isTest = process.env.NODE_ENV === 'test';
const domains = {
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test3.yohops.com:9999/',
// liveApi: 'http://testapi.live.yohops.com:9999/',
// singleApi: 'http://api-test3.yohops.com:9999/',
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
// api: 'http://api-test3.yohops.com:9999/',
// service: 'http://service-test3.yohops.com:9999/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/',
api: 'http://dev-api.yohops.com:9999/',
service: 'http://dev-service.yohops.com:9999/',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test1.yohops.com:9999/',
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/',
imSocket: 'ws://socket.yohobuy.com:10240',
imCs: 'http://im.yohobuy.com/api'
};
... ...
... ... @@ -834,4 +834,14 @@ $('#goods-container').on('click', '.good-info', function() {
// return false;
});
$('.more-shop').on('click', function() {
if ($(this).hasClass('down')) {
$('.brand-enter').css('max-height', '100%');
$('.more-shop').removeClass('down').find('span').html('&#xe615;');
} else {
$('.brand-enter').removeAttr('style');
$('.more-shop').addClass('down').find('span').html('&#xe616;');
}
});
require('channel/maybe-like')({recpose: 100101, isExecute: true});
... ...
... ... @@ -65,12 +65,16 @@
padding-bottom: 20px;
background: #f4f4f4;
> a {
.brand-enter {
max-height: 160px;
overflow: hidden;
}
a {
display: block;
height: 80px;
line-height: 80px;
padding: 0 20px;
border-bottom: 1px solid #e6e6e6;
border-top: 1px solid #e6e6e6;
font-size: 34px;
background: #fff;
... ... @@ -78,6 +82,10 @@
overflow: hidden;
}
/* a:last-child {
border-bottom: 1px solid #e6e6e6;
} */
span {
font-size: 28px;
overflow: hidden;
... ... @@ -90,21 +98,38 @@
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
position: absolute;
display: inline-block;
/* position: absolute; */
}
.brand-thumb {
display: block;
float: left;
width: 150px;
height: 80px;
margin: 0;
display: inline-block;
}
.entry {
color: #999;
font-size: 28px;
float: right;
display: inline-block;
}
.more-shop {
width: 100%;
height: 40px;
background: #fff;
color: #999;
margin-top: 0;
text-align: center;
span {
position: relative;
top: -6px;
}
}
}
... ...