Authored by 刘传洋

Merge branch 'release/newSearch' of http://git.yoho.cn/fe/yohobuy-node into release/newSearch

@@ -109,6 +109,24 @@ exports.brand = (req, res, next) => { @@ -109,6 +109,24 @@ exports.brand = (req, res, next) => {
109 }; 109 };
110 110
111 /** 111 /**
  112 + * 品牌介绍页
  113 + * @param {[type]} req [description]
  114 + * @param {[type]} res [description]
  115 + * @return {[type]} [description]
  116 + */
  117 +exports.brandAbout = (req, res, next) => {
  118 + let brandDomain = req.params.brandDomain;
  119 +
  120 + if (!brandDomain) {
  121 + return res.redirect(helpers.urlFormat(''));
  122 + }
  123 +
  124 + list.getBrandAbout(brandDomain, req.user.uid, req.yoho.channel).then(result => {
  125 + res.render('list/brand', Object.assign(result, {page: 'search'}));
  126 + }).catch(next);
  127 +};
  128 +
  129 +/**
112 * 店铺商品列表页 130 * 店铺商品列表页
113 * @param {[type]} req [description] 131 * @param {[type]} req [description]
114 * @param {[type]} res [description] 132 * @param {[type]} res [description]
@@ -272,6 +272,84 @@ exports.getBrandData = (params, extra, channel) => { @@ -272,6 +272,84 @@ exports.getBrandData = (params, extra, channel) => {
272 }; 272 };
273 273
274 /** 274 /**
  275 + * 获取品牌页面数据
  276 + */
  277 +exports.getBrandAbout = (domain, uid, channel) => {
  278 + channel = channel || 'boys';
  279 +
  280 + return Promise.all([
  281 + headerModel.requestHeaderData(channel),
  282 + searchApi.getBrandData({domain: domain})
  283 + ]).then(result => {
  284 + let home;
  285 + let finalResult = {
  286 + headerData: Object.assign(result[0].headerData, {
  287 + header: true
  288 + })
  289 + };
  290 +
  291 + switch (channel) {
  292 + case 'girls':
  293 + home = helpers.urlFormat('/woman', {}, 'new');
  294 + break;
  295 + case 'lifestyle':
  296 + home = helpers.urlFormat('/lifestyle', {}, 'new');
  297 + break;
  298 + case 'kids':
  299 + home = helpers.urlFormat('/kids', {}, 'new');
  300 + break;
  301 + default:
  302 + home = helpers.urlFormat('');
  303 + break;
  304 + }
  305 +
  306 + if (result[1].code === 200) {
  307 + let data = result[1].data || {};
  308 + let extra = {
  309 + brandId: data.id,
  310 + brandNameEn: data.brand_name_en || '',
  311 + brandNameCn: data.brand_name_cn || '',
  312 + brandBanner: data.brand_banner || '',
  313 + node: data.static_content_code || '',
  314 + brandAbout: data.brand_intro || '',
  315 + shopTemplateType: data.shop_template_type || 0,
  316 + url: helpers.urlFormat('', '', data.brand_domain),
  317 + name: data.brand_name,
  318 + shopId: data.shop_id || 0,
  319 + type: data.type || 0,
  320 + brandDomain: data.brand_domain
  321 + };
  322 +
  323 + finalResult.brand = {
  324 + brandBanner: searchHandler.handleBrandBanner(extra),
  325 + pathNav: [
  326 + {
  327 + href: home,
  328 + name: `${_.toUpper(channel)}首页`,
  329 + pathTitle: 'YOHO!BUY 有货'
  330 + },
  331 + {
  332 + href: helpers.urlFormat('/brands'),
  333 + name: '品牌一览',
  334 + pathTitle: '品牌一览'
  335 + },
  336 + {
  337 + name: `${extra.brandNameEn} ${extra.brandNameCn}`
  338 + }
  339 + ],
  340 + brandAbout: {
  341 + brandIntro: extra.brandAbout
  342 + }
  343 + };
  344 + }
  345 +
  346 + return finalResult;
  347 +
  348 + });
  349 +
  350 +};
  351 +
  352 +/**
275 * 获取品牌页面水牌 353 * 获取品牌页面水牌
276 */ 354 */
277 exports.getNodeContentData = (params) => { 355 exports.getNodeContentData = (params) => {
@@ -368,7 +368,7 @@ exports.handleSortData = (origin, params) => { @@ -368,7 +368,7 @@ exports.handleSortData = (origin, params) => {
368 leftContent.allSort.all = [{ 368 leftContent.allSort.all = [{
369 name: '全部品类', 369 name: '全部品类',
370 num: allCount, 370 num: allCount,
371 - href: handleFilterUrl(params) 371 + href: handleFilterUrl(params, {}, {msort: true, misort: true})
372 }]; 372 }];
373 373
374 // 374 //
@@ -77,6 +77,7 @@ router.get('/list/new', list.new); @@ -77,6 +77,7 @@ router.get('/list/new', list.new);
77 77
78 // 品牌页 78 // 品牌页
79 router.get('/brand/:brandDomain', list.brand); 79 router.get('/brand/:brandDomain', list.brand);
  80 +router.get('/about/:brandDomain', list.brandAbout);
80 81
81 router.get('/shoplist', list.shopList); // 店铺列表页 82 router.get('/shoplist', list.shopList); // 店铺列表页
82 router.post('/shop/togglecollect', favorite.collectShop); // 店铺收藏 83 router.post('/shop/togglecollect', favorite.collectShop); // 店铺收藏
@@ -5,15 +5,15 @@ @@ -5,15 +5,15 @@
5 <div class="opt-wrap"> 5 <div class="opt-wrap">
6 <p class="opt center-content"> 6 <p class="opt center-content">
7 <a href="{{brandHome}}"> 7 <a href="{{brandHome}}">
8 - <i class="iconfont">&#xe617;</i> 8 + <i class="iconfont">&#xe61a;</i>
9 品牌首页 9 品牌首页
10 </a> 10 </a>
11 <a href="{{brandIntro}}"> 11 <a href="{{brandIntro}}">
12 - <i class="iconfont">&#xe631;</i> 12 + <i class="iconfont">&#xe62a;</i>
13 品牌介绍 13 品牌介绍
14 </a> 14 </a>
15 <span id="brand-favor" class="brand-favor" data-id="{{dataId}}"> 15 <span id="brand-favor" class="brand-favor" data-id="{{dataId}}">
16 - <i class="iconfont{{#if coled}} coled{{/if}}">&#xe616;</i> 16 + <i class="iconfont{{#if coled}} coled{{/if}}">&#xe611;</i>
17 </span> 17 </span>
18 </p> 18 </p>
19 </div> 19 </div>
@@ -29,15 +29,15 @@ @@ -29,15 +29,15 @@
29 <span class="shop-name">{{shopName}}</span> 29 <span class="shop-name">{{shopName}}</span>
30 {{/if}} 30 {{/if}}
31 <a href="{{shopHome}}"> 31 <a href="{{shopHome}}">
32 - <i class="iconfont">&#xe617;</i> 32 + <i class="iconfont">&#xe61a;</i>
33 店铺首页 33 店铺首页
34 </a> 34 </a>
35 <a href="{{shopIntro}}"> 35 <a href="{{shopIntro}}">
36 - <i class="iconfont">&#xe631;</i> 36 + <i class="iconfont">&#xe62a;</i>
37 店铺介绍 37 店铺介绍
38 </a> 38 </a>
39 <span id="shop-favor" class="brand-favor shop-favor" data-id="{{shopId}}"> 39 <span id="shop-favor" class="brand-favor shop-favor" data-id="{{shopId}}">
40 - <i class="iconfont{{#if coled}} coled{{/if}}">&#xe616;</i> 40 + <i class="iconfont{{#if coled}} coled{{/if}}">&#xe611;</i>
41 </span> 41 </span>
42 </p> 42 </p>
43 </div> 43 </div>
@@ -45,38 +45,40 @@ @@ -45,38 +45,40 @@
45 {{/ shopBanner}} 45 {{/ shopBanner}}
46 46
47 <div class="center-content clearfix"> 47 <div class="center-content clearfix">
  48 + {{> common/path-nav}}
48 49
49 - {{# pathNav}}  
50 - {{> common/path-nav}}  
51 - {{/ pathNav}}  
52 -  
53 -  
54 - <div class="list-left pull-left">  
55 - {{> product/left-content}}  
56 - </div> 50 + {{# brandAbout}}
  51 + <div class="brand-about">
  52 + {{{brandIntro}}}
  53 + </div>
  54 + {{^}}
  55 + <div class="list-left pull-left">
  56 + {{> product/left-content}}
  57 + </div>
57 58
58 - <div class="list-right pull-right">  
59 - {{# sortIntro}}  
60 - <div class="sort-intro clearfix">  
61 - <div class="texts pull-left">  
62 - <p class="name">{{name}}</p>  
63 - <p class="en-name">{{enName}}</p>  
64 - <p class="desc">{{{description}}}</p>  
65 - <div class="key-entry">  
66 - {{#each keyEntry}}  
67 - <a href="{{url}}">{{name}}</a>  
68 - {{/each}}  
69 - </div>  
70 - </div>  
71 - <img class="pull-right img" src="{{img}}">  
72 - </div>  
73 - {{/ sortIntro}} 59 + <div class="list-right pull-right">
  60 + {{# sortIntro}}
  61 + <div class="sort-intro clearfix">
  62 + <div class="texts pull-left">
  63 + <p class="name">{{name}}</p>
  64 + <p class="en-name">{{enName}}</p>
  65 + <p class="desc">{{{description}}}</p>
  66 + <div class="key-entry">
  67 + {{#each keyEntry}}
  68 + <a href="{{url}}">{{name}}</a>
  69 + {{/each}}
  70 + </div>
  71 + </div>
  72 + <img class="pull-right img" src="{{img}}">
  73 + </div>
  74 + {{/ sortIntro}}
74 75
75 - {{> list/shop-entry}} 76 + {{> list/shop-entry}}
76 77
77 - {{> product/standard-content}} 78 + {{> product/standard-content}}
78 79
79 - {{> product/latest-walk}} 80 + {{> product/latest-walk}}
80 81
81 - </div> 82 + </div>
  83 + {{/ brandAbout}}
82 </div> 84 </div>
@@ -32,6 +32,10 @@ module.exports = () => { @@ -32,6 +32,10 @@ module.exports = () => {
32 break; 32 break;
33 default: // 其它(识别为品牌) 33 default: // 其它(识别为品牌)
34 req.url = `/product/brand/${req.subdomains[0]}`; 34 req.url = `/product/brand/${req.subdomains[0]}`;
  35 +
  36 + if (req.path === '/about') {
  37 + req.url = `/product/about/${req.subdomains[0]}`;
  38 + }
35 break; 39 break;
36 } 40 }
37 } 41 }
No preview for this file type
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > 2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3 <svg xmlns="http://www.w3.org/2000/svg"> 3 <svg xmlns="http://www.w3.org/2000/svg">
4 <metadata> 4 <metadata>
5 -Created by FontForge 20120731 at Wed Aug 10 19:10:35 2016 5 +Created by FontForge 20120731 at Wed Sep 21 17:18:20 2016
6 By admin 6 By admin
7 </metadata> 7 </metadata>
8 <defs> 8 <defs>
@@ -19,7 +19,7 @@ Created by FontForge 20120731 at Wed Aug 10 19:10:35 2016 @@ -19,7 +19,7 @@ Created by FontForge 20120731 at Wed Aug 10 19:10:35 2016
19 bbox="0 -212 1158 896" 19 bbox="0 -212 1158 896"
20 underline-thickness="50" 20 underline-thickness="50"
21 underline-position="-100" 21 underline-position="-100"
22 - unicode-range="U+0078-E623" 22 + unicode-range="U+0078-E62A"
23 /> 23 />
24 <missing-glyph horiz-adv-x="374" 24 <missing-glyph horiz-adv-x="374"
25 d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" /> 25 d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" />
@@ -129,5 +129,26 @@ t-35.5 -173.5t35.5 -173.5t95.5 -142.5t142.5 -95t173 -35t173.5 35t142.5 95t95 142 @@ -129,5 +129,26 @@ t-35.5 -173.5t35.5 -173.5t95.5 -142.5t142.5 -95t173 -35t173.5 35t142.5 95t95 142
129 " /> 129 " />
130 <glyph glyph-name="uniE623" unicode="&#xe623;" 130 <glyph glyph-name="uniE623" unicode="&#xe623;"
131 d="M512 63l-316 -166l60 352l-256 250l354 51l158 321l158 -321l354 -51l-256 -250l60 -352z" /> 131 d="M512 63l-316 -166l60 352l-256 250l354 51l158 321l158 -321l354 -51l-256 -250l60 -352z" />
  132 + <glyph glyph-name="uniE624" unicode="&#xe624;" horiz-adv-x="1000"
  133 +d="M744 598h-488q-38 0 -64.5 -26.5t-26.5 -64.5v-290q0 -38 26.5 -64.5t64.5 -26.5h227l200 -138v138h61q38 0 64.5 26.5t26.5 64.5v290q0 38 -26.5 64.5t-64.5 26.5zM744 358z" />
  134 + <glyph glyph-name="uniE625" unicode="&#xe625;"
  135 +d="M511 832q-91 0 -173.5 -35.5t-142 -95t-95 -142t-35.5 -173.5t35.5 -173.5t95 -142t142 -95t173.5 -35.5t173.5 35.5t142.5 95t95 142t35 173.5t-35 173.5t-95 142t-142.5 95t-173.5 35.5zM734 337h-237q-7 0 -14 3q-22 9 -22 33v237q0 15 10.5 26t26 11t26 -11t10.5 -26
  136 +v-200h200q15 0 26 -10.5t11 -26t-11 -26t-26 -10.5zM734 337z" />
  137 + <glyph glyph-name="uniE626" unicode="&#xe626;" horiz-adv-x="1025"
  138 +d="M994 163q-18 9 -16 30.5t27 46.5q24 27 17.5 54.5t-33.5 40.5q-17 8 -24.5 17.5t-2 20t26.5 19.5q30 11 29.5 55.5t-31.5 80.5q-34 39 -278 23l-23 -1q3 2 3 145q0 101 -28 139t-84 36q-18 0 -28.5 -5t-17 -13t-11 -26.5t-7.5 -38t-10 -56.5t-16 -74q-12 -47 -38 -94
  139 +t-54 -80t-55 -59t-44 -39l-18 -13v-386q10 -14 27 -25.5t31 -17t31 -11.5t21 -8q9 -4 65 -10.5t105.5 -11t51.5 -4.5q4 0 11 0.5t30 2.5t45 4.5t52 6.5t56.5 8t53.5 9.5t47 11t33.5 13t15.5 14.5q8 24 3 39t-2 27t23 20q27 10 34.5 34.5t0.5 46t-19 28.5zM0 379v-380
  140 +q0 -28 20 -48.5t49 -20.5h137v518h-137q-29 0 -49 -20.5t-20 -48.5zM0 379z" />
  141 + <glyph glyph-name="uniE627" unicode="&#xe627;" horiz-adv-x="1025"
  142 +d="M512 719q-167 0 -304.5 -89.5t-205.5 -236.5q-4 -9 0 -18q68 -147 205.5 -236.5t304.5 -89.5t304.5 89.5t205.5 236.5q4 9 0 18q-68 147 -205.5 236.5t-304.5 89.5zM512 153q-96 0 -163.5 67.5t-67.5 163.5t67.5 163.5t163.5 67.5t163.5 -67.5t67.5 -163.5t-67.5 -163.5
  143 +t-163.5 -67.5zM512 384zM364 384q0 61 43.5 104.5t104.5 43.5t104.5 -43.5t43.5 -104.5t-43.5 -104.5t-104.5 -43.5t-104.5 43.5t-43.5 104.5z" />
  144 + <glyph glyph-name="uniE628" unicode="&#xe628;"
  145 +d="M512 886q-102 0 -195 -39.5t-160.5 -107t-107 -160.5t-39.5 -195t39.5 -195t107 -160.5t160.5 -107t195 -39.5t195 39.5t160.5 107t107 160.5t39.5 195t-39.5 195t-107 160.5t-160.5 107t-195 39.5zM521 -15q-34 0 -58.5 24t-24.5 58.5t24.5 58.5t58.5 24t58 -24t24 -58
  146 +q1 -34 -23.5 -58.5t-58.5 -24.5zM738 477q-17 -34 -67 -83q-45 -43 -60 -61q-12 -16 -17 -35q-6 -22 -6 -61l1 -31h-142v30q0 56 9 90q11 38 30 64q17 23 62 71q43 44 52 60q8 13 8 44q0 28 -20 51q-20 21 -61 21q-29 0 -48.5 -9.5t-28.5 -27.5t-12.5 -36t-3.5 -43v-30h-142
  147 +l1 31q2 72 18 111q16 40 52 73q34 31 78 46q41 14 88 14q96 0 160 -56q66 -59 66 -154q0 -43 -17 -79z" />
  148 + <glyph glyph-name="uniE629" unicode="&#xe629;"
  149 +d="M511 833q-91 0 -174 -36t-143 -96t-95.5 -143t-35.5 -174t35.5 -174t95.5 -143t143 -95.5t174 -35.5t174 35.5t143 95.5t95.5 143t35.5 174t-35.5 174t-95.5 143t-143 96t-174 36zM770 193q15 -14 15 -34t-14.5 -34t-34 -14t-33.5 14l-192 191l-192 -191q-14 -14 -34 -14
  150 +t-34 14t-14 34t14 34l192 191l-192 192q-14 14 -14 34t14 34t34 14t34 -14l192 -192l192 192q14 14 33.5 14t34 -14t14.5 -34t-15 -34l-191 -192z" />
  151 + <glyph glyph-name="uniE62A" unicode="&#xe62a;"
  152 +d="M799 456l127 127v313h-830v-609l421 -413l409 404v181l-414 -401l-288 284v426h575v-312zM671 518l-107 22l-53 100l-52 -100l-108 -22l75 -83l-14 -114l99 49l99 -49l-14 114z" />
132 </font> 153 </font>
133 </defs></svg> 154 </defs></svg>
No preview for this file type
No preview for this file type
@@ -203,7 +203,7 @@ $productListNav.find('h3').click(function() { @@ -203,7 +203,7 @@ $productListNav.find('h3').click(function() {
203 203
204 // 品牌页请求 204 // 品牌页请求
205 if ($brandFavor.length) { 205 if ($brandFavor.length) {
206 - html = $('#pic-link-tpl').html(); 206 + html = $('#pic-link-tpl').html() || '';
207 207
208 $.ajax({ 208 $.ajax({
209 type: 'POST', 209 type: 'POST',
@@ -15,14 +15,6 @@ require('./detail/latest-walk'); @@ -15,14 +15,6 @@ require('./detail/latest-walk');
15 15
16 product.init(4); 16 product.init(4);
17 17
18 -  
19 -  
20 -  
21 -  
22 -  
23 -  
24 -  
25 -  
26 lazyLoad($('img.lazy'), { 18 lazyLoad($('img.lazy'), {
27 failure_limit: 20 19 failure_limit: 20
28 }); 20 });