Merge branch 'feature/brand' into develop
Showing
8 changed files
with
65 additions
and
33 deletions
@@ -59,7 +59,10 @@ module.exports = { | @@ -59,7 +59,10 @@ module.exports = { | ||
59 | shopId: req.body.shopId, | 59 | shopId: req.body.shopId, |
60 | favId: req.body.favId, | 60 | favId: req.body.favId, |
61 | uid: req.user.uid, | 61 | uid: req.user.uid, |
62 | - type: 'shop' | 62 | + |
63 | + // uid: '8050882', | ||
64 | + type: 'shop', | ||
65 | + isFav: req.body.isFav | ||
63 | }).then(result => { | 66 | }).then(result => { |
64 | res.json(result); | 67 | res.json(result); |
65 | }); | 68 | }); |
@@ -109,13 +109,13 @@ module.exports = { | @@ -109,13 +109,13 @@ module.exports = { | ||
109 | type: params.type | 109 | type: params.type |
110 | }; | 110 | }; |
111 | 111 | ||
112 | - if (params.isFav) { | 112 | + if (params.isFav === 'true') { |
113 | Object.assign(finalParams, { | 113 | Object.assign(finalParams, { |
114 | - method: 'app.favorite.add' | 114 | + method: 'app.favorite.cancel' |
115 | }); | 115 | }); |
116 | } else { | 116 | } else { |
117 | Object.assign(finalParams, { | 117 | Object.assign(finalParams, { |
118 | - method: 'app.favorite.cancel' | 118 | + method: 'app.favorite.add' |
119 | }); | 119 | }); |
120 | } | 120 | } |
121 | return api.get('', finalParams); | 121 | return api.get('', finalParams); |
@@ -31,13 +31,16 @@ const getShopData = params => { | @@ -31,13 +31,16 @@ const getShopData = params => { | ||
31 | 31 | ||
32 | /* 是 BLK 的店铺 */ | 32 | /* 是 BLK 的店铺 */ |
33 | Object.assign(finalResult, { | 33 | Object.assign(finalResult, { |
34 | - isBlkShop: true | 34 | + isBlkShop: true, |
35 | + shopId: result[0].data.shop_id | ||
35 | }); | 36 | }); |
36 | 37 | ||
37 | return api.all([ | 38 | return api.all([ |
38 | shopApi.getShopInfoData({ | 39 | shopApi.getShopInfoData({ |
39 | shopId: result[0].data.shop_id, | 40 | shopId: result[0].data.shop_id, |
40 | uid: params.uid | 41 | uid: params.uid |
42 | + | ||
43 | + // uid: '8050882' | ||
41 | }) | 44 | }) |
42 | ]).then(subResult => { | 45 | ]).then(subResult => { |
43 | if (subResult[0].code === 200) { | 46 | if (subResult[0].code === 200) { |
@@ -46,7 +49,8 @@ const getShopData = params => { | @@ -46,7 +49,8 @@ const getShopData = params => { | ||
46 | Object.assign(finalResult, { | 49 | Object.assign(finalResult, { |
47 | brandLogo: subResult[0].data.shop_logo, | 50 | brandLogo: subResult[0].data.shop_logo, |
48 | brandName: subResult[0].data.shop_name, | 51 | brandName: subResult[0].data.shop_name, |
49 | - brandIntro: subResult[0].data.shop_intro | 52 | + brandIntro: subResult[0].data.shop_intro, |
53 | + isFav: subResult[0].data.is_favorite === 'Y' | ||
50 | }); | 54 | }); |
51 | 55 | ||
52 | /* TODO shop_template_type 待接口确认 */ | 56 | /* TODO shop_template_type 待接口确认 */ |
1 | <template> | 1 | <template> |
2 | <div class="share-bottom clearfix" v-bind:class="{ 'hidden': close }"> | 2 | <div class="share-bottom clearfix" v-bind:class="{ 'hidden': close }"> |
3 | - | ||
4 | - <!-- TODO iconfont 要换--> | ||
5 | - <span class="icon close" @click="closeBottom()"></span> | ||
6 | - <img v-lazy=""> | 3 | + <span class="icon close" @click="closeBottom()"></span> |
4 | + <span class="icon blk-icon"></span> | ||
7 | <a href="javascript:;" class="new-user">新用户送千元礼包</a> | 5 | <a href="javascript:;" class="new-user">新用户送千元礼包</a> |
8 | <a href="http://m.yohoblk.com" class="download">立即下载</a> | 6 | <a href="http://m.yohoblk.com" class="download">立即下载</a> |
9 | </div> | 7 | </div> |
@@ -30,10 +28,17 @@ | @@ -30,10 +28,17 @@ | ||
30 | float: left; | 28 | float: left; |
31 | } | 29 | } |
32 | 30 | ||
31 | + .blk-icon { | ||
32 | + margin-left: 50px; | ||
33 | + margin-right: 20px; | ||
34 | + float: left; | ||
35 | + } | ||
36 | + | ||
33 | a { | 37 | a { |
34 | border: #000 solid 2px; | 38 | border: #000 solid 2px; |
35 | padding: 10px; | 39 | padding: 10px; |
36 | border-radius: 40px; | 40 | border-radius: 40px; |
41 | + float: left; | ||
37 | } | 42 | } |
38 | 43 | ||
39 | .new-user { | 44 | .new-user { |
@@ -43,6 +48,7 @@ | @@ -43,6 +48,7 @@ | ||
43 | 48 | ||
44 | .download { | 49 | .download { |
45 | float: right; | 50 | float: right; |
51 | + margin-right: 20px; | ||
46 | } | 52 | } |
47 | 53 | ||
48 | } | 54 | } |
1 | <template> | 1 | <template> |
2 | <div class="brand-share"> | 2 | <div class="brand-share"> |
3 | - <div class="brand-top-box" v-bind:style="{ 'background-image': `url(${brandBg})` }"></div> | ||
4 | - <div class="brand-title">{{ brandName }}</div> | ||
5 | - <div class="brand-intro">{{ brandIntro }}</div> | 3 | + <div class="brand-top-box" v-bind:style="{ 'background-image': `url(${shopInfo.brandBg})` }"></div> |
4 | + <div class="brand-title">{{ shopInfo.brandName }}</div> | ||
5 | + <div class="brand-intro">{{ shopInfo.brandIntro }}</div> | ||
6 | <div class="tip">进入 BLK 选购潮品</div> | 6 | <div class="tip">进入 BLK 选购潮品</div> |
7 | <div class="icon arrow"></div> | 7 | <div class="icon arrow"></div> |
8 | - <img v-lazy="brandBg | resize 752 365"> | 8 | + <a href="//m.yohoblk.com"><img v-lazy="shopInfo.brandBg | resize 752 365"></a> |
9 | </div> | 9 | </div> |
10 | <share-bottom></share-bottom> | 10 | <share-bottom></share-bottom> |
11 | </template> | 11 | </template> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | width: 100%; | 15 | width: 100%; |
16 | height: 468px; | 16 | height: 468px; |
17 | color: #fff; | 17 | color: #fff; |
18 | - background-color: #000; | 18 | + background-color: #ccc; |
19 | position: relative; | 19 | position: relative; |
20 | } | 20 | } |
21 | 21 | ||
@@ -54,20 +54,36 @@ | @@ -54,20 +54,36 @@ | ||
54 | </style> | 54 | </style> |
55 | <script> | 55 | <script> |
56 | const shareBottom = require('product/shop/share-bottom.vue'); | 56 | const shareBottom = require('product/shop/share-bottom.vue'); |
57 | + const qs = require('yoho-qs'); | ||
58 | + const tip = require('common/tip'); | ||
57 | 59 | ||
58 | module.exports = { | 60 | module.exports = { |
59 | 61 | ||
60 | /* TODO 数据需要从接口获取 */ | 62 | /* TODO 数据需要从接口获取 */ |
61 | data() { | 63 | data() { |
62 | return { | 64 | return { |
63 | - brandName: 'COLORMAD', | ||
64 | - brandBg: 'http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg', | ||
65 | - brandIntro: 'COLORMAD坚持女性的时尚美丽不应为牺牲健康为代价,以健康,时尚,科技为理念,' + | ||
66 | - '研发健康无伤害的新概念甲油。' | 65 | + shopInfo: {} |
67 | }; | 66 | }; |
68 | }, | 67 | }, |
68 | + methods: { | ||
69 | + | ||
70 | + /* 获取店铺简介相关数据 */ | ||
71 | + getShopInfo() { | ||
72 | + $.get({ | ||
73 | + url: '/product/get-shop-info', | ||
74 | + data: { domain: qs.domain } | ||
75 | + }).done(result => { | ||
76 | + this.shopInfo = result; | ||
77 | + }).fail(() => { | ||
78 | + tip('网络错误'); | ||
79 | + }); | ||
80 | + } | ||
81 | + }, | ||
69 | components: { | 82 | components: { |
70 | shareBottom | 83 | shareBottom |
84 | + }, | ||
85 | + created() { | ||
86 | + this.getShopInfo(); | ||
71 | } | 87 | } |
72 | }; | 88 | }; |
73 | </script> | 89 | </script> |
@@ -70,8 +70,11 @@ | @@ -70,8 +70,11 @@ | ||
70 | this.shopInfo.showBrandInfo = true; | 70 | this.shopInfo.showBrandInfo = true; |
71 | this.shareData = { | 71 | this.shareData = { |
72 | title: result.brandName, | 72 | title: result.brandName, |
73 | - link: '/brand-share?domain=' + this.domain, | ||
74 | - img: result.brandBg | 73 | + des: result.brandIntro, |
74 | + url: '/product/brand-share?domain=' + this.domain, | ||
75 | + img: result.brandBg, | ||
76 | + shopId: result.shopId, // 不是分享的参数,收藏店铺使用 | ||
77 | + isFav: result.isFav // 不是分享的参数,收藏店铺使用 | ||
75 | }; | 78 | }; |
76 | } else { | 79 | } else { |
77 | this.shopInfo.showBrandInfo = false; | 80 | this.shopInfo.showBrandInfo = false; |
@@ -2,9 +2,10 @@ | @@ -2,9 +2,10 @@ | ||
2 | <div class="top-box clearfix"> | 2 | <div class="top-box clearfix"> |
3 | <span class="icon back" @click="goBack()"></span> | 3 | <span class="icon back" @click="goBack()"></span> |
4 | <div class="right"> | 4 | <div class="right"> |
5 | - <span class="icon" v-bind:class="{'favorite': shareData.isFav}" @click="collectShop()"></span> | ||
6 | - <span class="icon share" @click="goShare()"></span> | ||
7 | - <span class="icon filter" @click="showFilter()"></span> | 5 | + <span v-if="shareData.isFav" class="icon" @click="collectShop()"></span> |
6 | + <span v-else class="icon" @click="collectShop()"></span> | ||
7 | + <span class="icon" @click="goShare()"></span> | ||
8 | + <span class="icon" @click="showFilter()"></span> | ||
8 | </div> | 9 | </div> |
9 | </div> | 10 | </div> |
10 | </template> | 11 | </template> |
@@ -38,10 +39,6 @@ | @@ -38,10 +39,6 @@ | ||
38 | height: 60px; | 39 | height: 60px; |
39 | margin: 0 5px; | 40 | margin: 0 5px; |
40 | } | 41 | } |
41 | - | ||
42 | - .favorite { | ||
43 | - color: #000; | ||
44 | - } | ||
45 | } | 42 | } |
46 | } | 43 | } |
47 | </style> | 44 | </style> |
@@ -59,6 +56,10 @@ | @@ -59,6 +56,10 @@ | ||
59 | }, | 56 | }, |
60 | methods: { | 57 | methods: { |
61 | goShare() { | 58 | goShare() { |
59 | + | ||
60 | + // 删除两个多余的参数,两个参数是收藏时使用的 | ||
61 | + delete this.shareData.shopId; | ||
62 | + delete this.shareData.isFav; | ||
62 | yoho.goShare(this.shareData, function() {}, function() {}); | 63 | yoho.goShare(this.shareData, function() {}, function() {}); |
63 | }, | 64 | }, |
64 | goBack() { | 65 | goBack() { |
@@ -75,13 +76,12 @@ | @@ -75,13 +76,12 @@ | ||
75 | }; | 76 | }; |
76 | 77 | ||
77 | $.post({ | 78 | $.post({ |
78 | - url: '/collect-shop', | 79 | + url: '/product/collect-shop', |
79 | data: data | 80 | data: data |
80 | }).done(result => { | 81 | }).done(result => { |
82 | + tip(result.message); | ||
81 | if (result.code === 200) { | 83 | if (result.code === 200) { |
82 | - this.shareData.isFav = this.shareData.isFav !== true; | ||
83 | - } else { | ||
84 | - tip('网络错误'); | 84 | + this.shareData.isFav = !this.shareData.isFav; |
85 | } | 85 | } |
86 | }).fail(() => { | 86 | }).fail(() => { |
87 | tip('网络错误'); | 87 | tip('网络错误'); |
-
Please register or login to post a comment