Authored by yyq

brand跳转

... ... @@ -24,7 +24,7 @@ const getBrandTopData = (contentCode) => {
* @param int $channel 频道标识 1:男,2:女,3:潮童,4:创意生活
*/
const getBrandListData = channel => {
let params = {method: 'app.brand.brandlist'};
let params = {method: 'app.brand.allBrandList'};
if (!isNaN(channel)) {
params.yh_channel = channel;
... ...
... ... @@ -31,6 +31,8 @@ const GIRLS = 'girls';
const KIDS = 'kids';
const LIFESTYLE = 'lifestyle';
const GLOBAL_BASE_URI = '/product/global/list';
/**
* 获取品牌一览资源位&channelType
*
... ... @@ -167,13 +169,14 @@ const getBrandViewList = (channel, start, length) => {
}
// 品牌list A-Z 0-9
if (res.data && res.data.brands) {
if (res.data && res.data.all_list) {
_.forEach(res.data.brands, (subValue, key) => {
_.forEach(res.data.all_list, (subValue, key) => {
let listTmp = [];
_.forEach(subValue, ssubValue => {
let extQs = {};
let baseUri = '';
// 为品牌名称
let href;
... ... @@ -183,22 +186,35 @@ const getBrandViewList = (channel, start, length) => {
} else if (switchParams.channelType === 2) {
Object.assign(extQs, {gender: '2,3'});
}
let shopInfo, shopId;
switch (ssubValue.type * 1) {
case 1:
extQs = {query: ssubValue.brand_domain};
extQs = {
query: ssubValue.brand_domain,
brand: ssubValue.id
};
ssubValue.brand_domain = 'search';
break;
case 2:
if (ssubValue.shop_id) {
Object.assign(extQs, {shopId: ssubValue.shop_id});
shopInfo = _.get(ssubValue, 'shop_info.yoho_shop_list[0]', {});
shopId = shopInfo.shop_id || ssubValue.shop_id;
ssubValue.brand_domain = shopInfo.shop_domain || ssubValue.brand_domain;
if (shopId) {
Object.assign(extQs, {shopId: shopId});
}
break;
case 3:
Object.assign(extQs, {brand: ssubValue.id});
ssubValue.brand_domain = '';
baseUri = GLOBAL_BASE_URI;
break;
default:
break;
}
href = helpers.urlFormat('', extQs, ssubValue.brand_domain);
href = helpers.urlFormat(baseUri, extQs, ssubValue.brand_domain);
let brandItem = {
name: ssubValue.brand_name,
... ...
... ... @@ -174,7 +174,6 @@ exports.newWithChannel = (req, res, next) => {
exports.brand = (req, res, next) => {
let brandDomain = req.query.domain;
let shopId = req.query.shopId;
let resData = {};
// shopId存在,直接走店铺
if (shopId) {
... ... @@ -198,13 +197,11 @@ exports.brand = (req, res, next) => {
case 2: // 店铺
return shop(brandInfo.shopId, req, res, next, brandInfo);
default: // 品牌
return list.getBrandData(req.query, Object.assign({uid: req.user.uid}, brandInfo),
req.yoho.channel).then(result => {
Object.assign(resData, result, {
page: 'list'
});
res.render('list/brand', resData);
});
res.redirect(helpers.urlFormat('', {
query: brandInfo.brandDomain,
brand: brandInfo.brandId
}, 'search'));
break;
}
}).catch(next);
};
... ...