Authored by ccbikai

Merge branch 'feature/brand' into develop

... ... @@ -39,7 +39,6 @@ module.exports = {
getCateListData(params) {
return api.get('', Object.assign(params, {
method: 'app.sort.get'
})
);
}));
}
};
... ...
... ... @@ -51,7 +51,7 @@ module.exports = {
},
/**
* TODO 从接口获得店铺装修资源
* 从接口获得店铺装修资源
* @param params
* @returns {*}
*/
... ...
... ... @@ -11,6 +11,7 @@ const shopApi = require('./shop-api');
const path = require('path');
const processProductList = require(path.join(global.utils, '/beautify/product')).processProductList;
const camelCase = global.yoho.camelCase;
const _ = require('lodash');
/**
* 获取品牌店铺数据
... ... @@ -26,8 +27,14 @@ const getShopData = params => {
if (result[0].code === 200) {
/* 品牌有店铺 */
/* 品牌是否有店铺 */
if (result[0].data.shop_id) {
/* 是 BLK 的店铺 */
Object.assign(finalResult, {
isBlkShop: true
});
return api.all([
shopApi.getShopInfoData({
shopId: result[0].data.shop_id,
... ... @@ -36,33 +43,61 @@ const getShopData = params => {
]).then(subResult => {
if (subResult[0].code === 200) {
/* TODO 判断是否是使用 BLK 模板,不使用 BLK 模板的就直接返回 */
if (subResult[0].data.shop_template_type === '2') {
Object.assign(finalResult, {
/* 取店铺的基本信息 */
Object.assign(finalResult, {
brandLogo: subResult[0].data.shop_logo,
brandName: subResult[0].data.shop_name,
brandIntro: subResult[0].data.shop_intro
});
/* TODO shop_template_type 待接口确认 */
if (subResult[0].data.shop_template_type === '3') {
/* 取资源位店铺背景图 */
return api.all([
shopApi.getShopsDecoratorList({shopId: result[0].data.shop_id})
]).then(thResult => {
if (thResult.code === 200) {
_.forEach(thResult[0].data.list, value => {
/* TODO resource_name 待接口确认 */
if (value.resource_name === 'shopTopBanner_BLK') {
Object.assign(finalResult, {
brandBg: value.resource_data.shopSrc
});
}
});
/* TODO 背景图取资源位,接口未开发 */
brandBg: 'http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg',
} else {
logger.info('getShopsDecoratorList api code no 200');
}
/* TODO 是否显示店铺 LOGO,接口未开发 */
showBrandLogo: false,
brandLogo: subResult[0].data.shop_logo,
brandName: subResult[0].data.shop_name,
brandIntro: subResult[0].data.shop_intro
return finalResult;
});
return finalResult;
} else {
logger.info('no BLK template');
logger.info('no BLK template resource');
}
} else {
logger.error('getShopInfoData api code no 200');
}
return finalResult;
});
} else {
/* 不是 BLK 的店铺 */
Object.assign(finalResult, {
isBlkShop: false
});
logger.info('brand has no shop');
}
} else {
logger.error('getBrandOriginData api code no 200');
}
return finalResult;
});
};
... ...
... ... @@ -249,7 +249,9 @@ const yoho = {
* @param callback 回调
*/
addNativeMethod(name, callback) {
window.yohoInterface[name] = callback;
if (window.yohoInterface) {
window.yohoInterface[name] = callback;
}
}
};
... ...
... ... @@ -31,6 +31,14 @@
return {
yoho
};
},
created() {
yoho.addNativeMethod('headerRightTopBtn', function(data) {
alert('app 调用 H5 成功!');
if (data) {
alert('传递的信息是:' + data);
}
});
}
};
</script>
... ...
... ... @@ -4,7 +4,7 @@
<div class="brand-title">{{ brandName }}</div>
<div class="brand-intro">{{ brandIntro }}</div>
<div class="tip">进入 BLK 选购潮品</div>
<div class="arrow">i</div>
<div class="icon arrow">&#xe602;</div>
<img v-lazy="brandBg | resize 752 365">
</div>
<share-bottom></share-bottom>
... ...
<template>
<div v-if="shopInfo.showBrandInfo" class="brand-top-box" v-bind:style="{ 'background-image': `url(${shopInfo.brandBg})` }">
<div v-if="shopInfo.isBlkShop" class="brand-top-box" v-bind:style="{ 'background-image': `url(${shopInfo.brandBg})` }">
<div class="brand-bottom">
<img v-if="shopInfo.showBrandLogo" v-lazy="brandIntro.brandLogo" alt="{{ shopInfo.brandName }}">
<div v-else class="brand-title">{{ shopInfo.brandName }}</div>
... ...