Authored by zhangxiaoru

品牌跳转

@@ -42,7 +42,7 @@ const _packageAd = (params) => { @@ -42,7 +42,7 @@ const _packageAd = (params) => {
42 42
43 const _packageList = (channel) => { 43 const _packageList = (channel) => {
44 return api.get('', { 44 return api.get('', {
45 - method: 'app.brand.newBrandList', 45 + method: 'app.brand.allBrandList',
46 yh_channel: channel 46 yh_channel: channel
47 }, { 47 }, {
48 cache: true, 48 cache: true,
@@ -172,7 +172,10 @@ const getBrandListByChannel = (channel) => { @@ -172,7 +172,10 @@ const getBrandListByChannel = (channel) => {
172 name: row.brand_name, 172 name: row.brand_name,
173 isHot: row.is_hot === 'Y' ? true : false, 173 isHot: row.is_hot === 'Y' ? true : false,
174 isNew: row.is_show_new === 'Y' ? true : false, 174 isNew: row.is_show_new === 'Y' ? true : false,
175 - url: helpers.urlFormat('/product/index/brand?domain=' + row.brand_domain) 175 + url: helpers.urlFormat('/product/index/brand', {
  176 + domain: row.brand_domain,
  177 + shopType: row.type
  178 + })
176 }); 179 });
177 }); 180 });
178 resu.brandList.push(obj); 181 resu.brandList.push(obj);
@@ -190,7 +193,10 @@ const getBrandListByChannel = (channel) => { @@ -190,7 +193,10 @@ const getBrandListByChannel = (channel) => {
190 193
191 obj.list.push({ 194 obj.list.push({
192 brandName: newList[key].brand_name, 195 brandName: newList[key].brand_name,
193 - url: helpers.urlFormat('/product/index/brand?domain=' + newList[key].brand_domain), 196 + url: helpers.urlFormat('/product/index/brand', {
  197 + domain: newList[key].brand_domain,
  198 + shopType: newList[key].type
  199 + }),
194 img: helpers.image(newList[key].brand_ico, 186, 115), 200 img: helpers.image(newList[key].brand_ico, 186, 115),
195 }); 201 });
196 resu.newBrandWall.push(obj); 202 resu.newBrandWall.push(obj);
@@ -208,7 +214,10 @@ const getBrandListByChannel = (channel) => { @@ -208,7 +214,10 @@ const getBrandListByChannel = (channel) => {
208 214
209 obj.list.push({ 215 obj.list.push({
210 brandName: hotList[key].brand_name, 216 brandName: hotList[key].brand_name,
211 - url: helpers.urlFormat('/product/index/brand?domain=' + hotList[key].brand_domain), 217 + url: helpers.urlFormat('/product/index/brand', {
  218 + domain: hotList[key].brand_domain,
  219 + shopType: hotList[key].type
  220 + }),
212 img: helpers.image(hotList[key].brand_ico, 186, 115), 221 img: helpers.image(hotList[key].brand_ico, 186, 115),
213 }); 222 });
214 resu.recommandBrandWall.push(obj); 223 resu.recommandBrandWall.push(obj);
@@ -43,6 +43,7 @@ const shop = { @@ -43,6 +43,7 @@ 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;
46 47
47 if (req.query.shop_id) { 48 if (req.query.shop_id) {
48 return shop.shop(req, res, next); 49 return shop.shop(req, res, next);
@@ -81,13 +82,13 @@ const shop = { @@ -81,13 +82,13 @@ const shop = {
81 searchParam.uid = uid; 82 searchParam.uid = uid;
82 } 83 }
83 84
84 - if (req.query.from !== 'search' && brandLogo.type === '2' && brandLogo.shopId) { 85 + if (req.query.from !== 'search' && brandLogo.type === '2' && brandLogo.shopId && shopType !== '1') {
85 req.query.shop_id = brandLogo.shopId; 86 req.query.shop_id = brandLogo.shopId;
86 shop.shop(req, res, next); 87 shop.shop(req, res, next);
87 return false; 88 return false;
88 - } else if (req.query.from === 'search') { 89 + } else if (req.query.from === 'search' || shopType === '1') {
89 return Promise.all([ 90 return Promise.all([
90 - listModel.getBrandShops(brandId, req), 91 + listModel.getBrandShops(brandLogo.brandDomain, req),
91 searchModel.getSearchData(searchParam) 92 searchModel.getSearchData(searchParam)
92 ]).then(shopResult => { 93 ]).then(shopResult => {
93 let brandShop = shopResult[0]; 94 let brandShop = shopResult[0];
@@ -113,14 +114,16 @@ const shop = { @@ -113,14 +114,16 @@ const shop = {
113 } 114 }
114 115
115 if (brandShop.length > 0 || brandLogo && shopEnter) { 116 if (brandShop.length > 0 || brandLogo && shopEnter) {
  117 +
116 params = _.assign({ 118 params = _.assign({
117 brandWay: _.isEmpty(brandShop) ? brandLogo : brandShop, 119 brandWay: _.isEmpty(brandShop) ? brandLogo : brandShop,
118 search: { 120 search: {
119 - default: req.query.query, 121 + default: req.query.query || req.query.domain,
120 url: helpers.urlFormat('', null, 'search') 122 url: helpers.urlFormat('', null, 'search')
121 } 123 }
122 }, params); 124 }, params);
123 } 125 }
  126 +
124 return true; 127 return true;
125 }); 128 });
126 } else { 129 } else {
@@ -34,12 +34,16 @@ const _processBrandShops = (list) => { @@ -34,12 +34,16 @@ const _processBrandShops = (list) => {
34 url: helpers.urlFormat('/product/index/brand/', { 34 url: helpers.urlFormat('/product/index/brand/', {
35 shop_id: item.shop_id 35 shop_id: item.shop_id
36 }), 36 }),
37 - thumb: helpers.image(item.brand_ico, 75, 40),  
38 - name: item.brand_name 37 + thumb: helpers.image(item.shop_logo, 75, 40),
  38 + name: item.shop_name
39 }); 39 });
40 } 40 }
41 }); 41 });
42 42
  43 + if (formatDat.length > 2) {
  44 + formatDat.moreShop = true;
  45 + }
  46 +
43 return formatDat; 47 return formatDat;
44 }; 48 };
45 49
@@ -749,7 +753,8 @@ const getBrandLogoByDomain = (domain) => { @@ -749,7 +753,8 @@ const getBrandLogoByDomain = (domain) => {
749 thumb: helpers.image(formatData.brand_ico, 75, 40), 753 thumb: helpers.image(formatData.brand_ico, 75, 40),
750 name: formatData.brand_name, 754 name: formatData.brand_name,
751 shopId: formatData.shop_id ? formatData.shop_id : 0, // 店铺id 755 shopId: formatData.shop_id ? formatData.shop_id : 0, // 店铺id
752 - type: formatData.type ? formatData.type : 0 756 + type: formatData.type ? formatData.type : 0,
  757 + brandDomain: formatData.brand_domain
753 }; 758 };
754 } else { 759 } else {
755 return false; 760 return false;
@@ -763,18 +768,18 @@ const getBrandLogoByDomain = (domain) => { @@ -763,18 +768,18 @@ const getBrandLogoByDomain = (domain) => {
763 * @param req 768 * @param req
764 * @return array 769 * @return array
765 */ 770 */
766 -const getBrandShops = (brandId, req) => { 771 +const getBrandShops = (domain, req) => {
767 return api.get('', { 772 return api.get('', {
768 - method: 'app.shop.queryShopsByBrandId',  
769 - brand_id: brandId 773 + method: 'app.search.li',
  774 + query: domain
770 }, { 775 }, {
771 code: 200, 776 code: 200,
772 cache: true 777 cache: true
773 }).then(result => { 778 }).then(result => {
774 - if (_.isArray(result.data)) { 779 + if (result.data.shopList && _.isArray(result.data.shopList)) {
775 let seoResult = _getBrandShopSeo(req.channel, result.data[0], req.query); 780 let seoResult = _getBrandShopSeo(req.channel, result.data[0], req.query);
776 781
777 - return Object.assign(_processBrandShops(result.data), {seoResult: seoResult}); 782 + return Object.assign(_processBrandShops(result.data.shopList), {seoResult: seoResult});
778 } else { 783 } else {
779 return []; 784 return [];
780 } 785 }
@@ -12,8 +12,10 @@ @@ -12,8 +12,10 @@
12 </div> 12 </div>
13 <ul class="search-associate"></ul> 13 <ul class="search-associate"></ul>
14 {{/ search}} 14 {{/ search}}
15 - {{# brandWay}} 15 + {{#if brandWay}}
16 <div class="brand-way"> 16 <div class="brand-way">
  17 + <div class="brand-enter">
  18 + {{# brandWay}}
17 <a href={{url}}> 19 <a href={{url}}>
18 <img class="brand-thumb" src={{image2 thumb q=60}}> 20 <img class="brand-thumb" src={{image2 thumb q=60}}>
19 <span class="brand-name">{{name}}</span> 21 <span class="brand-name">{{name}}</span>
@@ -22,8 +24,16 @@ @@ -22,8 +24,16 @@
22 <i class="iconfont">&#xe614;</i> 24 <i class="iconfont">&#xe614;</i>
23 </span> 25 </span>
24 </a> 26 </a>
25 - </div>  
26 {{/ brandWay}} 27 {{/ brandWay}}
  28 + </div>
  29 +
  30 + {{#if brandWay.moreShop}}
  31 + <div class="more-shop down">
  32 + <span class="iconfont">&#xe616;</span>
  33 + </div>
  34 + {{/if}}
  35 + </div>
  36 + {{/if}}
27 <!-- 品牌页面 --> 37 <!-- 品牌页面 -->
28 {{# brandHome}} 38 {{# brandHome}}
29 <div id="brand-header" class="brand-header" data-id={{id}}> 39 <div id="brand-header" class="brand-header" data-id={{id}}>
@@ -10,15 +10,26 @@ const isProduction = process.env.NODE_ENV === 'production'; @@ -10,15 +10,26 @@ 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/',
  26 +
  27 + // api: 'http://api.yoho.cn/',
  28 + // service: 'http://service.yoho.cn/',
  29 + // liveApi: 'http://api.live.yoho.cn/',
  30 + // singleApi: 'http://single.yoho.cn/',
  31 +
  32 +
22 imSocket: 'ws://socket.yohobuy.com:10240', 33 imSocket: 'ws://socket.yohobuy.com:10240',
23 imCs: 'http://im.yohobuy.com/api' 34 imCs: 'http://im.yohobuy.com/api'
24 }; 35 };
@@ -834,4 +834,14 @@ $('#goods-container').on('click', '.good-info', function() { @@ -834,4 +834,14 @@ $('#goods-container').on('click', '.good-info', function() {
834 // return false; 834 // return false;
835 }); 835 });
836 836
  837 +$('.more-shop').on('click', function() {
  838 + if ($(this).hasClass('down')) {
  839 + $('.brand-enter').css('max-height', '100%');
  840 + $('.more-shop').removeClass('down').find('span').html('&#xe615;');
  841 + } else {
  842 + $('.brand-enter').removeAttr('style');
  843 + $('.more-shop').addClass('down').find('span').html('&#xe616;');
  844 + }
  845 +});
  846 +
837 require('channel/maybe-like')({recpose: 100101, isExecute: true}); 847 require('channel/maybe-like')({recpose: 100101, isExecute: true});
@@ -65,12 +65,16 @@ @@ -65,12 +65,16 @@
65 padding-bottom: 20px; 65 padding-bottom: 20px;
66 background: #f4f4f4; 66 background: #f4f4f4;
67 67
68 - > a { 68 + .brand-enter {
  69 + max-height: 160px;
  70 + overflow: hidden;
  71 + }
  72 +
  73 + a {
69 display: block; 74 display: block;
70 height: 80px; 75 height: 80px;
71 line-height: 80px; 76 line-height: 80px;
72 padding: 0 20px; 77 padding: 0 20px;
73 - border-bottom: 1px solid #e6e6e6;  
74 border-top: 1px solid #e6e6e6; 78 border-top: 1px solid #e6e6e6;
75 font-size: 34px; 79 font-size: 34px;
76 background: #fff; 80 background: #fff;
@@ -78,6 +82,10 @@ @@ -78,6 +82,10 @@
78 overflow: hidden; 82 overflow: hidden;
79 } 83 }
80 84
  85 + /* a:last-child {
  86 + border-bottom: 1px solid #e6e6e6;
  87 + } */
  88 +
81 span { 89 span {
82 font-size: 28px; 90 font-size: 28px;
83 overflow: hidden; 91 overflow: hidden;
@@ -90,21 +98,38 @@ @@ -90,21 +98,38 @@
90 overflow: hidden; 98 overflow: hidden;
91 text-overflow: ellipsis; 99 text-overflow: ellipsis;
92 white-space: nowrap; 100 white-space: nowrap;
93 - position: absolute; 101 + display: inline-block;
  102 +
  103 + /* position: absolute; */
94 } 104 }
95 105
96 .brand-thumb { 106 .brand-thumb {
97 - display: block;  
98 float: left; 107 float: left;
99 width: 150px; 108 width: 150px;
100 height: 80px; 109 height: 80px;
101 margin: 0; 110 margin: 0;
  111 + display: inline-block;
102 } 112 }
103 113
104 .entry { 114 .entry {
105 color: #999; 115 color: #999;
106 font-size: 28px; 116 font-size: 28px;
107 float: right; 117 float: right;
  118 + display: inline-block;
  119 + }
  120 +
  121 + .more-shop {
  122 + width: 100%;
  123 + height: 40px;
  124 + background: #fff;
  125 + color: #999;
  126 + margin-top: 0;
  127 + text-align: center;
  128 +
  129 + span {
  130 + position: relative;
  131 + top: -6px;
  132 + }
108 } 133 }
109 } 134 }
110 135