Authored by zhangxiaoru

品牌品类树 跳转调整

@@ -31,6 +31,7 @@ const index = (req, res, next) => { @@ -31,6 +31,7 @@ const index = (req, res, next) => {
31 } 31 }
32 32
33 brandModel.indexData(gender, brandCode, cateCode).then(result => { 33 brandModel.indexData(gender, brandCode, cateCode).then(result => {
  34 + // console.log(result)
34 35
35 res.render('brand/brand', { 36 res.render('brand/brand', {
36 module: 'guang', 37 module: 'guang',
@@ -53,7 +53,8 @@ const handleBrandList = origin => { @@ -53,7 +53,8 @@ const handleBrandList = origin => {
53 brands.push({ 53 brands.push({
54 name: subValue.brand_name_en || subValue.brand_name_cn || subValue.brand_name, 54 name: subValue.brand_name_en || subValue.brand_name_cn || subValue.brand_name,
55 logo: subValue.brand_ico, 55 logo: subValue.brand_ico,
56 - domain: subValue.brand_domain 56 + domain: subValue.brand_domain,
  57 + brandUrl: '//m.yohobuy.com/product/index/brand?domain=' + subValue.brand_domain
57 }); 58 });
58 }); 59 });
59 60
@@ -164,7 +165,7 @@ const _getBrandListOriginData = (channel) => { @@ -164,7 +165,7 @@ const _getBrandListOriginData = (channel) => {
164 }); 165 });
165 }; 166 };
166 167
167 -let _processCateData = (list, channel) => { 168 +const _processCateData = (list, channel) => {
168 let nav = ['MEN男士', 'WOMEN女士']; 169 let nav = ['MEN男士', 'WOMEN女士'];
169 170
170 nav = _.map(nav, function(item) { 171 nav = _.map(nav, function(item) {
@@ -213,6 +214,18 @@ let _processCateData = (list, channel) => { @@ -213,6 +214,18 @@ let _processCateData = (list, channel) => {
213 }; 214 };
214 }; 215 };
215 216
  217 +const _dealBrandUrl = (list) => {
  218 + var domain;
  219 +
  220 + _.forEach(list.data, function(val) {
  221 + domain = val.url.substring(val.url.indexOf('shop/') + 5, val.url.indexOf('?'));
  222 +
  223 + val.url = '//m.yohobuy.com/product/index/brand?domain=' + domain;
  224 + })
  225 +
  226 + return list;
  227 +}
  228 +
216 const indexData = (gender, brandCode, cateCode) => { 229 const indexData = (gender, brandCode, cateCode) => {
217 return Promise.all([_getChannelData(gender), _getResourcesData(brandCode), _getBrandListOriginData(gender), _getResourcesData(cateCode)]).then(result => { 230 return Promise.all([_getChannelData(gender), _getResourcesData(brandCode), _getBrandListOriginData(gender), _getResourcesData(cateCode)]).then(result => {
218 let brandList = {}; 231 let brandList = {};
@@ -227,14 +240,17 @@ const indexData = (gender, brandCode, cateCode) => { @@ -227,14 +240,17 @@ const indexData = (gender, brandCode, cateCode) => {
227 if (result[1]) { 240 if (result[1]) {
228 _.forEach(result[1], function(data) { 241 _.forEach(result[1], function(data) {
229 if (data.focus_type === '1') { 242 if (data.focus_type === '1') {
230 - brandList.bannerTop = data; 243 +
  244 + brandList.bannerTop = _dealBrandUrl(data);
231 } else if (data.focus_type === '2') { 245 } else if (data.focus_type === '2') {
232 - brandList.focusData = data.data; 246 +
  247 + brandList.focusData = _dealBrandUrl(data).data;
233 } 248 }
234 }); 249 });
235 } 250 }
236 251
237 if (result[2]) { 252 if (result[2]) {
  253 +
238 brandList.listData = result[2].ListData; 254 brandList.listData = result[2].ListData;
239 brandList.indexList = result[2].indexList; 255 brandList.indexList = result[2].indexList;
240 } 256 }
@@ -242,8 +258,17 @@ const indexData = (gender, brandCode, cateCode) => { @@ -242,8 +258,17 @@ const indexData = (gender, brandCode, cateCode) => {
242 if (result[3]) { 258 if (result[3]) {
243 _.forEach(result[3], function(data) { 259 _.forEach(result[3], function(data) {
244 if (data.template_name === 'recommend_content_five') { 260 if (data.template_name === 'recommend_content_five') {
  261 + _.forEach(data.data.list, function(val) {
  262 + var param = val.url.substring(val.url.indexOf('list?') + 5);
  263 +
  264 + val.url = '//list.m.yohobuy.com/?' + param;
  265 + })
245 categoryData.list = data.data.list; 266 categoryData.list = data.data.list;
246 } else if (data.template_name === 'focus') { 267 } else if (data.template_name === 'focus') {
  268 + _.forEach(data.data, function(val) {
  269 +
  270 + val.url = '//m.yohobuy.com/guang/cate-all';
  271 + })
247 categoryData.focusData = data; 272 categoryData.focusData = data;
248 } 273 }
249 }); 274 });
@@ -263,9 +288,9 @@ const brandListData = (code, gender) => { @@ -263,9 +288,9 @@ const brandListData = (code, gender) => {
263 if (result[0]) { 288 if (result[0]) {
264 _.forEach(result[0], function(data) { 289 _.forEach(result[0], function(data) {
265 if (data.focus_type === '1') { 290 if (data.focus_type === '1') {
266 - brandList.bannerTop = data; 291 + brandList.bannerTop = _dealBrandUrl(data);
267 } else if (data.focus_type === '2') { 292 } else if (data.focus_type === '2') {
268 - brandList.focusData = data.data; 293 + brandList.focusData = _dealBrandUrl(data).data;
269 } 294 }
270 }); 295 });
271 } 296 }
@@ -289,8 +314,18 @@ const categoryData = (code) => { @@ -289,8 +314,18 @@ const categoryData = (code) => {
289 if (result) { 314 if (result) {
290 _.forEach(result, function(data) { 315 _.forEach(result, function(data) {
291 if (data.template_name === 'recommend_content_five') { 316 if (data.template_name === 'recommend_content_five') {
  317 + _.forEach(data.data.list, function(val) {
  318 + var param = val.url.substring(val.url.indexOf('list?') + 5);
  319 +
  320 + val.url = '//list.m.yohobuy.com/?' + param;
  321 + })
292 category.list = data.data.list; 322 category.list = data.data.list;
293 } else if (data.template_name === 'focus') { 323 } else if (data.template_name === 'focus') {
  324 + _.forEach(data.data, function(val) {
  325 +
  326 + val.url = '//m.yohobuy.com/guang/cate-all';
  327 + })
  328 +
294 category.focusData = data; 329 category.focusData = data;
295 } 330 }
296 }); 331 });
@@ -6,7 +6,15 @@ @@ -6,7 +6,15 @@
6 </ul> 6 </ul>
7 7
8 <div class="channel-tab"> 8 <div class="channel-tab">
9 - <ul> 9 + <ul class="brand-cha{{# categoryTab}} hide{{/ categoryTab}}">
  10 + {{#each channel}}
  11 + <li class='{{#if focus}} focus {{/if}}' data-code='{{code}}'>
  12 + <span>{{mame}}</span>
  13 + </li>
  14 + {{/each}}
  15 + </ul>
  16 +
  17 + <ul class="cate-cha{{#unless categoryTab}} hide{{/unless}}">
10 {{#each channel}} 18 {{#each channel}}
11 <li class='{{#if focus}} focus {{/if}}' data-code='{{code}}'> 19 <li class='{{#if focus}} focus {{/if}}' data-code='{{code}}'>
12 <span>{{mame}}</span> 20 <span>{{mame}}</span>
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 {{# brands}} 29 {{# brands}}
30 <div class="brand-big-box"> 30 <div class="brand-big-box">
31 <div class="brand-box"> 31 <div class="brand-box">
32 - <a href=""> 32 + <a href="{{brandUrl}}">
33 <div class="brand-logo"> 33 <div class="brand-logo">
34 <img src="{{image logo 136 136}}"> 34 <img src="{{image logo 136 136}}">
35 </div> 35 </div>
1 -{{# categoryData}} 1 +{{# categoryData}}
2 <div class="resources"> 2 <div class="resources">
3 <div class="recommend-content-five"> 3 <div class="recommend-content-five">
4 {{# list}} 4 {{# list}}
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 10
11 <div class="focus-floor"> 11 <div class="focus-floor">
12 {{# focusData}} 12 {{# focusData}}
  13 + {{!-- {{{log this}}} --}}
13 {{> resources/banner-top}} 14 {{> resources/banner-top}}
14 {{/ focusData}} 15 {{/ focusData}}
15 </div> 16 </div>
@@ -2,7 +2,9 @@ var $ = require('yoho-jquery'), @@ -2,7 +2,9 @@ var $ = require('yoho-jquery'),
2 Swiper = require('yoho-swiper'); 2 Swiper = require('yoho-swiper');
3 3
4 var bannerSwiper, 4 var bannerSwiper,
5 - categoryHeight = $('.tab-box').height(); 5 + categoryHeight = $('.tab-box').height(),
  6 + gender,
  7 + isBrand;
6 8
7 var $intercept = $('.no-intercept'), 9 var $intercept = $('.no-intercept'),
8 $list = $('.brand-list-box'); 10 $list = $('.brand-list-box');
@@ -42,8 +44,8 @@ function loadData(channel, isBrand) { @@ -42,8 +44,8 @@ function loadData(channel, isBrand) {
42 } 44 }
43 45
44 $('.channel-tab').find('li').click(function() { 46 $('.channel-tab').find('li').click(function() {
45 - var gender = $(this).find('span').text().replace(/[^A-Za-z]+/g, '').toLowerCase(),  
46 - isBrand = $('.brand-tab').find('.brand').hasClass('active'); 47 + gender = $(this).find('span').text().replace(/[^A-Za-z]+/g, '').toLowerCase(),
  48 + isBrand = $('.brand-tab').find('.brand').hasClass('active');
47 49
48 $(this).addClass('focus').siblings().removeClass('focus'); 50 $(this).addClass('focus').siblings().removeClass('focus');
49 51
@@ -67,20 +69,21 @@ $('.brand-tab').find('li').click(function() { @@ -67,20 +69,21 @@ $('.brand-tab').find('li').click(function() {
67 69
68 if ($(this).hasClass('brand')) { 70 if ($(this).hasClass('brand')) {
69 $('.brand-content').removeClass('hide').siblings().addClass('hide'); 71 $('.brand-content').removeClass('hide').siblings().addClass('hide');
  72 + $('.brand-cha').removeClass('hide').siblings().addClass('hide');
70 } else { 73 } else {
71 $('.category-content').removeClass('hide').siblings().addClass('hide'); 74 $('.category-content').removeClass('hide').siblings().addClass('hide');
  75 + $('.cate-cha').removeClass('hide').siblings().addClass('hide');
72 } 76 }
73 }); 77 });
74 78
75 $(function() { 79 $(function() {
76 - // loadData();  
77 80
78 if ($('.banner-swiper').find('li').size() > 1) { 81 if ($('.banner-swiper').find('li').size() > 1) {
79 bannerSwiper = new Swiper('.banner-swiper', { 82 bannerSwiper = new Swiper('.banner-swiper', {
80 lazyLoading: true, 83 lazyLoading: true,
81 lazyLoadingInPrevNext: true, 84 lazyLoadingInPrevNext: true,
82 loop: true, 85 loop: true,
83 - autoplay: 3000, 86 + autoplay: 2000,
84 autoplayDisableOnInteraction: false, 87 autoplayDisableOnInteraction: false,
85 paginationClickable: true, 88 paginationClickable: true,
86 slideElement: 'li', 89 slideElement: 'li',