Authored by 郭成尧

Merge branch 'feature/brand' into develop

... ... @@ -59,7 +59,10 @@ module.exports = {
shopId: req.body.shopId,
favId: req.body.favId,
uid: req.user.uid,
type: 'shop'
// uid: '8050882',
type: 'shop',
isFav: req.body.isFav
}).then(result => {
res.json(result);
});
... ...
... ... @@ -109,13 +109,13 @@ module.exports = {
type: params.type
};
if (params.isFav) {
if (params.isFav === 'true') {
Object.assign(finalParams, {
method: 'app.favorite.add'
method: 'app.favorite.cancel'
});
} else {
Object.assign(finalParams, {
method: 'app.favorite.cancel'
method: 'app.favorite.add'
});
}
return api.get('', finalParams);
... ...
... ... @@ -31,13 +31,16 @@ const getShopData = params => {
/* 是 BLK 的店铺 */
Object.assign(finalResult, {
isBlkShop: true
isBlkShop: true,
shopId: result[0].data.shop_id
});
return api.all([
shopApi.getShopInfoData({
shopId: result[0].data.shop_id,
uid: params.uid
// uid: '8050882'
})
]).then(subResult => {
if (subResult[0].code === 200) {
... ... @@ -46,7 +49,8 @@ const getShopData = params => {
Object.assign(finalResult, {
brandLogo: subResult[0].data.shop_logo,
brandName: subResult[0].data.shop_name,
brandIntro: subResult[0].data.shop_intro
brandIntro: subResult[0].data.shop_intro,
isFav: subResult[0].data.is_favorite === 'Y'
});
/* TODO shop_template_type 待接口确认 */
... ...
<template>
<div class="share-bottom clearfix" v-bind:class="{ 'hidden': close }">
<!-- TODO iconfont 要换-->
<span class="icon close" @click="closeBottom()">&#xe609;</span>
<img v-lazy="">
<span class="icon close" @click="closeBottom()">&#xe610;</span>
<span class="icon blk-icon">&#xe60f;</span>
<a href="javascript:;" class="new-user">新用户送千元礼包</a>
<a href="http://m.yohoblk.com" class="download">立即下载</a>
</div>
... ... @@ -30,10 +28,17 @@
float: left;
}
.blk-icon {
margin-left: 50px;
margin-right: 20px;
float: left;
}
a {
border: #000 solid 2px;
padding: 10px;
border-radius: 40px;
float: left;
}
.new-user {
... ... @@ -43,6 +48,7 @@
.download {
float: right;
margin-right: 20px;
}
}
... ...
<template>
<div class="brand-share">
<div class="brand-top-box" v-bind:style="{ 'background-image': `url(${brandBg})` }"></div>
<div class="brand-title">{{ brandName }}</div>
<div class="brand-intro">{{ brandIntro }}</div>
<div class="brand-top-box" v-bind:style="{ 'background-image': `url(${shopInfo.brandBg})` }"></div>
<div class="brand-title">{{ shopInfo.brandName }}</div>
<div class="brand-intro">{{ shopInfo.brandIntro }}</div>
<div class="tip">进入 BLK 选购潮品</div>
<div class="icon arrow">&#xe602;</div>
<img v-lazy="brandBg | resize 752 365">
<a href="//m.yohoblk.com"><img v-lazy="shopInfo.brandBg | resize 752 365"></a>
</div>
<share-bottom></share-bottom>
</template>
... ... @@ -15,7 +15,7 @@
width: 100%;
height: 468px;
color: #fff;
background-color: #000;
background-color: #ccc;
position: relative;
}
... ... @@ -54,20 +54,36 @@
</style>
<script>
const shareBottom = require('product/shop/share-bottom.vue');
const qs = require('yoho-qs');
const tip = require('common/tip');
module.exports = {
/* TODO 数据需要从接口获取 */
data() {
return {
brandName: 'COLORMAD',
brandBg: 'http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg',
brandIntro: 'COLORMAD坚持女性的时尚美丽不应为牺牲健康为代价,以健康,时尚,科技为理念,' +
'研发健康无伤害的新概念甲油。'
shopInfo: {}
};
},
methods: {
/* 获取店铺简介相关数据 */
getShopInfo() {
$.get({
url: '/product/get-shop-info',
data: { domain: qs.domain }
}).done(result => {
this.shopInfo = result;
}).fail(() => {
tip('网络错误');
});
}
},
components: {
shareBottom
},
created() {
this.getShopInfo();
}
};
</script>
... ...
... ... @@ -70,8 +70,11 @@
this.shopInfo.showBrandInfo = true;
this.shareData = {
title: result.brandName,
link: '/brand-share?domain=' + this.domain,
img: result.brandBg
des: result.brandIntro,
url: '/product/brand-share?domain=' + this.domain,
img: result.brandBg,
shopId: result.shopId, // 不是分享的参数,收藏店铺使用
isFav: result.isFav // 不是分享的参数,收藏店铺使用
};
} else {
this.shopInfo.showBrandInfo = false;
... ...
... ... @@ -15,7 +15,7 @@
width: 100%;
height: 468px;
color: #fff;
background-color: #000;
background-color: #ccc;
position: relative;
.brand-bottom {
... ...
... ... @@ -2,9 +2,10 @@
<div class="top-box clearfix">
<span class="icon back" @click="goBack()">&#xe606;</span>
<div class="right">
<span class="icon" v-bind:class="{'favorite': shareData.isFav}" @click="collectShop()">&#xe609;</span>
<span class="icon share" @click="goShare()">&#xe60e;</span>
<span class="icon filter" @click="showFilter()">&#xe60b;</span>
<span v-if="shareData.isFav" class="icon" @click="collectShop()">&#xe60d;</span>
<span v-else class="icon" @click="collectShop()">&#xe60c;</span>
<span class="icon" @click="goShare()">&#xe60e;</span>
<span class="icon" @click="showFilter()">&#xe60b;</span>
</div>
</div>
</template>
... ... @@ -38,10 +39,6 @@
height: 60px;
margin: 0 5px;
}
.favorite {
color: #000;
}
}
}
</style>
... ... @@ -59,6 +56,10 @@
},
methods: {
goShare() {
// 删除两个多余的参数,两个参数是收藏时使用的
delete this.shareData.shopId;
delete this.shareData.isFav;
yoho.goShare(this.shareData, function() {}, function() {});
},
goBack() {
... ... @@ -75,13 +76,12 @@
};
$.post({
url: '/collect-shop',
url: '/product/collect-shop',
data: data
}).done(result => {
tip(result.message);
if (result.code === 200) {
this.shareData.isFav = this.shareData.isFav !== true;
} else {
tip('网络错误');
this.shareData.isFav = !this.shareData.isFav;
}
}).fail(() => {
tip('网络错误');
... ...