Showing
10 changed files
with
154 additions
and
53 deletions
@@ -145,6 +145,15 @@ const getBrandByChannel = (channel) => { | @@ -145,6 +145,15 @@ const getBrandByChannel = (channel) => { | ||
145 | }); | 145 | }); |
146 | }; | 146 | }; |
147 | 147 | ||
148 | +const _urlJump = (key, row) => { | ||
149 | + | ||
150 | + return { | ||
151 | + 1: helpers.urlFormat('', {from: 'search', query: row.brand_name}, 'search'), | ||
152 | + 2: helpers.urlFormat('/product/index/brand', {domain: row.brand_domain}), | ||
153 | + 3: helpers.urlFormat('/product/global/list/', {brand: row.global_brand_id}) | ||
154 | + }[key]; | ||
155 | +}; | ||
156 | + | ||
148 | const getBrandListByChannel = (channel) => { | 157 | const getBrandListByChannel = (channel) => { |
149 | return _packageList(channel).then(result => { | 158 | return _packageList(channel).then(result => { |
150 | let resu = { | 159 | let resu = { |
@@ -168,16 +177,12 @@ const getBrandListByChannel = (channel) => { | @@ -168,16 +177,12 @@ const getBrandListByChannel = (channel) => { | ||
168 | }; | 177 | }; |
169 | 178 | ||
170 | allList[key].forEach(row => { | 179 | allList[key].forEach(row => { |
180 | + | ||
171 | obj.list.push({ | 181 | obj.list.push({ |
172 | name: row.brand_name, | 182 | name: row.brand_name, |
173 | isHot: row.is_hot === 'Y' ? true : false, | 183 | isHot: row.is_hot === 'Y' ? true : false, |
174 | isNew: row.is_show_new === 'Y' ? true : false, | 184 | isNew: row.is_show_new === 'Y' ? true : false, |
175 | - url: parseInt(row.type, 10) !== 3 ? helpers.urlFormat('/product/index/brand', { | ||
176 | - domain: row.brand_domain, | ||
177 | - shopType: row.type | ||
178 | - }) : helpers.urlFormat('/product/global/list/', { | ||
179 | - brand: row.global_brand_id | ||
180 | - }) | 185 | + url: _urlJump(parseInt(row.type, 10), row) |
181 | }); | 186 | }); |
182 | }); | 187 | }); |
183 | resu.brandList.push(obj); | 188 | resu.brandList.push(obj); |
@@ -43,7 +43,6 @@ const shop = { | @@ -43,7 +43,6 @@ const shop = { | ||
43 | let title = ''; | 43 | let title = ''; |
44 | let uid = req.user.uid || 0; | 44 | let uid = req.user.uid || 0; |
45 | let shopEnter; | 45 | let shopEnter; |
46 | - let shopType = req.query.shopType; | ||
47 | 46 | ||
48 | if (req.query.shop_id) { | 47 | if (req.query.shop_id) { |
49 | return shop.shop(req, res, next); | 48 | return shop.shop(req, res, next); |
@@ -82,11 +81,11 @@ const shop = { | @@ -82,11 +81,11 @@ const shop = { | ||
82 | searchParam.uid = uid; | 81 | searchParam.uid = uid; |
83 | } | 82 | } |
84 | 83 | ||
85 | - if (req.query.from !== 'search' && brandLogo.type === '2' && brandLogo.shopId && shopType !== '1') { | 84 | + if (req.query.from !== 'search' && brandLogo.type === '2' && brandLogo.shopId) { |
86 | req.query.shop_id = brandLogo.shopId; | 85 | req.query.shop_id = brandLogo.shopId; |
87 | shop.shop(req, res, next); | 86 | shop.shop(req, res, next); |
88 | return false; | 87 | return false; |
89 | - } else if (req.query.from === 'search' || shopType === '1') { | 88 | + } else if (req.query.from === 'search') { |
90 | return Promise.all([ | 89 | return Promise.all([ |
91 | listModel.getBrandShops(brandLogo.brandDomain, req), | 90 | listModel.getBrandShops(brandLogo.brandDomain, req), |
92 | searchModel.getSearchData(searchParam) | 91 | searchModel.getSearchData(searchParam) |
@@ -24,7 +24,7 @@ const list = (req, res, next) => { | @@ -24,7 +24,7 @@ const list = (req, res, next) => { | ||
24 | let title = ''; | 24 | let title = ''; |
25 | let isQueryFirstClass = false; // 标识用户搜的是不是一级品类 | 25 | let isQueryFirstClass = false; // 标识用户搜的是不是一级品类 |
26 | let isQuerySecondClass = false; // 标识用户搜的是不是二级品类 | 26 | let isQuerySecondClass = false; // 标识用户搜的是不是二级品类 |
27 | - let domain = null; | 27 | + // let domain = null; |
28 | let uid = req.user.uid || 0; | 28 | let uid = req.user.uid || 0; |
29 | 29 | ||
30 | if (params.shop_id) { | 30 | if (params.shop_id) { |
@@ -65,26 +65,30 @@ const list = (req, res, next) => { | @@ -65,26 +65,30 @@ const list = (req, res, next) => { | ||
65 | params.newquery = result[2].suggestion.termsSuggestion[0].name; | 65 | params.newquery = result[2].suggestion.termsSuggestion[0].name; |
66 | } | 66 | } |
67 | 67 | ||
68 | + if (result[2] && result[2].brandWay) { | ||
69 | + params.brandWay = result[2].brandWay; | ||
70 | + } | ||
71 | + | ||
68 | if (params.query) { | 72 | if (params.query) { |
69 | - domain = result[0]; | 73 | + // domain = result[0]; |
70 | 74 | ||
71 | // 跳转到品牌商品列表页 | 75 | // 跳转到品牌商品列表页 |
72 | - if (domain !== null && !params.shop_id) { | ||
73 | - let urlPro = { | ||
74 | - from: 'search', | ||
75 | - query: params.query | ||
76 | - }; | ||
77 | - | ||
78 | - if (req.query.app_type) { | ||
79 | - urlPro = _.assign(urlPro, { | ||
80 | - app_type: req.query.app_type | ||
81 | - }); | ||
82 | - } | ||
83 | - | ||
84 | - let url = helpers.urlFormat('', urlPro, domain); | ||
85 | - | ||
86 | - return res.redirect(url); | ||
87 | - } | 76 | + // if (domain !== null && !params.shop_id) { |
77 | + // let urlPro = { | ||
78 | + // from: 'search', | ||
79 | + // query: params.query | ||
80 | + // }; | ||
81 | + | ||
82 | + // if (req.query.app_type) { | ||
83 | + // urlPro = _.assign(urlPro, { | ||
84 | + // app_type: req.query.app_type | ||
85 | + // }); | ||
86 | + // } | ||
87 | + | ||
88 | + // let url = helpers.urlFormat('', urlPro, domain); | ||
89 | + | ||
90 | + // return res.redirect(url); | ||
91 | + // } | ||
88 | 92 | ||
89 | // 品类名称为空时跳出 | 93 | // 品类名称为空时跳出 |
90 | if (!result[1]) { | 94 | if (!result[1]) { |
@@ -981,5 +981,6 @@ module.exports = { | @@ -981,5 +981,6 @@ module.exports = { | ||
981 | getShopDecorator: _getShopDecorator, | 981 | getShopDecorator: _getShopDecorator, |
982 | getShopCategoryApi: _getShopCategory, | 982 | getShopCategoryApi: _getShopCategory, |
983 | formShopData: _formShopData, | 983 | formShopData: _formShopData, |
984 | - getBrandShopSeo: _getBrandShopSeo | 984 | + getBrandShopSeo: _getBrandShopSeo, |
985 | + processBrandShops: _processBrandShops | ||
985 | }; | 986 | }; |
@@ -11,7 +11,9 @@ const _ = require('lodash'); | @@ -11,7 +11,9 @@ const _ = require('lodash'); | ||
11 | const logger = global.yoho.logger; | 11 | const logger = global.yoho.logger; |
12 | const api = global.yoho.API; | 12 | const api = global.yoho.API; |
13 | const cache = require('memory-cache'); | 13 | const cache = require('memory-cache'); |
14 | +const helpers = global.yoho.helpers; | ||
14 | 15 | ||
16 | +// const listModel = require('./list'); | ||
15 | 17 | ||
16 | /** | 18 | /** |
17 | * 封面图 | 19 | * 封面图 |
@@ -118,10 +120,12 @@ const _searchGoods = (params) => { | @@ -118,10 +120,12 @@ const _searchGoods = (params) => { | ||
118 | 120 | ||
119 | if (params.shop_id && !params.productPool) { | 121 | if (params.shop_id && !params.productPool) { |
120 | method = 'app.search.li'; | 122 | method = 'app.search.li'; |
121 | - } else if (params.brand && !params.productPool) { | ||
122 | - method = 'app.search.brand'; | ||
123 | } | 123 | } |
124 | 124 | ||
125 | + // else if (params.brand && !params.productPool) { | ||
126 | + // method = 'app.search.brand'; | ||
127 | + // } | ||
128 | + | ||
125 | if (params.channel) { | 129 | if (params.channel) { |
126 | params.yh_channel = searchProcess.getChannelType(params.channel); | 130 | params.yh_channel = searchProcess.getChannelType(params.channel); |
127 | delete params.channel; | 131 | delete params.channel; |
@@ -188,6 +192,41 @@ const _searchGoods = (params) => { | @@ -188,6 +192,41 @@ const _searchGoods = (params) => { | ||
188 | }; | 192 | }; |
189 | 193 | ||
190 | /** | 194 | /** |
195 | + * 获取店铺列表 | ||
196 | + */ | ||
197 | +const _processBrandShops = (list) => { | ||
198 | + let formatDat = []; | ||
199 | + | ||
200 | + _.forEach(list, item => { | ||
201 | + if (item.shop_type === 'yoho_shop') { | ||
202 | + formatDat.push({ | ||
203 | + url: helpers.urlFormat('/product/index/brand/', { | ||
204 | + shop_id: item.shop_id | ||
205 | + }), | ||
206 | + thumb: helpers.image(item.shop_logo, 75, 40), | ||
207 | + name: item.shop_name, | ||
208 | + shopId: item.shop_id | ||
209 | + }); | ||
210 | + } else if (item.shop_type === 'tbl_brand') { | ||
211 | + formatDat.push({ | ||
212 | + url: helpers.urlFormat('/product/global/list/', { | ||
213 | + brand: item.global_brand_id | ||
214 | + }), | ||
215 | + thumb: helpers.image(item.brand_ico, 75, 40), | ||
216 | + name: item.brand_name, | ||
217 | + brandId: item.global_brand_id | ||
218 | + }); | ||
219 | + } | ||
220 | + }); | ||
221 | + | ||
222 | + if (formatDat.length > 2) { | ||
223 | + formatDat.moreShop = true; | ||
224 | + } | ||
225 | + | ||
226 | + return formatDat; | ||
227 | +}; | ||
228 | + | ||
229 | +/** | ||
191 | * 获取商品数据 | 230 | * 获取商品数据 |
192 | */ | 231 | */ |
193 | const getSearchData = (params) => { | 232 | const getSearchData = (params) => { |
@@ -197,6 +236,11 @@ const getSearchData = (params) => { | @@ -197,6 +236,11 @@ const getSearchData = (params) => { | ||
197 | let newList = {}; | 236 | let newList = {}; |
198 | let suggestion = {}; | 237 | let suggestion = {}; |
199 | 238 | ||
239 | + | ||
240 | + if (result.data.shopList && result.data.shopList.length !== 0) { | ||
241 | + newList.brandWay = _processBrandShops(result.data.shopList); | ||
242 | + } | ||
243 | + | ||
200 | newList.list = productProcess.processProductList(result.data.product_list || [], { | 244 | newList.list = productProcess.processProductList(result.data.product_list || [], { |
201 | isApp: params.isApp || (params.appVersion && params.appVersion !== 'false'), | 245 | isApp: params.isApp || (params.appVersion && params.appVersion !== 'false'), |
202 | gender: _coverChannel[params.coverChannel] | 246 | gender: _coverChannel[params.coverChannel] |
@@ -13,18 +13,29 @@ | @@ -13,18 +13,29 @@ | ||
13 | <ul class="search-associate"></ul> | 13 | <ul class="search-associate"></ul> |
14 | {{/ search}} | 14 | {{/ search}} |
15 | 15 | ||
16 | - {{# brandWay}} | 16 | + {{#if brandWay}} |
17 | <div class="brand-way"> | 17 | <div class="brand-way"> |
18 | - <a href={{url}}> | ||
19 | - <img class="brand-thumb" src={{thumb}}> | ||
20 | - <span class="brand-name">{{name}}</span> | ||
21 | - <span class="entry"> | ||
22 | - 进入店铺 | ||
23 | - <i class="iconfont"></i> | ||
24 | - </span> | ||
25 | - </a> | 18 | + <div class="brand-enter"> |
19 | + {{# brandWay}} | ||
20 | + <a href={{url}} data-shopid="{{shopId}}" data-brandid="{{brandId}}"> | ||
21 | + <img class="brand-thumb" src={{image2 thumb q=60}}> | ||
22 | + <span class="brand-name">{{name}}</span> | ||
23 | + {{#if brandId}}<span class="global"></span>{{/if}} | ||
24 | + <span class="entry"> | ||
25 | + 进入店铺 | ||
26 | + <i class="iconfont"></i> | ||
27 | + </span> | ||
28 | + </a> | ||
29 | + {{/ brandWay}} | ||
30 | + </div> | ||
31 | + | ||
32 | + {{#if brandWay.moreShop}} | ||
33 | + <div class="more-shop down"> | ||
34 | + <span class="iconfont"></span> | ||
35 | + </div> | ||
36 | + {{/if}} | ||
26 | </div> | 37 | </div> |
27 | - {{/ brandWay}} | 38 | + {{/if}} |
28 | 39 | ||
29 | {{# shopBanner}} | 40 | {{# shopBanner}} |
30 | <div class="brand-header"> | 41 | <div class="brand-header"> |
@@ -10,19 +10,19 @@ const isProduction = process.env.NODE_ENV === 'production'; | @@ -10,19 +10,19 @@ const isProduction = process.env.NODE_ENV === 'production'; | ||
10 | const isTest = process.env.NODE_ENV === 'test'; | 10 | const isTest = process.env.NODE_ENV === 'test'; |
11 | 11 | ||
12 | const domains = { | 12 | const domains = { |
13 | - // liveApi: 'http://testapi.live.yohops.com:9999/', | ||
14 | - // singleApi: 'http://api-test3.yohops.com:9999/', | 13 | + liveApi: 'http://testapi.live.yohops.com:9999/', |
14 | + singleApi: 'http://api-test3.yohops.com:9999/', | ||
15 | 15 | ||
16 | - // api: 'http://api-test3.yohops.com:9999/', | ||
17 | - // service: 'http://service-test3.yohops.com:9999/', | 16 | + api: 'http://api-test3.yohops.com:9999/', |
17 | + service: 'http://service-test3.yohops.com:9999/', | ||
18 | 18 | ||
19 | // liveApi: 'http://api.live.yoho.cn/', | 19 | // liveApi: 'http://api.live.yoho.cn/', |
20 | // singleApi: 'http://single.yoho.cn/', | 20 | // singleApi: 'http://single.yoho.cn/', |
21 | 21 | ||
22 | - api: 'http://dev-api.yohops.com:9999/', | ||
23 | - service: 'http://dev-service.yohops.com:9999/', | ||
24 | - liveApi: 'http://testapi.live.yohops.com:9999/', | ||
25 | - singleApi: 'http://api-test1.yohops.com:9999/', | 22 | + // api: 'http://dev-api.yohops.com:9999/', |
23 | + // service: 'http://dev-service.yohops.com:9999/', | ||
24 | + // liveApi: 'http://testapi.live.yohops.com:9999/', | ||
25 | + // singleApi: 'http://api-test1.yohops.com:9999/', | ||
26 | 26 | ||
27 | // api: 'http://api.yoho.cn/', | 27 | // api: 'http://api.yoho.cn/', |
28 | // service: 'http://service.yoho.cn/', | 28 | // service: 'http://service.yoho.cn/', |
@@ -36,7 +36,7 @@ const domains = { | @@ -36,7 +36,7 @@ const domains = { | ||
36 | 36 | ||
37 | module.exports = { | 37 | module.exports = { |
38 | app: 'h5', | 38 | app: 'h5', |
39 | - appVersion: '5.5.2', // 调用api的版本 | 39 | + appVersion: '5.6.0', // 调用api的版本 |
40 | port: 6001, | 40 | port: 6001, |
41 | siteUrl: '//m.yohobuy.com', | 41 | siteUrl: '//m.yohobuy.com', |
42 | assetUrl: '//127.0.0.1:5001', | 42 | assetUrl: '//127.0.0.1:5001', |
public/img/product/global.png
0 → 100644
2.62 KB
@@ -1151,6 +1151,31 @@ $('#goods-container').on('click', '.good-info', function() { | @@ -1151,6 +1151,31 @@ $('#goods-container').on('click', '.good-info', function() { | ||
1151 | } | 1151 | } |
1152 | }); | 1152 | }); |
1153 | 1153 | ||
1154 | +$('.more-shop').on('click', function() { | ||
1155 | + if ($(this).hasClass('down')) { | ||
1156 | + $('.brand-enter').css('max-height', '100%'); | ||
1157 | + $('.more-shop').removeClass('down').find('span').html(''); | ||
1158 | + } else { | ||
1159 | + $('.brand-enter').removeAttr('style'); | ||
1160 | + $('.more-shop').addClass('down').find('span').html(''); | ||
1161 | + } | ||
1162 | +}); | ||
1163 | + | ||
1164 | +// 进入店铺埋点 | ||
1165 | +$('.brand-way a').on('click', function() { | ||
1166 | + if (window._yas && window._yas.sendCustomInfo) { | ||
1167 | + window._yas.sendCustomInfo({ | ||
1168 | + op: 'YB_BRAND_SHOP_C', | ||
1169 | + param: JSON.stringify({ | ||
1170 | + BRAND_ID: $('.brand-enter a').data('brandid'), | ||
1171 | + SHOP_ID: $('.brand-enter a').data('shopid'), | ||
1172 | + POS_ID: 101 | ||
1173 | + }) | ||
1174 | + }, true); | ||
1175 | + } | ||
1176 | +}); | ||
1177 | + | ||
1178 | + | ||
1154 | let fuckNum = $('.good-info').length; | 1179 | let fuckNum = $('.good-info').length; |
1155 | 1180 | ||
1156 | fuckNum < 12 && $('.search-divide').remove(); | 1181 | fuckNum < 12 && $('.search-divide').remove(); |
@@ -72,7 +72,7 @@ | @@ -72,7 +72,7 @@ | ||
72 | 72 | ||
73 | a { | 73 | a { |
74 | display: block; | 74 | display: block; |
75 | - height: 80px; | 75 | + height: 84px; |
76 | line-height: 80px; | 76 | line-height: 80px; |
77 | padding: 0 20px; | 77 | padding: 0 20px; |
78 | border-top: 1px solid #e6e6e6; | 78 | border-top: 1px solid #e6e6e6; |
@@ -94,7 +94,7 @@ | @@ -94,7 +94,7 @@ | ||
94 | } | 94 | } |
95 | 95 | ||
96 | .brand-name { | 96 | .brand-name { |
97 | - width: 40%; | 97 | + max-width: 35%; |
98 | overflow: hidden; | 98 | overflow: hidden; |
99 | text-overflow: ellipsis; | 99 | text-overflow: ellipsis; |
100 | white-space: nowrap; | 100 | white-space: nowrap; |
@@ -105,12 +105,24 @@ | @@ -105,12 +105,24 @@ | ||
105 | 105 | ||
106 | .brand-thumb { | 106 | .brand-thumb { |
107 | float: left; | 107 | float: left; |
108 | - width: 150px; | ||
109 | - height: 80px; | 108 | + width: 110px; |
109 | + height: 84px; | ||
110 | margin: 0; | 110 | margin: 0; |
111 | display: inline-block; | 111 | display: inline-block; |
112 | } | 112 | } |
113 | 113 | ||
114 | + .global { | ||
115 | + background-image: resolve("product/global.png"); | ||
116 | + display: inline-block; | ||
117 | + width: 92px; | ||
118 | + height: 34px; | ||
119 | + background-size: 100%; | ||
120 | + background-repeat: no-repeat; | ||
121 | + position: relative; | ||
122 | + top: -30%; | ||
123 | + margin-left: 10px; | ||
124 | + } | ||
125 | + | ||
114 | .entry { | 126 | .entry { |
115 | color: #999; | 127 | color: #999; |
116 | font-size: 28px; | 128 | font-size: 28px; |
-
Please register or login to post a comment