Authored by 郭成尧

sknlist

@@ -14,7 +14,7 @@ const _ = require('lodash'); @@ -14,7 +14,7 @@ const _ = require('lodash');
14 const helpers = global.yoho.helpers; 14 const helpers = global.yoho.helpers;
15 const productProcess = require(`${utils}/product-process`); 15 const productProcess = require(`${utils}/product-process`);
16 const redShopPrcs = require(`${utils}/redshop-process`); 16 const redShopPrcs = require(`${utils}/redshop-process`);
17 - 17 +const co = require('bluebird').coroutine;
18 18
19 /** 19 /**
20 * 从 useragent 获取 uid 20 * 从 useragent 获取 uid
@@ -388,17 +388,16 @@ const shop = { @@ -388,17 +388,16 @@ const shop = {
388 redShop(req, res, next) { 388 redShop(req, res, next) {
389 let shopId = req.query.shop_id || 792; // test3 389 let shopId = req.query.shop_id || 792; // test3
390 390
391 - Promise.all([  
392 - redsShopModel.getBanner(shopId), // 0: 获取红人店 banner  
393 - redsShopModel.getShopsBrands(shopId), // 1: 获取店铺品牌数据  
394 - redsShopModel.getIntro(shopId), // 2. 获取店铺介绍  
395 - redsShopModel.getShopsdecorator(shopId) // 3. 获取店铺装修元素  
396 - ]).then(valArr => {  
397 - let banner = _.get(valArr[0], 'data.banner'); 391 + co(function* () {
  392 + let bannerData = yield redsShopModel.getBanner(shopId);
  393 + let brandData = yield redsShopModel.getShopsBrands(shopId);
  394 + let shopIntroData = yield redsShopModel.getIntro(shopId);
  395 + let decoratorsData = yield redsShopModel.getShopsdecorator(shopId);
398 396
399 - let brand = _.get(valArr[1], 'data[0]', {});  
400 - let shopIntro = redShopPrcs.shopIntro(_.get(valArr[2], 'data', {}));  
401 - let decoratorsData = redShopPrcs.floor(_.get(valArr[3], 'data.modules', [])); 397 + let banner = _.get(bannerData, 'data.banner');
  398 + let brand = _.get(brandData, 'data[0]', {});
  399 + let shopIntro = redShopPrcs.shopIntro(_.get(shopIntroData, 'data', {}));
  400 + let decorators = redShopPrcs.floor(_.get(decoratorsData, 'data.modules', []));
402 401
403 res.render('newshop/shop-reds', { 402 res.render('newshop/shop-reds', {
404 pageHeader: headerModel.setNav({ 403 pageHeader: headerModel.setNav({
@@ -409,11 +408,9 @@ const shop = { @@ -409,11 +408,9 @@ const shop = {
409 module: 'product', 408 module: 'product',
410 page: 'reds-shop', 409 page: 'reds-shop',
411 shopId, 410 shopId,
412 - banner, brand, shopIntro, decoratorsData,  
413 - time3: [0, 1, 2] 411 + banner, brand, shopIntro, decorators
414 }); 412 });
415 - }).catch(next);  
416 - 413 + })().catch(next);
417 }, 414 },
418 415
419 /** 416 /**
1 -{{#each decoratorsData}} 1 +{{#each decorators}}
2 {{#isEqual module_type 'Title'}} 2 {{#isEqual module_type 'Title'}}
3 <header class="section-header"> 3 <header class="section-header">
4 <i class="section-more iconfont">&#xe606;</i> 4 <i class="section-more iconfont">&#xe606;</i>
@@ -47,15 +47,13 @@ @@ -47,15 +47,13 @@
47 </div> 47 </div>
48 {{/isEqual}} 48 {{/isEqual}}
49 {{#isEqual module_type 'TripleImage'}} 49 {{#isEqual module_type 'TripleImage'}}
50 - <div class="{{#isEqual ../displayType '1'}}items-3-2 items-3-2-left{{/isEqual}}  
51 - {{#isEqual ../displayType '2'}}items-3-2 items-3-2-right{{/isEqual}}  
52 - {{#isEqual ../displayType '3'}}items-3-3{{/isEqual}}  
53 - {{#isEqual ../displayType '4'}}items-3-3 items-small{{/isEqual}}"> 50 + <div class="{{#isEqual ../displayType '1'}}items-3-2 items-3-2-left{{/isEqual}}{{#isEqual ../displayType '2'}}items-3-2 items-3-2-right{{/isEqual}}{{#isEqual ../displayType '3'}}items-3-3{{/isEqual}}{{#isEqual ../displayType '4'}}items-3-3 items-small{{/isEqual}}">
54 {{#each ../pics}} 51 {{#each ../pics}}
55 {{> reds-shop/item}} 52 {{> reds-shop/item}}
56 {{/each}} 53 {{/each}}
57 </div> 54 </div>
58 {{/isEqual}} 55 {{/isEqual}}
59 {{#isEqual module_type 'SknList'}} 56 {{#isEqual module_type 'SknList'}}
  57 + <div class="goods-container" data-skns="{{../skns}}"></div>
60 {{/isEqual}} 58 {{/isEqual}}
61 {{/each}} 59 {{/each}}
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2017-03-23 11:31:51 3 * @Date: 2017-03-23 11:31:51
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2017-03-23 18:37:04 5 + * @Last Modified time: 2017-03-24 16:17:00
6 */ 6 */
7 /* 红人店铺首页 */ 7 /* 红人店铺首页 */
8 const Swiper2 = require('yoho-swiper2'); 8 const Swiper2 = require('yoho-swiper2');
@@ -11,6 +11,7 @@ let $shopIntroFolder = $('.shop-intro-folder'); @@ -11,6 +11,7 @@ let $shopIntroFolder = $('.shop-intro-folder');
11 let $shortIntro = $('#shortIntro'); 11 let $shortIntro = $('#shortIntro');
12 let $shopIntro = $('#shopIntro'); 12 let $shopIntro = $('#shopIntro');
13 let $shopIntrArrw = $('#shopIntrArrw'); 13 let $shopIntrArrw = $('#shopIntrArrw');
  14 +let $goodsContainer = $('.goods-container');
14 15
15 /** 16 /**
16 * 店铺介绍展开收起 17 * 店铺介绍展开收起
@@ -27,6 +28,25 @@ $shopIntroFolder.on('click', function() { @@ -27,6 +28,25 @@ $shopIntroFolder.on('click', function() {
27 }); 28 });
28 29
29 /** 30 /**
  31 + * 异步加载人气单品
  32 + */
  33 +$.each($goodsContainer, function(index, elem) {
  34 + $.ajax({
  35 + type: 'GET',
  36 + url: location.protocol + '//m.yohobuy.com/product//new/shop/hotlist',
  37 + xhrFields: {
  38 + withCredentials: true
  39 + },
  40 + data: {
  41 + skns: $(elem).data('skns')
  42 + },
  43 + success: function(result) {
  44 + $(elem).html(result);
  45 + }
  46 + });
  47 +});
  48 +
  49 +/**
30 * 店铺轮播图 50 * 店铺轮播图
31 */ 51 */
32 if ($('.shop-swiper')) { 52 if ($('.shop-swiper')) {
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2017-03-23 17:12:53 3 * @Date: 2017-03-23 17:12:53
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2017-03-24 11:23:25 5 + * @Last Modified time: 2017-03-24 16:13:11
6 */ 6 */
7 // 红人店铺首页 7 // 红人店铺首页
8 8
@@ -28,63 +28,7 @@ @@ -28,63 +28,7 @@
28 color: #a9a9a9; 28 color: #a9a9a9;
29 float: right; 29 float: right;
30 } 30 }
31 -}  
32 -  
33 -.shop-coupon {  
34 - background-color: #f0f0f0;  
35 -}  
36 -  
37 -.shop-swiper {  
38 - height: 234px;  
39 - overflow: hidden;  
40 -  
41 - ul {  
42 - width: 100%;  
43 - }  
44 -  
45 - ul > li {  
46 - width: 100%;  
47 - }  
48 -}  
49 -  
50 -.shop-video {  
51 - .video-player {  
52 - height: 363px;  
53 - }  
54 -  
55 - .video-intro {  
56 - padding: 30px;  
57 - }  
58 31
59 - .video-title {  
60 - font-size: 36px;  
61 - color: #444;  
62 - margin-bottom: 30px;  
63 - }  
64 -  
65 - .video-desc {  
66 - font-size: 28px;  
67 - color: #444;  
68 - }  
69 -  
70 - .video-poster {  
71 - position: relative;  
72 - height: 363px;  
73 - color: #fff;  
74 - }  
75 -  
76 - .video-meta-customers {  
77 - position: absolute;  
78 - top: 20px;  
79 - right: 30px;  
80 - font-size: 24px;  
81 - padding: 10px 20px;  
82 - border-radius: 50px;  
83 - background-color: rgba(0, 0, 0, 0.5);  
84 - }  
85 -}  
86 -  
87 -.red-shop-index {  
88 .item { 32 .item {
89 position: relative; 33 position: relative;
90 } 34 }
@@ -212,9 +156,67 @@ @@ -212,9 +156,67 @@
212 background-color: rgba(0, 0, 0, 0.5); 156 background-color: rgba(0, 0, 0, 0.5);
213 } 157 }
214 } 158 }
215 -}  
216 159
217 -.shop-item-div {  
218 - height: 30px;  
219 - background-color: #f0f0f0; 160 + .goods-container {
  161 + display: inline-block;
  162 + }
  163 +
  164 + .shop-coupon {
  165 + background-color: #f0f0f0;
  166 + }
  167 +
  168 + .shop-swiper {
  169 + height: 234px;
  170 + overflow: hidden;
  171 +
  172 + ul {
  173 + width: 100%;
  174 + }
  175 +
  176 + ul > li {
  177 + width: 100%;
  178 + }
  179 + }
  180 +
  181 + .shop-video {
  182 + .video-player {
  183 + height: 363px;
  184 + }
  185 +
  186 + .video-intro {
  187 + padding: 30px;
  188 + }
  189 +
  190 + .video-title {
  191 + font-size: 36px;
  192 + color: #444;
  193 + margin-bottom: 30px;
  194 + }
  195 +
  196 + .video-desc {
  197 + font-size: 28px;
  198 + color: #444;
  199 + }
  200 +
  201 + .video-poster {
  202 + position: relative;
  203 + height: 363px;
  204 + color: #fff;
  205 + }
  206 +
  207 + .video-meta-customers {
  208 + position: absolute;
  209 + top: 20px;
  210 + right: 30px;
  211 + font-size: 24px;
  212 + padding: 10px 20px;
  213 + border-radius: 50px;
  214 + background-color: rgba(0, 0, 0, 0.5);
  215 + }
  216 + }
  217 +
  218 + .shop-item-div {
  219 + height: 30px;
  220 + background-color: #f0f0f0;
  221 + }
220 } 222 }